00001 #ifndef DEVICE_DS_H
00002 #define DEVICE_DS_H
00003
00004
00005
00006 #ifdef _MSC_VER
00007 #pragma warning(disable : 4786)
00008 #endif
00009
00010
00011 #include <windows.h>
00012 #include <mmsystem.h>
00013 #include <dsound.h>
00014 #include <list>
00015 #include "audiere.h"
00016 #include "device.h"
00017 #include "internal.h"
00018 #include "threads.h"
00019 #include "utility.h"
00020
00021
00022 namespace audiere {
00023
00024 class DSOutputBuffer;
00025 class DSOutputStream;
00026
00027 class DSAudioDevice : public AbstractDevice, public Mutex {
00028 public:
00029 static DSAudioDevice* create(const ParameterList& parameters);
00030
00031 private:
00032 DSAudioDevice(
00033 bool global_focus,
00034 int stream_buffer_length,
00035 int min_buffer_length,
00036 HWND anonymous_window,
00037 IDirectSound* direct_sound);
00038 ~DSAudioDevice();
00039
00040 public:
00041 void ADR_CALL update();
00042 OutputStream* ADR_CALL openStream(SampleSource* source);
00043 OutputStream* ADR_CALL openBuffer(
00044 void* samples, int frame_count,
00045 int channel_count, int sample_rate, SampleFormat sample_format);
00046 const char* ADR_CALL getName();
00047
00053 static int Volume_AudiereToDirectSound(float volume);
00054 static int Pan_AudiereToDirectSound(float pan);
00055
00056 private:
00057 typedef std::list<DSOutputStream*> StreamList;
00058 typedef std::list<DSOutputBuffer*> BufferList;
00059
00060 void removeStream(DSOutputStream* stream);
00061 void removeBuffer(DSOutputBuffer* buffer);
00062
00063 IDirectSound* m_direct_sound;
00064 StreamList m_open_streams;
00065 BufferList m_open_buffers;
00066
00067 bool m_global_focus;
00068 int m_buffer_length;
00069 int m_min_buffer_length;
00070
00071 HWND m_anonymous_window;
00072
00073 friend class DSOutputBuffer;
00074 friend class DSOutputStream;
00075 };
00076
00077
00078 }
00079
00080
00081 #endif