Alsa Class Reference

Inheritance diagram for Alsa:

Inheritance graph
Collaboration diagram for Alsa:

Collaboration graph
List of all members.

Detailed Description

Definition at line 82 of file alsa.h.

Public Member Functions

 Alsa (ConfigFile *cf, int section)
 ~Alsa (void)
virtual int Setup (void)
 Initialize the driver.
virtual int Shutdown (void)
 Finalize the driver.
virtual int ProcessMessage (QueuePointer &resp_queue, player_msghdr *hdr, void *data)
 Message handler.

Private Member Functions

virtual void Main (void)
 Main method for driver thread.
void SendStateMessage (void)
bool AddStoredSample (StoredSample *newSample)
bool AddStoredSample (player_audio_wav_t *waveData)
bool AddStoredSample (const char *filePath)
StoredSampleGetSampleAtIndex (int index)
void ClearQueue (void)
bool AddToQueue (QueueItem *newItem)
bool AddToQueue (player_audio_wav_t *waveData)
bool AddToQueue (AudioSample *sample)
bool AddSilence (uint32_t time, AudioSample *format)
void AdvanceQueue (void)
bool SetupPlayBack (void)
bool SetPBParams (AudioSample *sample)
void PlaybackCallback (int numFrames)
bool SetupRecord (void)
bool SetRecParams (void)
bool SetupRecordBuffer (uint32_t length)
void RecordCallback (int numFrames)
void HandleRecordedData (void)
void PublishRecordedData (void)
void StartPlayback (void)
void StopPlayback (void)
void StartRecording (void)
void StopRecording (void)
bool SetupMixer (void)
bool EnumMixerElements (void)
bool EnumElementCaps (MixerElement *element)
MixerElementSplitElements (MixerElement *elements, uint32_t &count)
MixerElementFilterElements (MixerElement *elements, uint32_t &count)
void CleanUpMixerElements (MixerElement *elements, uint32_t count)
void MixerDetailsToPlayer (player_audio_mixer_channel_list_detail_t *dest)
void MixerLevelsToPlayer (player_audio_mixer_channel_list_t *dest)
void SetElementLevel (uint32_t index, float level)
void SetElementSwitch (uint32_t index, player_bool_t active)
void PublishMixerData (void)
float LevelToPlayer (long min, long max, long level)
long LevelFromPlayer (long min, long max, float level)
void PrintMixerElements (MixerElement *elements, uint32_t count)
int HandleWavePlayCmd (player_audio_wav_t *waveData)
int HandleSamplePlayCmd (player_audio_sample_item_t *data)
int HandleRecordCmd (player_bool_t *data)
int HandleMixerChannelCmd (player_audio_mixer_channel_list_t *data)
int HandleSampleLoadReq (player_audio_sample_t *data, QueuePointer &resp_queue)
int HandleSampleRetrieveReq (player_audio_sample_t *data, QueuePointer &resp_queue)
int HandleSampleRecordReq (player_audio_sample_rec_req_t *data, QueuePointer &resp_queue)
int HandleMixerChannelListReq (player_audio_mixer_channel_list_detail_t *data, QueuePointer &resp_queue)
int HandleMixerChannelLevelReq (player_audio_mixer_channel_list_t *data, QueuePointer &resp_queue)

Private Attributes

bool useQueue
uint8_t debugLevel
char ** mixerFilters
bool mixerFilterExact
char * pbDevice
char * mixerDevice
char * recDevice
uint32_t cfgPBPeriodTime
uint32_t cfgPBBufferTime
uint32_t silenceTime
uint32_t cfgRecBufferTime
uint32_t cfgRecStoreTime
uint32_t cfgRecPeriodTime
uint8_t recNumChannels
uint32_t recSampleRate
uint8_t recBits
snd_pcm_t * pbHandle
int numPBFDs
pollfd * pbFDs
uint32_t actPBBufferTime
uint32_t actPBPeriodTime
snd_pcm_uframes_t pbPeriodSize
uint8_t * periodBuffer
snd_pcm_t * recHandle
int numRecFDs
pollfd * recFDs
uint32_t actRecBufferTime
uint32_t actRecPeriodTime
snd_pcm_uframes_t recPeriodSize
snd_mixer_t * mixerHandle
uint32_t numElements
int nextSampleIdx
PBState playState
PBState recState
uint32_t recDataLength
uint32_t recDataOffset
uint8_t * recData
int recDest

Member Function Documentation

int Alsa::Setup ( void   )  [virtual]

Initialize the driver.

This function is called with the first client subscribes; it MUST be implemented by the driver.

Returns 0 on success.

Implements Driver.

Definition at line 2156 of file

References ClearQueue(), mixerDevice, mixerHandle, pbDevice, pbHandle, PLAYER_WARN, playState, recDevice, recHandle, recState, SetupMixer(), SetupPlayBack(), and SetupRecord().

Here is the call graph for this function:

int Alsa::Shutdown ( void   )  [virtual]

Finalize the driver.

This function is called with the last client unsubscribes; it MUST be implemented by the driver.

Returns 0 on success.

Implements Driver.

Definition at line 2200 of file

References CleanUpMixerElements(), ClearQueue(), mixerDevice, mixerElements, mixerHandle, numElements, pbFDs, pbHandle, periodBuffer, PLAYER_WARN, recData, recFDs, recHandle, StopPlayback(), StopRecording(), and Driver::StopThread().

Here is the call graph for this function:

int Alsa::ProcessMessage ( QueuePointer resp_queue,
player_msghdr hdr,
void *  data 
) [virtual]

Message handler.

This function is called once for each message in the incoming queue. Reimplement it to provide message handling. Return 0 if you handled the message and -1 otherwise

resp_queue The queue to which any response should go.
hdr The message header
data The message body

Reimplemented from Driver.

Definition at line 2582 of file

References Driver::device_addr, HandleMixerChannelCmd(), HandleMixerChannelLevelReq(), HandleMixerChannelListReq(), HandleRecordCmd(), HandleSampleLoadReq(), HandleSamplePlayCmd(), HandleSampleRecordReq(), HandleSampleRetrieveReq(), HandleWavePlayCmd(), Message::MatchMessage(), mixerHandle, pbHandle, PLAYER_AUDIO_CMD_MIXER_CHANNEL, PLAYER_AUDIO_CMD_SAMPLE_PLAY, PLAYER_AUDIO_CMD_WAV_PLAY, PLAYER_AUDIO_CMD_WAV_STREAM_REC, PLAYER_AUDIO_REQ_MIXER_CHANNEL_LEVEL, PLAYER_AUDIO_REQ_MIXER_CHANNEL_LIST, PLAYER_AUDIO_REQ_SAMPLE_LOAD, PLAYER_AUDIO_REQ_SAMPLE_REC, PLAYER_AUDIO_REQ_SAMPLE_RETRIEVE, PLAYER_MSGTYPE_CMD, PLAYER_MSGTYPE_REQ, and recHandle.

Here is the call graph for this function:

void Alsa::Main ( void   )  [private, virtual]

Main method for driver thread.

drivers have their own thread of execution, created using StartThread(); this is the entry point for the driver thread, and must be overloaded by all threaded drivers.

Reimplemented from Driver.

Definition at line 2264 of file

References AdvanceQueue(), Driver::InQueue, numPBFDs, numRecFDs, pbFDs, pbHandle, pbPeriodSize, PlaybackCallback(), PLAYER_WARN1, playState, Driver::ProcessMessages(), queueHead, recFDs, RecordCallback(), recPeriodSize, recState, QueueItem::sample, SendStateMessage(), and SetPBParams().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

Last updated 12 September 2005 21:38:45