equal
deleted
inserted
replaced
245 } |
245 } |
246 } |
246 } |
247 } |
247 } |
248 |
248 |
249 // ----------------------------------------------------------------------------- |
249 // ----------------------------------------------------------------------------- |
250 // CBTRCCLegacyVolumeLevelController::GetPhoneVolume |
250 // CBTRCCLegacyVolumeLevelController::ScalePhoneVolume |
251 // ----------------------------------------------------------------------------- |
251 // ----------------------------------------------------------------------------- |
252 // |
252 // |
253 TInt CBTRCCLegacyVolumeLevelController::GetPhoneVolume(TInt &aVol) |
253 void CBTRCCLegacyVolumeLevelController::ScalePhoneVolume(TInt &aVolume) |
254 { |
254 { |
255 TRACE_FUNC |
255 TRACE_FUNC |
256 TInt err = CBTRCCVolumeLevelControllerBase::GetPhoneVolume(aVol); |
|
257 |
|
258 // Converts volume level scale used in DevSound Audio (0 - 10000) into 0 - KVolumeScaleMax. |
256 // Converts volume level scale used in DevSound Audio (0 - 10000) into 0 - KVolumeScaleMax. |
259 if( aVol <= 0 ) |
257 if( aVolume <= 0 ) |
260 { |
258 { |
261 // 0 level and -1 (no stream) don't need adjustment. |
259 // 0 level and -1 (no stream) don't need adjustment. |
262 return err; |
260 return; |
263 } |
261 } |
264 |
262 |
265 TReal tgt; |
263 TReal tgt; |
266 TReal src(aVol); |
264 TReal src(aVolume); |
267 TReal maxScale(KVolumeScaleMax); |
265 TReal maxScale(KVolumeScaleMax); |
268 TReal maxDevSound(iLocalMaxVolume); |
266 TReal maxDevSound(iLocalMaxVolume); |
269 TReal scale = maxScale/maxDevSound; |
267 TReal scale = maxScale/maxDevSound; |
270 Math::Round( tgt, src*scale, 0); |
268 Math::Round( tgt, src*scale, 0); |
271 |
269 |
273 { |
271 { |
274 // Only aVol value 0 is real zero (muted). All other scaled zero |
272 // Only aVol value 0 is real zero (muted). All other scaled zero |
275 // values have to be upgraded to level 1. |
273 // values have to be upgraded to level 1. |
276 tgt = 1; |
274 tgt = 1; |
277 } |
275 } |
278 TRACE_INFO((_L("Volume scaled: original %d, scaled %d"), aVol, TInt(tgt))) |
276 TRACE_INFO((_L("Volume scaled: original %d, scaled %d"), aVolume, TInt(tgt))) |
279 aVol = TInt(tgt); |
277 aVolume = TInt(tgt); |
280 return err; |
|
281 } |
278 } |
282 |
279 |
283 // ----------------------------------------------------------------------------- |
280 // ----------------------------------------------------------------------------- |
284 // CBTRCCLegacyVolumeLevelController::RequestCompletedL |
281 // CBTRCCLegacyVolumeLevelController::RequestCompletedL |
285 // ----------------------------------------------------------------------------- |
282 // ----------------------------------------------------------------------------- |