1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/mm/devsound/a3fdevsound/src/devsoundadaptor/mmfdevsoundadaptation.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,931 @@
1.4 +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +
1.20 +
1.21 +
1.22 +// INCLUDE FILES
1.23 +#include "mmfdevsoundadaptation.h"
1.24 +#include "mmfdevsoundadaptationbody.h"
1.25 +
1.26 +// ============================ MEMBER FUNCTIONS ===============================
1.27 +
1.28 +// -----------------------------------------------------------------------------
1.29 +// CMMFDevSoundAdaptation::CMMFDevSoundAdaptation
1.30 +// C++ default constructor can NOT contain any code, that
1.31 +// might leave.
1.32 +// -----------------------------------------------------------------------------
1.33 +//
1.34 +CMMFDevSoundAdaptation::CMMFDevSoundAdaptation()
1.35 + {
1.36 + TRACE_CREATE();
1.37 + DP_CONTEXT(CMMFDevSoundAdaptation::CMMFDevSoundAdaptation *CD1*, CtxDevSound, DPLOCAL);
1.38 + DP_IN();
1.39 + PRF_HEAP_STATUS(PRF_MEM, HEAP_DS_Session);
1.40 + DP_OUT();
1.41 + }
1.42 +
1.43 +// -----------------------------------------------------------------------------
1.44 +// CMMFDevSoundAdaptation::ConstructL
1.45 +// Symbian 2nd phase constructor can leave.
1.46 +// -----------------------------------------------------------------------------
1.47 +void CMMFDevSoundAdaptation::ConstructL(MDevSoundAdaptationObserver& aDevSoundObserver,
1.48 + MGlobalProperties& aGlobalProperties)
1.49 + {
1.50 + DP_CONTEXT(CMMFDevSoundAdaptation::ConstructL *CD1*, CtxDevSound, DPLOCAL);
1.51 + DP_IN();
1.52 + iBody = CBody::NewL(aDevSoundObserver, aGlobalProperties);
1.53 + DP_OUT();
1.54 + }
1.55 +
1.56 +// -----------------------------------------------------------------------------
1.57 +// CMMFDevSoundAdaptation::NewL
1.58 +// Two-phased constructor.
1.59 +// -----------------------------------------------------------------------------
1.60 +//
1.61 +EXPORT_C CMMFDevSoundAdaptation* CMMFDevSoundAdaptation::NewL(MDevSoundAdaptationObserver& aDevSoundObserver,
1.62 + MGlobalProperties& aGlobalProperties)
1.63 + {
1.64 + DP_STATIC_CONTEXT(CMMFDevSoundAdaptation::NewL *CD0*, CtxDevSound, DPLOCAL);
1.65 + DP_IN();
1.66 + CMMFDevSoundAdaptation* self = new (ELeave)CMMFDevSoundAdaptation();
1.67 + CleanupStack::PushL(self);
1.68 + self->ConstructL(aDevSoundObserver, aGlobalProperties);
1.69 + CleanupStack::Pop(self);
1.70 + DP0_RET(self, "0x%x");
1.71 + }
1.72 +
1.73 +// -----------------------------------------------------------------------------
1.74 +// CMMFDevSoundAdaptation::ConstructL
1.75 +// Destructor
1.76 +// -----------------------------------------------------------------------------
1.77 +//
1.78 +EXPORT_C CMMFDevSoundAdaptation::~CMMFDevSoundAdaptation()
1.79 + {
1.80 + DP_CONTEXT(CMMFDevSoundAdaptation::~CMMFDevSoundAdaptation *CD1*, CtxDevSound, DPLOCAL);
1.81 + DP_IN();
1.82 + delete iBody;
1.83 + PRF_HEAP_STATUS(PRF_MEM, HEAP_DS_Session);
1.84 + DP_OUT();
1.85 + }
1.86 +
1.87 +// PostOpenL() - asynchronous 2nd-phase open operation
1.88 +EXPORT_C void CMMFDevSoundAdaptation::PostOpenL()
1.89 + {
1.90 + DP_CONTEXT(CMMFDevSoundAdaptation::PostOpenL *CD1*, CtxDevSound, DPLOCAL);
1.91 + DP_IN();
1.92 + iBody->PostOpenL();
1.93 + DP_OUT();
1.94 + }
1.95 +
1.96 +// -----------------------------------------------------------------------------
1.97 +// CMMFDevSoundAdaptation::InitializeL
1.98 +// Initializes CMMFDevSoundProxy object to play and record PCM16 raw audio data
1.99 +// with sampling rate of 8 KHz.On completion of Initialization, calls
1.100 +// InitializeComplete() on aDevSoundObserver.
1.101 +// Leaves on failure.
1.102 +// (other items were commented in a header).
1.103 +// -----------------------------------------------------------------------------
1.104 +//
1.105 +EXPORT_C void CMMFDevSoundAdaptation::InitializeL(TMMFState aMode)
1.106 + {
1.107 + DP_CONTEXT(CMMFDevSoundAdaptation::InitializeL *CD1*, CtxDevSound, DPLOCAL);
1.108 + DP_IN();
1.109 + iBody->InitializeL(aMode);
1.110 + DP_OUT();
1.111 + }
1.112 +
1.113 +// -----------------------------------------------------------------------------
1.114 +// CMMFDevSoundAdaptation::InitializeL
1.115 +// Initializes DevSound object for the mode aMode for processing audio data
1.116 +// with hardware device aHWDev. On completion of Initialization, the observer
1.117 +// will be notified via call back InitializeComplete().
1.118 +// Leaves on failure.
1.119 +// (other items were commented in a header).
1.120 +// -----------------------------------------------------------------------------
1.121 +//
1.122 +EXPORT_C void CMMFDevSoundAdaptation::InitializeL(TUid aHWDev,
1.123 + TMMFState aMode)
1.124 + {
1.125 + DP_CONTEXT(CMMFDevSoundAdaptation::InitializeL *CD1*, CtxDevSound, DPLOCAL);
1.126 + DP_IN();
1.127 + iBody->InitializeL(aHWDev, aMode);
1.128 + DP_OUT();
1.129 + }
1.130 +
1.131 +// -----------------------------------------------------------------------------
1.132 +// CMMFDevSoundAdaptation::InitializeL
1.133 +// Initializes DevSound object for the mode aMode for processing audio data
1.134 +// with hardware device supporting FourCC aDesiredFourCC. On completion of
1.135 +// Initialization, the observer will be notified via callback
1.136 +// InitializeComplete().
1.137 +// Leaves on failure.
1.138 +// (other items were commented in a header).
1.139 +// -----------------------------------------------------------------------------
1.140 +//
1.141 +EXPORT_C void CMMFDevSoundAdaptation::InitializeL(TFourCC aDesiredFourCC,
1.142 + TMMFState aMode)
1.143 + {
1.144 + DP_CONTEXT(CMMFDevSoundAdaptation::InitializeL *CD1*, CtxDevSound, DPLOCAL);
1.145 + DP_IN();
1.146 + iBody->InitializeL(aDesiredFourCC, aMode);
1.147 + DP_OUT();
1.148 + }
1.149 +
1.150 +// -----------------------------------------------------------------------------
1.151 +// CMMFDevSoundAdaptation::CancelInitialize
1.152 +// Cancels the initialization of DevSound object
1.153 +// returns an error code
1.154 +// (other items were commented in a header).
1.155 +// -----------------------------------------------------------------------------
1.156 +//
1.157 +EXPORT_C TInt CMMFDevSoundAdaptation::CancelInitialize()
1.158 + {
1.159 + DP_CONTEXT(CMMFDevSoundAdaptation::CancelInitialize *CD1*, CtxDevSound, DPLOCAL);
1.160 + DP_IN();
1.161 + TInt retVal = iBody->CancelInitialize();
1.162 + DP0_RET(retVal, "%d");
1.163 + }
1.164 +
1.165 +// -----------------------------------------------------------------------------
1.166 +// CMMFDevSoundAdaptation::Capabilities
1.167 +// Returns the supported Audio settings.
1.168 +// (other items were commented in a header).
1.169 +// -----------------------------------------------------------------------------
1.170 +//
1.171 +EXPORT_C TInt CMMFDevSoundAdaptation::Capabilities(TMMFCapabilities& aCap)
1.172 + {
1.173 + DP_CONTEXT(CMMFDevSoundAdaptation::Capabilities *CD1*, CtxDevSound, DPLOCAL);
1.174 + DP_IN();
1.175 + TInt retVal = iBody->Capabilities(aCap);
1.176 + DP0_RET(retVal, "%d");
1.177 + }
1.178 +
1.179 +// -----------------------------------------------------------------------------
1.180 +// CMMFDevSoundAdaptation::Config
1.181 +// Returns the current audio settings.
1.182 +// (other items were commented in a header).
1.183 +// -----------------------------------------------------------------------------
1.184 +//
1.185 +EXPORT_C TMMFCapabilities CMMFDevSoundAdaptation::Config() const
1.186 + {
1.187 + DP_CONTEXT(CMMFDevSoundAdaptation::Config *CD1*, CtxDevSound, DPLOCAL);
1.188 + DP_IN();
1.189 + TMMFCapabilities retVal = iBody->Config();
1.190 + DP0_RET(retVal, "%d");
1.191 + }
1.192 +
1.193 +// -----------------------------------------------------------------------------
1.194 +// CMMFDevSoundAdaptation::SetConfigL
1.195 +// Configure CMMFDevSoundProxy object for the settings in aConfig.
1.196 +// Use this to set sampling rate, Encoding and Mono/Stereo.
1.197 +// As part of defect 20796, the iRecordFormat has been set under the iPlayFormat,
1.198 +// before it was not set at all.
1.199 +// (other items were commented in a header).
1.200 +// -----------------------------------------------------------------------------
1.201 +//
1.202 +EXPORT_C void CMMFDevSoundAdaptation::SetConfigL(
1.203 + const TMMFCapabilities& aConfig)
1.204 + {
1.205 + DP_CONTEXT(CMMFDevSoundAdaptation::SetConfigL *CD1*, CtxDevSound, DPLOCAL);
1.206 + DP_IN();
1.207 + iBody->SetConfigL(aConfig);
1.208 + DP_OUT();
1.209 + }
1.210 +
1.211 +// -----------------------------------------------------------------------------
1.212 +// CMMFDevSoundAdaptation::MaxVolume
1.213 +// Returns an integer representing the maximum volume.
1.214 +// This is the maximum value which can be passed to CMMFDevSoundProxy::SetVolume.
1.215 +// (other items were commented in a header).
1.216 +// -----------------------------------------------------------------------------
1.217 +//
1.218 +EXPORT_C TInt CMMFDevSoundAdaptation::MaxVolume()
1.219 + {
1.220 + DP_CONTEXT(CMMFDevSoundAdaptation::MaxVolume *CD1*, CtxDevSound, DPLOCAL);
1.221 + DP_IN();
1.222 + TInt retVal = iBody->MaxVolume();
1.223 + DP0_RET(retVal, "%d");
1.224 + }
1.225 +
1.226 +// -----------------------------------------------------------------------------
1.227 +// CMMFDevSoundAdaptation::Volume
1.228 +// Returns an integer representing the current volume.
1.229 +// (other items were commented in a header).
1.230 +// -----------------------------------------------------------------------------
1.231 +//
1.232 +EXPORT_C TInt CMMFDevSoundAdaptation::Volume()
1.233 + {
1.234 + DP_CONTEXT(CMMFDevSoundAdaptation::Volume *CD1*, CtxDevSound, DPLOCAL);
1.235 + DP_IN();
1.236 + TInt retVal = iBody->Volume();
1.237 + DP0_RET(retVal, "%d");
1.238 + }
1.239 +
1.240 +// -----------------------------------------------------------------------------
1.241 +// CMMFDevSoundAdaptation::SetVolume
1.242 +// Changes the current playback volume to a specified value.
1.243 +// The volume can be changed before or during playback and is effective
1.244 +// immediately.
1.245 +// (other items were commented in a header).
1.246 +// -----------------------------------------------------------------------------
1.247 +//
1.248 +EXPORT_C TInt CMMFDevSoundAdaptation::SetVolume(TInt aVolume, TBool& aAsyncCompletion)
1.249 + {
1.250 + DP_CONTEXT(CMMFDevSoundAdaptation::SetVolume *CD1*, CtxDevSound, DPLOCAL);
1.251 + DP_IN();
1.252 + TInt error = iBody->SetVolume(aVolume, aAsyncCompletion);
1.253 + DP0_RET(error, "%d");
1.254 + }
1.255 +
1.256 +// -----------------------------------------------------------------------------
1.257 +// CMMFDevSoundAdaptation::MaxGain
1.258 +// Returns an integer representing the maximum gain.
1.259 +// This is the maximum value which can be passed to CMMFDevSoundProxy::SetGain.
1.260 +// (other items were commented in a header).
1.261 +// -----------------------------------------------------------------------------
1.262 +//
1.263 +EXPORT_C TInt CMMFDevSoundAdaptation::MaxGain()
1.264 + {
1.265 + DP_CONTEXT(CMMFDevSoundAdaptation::MaxGain *CD1*, CtxDevSound, DPLOCAL);
1.266 + DP_IN();
1.267 + TInt retVal = iBody->MaxGain();
1.268 + DP0_RET(retVal, "%d");
1.269 + }
1.270 +
1.271 +// -----------------------------------------------------------------------------
1.272 +// CMMFDevSoundAdaptation::Gain
1.273 +// Returns an integer representing the current gain.
1.274 +// (other items were commented in a header).
1.275 +// -----------------------------------------------------------------------------
1.276 +//
1.277 +EXPORT_C TInt CMMFDevSoundAdaptation::Gain()
1.278 + {
1.279 + DP_CONTEXT(CMMFDevSoundAdaptation::Gain *CD1*, CtxDevSound, DPLOCAL);
1.280 + DP_IN();
1.281 + TInt retVal = iBody->Gain();
1.282 + DP0_RET(retVal, "%d");
1.283 + }
1.284 +
1.285 +// -----------------------------------------------------------------------------
1.286 +// CMMFDevSoundAdaptation::SetGain
1.287 +// Changes the current recording gain to a specified value.
1.288 +// The gain can be changed before or during recording and is effective
1.289 +// immediately.
1.290 +// (other items were commented in a header).
1.291 +// -----------------------------------------------------------------------------
1.292 +//
1.293 +EXPORT_C TInt CMMFDevSoundAdaptation::SetGain(TInt aGain, TBool& aAsyncCompletion)
1.294 + {
1.295 + DP_CONTEXT(CMMFDevSoundAdaptation::SetGain *CD1*, CtxDevSound, DPLOCAL);
1.296 + DP_IN();
1.297 + TInt error = iBody->SetGain(aGain, aAsyncCompletion);
1.298 + DP0_RET(error, "%d");
1.299 + }
1.300 +
1.301 +// -----------------------------------------------------------------------------
1.302 +// CMMFDevSoundAdaptation::GetPlayBalanceL
1.303 +// Returns the speaker balance set for playing.
1.304 +// Leaves on failure.
1.305 +// (other items were commented in a header).
1.306 +// -----------------------------------------------------------------------------
1.307 +//
1.308 +EXPORT_C void CMMFDevSoundAdaptation::GetPlayBalanceL(
1.309 + TInt& aLeftPercentage,
1.310 + TInt& aRightPercentage)
1.311 + {
1.312 + DP_CONTEXT(CMMFDevSoundAdaptation::GetPlayBalanceL *CD1*, CtxDevSound, DPLOCAL);
1.313 + DP_IN();
1.314 + iBody->GetPlayBalanceL(aLeftPercentage, aRightPercentage);
1.315 + DP_OUT();
1.316 + }
1.317 +
1.318 +// -----------------------------------------------------------------------------
1.319 +// CMMFDevSoundAdaptation::SetPlayBalanceL
1.320 +// Sets the speaker balance for playing. The speaker balance can be changed
1.321 +// before or during playback and is effective immediately.
1.322 +// (other items were commented in a header).
1.323 +// -----------------------------------------------------------------------------
1.324 +//
1.325 +EXPORT_C void CMMFDevSoundAdaptation::SetPlayBalanceL(
1.326 + TInt aLeftPercentage,
1.327 + TInt aRightPercentage,
1.328 + TBool& aAsyncCompletion)
1.329 + {
1.330 + DP_CONTEXT(CMMFDevSoundAdaptation::SetPlayBalanceL *CD1*, CtxDevSound, DPLOCAL);
1.331 + DP_IN();
1.332 + iBody->SetPlayBalanceL(aLeftPercentage, aRightPercentage, aAsyncCompletion);
1.333 + DP_OUT();
1.334 + }
1.335 +
1.336 +// -----------------------------------------------------------------------------
1.337 +// CMMFDevSoundAdaptation::GetRecordBalanceL
1.338 +// Returns the microphone gain balance set for recording.
1.339 +// Leaves on failure.
1.340 +// (other items were commented in a header).
1.341 +// -----------------------------------------------------------------------------
1.342 +//
1.343 +EXPORT_C void CMMFDevSoundAdaptation::GetRecordBalanceL(
1.344 + TInt& aLeftPercentage,
1.345 + TInt& aRightPercentage)
1.346 + {
1.347 + DP_CONTEXT(CMMFDevSoundAdaptation::GetRecordBalanceL *CD1*, CtxDevSound, DPLOCAL);
1.348 + DP_IN();
1.349 + iBody->GetRecordBalanceL(aLeftPercentage, aRightPercentage);
1.350 + DP_OUT();
1.351 + }
1.352 +
1.353 +// -----------------------------------------------------------------------------
1.354 +// CMMFDevSoundAdaptation::SetRecordBalanceL
1.355 +// Sets the microphone gain balance for recording.
1.356 +// The microphone gain balance can be changed before or during recording and
1.357 +// is effective immediately.
1.358 +// (other items were commented in a header).
1.359 +// -----------------------------------------------------------------------------
1.360 +//
1.361 +EXPORT_C void CMMFDevSoundAdaptation::SetRecordBalanceL(
1.362 + TInt aLeftPercentage,
1.363 + TInt aRightPercentage,
1.364 + TBool& aAsyncCompletion)
1.365 + {
1.366 + DP_CONTEXT(CMMFDevSoundAdaptation::SetRecordBalanceL *CD1*, CtxDevSound, DPLOCAL);
1.367 + DP_IN();
1.368 + iBody->SetRecordBalanceL(aLeftPercentage, aRightPercentage, aAsyncCompletion);
1.369 + DP_OUT();
1.370 + }
1.371 +
1.372 +// -----------------------------------------------------------------------------
1.373 +// CMMFDevSoundAdaptation::PlayInitL
1.374 +// Initializes audio device and start play process. This method queries and
1.375 +// acquires the audio policy before initializing audio device. If there was an
1.376 +// error during policy initialization, PlayError() method will be called on
1.377 +// the observer with error code KErrAccessDenied, otherwise BufferToBeFilled()
1.378 +// method will be called with a buffer reference. After reading data into the
1.379 +// buffer reference passed, the client should call PlayData() to play data.
1.380 +//
1.381 +// The amount of data that can be played is specified in
1.382 +// CMMFBuffer::RequestSize(). Any data that is read into buffer beyond this
1.383 +// size will be ignored.
1.384 +//
1.385 +// Leaves on failure.
1.386 +// (other items were commented in a header).
1.387 +// -----------------------------------------------------------------------------
1.388 +//
1.389 +EXPORT_C void CMMFDevSoundAdaptation::PlayInitL()
1.390 + {
1.391 + DP_CONTEXT(CMMFDevSoundAdaptation::PlayInitL *CD1*, CtxDevSound, DPLOCAL);
1.392 + DP_IN();
1.393 + iBody->PlayInitL();
1.394 + DP_OUT();
1.395 + }
1.396 +
1.397 +// -----------------------------------------------------------------------------
1.398 +// CMMFDevSoundAdaptation::RecordInitL
1.399 +// Initializes audio device and start record process. This method queries and
1.400 +// acquires the audio policy before initializing audio device. If there was an
1.401 +// error during policy initialization, RecordError() method will be called on
1.402 +// the observer with error code KErrAccessDenied, otherwise BufferToBeEmptied()
1.403 +// method will be called with a buffer reference. This buffer contains recorded
1.404 +// or encoded data. After processing data in the buffer reference passed, the
1.405 +// client should call RecordData() to continue recording process.
1.406 +//
1.407 +// The amount of data that is available is specified in
1.408 +// CMMFBuffer::RequestSize().
1.409 +//
1.410 +// Leaves on failure.
1.411 +// (other items were commented in a header).
1.412 +// -----------------------------------------------------------------------------
1.413 +//
1.414 +EXPORT_C void CMMFDevSoundAdaptation::RecordInitL()
1.415 + {
1.416 + DP_CONTEXT(CMMFDevSoundAdaptation::RecordInitL *CD1*, CtxDevSound, DPLOCAL);
1.417 + DP_IN();
1.418 + iBody->RecordInitL();
1.419 + DP_OUT();
1.420 + }
1.421 +
1.422 +// -----------------------------------------------------------------------------
1.423 +// CMMFDevSoundAdaptation::PlayData
1.424 +// Plays data in the buffer at the current volume. The client should fill
1.425 +// the buffer with audio data before calling this method. The Observer gets
1.426 +// reference to buffer along with callback BufferToBeFilled(). When playing of
1.427 +// the audio sample is complete, successfully or otherwise, the method
1.428 +// PlayError() on observer is called.
1.429 +// (other items were commented in a header).
1.430 +// -----------------------------------------------------------------------------
1.431 +//
1.432 +EXPORT_C void CMMFDevSoundAdaptation::PlayData()
1.433 + {
1.434 + DP_CONTEXT(CMMFDevSoundAdaptation::PlayData *CD1*, CtxDevSound, DPLOCAL);
1.435 + DP_IN();
1.436 + iBody->PlayData();
1.437 + DP_OUT();
1.438 + }
1.439 +
1.440 +// -----------------------------------------------------------------------------
1.441 +// CMMFDevSoundAdaptation::RecordData
1.442 +// Contine the process of recording. Once the buffer is filled with recorded
1.443 +// data, the Observer gets reference to buffer along with callback
1.444 +// BufferToBeEmptied(). After processing the buffer (copying over to a
1.445 +// different buffer or writing to file) the client should call this
1.446 +// method to continue recording process.
1.447 +// (other items were commented in a header).
1.448 +// -----------------------------------------------------------------------------
1.449 +//
1.450 +EXPORT_C void CMMFDevSoundAdaptation::RecordData()
1.451 + {
1.452 + DP_CONTEXT(CMMFDevSoundAdaptation::RecordData *CD1*, CtxDevSound, DPLOCAL);
1.453 + DP_IN();
1.454 + iBody->RecordData();
1.455 + DP_OUT();
1.456 + }
1.457 +
1.458 +// -----------------------------------------------------------------------------
1.459 +// CMMFDevSoundAdaptation::Stop
1.460 +// Stops the ongoing operation (Play, Record, TonePlay)
1.461 +// (other items were commented in a header).
1.462 +// -----------------------------------------------------------------------------
1.463 +//
1.464 +EXPORT_C TBool CMMFDevSoundAdaptation::Stop()
1.465 + {
1.466 + DP_CONTEXT(CMMFDevSoundAdaptation::Stop *CD1*, CtxDevSound, DPLOCAL);
1.467 + DP_IN();
1.468 + TBool retVal = iBody->Stop();
1.469 + DP0_RET(retVal, "%d");
1.470 + }
1.471 +
1.472 +// -----------------------------------------------------------------------------
1.473 +// CMMFDevSoundAdaptation::Pause
1.474 +// Temporarily Stops the ongoing operation (Play, Record, TonePlay)
1.475 +// (other items were commented in a header).
1.476 +// -----------------------------------------------------------------------------
1.477 +//
1.478 +EXPORT_C TInt CMMFDevSoundAdaptation::Pause()
1.479 + {
1.480 + DP_CONTEXT(CMMFDevSoundAdaptation::Pause *CD1*, CtxDevSound, DPLOCAL);
1.481 + DP_IN();
1.482 + TInt retVal = iBody->Pause();
1.483 + DP0_RET(retVal, "%d");
1.484 + }
1.485 +
1.486 +// -----------------------------------------------------------------------------
1.487 +// CMMFDevSoundAdaptation::SamplesRecorded
1.488 +// Returns the sample recorded so far.
1.489 +// (other items were commented in a header).
1.490 +// -----------------------------------------------------------------------------
1.491 +//
1.492 +EXPORT_C TInt CMMFDevSoundAdaptation::SamplesRecorded()
1.493 + {
1.494 + DP_CONTEXT(CMMFDevSoundAdaptation::SamplesRecorded *CD1*, CtxDevSound, DPLOCAL);
1.495 + DP_IN();
1.496 + TInt retVal = iBody->SamplesRecorded();
1.497 + DP0_RET(retVal, "%d");
1.498 + }
1.499 +
1.500 +// -----------------------------------------------------------------------------
1.501 +// CMMFDevSoundAdaptation::SamplesPlayed
1.502 +// Returns the sample played so far.
1.503 +// (other items were commented in a header).
1.504 +// -----------------------------------------------------------------------------
1.505 +//
1.506 +EXPORT_C TInt CMMFDevSoundAdaptation::SamplesPlayed()
1.507 + {
1.508 + DP_CONTEXT(CMMFDevSoundAdaptation::SamplesPlayed *CD1*, CtxDevSound, DPLOCAL);
1.509 + DP_IN();
1.510 + TInt retVal = iBody->SamplesPlayed();
1.511 + DP0_RET(retVal, "%d");
1.512 + }
1.513 +
1.514 +// -----------------------------------------------------------------------------
1.515 +// CMMFDevSoundAdaptation::PlayToneL
1.516 +// Initializes audio device and start playing tone. Tone is played with
1.517 +// frequency and for duration specified.
1.518 +// Leaves on failure.
1.519 +// (other items were commented in a header).
1.520 +// -----------------------------------------------------------------------------
1.521 +//
1.522 +EXPORT_C void CMMFDevSoundAdaptation::PlayToneL(
1.523 + TInt aFrequency,
1.524 + const TTimeIntervalMicroSeconds& aDuration)
1.525 + {
1.526 + DP_CONTEXT(CMMFDevSoundAdaptation::PlayToneL *CD1*, CtxDevSound, DPLOCAL);
1.527 + DP_IN();
1.528 + iBody->PlayToneL(aFrequency, aDuration);
1.529 + DP_OUT();
1.530 + }
1.531 +
1.532 +// -----------------------------------------------------------------------------
1.533 +// CMMFDevSoundAdaptation::PlayDualToneL
1.534 +// Initializes audio device and start playing a dual tone.
1.535 +// The tone consists of two sine waves of different frequencies summed together
1.536 +// Dual Tone is played with specified frequencies and for specified duration.
1.537 +// (other items were commented in a header).
1.538 +// -----------------------------------------------------------------------------
1.539 +//
1.540 +EXPORT_C void CMMFDevSoundAdaptation::PlayDualToneL(
1.541 + TInt aFrequencyOne,
1.542 + TInt aFrequencyTwo,
1.543 + const TTimeIntervalMicroSeconds& aDuration)
1.544 + {
1.545 + DP_CONTEXT(CMMFDevSoundAdaptation::PlayDualToneL *CD1*, CtxDevSound, DPLOCAL);
1.546 + DP_IN();
1.547 + iBody->PlayDualToneL(aFrequencyOne, aFrequencyTwo, aDuration);
1.548 + DP_OUT();
1.549 + }
1.550 +
1.551 +// -----------------------------------------------------------------------------
1.552 +// CMMFDevSoundAdaptation::PlayDTMFStringL
1.553 +// Initializes audio device and start playing DTMF string aDTMFString.
1.554 +// Leaves on failure.
1.555 +// (other items were commented in a header).
1.556 +// -----------------------------------------------------------------------------
1.557 +//
1.558 +EXPORT_C void CMMFDevSoundAdaptation::PlayDTMFStringL(
1.559 + const TDesC& aDTMFString)
1.560 + {
1.561 + DP_CONTEXT(CMMFDevSoundAdaptation::PlayDTMFStringL *CD1*, CtxDevSound, DPLOCAL);
1.562 + DP_IN();
1.563 + iBody->PlayDTMFStringL(aDTMFString);
1.564 + DP_OUT();
1.565 + }
1.566 +
1.567 +// -----------------------------------------------------------------------------
1.568 +// CMMFDevSoundAdaptation::PlayToneSequenceL
1.569 +// Initializes audio device and start playing tone sequence.
1.570 +// Leaves on failure.
1.571 +// (other items were commented in a header).
1.572 +// -----------------------------------------------------------------------------
1.573 +//
1.574 +EXPORT_C void CMMFDevSoundAdaptation::PlayToneSequenceL(
1.575 + const TDesC8& aData)
1.576 + {
1.577 + DP_CONTEXT(CMMFDevSoundAdaptation::PlayToneSequenceL *CD1*, CtxDevSound, DPLOCAL);
1.578 + DP_IN();
1.579 + iBody->PlayToneSequenceL(aData);
1.580 + DP_OUT();
1.581 + }
1.582 +
1.583 +// -----------------------------------------------------------------------------
1.584 +// CMMFDevSoundAdaptation::PlayFixedSequenceL
1.585 +// Initializes audio device and start playing the specified pre-defined tone
1.586 +// sequence.
1.587 +// Leaves on failure.
1.588 +// (other items were commented in a header).
1.589 +// -----------------------------------------------------------------------------
1.590 +//
1.591 +EXPORT_C void CMMFDevSoundAdaptation::PlayFixedSequenceL(
1.592 + TInt aSequenceNumber)
1.593 + {
1.594 + DP_CONTEXT(CMMFDevSoundAdaptation::PlayFixedSequenceL *CD1*, CtxDevSound, DPLOCAL);
1.595 + DP_IN();
1.596 + iBody->PlayFixedSequenceL(aSequenceNumber);
1.597 + DP_OUT();
1.598 + }
1.599 +
1.600 +// -----------------------------------------------------------------------------
1.601 +// CMMFDevSoundAdaptation::SetToneRepeats
1.602 +// Defines the number of times the audio is to be repeated during the tone
1.603 +// playback operation. A period of silence can follow each playing of tone.
1.604 +// The tone playing can be repeated indefinitely.
1.605 +// (other items were commented in a header).
1.606 +// -----------------------------------------------------------------------------
1.607 +//
1.608 +EXPORT_C TInt CMMFDevSoundAdaptation::SetToneRepeats(
1.609 + TInt aRepeatCount,
1.610 + const TTimeIntervalMicroSeconds& aRepeatTrailingSilence)
1.611 + {
1.612 + DP_CONTEXT(CMMFDevSoundAdaptation::SetToneRepeats *CD1*, CtxDevSound, DPLOCAL);
1.613 + DP_IN();
1.614 + TInt retVal = iBody->SetToneRepeats(aRepeatCount, aRepeatTrailingSilence);
1.615 + DP0_RET(retVal, "%d");
1.616 + }
1.617 +
1.618 +// -----------------------------------------------------------------------------
1.619 +// CMMFDevSoundAdaptation::SetDTMFLengths
1.620 +// Defines the duration of tone on, tone off and tone pause to be used during the
1.621 +// DTMF tone playback operation.
1.622 +// Supported only during tone playing.
1.623 +// (other items were commented in a header).
1.624 +// -----------------------------------------------------------------------------
1.625 +//
1.626 +EXPORT_C TInt CMMFDevSoundAdaptation::SetDTMFLengths(
1.627 + TTimeIntervalMicroSeconds32& aToneOnLength,
1.628 + TTimeIntervalMicroSeconds32& aToneOffLength,
1.629 + TTimeIntervalMicroSeconds32& aPauseLength)
1.630 + {
1.631 + DP_CONTEXT(CMMFDevSoundAdaptation::SetDTMFLengths *CD1*, CtxDevSound, DPLOCAL);
1.632 + DP_IN();
1.633 + TInt retVal = iBody->SetDTMFLengths(aToneOnLength, aToneOffLength, aPauseLength);
1.634 + DP0_RET(retVal, "%d");
1.635 + }
1.636 +
1.637 +// -----------------------------------------------------------------------------
1.638 +// CMMFDevSoundAdaptation::SetVolumeRamp
1.639 +// Defines the period over which the volume level is to rise smoothly from
1.640 +// nothing to the normal volume level.
1.641 +// (other items were commented in a header).
1.642 +// -----------------------------------------------------------------------------
1.643 +//
1.644 +EXPORT_C TInt CMMFDevSoundAdaptation::SetVolumeRamp(
1.645 + const TTimeIntervalMicroSeconds& aRampDuration)
1.646 + {
1.647 + DP_CONTEXT(CMMFDevSoundAdaptation::SetVolumeRamp *CD1*, CtxDevSound, DPLOCAL);
1.648 + DP_IN();
1.649 + TInt retVal = iBody->SetVolumeRamp(aRampDuration);
1.650 + DP0_RET(retVal, "%d");
1.651 + }
1.652 +
1.653 +// -----------------------------------------------------------------------------
1.654 +// CMMFDevSoundAdaptation::SetPrioritySettings
1.655 +// Defines the priority settings that should be used for this instance.
1.656 +// (other items were commented in a header).
1.657 +// -----------------------------------------------------------------------------
1.658 +//
1.659 +EXPORT_C TInt CMMFDevSoundAdaptation::SetPrioritySettings(
1.660 + const TMMFPrioritySettings& aPrioritySettings)
1.661 + {
1.662 + DP_CONTEXT(CMMFDevSoundAdaptation::SetPrioritySettings *CD1*, CtxDevSound, DPLOCAL);
1.663 + DP_IN();
1.664 + TInt retVal = iBody->SetPrioritySettings(aPrioritySettings);
1.665 + DP0_RET(retVal, "%d");
1.666 + }
1.667 +
1.668 +// -----------------------------------------------------------------------------
1.669 +// CMMFDevSoundAdaptation::CustomInterface
1.670 +// see sounddevice.h
1.671 +// (other items were commented in a header).
1.672 +// -----------------------------------------------------------------------------
1.673 +//
1.674 +EXPORT_C TAny* CMMFDevSoundAdaptation::CustomInterface(
1.675 + TUid aInterfaceId)
1.676 + {
1.677 + DP_CONTEXT(CMMFDevSoundAdaptation::CustomInterface *CD1*, CtxDevSound, DPLOCAL);
1.678 + DP_IN();
1.679 + DP_OUT();
1.680 + // TODO - Need to revisit this to allow for async operation
1.681 + TAny* retVal = iBody->CustomInterface(aInterfaceId);
1.682 + DP0_RET(retVal, "0x%x");
1.683 + }
1.684 +
1.685 +// -----------------------------------------------------------------------------
1.686 +// CMMFDevSoundAdaptation::FixedSequenceCount
1.687 +// Returns the number of available pre-defined tone sequences.
1.688 +// This is the number of fixed sequence supported by DevSound by default.
1.689 +// (other items were commented in a header).
1.690 +// -----------------------------------------------------------------------------
1.691 +//
1.692 +EXPORT_C TInt CMMFDevSoundAdaptation::FixedSequenceCount()
1.693 + {
1.694 + DP_CONTEXT(CMMFDevSoundAdaptation::FixedSequenceCount *CD1*, CtxDevSound, DPLOCAL);
1.695 + DP_IN();
1.696 + TInt retVal = iBody->FixedSequenceCount();
1.697 + DP0_RET(retVal, "%d");
1.698 + }
1.699 +
1.700 +// -----------------------------------------------------------------------------
1.701 +// CMMFDevSoundAdaptation::FixedSequenceName
1.702 +// Returns the name assigned to a specific pre-defined tone sequence.
1.703 +// This is the number of fixed sequence supported by DevSound by default.
1.704 +// The function raises a panic if sequence number specified invalid.
1.705 +// (other items were commented in a header).
1.706 +// -----------------------------------------------------------------------------
1.707 +//
1.708 +EXPORT_C const TDesC& CMMFDevSoundAdaptation::FixedSequenceName(
1.709 + TInt aSequenceNumber)
1.710 + {
1.711 + DP_CONTEXT(CMMFDevSoundAdaptation::FixedSequenceName *CD1*, CtxDevSound, DPLOCAL);
1.712 + DP_IN();
1.713 + DP_OUT();
1.714 + return(iBody->FixedSequenceName(aSequenceNumber));
1.715 + }
1.716 +
1.717 +// -----------------------------------------------------------------------------
1.718 +// CMMFDevSoundAdaptation::GetSupportedInputDataTypesL
1.719 +// see sounddevice.h
1.720 +// (other items were commented in a header).
1.721 +// -----------------------------------------------------------------------------
1.722 +//
1.723 +EXPORT_C void CMMFDevSoundAdaptation::GetSupportedInputDataTypesL(
1.724 +RArray<TFourCC>& aSupportedDataTypes,
1.725 +const TMMFPrioritySettings& aPrioritySettings) const
1.726 + {
1.727 + DP_CONTEXT(CMMFDevSoundAdaptation::GetSupportedInputDataTypesL *CD1*, CtxDevSound, DPLOCAL);
1.728 + DP_IN();
1.729 + iBody->GetSupportedInputDataTypesL(aSupportedDataTypes, aPrioritySettings);
1.730 + DP_OUT();
1.731 + }
1.732 +
1.733 +// -----------------------------------------------------------------------------
1.734 +// CMMFDevSoundAdaptation::GetSupportedOutputDataTypesL
1.735 +// see sounddevice.h
1.736 +// (other items were commented in a header).
1.737 +// -----------------------------------------------------------------------------
1.738 +//
1.739 +EXPORT_C void CMMFDevSoundAdaptation::GetSupportedOutputDataTypesL(
1.740 + RArray<TFourCC>& aSupportedDataTypes,
1.741 + const TMMFPrioritySettings& aPrioritySettings) const
1.742 + {
1.743 + DP_CONTEXT(CMMFDevSoundAdaptation::GetSupportedOutputDataTypesL *CD1*, CtxDevSound, DPLOCAL);
1.744 + DP_IN();
1.745 + iBody->GetSupportedOutputDataTypesL(aSupportedDataTypes, aPrioritySettings);
1.746 + DP_OUT();
1.747 + }
1.748 +
1.749 +// -----------------------------------------------------------------------------
1.750 +// SetClientConfig
1.751 +// Sets client capabilities for this instance of DevSound Adaptation.
1.752 +// (other items were commented in a header).
1.753 +// -----------------------------------------------------------------------------
1.754 +//
1.755 +EXPORT_C TInt CMMFDevSoundAdaptation::SetClientConfig(
1.756 + const TProcessId& aProcessId)
1.757 + {
1.758 + DP_CONTEXT(CMMFDevSoundAdaptation::SetClientConfig *CD1*, CtxDevSound, DPLOCAL);
1.759 + DP_IN();
1.760 + TInt retVal = iBody->SetClientConfig(aProcessId);
1.761 + DP0_RET(retVal, "%d");
1.762 + }
1.763 +
1.764 +EXPORT_C TInt CMMFDevSoundAdaptation::SetClientConfig(
1.765 + const TProcessId& aActualProcessId,
1.766 + const TProcessId& aProcessId)
1.767 + {
1.768 + DP_CONTEXT(CMMFDevSoundAdaptation::SetClientConfig *CD1*, CtxDevSound, DPLOCAL);
1.769 + DP_IN();
1.770 + TInt retVal = iBody->SetClientConfig(aActualProcessId, aProcessId);
1.771 + DP0_RET(retVal, "%d");
1.772 + }
1.773 +
1.774 +// -----------------------------------------------------------------------------
1.775 +// CMMFDevSoundAdaptation::EmptyBuffers
1.776 +//
1.777 +// (other items were commented in a header).
1.778 +// -----------------------------------------------------------------------------
1.779 +
1.780 +EXPORT_C TInt CMMFDevSoundAdaptation::EmptyBuffers()
1.781 + {
1.782 + DP_CONTEXT(CMMFDevSoundAdaptation::EmptyBuffers *CD1*, CtxDevSound, DPLOCAL);
1.783 + DP_IN();
1.784 + TInt retVal = iBody->EmptyBuffers();
1.785 + DP0_RET(retVal, "%d");
1.786 + }
1.787 +
1.788 +// -----------------------------------------------------------------------------
1.789 +// CMMFDevSoundAdaptation::CloseDevSound
1.790 +// (other items were commented in a header).
1.791 +// -----------------------------------------------------------------------------
1.792 +//
1.793 +EXPORT_C TBool CMMFDevSoundAdaptation::CloseDevSound()
1.794 + {
1.795 + DP_CONTEXT(CMMFDevSoundAdaptation::::CloseDevSound *CD1*, CtxDevSound, DPLOCAL);
1.796 + DP_IN();
1.797 + TBool rerVal= iBody->CloseDevSound();
1.798 + DP0_RET(rerVal, "%d");
1.799 + }
1.800 +
1.801 +// -----------------------------------------------------------------------------
1.802 +// CMMFDevSoundAdaptation::ProcessingFinished
1.803 +// (other items were commented in a header).
1.804 +// -----------------------------------------------------------------------------
1.805 +//
1.806 +EXPORT_C TInt CMMFDevSoundAdaptation::ProcessingFinishedReceived(TBool& asyncOperation)
1.807 + {
1.808 + DP_CONTEXT(CMMFDevSoundAdaptation::::ProcessingFinished *CD1*, CtxDevSound, DPLOCAL);
1.809 + DP_IN();
1.810 + TInt retVal = iBody->ProcessingFinishedReceived(asyncOperation);
1.811 + DP0_RET(retVal, "%d");
1.812 + }
1.813 +
1.814 +// -----------------------------------------------------------------------------
1.815 +// CMMFDevSoundAdaptation::ProcessingFinished
1.816 +// (other items were commented in a header).
1.817 +// -----------------------------------------------------------------------------
1.818 +//
1.819 +EXPORT_C TInt CMMFDevSoundAdaptation::ProcessingError(TBool& asyncOperation)
1.820 + {
1.821 + DP_CONTEXT(CMMFDevSoundAdaptation::::ProcessingError *CD1*, CtxDevSound, DPLOCAL);
1.822 + DP_IN();
1.823 + TInt retVal = iBody->ProcessingError(asyncOperation);
1.824 + DP0_RET(retVal, "%d");
1.825 + }
1.826 +
1.827 +// -----------------------------------------------------------------------------
1.828 +// CMMFDevSoundAdaptation::RegisterAsClient
1.829 +// (other items were commented in a header).
1.830 +// -----------------------------------------------------------------------------
1.831 +//
1.832 +EXPORT_C TInt CMMFDevSoundAdaptation::RegisterAsClient(TUid aEventType, const TDesC8& aNotificationRegistrationData)
1.833 + {
1.834 + DP_CONTEXT(CMMFDevSoundAdaptation::RegisterAsClient *CD1*, CtxDevSound, DPLOCAL);
1.835 + DP_IN();
1.836 + TInt error = iBody->RegisterAsClient(aEventType, aNotificationRegistrationData);
1.837 + DP0_RET(error, "%d");
1.838 + }
1.839 +
1.840 +
1.841 +// -----------------------------------------------------------------------------
1.842 +// CMMFDevSoundAdaptation::CancelRegisterAsClient
1.843 +// (other items were commented in a header).
1.844 +// -----------------------------------------------------------------------------
1.845 +//
1.846 +EXPORT_C TInt CMMFDevSoundAdaptation::CancelRegisterAsClient(TUid aEventType)
1.847 + {
1.848 + DP_CONTEXT(CMMFDevSoundAdaptation::CancelRegisterAsClient *CD1*, CtxDevSound, DPLOCAL);
1.849 + DP_IN();
1.850 + TInt error = iBody->CancelRegisterAsClient(aEventType);
1.851 + DP0_RET(error, "%d");
1.852 + }
1.853 +
1.854 +
1.855 +// -----------------------------------------------------------------------------
1.856 +// CMMFDevSoundAdaptation::GetResourceNotificationData
1.857 +// (other items were commented in a header).
1.858 +// -----------------------------------------------------------------------------
1.859 +//
1.860 +EXPORT_C TInt CMMFDevSoundAdaptation::GetResourceNotificationData(TUid aEventType, TDes8& aNotificationData)
1.861 + {
1.862 + DP_CONTEXT(CMMFDevSoundAdaptation::GetResourceNotificationData *CD1*, CtxDevSound, DPLOCAL);
1.863 + DP_IN();
1.864 + TInt error = iBody->GetResourceNotificationData(aEventType, aNotificationData);
1.865 + DP0_RET(error, "%d");
1.866 + }
1.867 +
1.868 +
1.869 +// -----------------------------------------------------------------------------
1.870 +// CMMFDevSoundAdaptation::WillResumePlay
1.871 +// (other items were commented in a header).
1.872 +// -----------------------------------------------------------------------------
1.873 +//
1.874 +EXPORT_C TInt CMMFDevSoundAdaptation::WillResumePlay()
1.875 + {
1.876 + DP_CONTEXT(CMMFDevSoundAdaptation::WillResumePlay *CD1*, CtxDevSound, DPLOCAL);
1.877 + DP_IN();
1.878 + TInt error = iBody->WillResumePlay();
1.879 + DP0_RET(error, "%d");
1.880 + }
1.881 +
1.882 +// -----------------------------------------------------------------------------
1.883 +// CMMFDevSoundAdaptation::GetTimePlayed
1.884 +// (other items were commented in a header).
1.885 +// -----------------------------------------------------------------------------
1.886 +//
1.887 +EXPORT_C TInt CMMFDevSoundAdaptation::GetTimePlayed(TTimeIntervalMicroSeconds& aTime)
1.888 + {
1.889 + DP_CONTEXT(CMMFDevSoundAdaptation::GetTimePlayed *CD1*, CtxDevSound, DPLOCAL);
1.890 + DP_IN();
1.891 + DP_OUT();
1.892 + return iBody->GetTimePlayed(aTime);
1.893 + }
1.894 +
1.895 +// -----------------------------------------------------------------------------
1.896 +// CMMFDevSoundAdaptation::IsResumeSupported
1.897 +// (other items were commented in a header).
1.898 +// -----------------------------------------------------------------------------
1.899 +//
1.900 +EXPORT_C TBool CMMFDevSoundAdaptation::IsResumeSupported()
1.901 + {
1.902 + DP_CONTEXT(CMMFDevSoundAdaptation::IsResumeSupported *CD1*, CtxDevSound, DPLOCAL);
1.903 + DP_IN();
1.904 + TBool isSupported = iBody->IsResumeSupported();
1.905 + DP0_RET(isSupported , "%d");
1.906 + }
1.907 +
1.908 +// -----------------------------------------------------------------------------
1.909 +// CMMFDevSoundAdaptation::IsResumeSupported
1.910 +// (other items were commented in a header).
1.911 +// -----------------------------------------------------------------------------
1.912 +//
1.913 +EXPORT_C TInt CMMFDevSoundAdaptation::Resume()
1.914 + {
1.915 + DP_CONTEXT(CMMFDevSoundAdaptation::Resume *CD1*, CtxDevSound, DPLOCAL);
1.916 + DP_IN();
1.917 + TInt error = iBody->Resume();
1.918 + DP0_RET(error, "%d");
1.919 + }
1.920 +
1.921 +EXPORT_C void CMMFDevSoundAdaptation::BufferErrorEvent()
1.922 + {
1.923 + iBody->BufferErrorEvent();
1.924 + }
1.925 +
1.926 +EXPORT_C void CMMFDevSoundAdaptation::RollbackAdaptorActiveStateToBeforeCommit()
1.927 + {
1.928 + DP_CONTEXT(CMMFDevSoundAdaptation::RollbackAdaptorActiveStateToBeforeCommit *CD1*, CtxDevSound, DPLOCAL);
1.929 + DP_IN();
1.930 + iBody->RollbackAdaptorActiveStateToBeforeCommit();
1.931 + DP_OUT();
1.932 + }
1.933 +
1.934 +// End of file