00001 #ifndef AUDIOOUTPUTNULL 00002 #define AUDIOOUTPUTNULL 00003 00004 #include "audiooutputbase.h" 00005 00006 #define NULLAUDIO_OUTPUT_BUFFER_SIZE 32768 00007 00008 /* 00009 00010 In its default invocation, this AudioOutput object does almost nothing. 00011 It takes all bytes written to its "device" and just ignores them. Since 00012 there is no device in the way consuming the audio bytes, nothing 00013 throttles the speed of decoding. 00014 00015 If it is told to buffer the output data (bufferOutputData(true)), then 00016 it will maintain a small buffer and will not let anymore audio data be 00017 decoded until something pulls the data off (via readOutputData()). 00018 00019 */ 00020 00021 class AudioOutputNULL : public AudioOutputBase 00022 { 00023 public: 00024 AudioOutputNULL(const AudioSettings &settings); 00025 00026 virtual ~AudioOutputNULL(); 00027 00028 virtual void Reset(void); 00029 00030 00031 // Volume control 00032 virtual int GetVolumeChannel(int /* channel */) const { return 100; } 00033 virtual void SetVolumeChannel(int /* channel */, int /* volume */){return;} 00034 00035 virtual int readOutputData(unsigned char *read_buffer, int max_length); 00036 00037 protected: 00038 // AudioOutputBase 00039 virtual bool OpenDevice(void); 00040 virtual void CloseDevice(void); 00041 virtual void WriteAudio(unsigned char *aubuf, int size); 00042 virtual int GetBufferedOnSoundcard(void) const; 00043 virtual AudioOutputSettings* GetOutputSettings(bool digital); 00044 00045 private: 00046 QMutex pcm_output_buffer_mutex; 00047 unsigned char pcm_output_buffer[NULLAUDIO_OUTPUT_BUFFER_SIZE]; 00048 int current_buffer_size; 00049 }; 00050 00051 #endif 00052
1.6.3