SecBSD's official ports repository
This commit is contained in:
commit
2c0afcbbf3
64331 changed files with 5339189 additions and 0 deletions
66
devel/ptlib/files/sound_sndio.h
Normal file
66
devel/ptlib/files/sound_sndio.h
Normal file
|
@ -0,0 +1,66 @@
|
|||
|
||||
#include <ptlib.h>
|
||||
#include <ptlib/sound.h>
|
||||
#include <ptlib/socket.h>
|
||||
|
||||
#include <sndio.h>
|
||||
|
||||
class PSoundChannelSNDIO: public PSoundChannel
|
||||
{
|
||||
public:
|
||||
PSoundChannelSNDIO();
|
||||
void Construct();
|
||||
PSoundChannelSNDIO(const PString &device,
|
||||
PSoundChannel::Directions dir,
|
||||
unsigned numChannels,
|
||||
unsigned sampleRate,
|
||||
unsigned bitsPerSample);
|
||||
~PSoundChannelSNDIO();
|
||||
static PStringArray GetDeviceNames(PSoundChannel::Directions = Player);
|
||||
static PString GetDefaultDevice(PSoundChannel::Directions);
|
||||
PBoolean Open(const PString & _device,
|
||||
Directions _dir,
|
||||
unsigned _numChannels,
|
||||
unsigned _sampleRate,
|
||||
unsigned _bitsPerSample);
|
||||
PBoolean Setup();
|
||||
PBoolean Close();
|
||||
PBoolean IsOpen() const;
|
||||
PBoolean Write(const void * buf, PINDEX len);
|
||||
PBoolean Read(void * buf, PINDEX len);
|
||||
PBoolean SetFormat(unsigned numChannels,
|
||||
unsigned sampleRate,
|
||||
unsigned bitsPerSample);
|
||||
unsigned GetChannels() const;
|
||||
unsigned GetSampleRate() const;
|
||||
unsigned GetSampleSize() const;
|
||||
PBoolean SetBuffers(PINDEX size, PINDEX count);
|
||||
PBoolean GetBuffers(PINDEX & size, PINDEX & count);
|
||||
PBoolean PlaySound(const PSound & sound, PBoolean wait);
|
||||
PBoolean PlayFile(const PFilePath & filename, PBoolean wait);
|
||||
PBoolean HasPlayCompleted();
|
||||
PBoolean WaitForPlayCompletion();
|
||||
PBoolean RecordSound(PSound & sound);
|
||||
PBoolean RecordFile(const PFilePath & filename);
|
||||
PBoolean StartRecording();
|
||||
PBoolean IsRecordBufferFull();
|
||||
PBoolean AreAllRecordBuffersFull();
|
||||
PBoolean WaitForRecordBufferFull();
|
||||
PBoolean WaitForAllRecordBuffersFull();
|
||||
PBoolean Abort();
|
||||
PBoolean SetVolume(unsigned newVal);
|
||||
PBoolean GetVolume(unsigned &devVol);
|
||||
|
||||
protected:
|
||||
struct sio_hdl *hdl;
|
||||
struct sio_par par;
|
||||
unsigned mNumChannels;
|
||||
unsigned mSampleRate;
|
||||
unsigned mBitsPerSample;
|
||||
unsigned mFragCount;
|
||||
unsigned mFragSize;
|
||||
unsigned mBytesPerFrame;
|
||||
Directions mDirection;
|
||||
PString mDevice;
|
||||
PBoolean isInitialised;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue