32 #ifndef _PSOUND_PORTAUDIO
33 #define _PSOUND_PORTAUDIO
38 #include <portmixer.h>
51 bool Write(
const void * buf, PINDEX len);
52 bool Read(
void * buf, PINDEX len);
55 unsigned bitsPerSample);
60 bool GetBuffers(PINDEX & size, PINDEX & count);
82 bool OpenStream(
unsigned numChannels,
unsigned sampleRate,
unsigned bitsPerSample);
bool GetMute(bool &mute)
Get the mute state of the play/read process.
bool IsRecordBufferFull()
Determine if a record buffer has been filled, so that the next Read() call will not block...
int m_bitsPerSample
Definition: portaudio.h:98
bool WaitForAllRecordBuffersFull()
Block the thread until all of the record buffer allocated has been filled.
Abstract class for a generalised sound channel, and an implementation of PSoundChannel for old code t...
Definition: sound.h:267
Definition: channel.h:255
bool WaitForRecordBufferFull()
Block the thread until a record buffer has been filled, so that the next Read() call will not block...
bool HasPlayCompleted()
Indicate if the sound play begun with PlayBuffer() or PlayFile() has completed.
int m_bytesPerSample
Definition: portaudio.h:99
bool PlaySound(const PSound &sound, bool wait)
Play a sound to the open device.
bool StartRecording()
Start filling record buffers.
bool Abort()
Abort the background playing/recording of the sound channel.
bool Write(const void *buf, PINDEX len)
Low level write to the channel.
static PStringArray GetDeviceNames(PSoundChannel::Directions=Player)
This class describes a full description for a file on the particular platform.
Definition: filepath.h:61
PINDEX m_muteBufferSize
Definition: portaudio.h:108
int m_playBufferCount
Definition: portaudio.h:119
bool IsOpen() const
Determine if the channel is currently open and read and write operations can be executed on it...
unsigned GetSampleRate() const
Get the sample rate in samples per second.
This is an array collection class of PString objects.
Definition: pstring.h:2365
int m_deviceId
Definition: portaudio.h:103
bool SetMute(bool mute)
Set the mute state of the play/read process.
int m_sampleFormat
Definition: portaudio.h:100
A class representing a sound.
Definition: sound.h:53
PString m_deviceName
Definition: portaudio.h:104
bool SetBuffers(PINDEX size, PINDEX count)
Set the internal buffers for the sound channel I/O.
bool RecordFile(const PFilePath &filename)
Record into the platform dependent sound file all of the buffer's of sound data.
bool Read(void *buf, PINDEX len)
Low level read from the channel.
Definition: portaudio.h:41
bool GetBuffers(PINDEX &size, PINDEX &count)
Get the internal buffers for the sound channel I/O.
bool m_started
Definition: portaudio.h:105
bool SetVolume(unsigned newVal)
Set the volume of the play/read process.
PaStream * m_stream
Definition: portaudio.h:110
int m_playBufferSize
Definition: portaudio.h:118
PString GetErrorText(ErrorGroup group=NumErrorGroups) const
Get error message description.
The character string class.
Definition: pstring.h:108
PMutex m_mutex
Definition: portaudio.h:95
bool Open(const Params ¶ms)
Open the specified device for playing or recording.
int m_sampleRate
Definition: portaudio.h:97
PaStreamParameters m_streamParms
Definition: portaudio.h:111
bool OpenStream(unsigned numChannels, unsigned sampleRate, unsigned bitsPerSample)
ErrorGroup
Error groups.
Definition: channel.h:251
const PaDeviceInfo * m_deviceInfo
Definition: portaudio.h:102
This class defines a thread mutual exclusion object.
Definition: mutex.h:101
bool WaitForPlayCompletion()
Block calling thread until the sound play begun with PlaySound() or PlayFile() has completed...
virtual PString GetName() const
Get the name of the channel.
int m_volume
Definition: portaudio.h:116
bool m_mute
Definition: portaudio.h:106
unsigned char * m_muteBuffer
Definition: portaudio.h:107
unsigned GetSampleSize() const
Get the sample size in bits per sample.
Parameters for opening a sound channel.
Definition: sound.h:289
bool SetFormat(unsigned numChannels, unsigned sampleRate, unsigned bitsPerSample)
Set the format for play/record.
bool AreAllRecordBuffersFull()
Determine if all of the record buffer allocated has been filled.
bool Close()
Close the channel.
bool PlayFile(const PFilePath &filename, bool wait)
bool GetVolume(unsigned &devVol)
Get the volume of the play/read process.
int m_channels
Definition: portaudio.h:96
unsigned GetChannels() const
Get the number of channels (mono/stereo) in the sound.
~PSoundChannelPortAudio()
bool RecordSound(PSound &sound)
Record into the sound object all of the buffer's of sound data.
static PMutex & GetInitMutex()