00001 /*********************************************************************** 00002 00003 FinalMix: DeviceMM.h 00004 by Martin Decky 00005 00006 Redistribution of this file is permitted under the GNU Public License. 00007 00008 0.9.2 Initial 00009 0.9.4 Complete rewrite, native threads instead of wxThread 00010 0.9.5 Documentation, cleanup 00011 00012 **********************************************************************/ 00013 00014 00015 #include "Devices.h" 00016 #include <wx/wx.h> 00017 00018 00019 #if defined(__WXMSW__) 00020 00021 00022 #ifndef _FM_DEVICEMM_H_ 00023 #define _FM_DEVICEMM_H_ 00024 00025 00026 #include <windows.h> 00027 #include <mmsystem.h> 00028 00029 00038 class MMDevice : public Device { 00039 public: 00040 MMDevice(); 00041 virtual ~MMDevice(); 00043 virtual const wxString & Name() const; 00045 static Device * RegisterDevice(); 00047 virtual bool Init(const format_ex_t & fmt, DeviceCallback & callback); 00048 virtual void Play(); 00049 virtual void Pause(); 00050 virtual void Done(); 00052 virtual samples_t GetPosition(); 00054 virtual void Configure(wxWindow * parent); 00056 friend DWORD __stdcall play_thread(LPVOID data); 00057 friend DWORD __stdcall push_thread(LPVOID data); 00059 private: 00060 void done(); 00062 DeviceCallback * cb; 00063 format_ex_t pfmt; 00065 HANDLE play; 00066 DWORD play_id; 00067 HANDLE push; 00068 DWORD push_id; 00070 HWAVEOUT handle; 00071 bool opened; 00072 bool playing; 00073 bool paused; 00075 HANDLE buf_mutex; 00076 size_t buf_count; 00077 size_t buf_start; 00078 size_t buf_size; 00079 size_t latency; 00080 void * buf; 00081 samples_t position; 00082 samples_t rpos; 00083 DWORD oldpos; 00085 WAVEHDR * fragments; 00086 }; 00087 00088 #endif 00089 00090 #endif