| 1 |
#ifndef AVIFILE_SUNAUDIORENDERER_H |
| 2 |
#define AVIFILE_SUNAUDIORENDERER_H |
| 3 |
|
| 4 |
#include "IAudioRenderer.h" |
| 5 |
#include "AudioQueue.h" |
| 6 |
|
| 7 |
#ifdef HAVE_SUNAUDIO |
| 8 |
|
| 9 |
AVM_BEGIN_NAMESPACE; |
| 10 |
|
| 11 |
class SunAudioMix : public IAudioMix |
| 12 |
{ |
| 13 |
int m_iFd; |
| 14 |
public: |
| 15 |
SunAudioMix(int fd) : m_iFd(fd) {} |
| 16 |
virtual int Mix(void* data, const void* src, uint_t n) const; |
| 17 |
}; |
| 18 |
|
| 19 |
|
| 20 |
class SunAudioRenderer: public IAudioRenderer |
| 21 |
{ |
| 22 |
public: |
| 23 |
SunAudioRenderer(IReadStream* stream, WAVEFORMATEX& Owf, const char* cname = 0); |
| 24 |
~SunAudioRenderer(); |
| 25 |
virtual int SetVolume(int volume); |
| 26 |
//restart thread if it waits |
| 27 |
protected: |
| 28 |
virtual double getRendererBufferTime() const; |
| 29 |
|
| 30 |
virtual int reset(); |
| 31 |
virtual void pause(int state); |
| 32 |
static void* doAudioOut(void* arg); |
| 33 |
|
| 34 |
int m_iAudioFd; // /dev/audio file descriptor |
| 35 |
PthreadTask* m_pAudioThread;// writes data to audio_fd |
| 36 |
SunAudioMix* m_pAudioMix; |
| 37 |
uint_t m_iSamplesSent; // number of samples written to device |
| 38 |
uint_t m_uiWriteSize; |
| 39 |
}; |
| 40 |
|
| 41 |
AVM_END_NAMESPACE; |
| 42 |
|
| 43 |
#endif // HAVE_SUNAUDIO |
| 44 |
#endif // AVIFILE_SUNAUDIORENDERER_H |