|
|
|
Location:
SoundDevice.h
Link against: MMFDevSound.lib
class CMMFDevSound : public CBase, public MMMFHwDeviceObserver;
Supported from 7.0s
An interface to the raw audio functions of Symbian OS device hardware.
The audio functions include the following functionality:
Initialisation and configuration of hardware devices, for example, setting microphone gain, setting setero balance and so on.
The playing and recording of raw audio data.
The playing and dynamic control of tones with user specified frequencies.
The playing of DTMF strings.
|
Defined in CMMFDevSound:
CMMFDevSound(), Capabilities(), Complete(), Config(), ConstructL(), ConvertData(), ConvertInitL(), CustomCommand(), DevSoundInfo(), Device(), DoPlayL(), EmptyThisHwBuffer(), FillFreeToneBuffer(), FillThisHwBuffer(), Gain(), GetPlayBalanceL(), GetRecordBalanceL(), InitAudioDeviceNode(), InitializeFormat(), InitializeL(), InitializeL(), InitializeL(), InitializeL(), LoadL(), MaxGain(), MaxVolume(), MoreData(), MoreRecordData(), MsgFromHwDevice(), NewL(), NumberOfChannels(), Pause(), PlayDTMFStringL(), PlayData(), PlayFixedSequenceL(), PlayInitL(), PlayToneL(), PlayToneSequenceL(), PlayingStopped(), RecordComplete(), RecordData(), RecordInitL(), RecordingStopped(), RequestPolicy(), ResumePlayDTMFStringL(), ResumePlayDataL(), ResumePlayToneL(), ResumePlayToneSequenceL(), ResumeRecordDataL(), SamplesPlayed(), SamplesRecorded(), SamplingFrequency(), SendEventToClient(), SetActiveToneBuffer(), SetConfigL(), SetDTMFLengths(), SetDevSoundId(), SetGain(), SetPlayBalanceL(), SetPrioritySettings(), SetRecordBalanceL(), SetToneRepeats(), SetVolume(), SetVolumeRamp(), Stop(), Stopped(), Unload(), UpdateBytesPlayed(), UpdatePolicyState(), Volume(), iActiveToneBuffer, iAudioPlayer, iAudioPolicyPrioritySettings, iAudioPolicyProxy, iAudioPolicyRequest, iAudioRecorder, iBuffer, iCMMFHwDevice, iClientSessionId, iCurrentGenerator, iDTMFGen, iDevInfo, iDevSoundEventHandler, iDevSoundInfo, iDevSoundObserver, iDevice, iDeviceCapabilities, iDeviceConfig, iDeviceIsOpen, iGain, iHwDeviceBuffer, iMode, iPlayFormat, iPlayFormatsSupported, iPlayedBytesCount, iPlayerErrors, iPrioritySettings, iRampDuration, iReceivingEvents, iRecordFormat, iRecordFormatsSupported, iRecordedBytesCount, iRecorderErrors, iRepeatCount, iRepeatTrailingSilence, iState, iToneBuffer1, iToneBuffer2, iToneGen, iVolume, ~CMMFDevSound()
Inherited from CBase:
operator new()
static CMMFDevSound* NewL();
Constructs and initialises a new instance of DevSound.
The function leaves if the DevSound object cannot be created.
|
~CMMFDevSound();
Default destructor.
Frees all resources owned by the object prior to its destruction.
void InitializeL(MDevSoundObserver& aDevSoundObserver);
Initialises the CMMFDevSound object and sets raw audio encoding to PCM16 and sampling to 8 KHz.
On completion of initialisation, the observer is notified via the call back
MDevSoundObserver::InitializeComplete().
|
void InitializeL(MDevSoundObserver& aDevSoundObserver, TUid aHWDev, TMMFState aMode);
Initialises the CMMFDevSound object specifying the hardware device and its mode, for example play, record or convert.
On completion of initialisation, the observer is notified via the call back
MDevSoundObserver::InitializeComplete().
|
void InitializeL(MDevSoundObserver& aDevSoundObserver, CArrayPtr<TUid> aHWDevArray, TMMFState aMode);
Initialises the CMMFDevSound object specifying a chain of hardware devices and a single mode to set them to.
The hardware devices are chained together with data flow starting with first array element.
On completion of initialisation, the observer is notified via the call back
MDevSoundObserver::InitializeComplete().
|
void InitializeL(MDevSoundObserver& aDevSoundObserver, TFourCC aDesiredFourCC, TMMFState aMode);
Initialises the CMMFDevSound object specifying a hardware device (referenced by its associated TFourCC code) and its mode, for example play, record or convert.
On completion of initialisation, the observer is notified via the call back
MDevSoundObserver::InitializeComplete().
|
TMMFCapabilities Capabilities();
Returns all possible values that the device configuration can be set to.
|
TMMFCapabilities Config() const;
Returns the current settings used by the device.
|
void SetConfigL(const TMMFCapabilities& aCaps);
Sets new device attribute values.
Use this to set sampling rate, encoding and the mono/stereo indicator.
|
TInt MaxVolume();
Returns the maximum volume setting supported by the current device.
|
TInt Volume();
Returns the volume setting of the current device.
|
void SetVolume(TInt aVolume);
Sets the volume of the current device.
Valid volume settings are in the range of 0 to MaxVolume().
|
TInt MaxGain();
Maximum microphone gain supported by the current device.
|
TInt Gain();
Returns the microphone gain of the current device.
|
void SetGain(TInt aGain);
Sets the microphone gain of the current device.
Valid gain settings are in the range of 0 to MaxGain().
|
void GetPlayBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
Gets the balance settings for the current playing device.
|
void SetPlayBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
Modifies the balance settings for the current playing device.
Both channels require percentage values, therefore, valid range is between 0 and 100 only.
|
void GetRecordBalanceL(TInt& aLeftPercentage, TInt& aRightPercentage);
Gets the balance settings for the current recording device.
|
void SetRecordBalanceL(TInt aLeftPercentage, TInt aRightPercentage);
Modifies the balance settings for the current recording device.
Both channels require percentage values, therefore, valid range is between 0 and 100 only.
|
void PlayInitL();
Initialises the audio device and starts the play process.
This method queries the audio policy server before initialising the audio device. If there is an
error during policy initialisation, MDevSoundObserver::PlayError() is called with an error code of KErrAccessDenied. If no initialisation error occurs, MDevSoundObserver::BufferToBeFilled()
is called with a buffer reference. The client then needs to fill the buffer with the data to play and then call PlayData().
Note: The amount of data that can be played is specified in
CMMFBuffer::RequestSize(). Any additional data placed in the buffer is ignored.
void RecordInitL();
Initialises the audio device and starts the record process.
This method queries the audio policy server before initialising the audio device. If there is an
error during policy initialisation, MDevSoundObserver::RecordError() is called with an error code of KErrAccessDenied. If no initialisation error occurs, MDevSoundObserver::BufferToBeEmptied()
is called with a buffer reference. This buffer contains recorded
or encoded data. After processing the recorded or encoded data the
client should call RecordData() to continue the recording process.
void PlayData();
Plays the audio data provided by the client when processing the BufferToBeFilled() callback.
When playing of
the audio sample is complete, successfully or otherwise MDevSoundObserver::PlayError() is called with the appropriate system wide error code.
void RecordData();
Continues the recording process.
Once the recording buffer is filled with audio data, MDevSoundObserver::BufferToBeEmptied() is called so that the client has the opportunity to process the recorded data (usually copying the data to another buffer or writing it to a file.)
void Stop();
Stops an ongoing operation, for example, play, record, tone play, convert and so on.
void Pause();
Temporarily stops an ongoing operation, for example, play, record, tone play, convert and so on.
TInt SamplesRecorded();
Returns the number of bytes recorded so far.
|
TInt SamplesPlayed();
Returns the number of bytes played so far.
|
void PlayToneL(TInt aFrequency, const TTimeIntervalMicroSeconds& aDuration);
Initialises the audio device and starts the play tone process.
The tone is played at a specified frequency for a specified amount of time.
|
void PlayDTMFStringL(const TDesC& aDTMFString);
Initialises the audio device and starts playing a DTMF string.
|
void PlayToneSequenceL(const TDesC8& aData);
Initialises the audio device and starts playing a sequence of tones.
Note: This function is not currently supported.
|
void PlayFixedSequenceL(TInt aSequenceNumber);
Initialises the audio device and starts playing a fixed sequence of tones.
Note: This function is not currently supported.
|
void SetToneRepeats(TInt aRepeatCount, const TTimeIntervalMicroSeconds& aRepeatTrailingSilence);
Defines the number of times the tone should be repeated during playback.
A period of silence can follow each playing of tone.
This function is only available while a tone is playing.
|
void SetDTMFLengths(TTimeIntervalMicroSeconds32& aToneOnLength, TTimeIntervalMicroSeconds32& aToneOffLength, TTimeIntervalMicroSeconds32& aPauseLength);
Defines the duration of tone on, tone off and tone pause to be used during the DTMF tone playback operation.
|
void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration);
Defines the period over which the volume level is to rise smoothly from nothing to the normal volume level.
This function is only available while a tone is playing.
|
void SetPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
Defines the priority settings to use for this instance.
|
void ConvertInitL();
Initialises the audio device and starts the convert process.
This method queries the audio policy server before initialising audio device. If there is an
error during policy initialisation, MDevSoundObserver::PlayError() is called with an error code of KErrAccessDenied. If no initialisation error occurs, MDevSoundObserver::BufferToBeFilled()
is called with a buffer reference used to store the source audio data. The client then needs to fill the buffer with the data to convert and then call ConvertData().
Note: The amount of data that can be converted is specified in
CMMFBuffer::RequestSize(). Any additional data placed in the buffer is ignored.
Note: This function is not currently supported.
void ConvertData();
Completes the conversion process.
Once the conversion buffer is filled with converted audio data MDevSoundObserver::BufferToBeEmptied() is called so that the client has the opportunity to process the converted data (usually copying the data to another buffer or writing it to a file.)
Note: This function is not currently supported.
TInt CustomCommand(TDesC8& aCommand);
Used to issue device specific commands that cannot be executed through the DevSound API.
The command is packed in the form of a descriptor. After executing
the custom command, the device may or may not send a command execution message
to the observer via MDevSoundObserver::DeviceMessage().
Note: This function is not currently supported.
|
|
private: TInt InitializeFormat(RMdaDevSound::TSoundFormatsSupportedBuf& aSupportedFormat, RMdaDevSound::TCurrentSoundFormatBuf& aFormat);
This member is internal and not intended for use.
void SendEventToClient(const TMMFEvent& aEvent);
This member is internal and not intended for use.
virtual TInt FillThisHwBuffer(CMMFDataBuffer& aHwDataBuffer);
This member is internal and not intended for use.
virtual TInt EmptyThisHwBuffer(CMMFDataBuffer& aHwDataBuffer);
This member is internal and not intended for use.
virtual TInt MsgFromHwDevice(TDesC8& aMsg);
This member is internal and not intended for use.
private: RMMFAudioPolicyProxy* iAudioPolicyProxy;
This member is internal and not intended for use.
private: CMMFAudioPolicyRequest* iAudioPolicyRequest;
This member is internal and not intended for use.
private: MDevSoundObserver* iDevSoundObserver;
This member is internal and not intended for use.
private: CDevSoundPlayer* iAudioPlayer;
This member is internal and not intended for use.
private: CDevSoundError* iPlayerErrors;
This member is internal and not intended for use.
private: CDevSoundRecorder* iAudioRecorder;
This member is internal and not intended for use.
private: CDevSoundRecordError* iRecorderErrors;
This member is internal and not intended for use.
private: CMMFDevSoundEventHandler* iDevSoundEventHandler;
This member is internal and not intended for use.
private: RMdaDevSound::TSoundFormatsSupportedBuf iPlayFormatsSupported;
This member is internal and not intended for use.
private: RMdaDevSound::TCurrentSoundFormatBuf iPlayFormat;
This member is internal and not intended for use.
private: RMdaDevSound::TSoundFormatsSupportedBuf iRecordFormatsSupported;
This member is internal and not intended for use.
private: RMdaDevSound::TCurrentSoundFormatBuf iRecordFormat;
This member is internal and not intended for use.
private: TMMFCapabilities iDeviceCapabilities;
This member is internal and not intended for use.
private: TMMFCapabilities iDeviceConfig;
This member is internal and not intended for use.
private: TMMFPrioritySettings iPrioritySettings;
This member is internal and not intended for use.
private: TMMFAudioPolicyPrioritySettings iAudioPolicyPrioritySettings;
This member is internal and not intended for use.
private: TMMFDevSoundInfo iDevSoundInfo;
This member is internal and not intended for use.
private: MMdaToneSynthesis* iCurrentGenerator;
This member is internal and not intended for use.
private: TMdaSimpleToneGenerator iToneGen;
This member is internal and not intended for use.
private: TTimeIntervalMicroSeconds iRepeatTrailingSilence;
This member is internal and not intended for use.
private: TTimeIntervalMicroSeconds iRampDuration;
This member is internal and not intended for use.
private: CMMFDataBuffer* iActiveToneBuffer;
This member is internal and not intended for use.
private: CMMFDataBuffer* iHwDeviceBuffer;
This member is internal and not intended for use.