00001 #ifndef DEVICE_DS_H 00002 #define DEVICE_DS_H 00003 00004 00005 // disable 'identifier too long' warning 00006 #ifdef _MSC_VER 00007 #pragma warning(disable : 4786) 00008 #endif 00009 00010 00011 #include <windows.h> 00012 #include <mmreg.h> 00013 #include <dsound.h> 00014 #include <list> 00015 #include "audiere.h" 00016 #include "internal.h" 00017 #include "threads.h" 00018 #include "utility.h" 00019 00020 00021 namespace audiere { 00022 00023 class DSOutputStream; 00024 00025 class DSAudioDevice 00026 : public RefImplementation<AudioDevice> 00027 , public Synchronized 00028 { 00029 public: 00030 static DSAudioDevice* create(const ParameterList& parameters); 00031 00032 private: 00033 DSAudioDevice( 00034 int buffer_length, 00035 HWND anonymous_window, 00036 IDirectSound* direct_sound); 00037 ~DSAudioDevice(); 00038 00039 public: 00040 void ADR_CALL update(); 00041 OutputStream* ADR_CALL openStream(SampleSource* source); 00042 OutputStream* ADR_CALL openBuffer( 00043 void* samples, int frame_count, 00044 int channel_count, int sample_rate, SampleFormat sample_format); 00045 00051 static int Volume_AudiereToDirectSound(float volume); 00052 static int Pan_AudiereToDirectSound(float pan); 00053 00054 private: 00055 typedef std::list<DSOutputStream*> StreamList; 00056 00057 void removeStream(DSOutputStream* stream); 00058 00059 IDirectSound* m_direct_sound; 00060 StreamList m_open_streams; 00061 00063 int m_buffer_length; 00064 00065 HWND m_anonymous_window; 00066 00067 friend class DSOutputStream; 00068 }; 00069 00070 00071 } 00072 00073 00074 #endif
1.2.17