23 #include <alsa/asoundlib.h> 25 #include "audio_sample.h" 47 typedef uint32_t ElemCap;
48 const ElemCap ELEMCAP_CAN_PLAYBACK = 0x0001;
49 const ElemCap ELEMCAP_CAN_CAPTURE = 0x0002;
50 const ElemCap ELEMCAP_COMMON = 0x0004;
51 const ElemCap ELEMCAP_PLAYBACK_VOL = 0x0008;
52 const ElemCap ELEMCAP_CAPTURE_VOL = 0x0010;
53 const ElemCap ELEMCAP_COMMON_VOL = 0x0020;
54 const ElemCap ELEMCAP_PLAYBACK_SWITCH = 0x0040;
55 const ElemCap ELEMCAP_CAPTURE_SWITCH = 0x0080;
56 const ElemCap ELEMCAP_COMMON_SWITCH = 0x0100;
63 snd_mixer_elem_t *elem;
64 long minPlayVol, curPlayVol, maxPlayVol;
65 long minCapVol, curCapVol, maxCapVol;
66 long minComVol, curComVol, maxComVol;
67 int playSwitch, capSwitch, comSwitch;
74 typedef uint8_t PBState;
75 const PBState PB_STATE_STOPPED = 0;
76 const PBState PB_STATE_PLAYING = 1;
77 const PBState PB_STATE_DRAIN = 2;
78 const PBState PB_STATE_RECORDING = 3;
95 bool mixerFilterExact;
99 uint32_t cfgPBPeriodTime;
100 uint32_t cfgPBBufferTime;
101 uint32_t silenceTime;
102 uint32_t cfgRecBufferTime;
103 uint32_t cfgRecStoreTime;
104 uint32_t cfgRecPeriodTime;
105 uint8_t recNumChannels;
106 uint32_t recSampleRate;
113 struct pollfd *pbFDs;
114 uint32_t actPBBufferTime;
115 uint32_t actPBPeriodTime;
116 snd_pcm_uframes_t pbPeriodSize;
117 uint8_t *periodBuffer;
119 snd_pcm_t *recHandle;
121 struct pollfd *recFDs;
122 uint32_t actRecBufferTime;
123 uint32_t actRecPeriodTime;
124 snd_pcm_uframes_t recPeriodSize;
126 snd_mixer_t *mixerHandle;
128 uint32_t numElements;
136 uint32_t recDataLength;
137 uint32_t recDataOffset;
143 virtual void Main (
void);
144 virtual int MainSetup (
void);
145 virtual void MainQuit (
void);
146 void SendStateMessage (
void);
151 bool AddStoredSample (
const char *filePath);
155 void ClearQueue (
void);
159 bool AddSilence (uint32_t time,
AudioSample *format);
160 void AdvanceQueue (
void);
165 bool SetupPlayBack (
void);
167 void PlaybackCallback (
int numFrames);
170 bool SetupRecord (
void);
171 bool SetRecParams (
void);
172 bool SetupRecordBuffer (uint32_t length);
173 void RecordCallback (
int numFrames);
174 void HandleRecordedData (
void);
175 void PublishRecordedData (
void);
178 void StartPlayback (
void);
179 void StopPlayback (
void);
180 void StartRecording (
void);
181 void StopRecording (
void);
184 bool SetupMixer (
void);
185 bool EnumMixerElements (
void);
189 void CleanUpMixerElements (
MixerElement *elements, uint32_t count);
192 void SetElementLevel (uint32_t index,
float level);
193 void SetElementSwitch (uint32_t index,
player_bool_t active);
194 void PublishMixerData (
void);
195 float LevelToPlayer (
long min,
long max,
long level);
196 long LevelFromPlayer (
long min,
long max,
float level);
197 void PrintMixerElements (
MixerElement *elements, uint32_t count);
Class for loading configuration file information.
Definition: configfile.h:196
Generic message header.
Definition: player.h:161
Player audio sample selection.
Definition: player_interfaces.h:1602
Base class for drivers which oeprate with a thread.
Definition: driver.h:552
Player audio sample record request.
Definition: player_interfaces.h:1613
An autopointer for the message queue.
Definition: message.h:73
A boolean variable, 0 for false anything else for true.
Definition: player.h:333
T max(T a, T b)
Return the maximum of a, b.
Definition: utility.h:104
Data: Raw audio data.
Definition: player_interfaces.h:1463
Player audio sample.
Definition: player_interfaces.h:1589
Player mixer channels.
Definition: player_interfaces.h:1569
Definition: audio_sample.h:32
T min(T a, T b)
Return the minimum of a, b.
Definition: utility.h:91
Player mixer channels.
Definition: player_interfaces.h:1530