2
* Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
2
* Copyright (C) 2004-2013 Savoir-Faire Linux Inc.
3
3
* Author: Yan Morin <yan.morin@savoirfairelinux.com>
4
4
* Author: Jerome Oufella <jerome.oufella@savoirfairelinux.com>
5
5
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
109
100
return isStarted_;
112
PlaybackMode getPlaybackMode() const {
113
return playbackMode_;
116
void setPlaybackMode(PlaybackMode mode) {
117
playbackMode_ = mode;
121
104
* Send a chunk of data to the hardware buffer to start the playback
122
105
* Copy data in the urgent buffer.
123
106
* @param buffer The buffer containing the data to be played ( ringtones )
124
* @param toCopy The size of the buffer
126
void putUrgent(void* buffer, int toCopy);
108
void putUrgent(AudioBuffer& buffer);
129
111
* Flush main buffer
136
118
void flushUrgent();
139
* Apply gain to audio frame
141
static void applyGain(SFLDataFormat *src , int samples, int gain);
144
* Convert audio amplitude value from linear value to dB
146
static double amplitudeLinearToDB(double value) {
147
return 20.0 * log10(value);
151
* Convert audio amplitude from dB to Linear value
153
static double ampluitudeDBToLinear(double value) {
154
return pow(10.0, value / 20.0);
120
bool isCaptureMuted() const {
121
return isCaptureMuted_;
125
* Mute capture (microphone)
127
void muteCapture(bool muted) {
128
isCaptureMuted_ = muted;
131
bool isPlaybackMuted() const {
132
return isPlaybackMuted_;
138
void mutePlayback(bool muted) {
139
isPlaybackMuted_ = muted;
158
143
* Set capture stream gain (microphone)
144
* Range should be [-1.0, 1.0]
160
void setCaptureGain(unsigned int gain) {
146
void setCaptureGain(double gain) {
161
147
captureGain_ = gain;
165
* Set capture stream gain (microphone)
151
* Get capture stream gain (microphone)
167
unsigned int getCaptureGain(void) {
153
double getCaptureGain() const {
168
154
return captureGain_;
172
158
* Set playback stream gain (speaker)
159
* Range should be [-1.0, 1.0]
174
void setPlaybackGain(unsigned int gain) {
161
void setPlaybackGain(double gain) {
175
162
playbackGain_ = gain;
179
166
* Get playback stream gain (speaker)
181
unsigned int getPlaybackGain(void) {
168
double getPlaybackGain() const {
182
169
return playbackGain_;
197
184
void notifyIncomingCall();
186
virtual void updatePreference(AudioPreference &pref, int index, PCMType type) = 0;
191
* True if capture is not to be used
193
bool isCaptureMuted_;
196
* True if playback is not to be used
198
bool isPlaybackMuted_;
200
201
* Gain applied to mic signal
202
static unsigned int captureGain_;
205
206
* Gain applied to playback signal
207
static unsigned int playbackGain_;
209
virtual void updatePreference(AudioPreference &pref, int index, PCMType type) = 0;
208
double playbackGain_;
213
211
* Whether or not the audio layer stream is started
217
PlaybackMode playbackMode_;
220
216
* Urgent ring buffer used for ringtones