jdkmidi class library documentation

Copyright © 2004 J.D. Koftinoff Software, Ltd.

Released under the GNU General Public License (GPL)




Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

include/jdkmidi/driverwin32.h

Go to the documentation of this file.
00001 /*
00002  *  libjdkmidi-2004 C++ Class Library for MIDI
00003  *
00004  *  Copyright (C) 2004  J.D. Koftinoff Software, Ltd.
00005  *  www.jdkoftinoff.com
00006  *  jeffk@jdkoftinoff.com
00007  *
00008  *  *** RELEASED UNDER THE GNU GENERAL PUBLIC LICENSE (GPL) April 27, 2004 ***
00009  *
00010  *  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU General Public License for more details.
00019  *
00020  *  You should have received a copy of the GNU General Public License
00021  *  along with this program; if not, write to the Free Software
00022  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 */
00024 #ifndef _JDKMIDI_DRIVERWIN32_H
00025 #define _JDKMIDI_DRIVERWIN32_H
00026 
00027 #include "jdkmidi/driver.h"
00028 #include "jdkmidi/sequencer.h"
00029 
00030 #ifdef WIN32
00031 #include <windows.h>
00032 #include <mmsystem.h>
00033 
00034 namespace jdkmidi
00035 {
00036   
00037   class MIDISequencerGUIEventNotifierWin32 :
00038     public MIDISequencerGUIEventNotifier
00039     {
00040     public:
00041       MIDISequencerGUIEventNotifierWin32(
00042         HWND w,
00043         DWORD wmmsg,
00044         WPARAM wparam_value_=0
00045         );
00046       
00047       virtual ~MIDISequencerGUIEventNotifierWin32();
00048       
00049       virtual void Notify( const MIDISequencer *seq, MIDISequencerGUIEvent e );
00050       virtual bool GetEnable() const;
00051       virtual void SetEnable( bool f );
00052       
00053     private:
00054       
00055       HWND dest_window;
00056       DWORD window_msg;
00057       WPARAM wparam_value;
00058       bool en;
00059     };
00060   
00061   
00062   
00063   class MIDIDriverWin32 : public MIDIDriver
00064     {
00065     public:
00066       MIDIDriverWin32( int queue_size);
00067       virtual ~MIDIDriverWin32();
00068       
00069       void ResetMIDIOut();
00070       
00071       bool StartTimer( int resolution_ms );
00072       bool OpenMIDIInPort( int id );
00073       bool OpenMIDIOutPort( int id );
00074       
00075       void StopTimer();
00076       void CloseMIDIInPort();
00077       void CloseMIDIOutPort();
00078       
00079       
00080       bool HardwareMsgOut( const MIDITimedBigMessage &msg );
00081       
00082     protected:
00083       
00084       static void CALLBACK win32_timer(
00085         UINT wTimerID,
00086         UINT msg,
00087         DWORD dwUser,
00088         DWORD dw1,
00089         DWORD dw2
00090         );
00091       
00092       static void CALLBACK win32_midi_in(
00093         HMIDIIN hMidiIn,
00094         UINT wMsg,
00095         DWORD dwInstance,
00096         DWORD dwParam1,
00097         DWORD dwParam2
00098         );
00099       
00100       HMIDIIN in_handle;
00101       HMIDIOUT out_handle;
00102       int timer_id;
00103       int timer_res;
00104       
00105       bool in_open;
00106       bool out_open;
00107       bool timer_open;
00108     }; 
00109   
00110   
00111 }
00112 #endif
00113 
00114 #endif