![Symbian Developer Library](../../../../a_stock/images/mainheading.gif)
![]() |
![]() |
|
class CMdaAudioInputStream : public CBase, public MMMFClientUtility;
The interface to an audio stream player passing raw audio data from the audio hardware to specified buffers.
This class enables MMF clients to:
Stream raw audio data from the audio hardware to specified buffers.
Specify the priority of the audio stream in relation to other clients that may request to use the same audio hardware.
Set the sample rate and the number of channels after successfully opening the stream. It is not possible to change these values once streaming has started.
Change the gain and balance before or while streaming is in progress. Gain and balance settings take effect immediately.
The API supports callbacks from the server to notify the client:
MaiscOpenComplete() will be called when the audio streaming object is open and ready to stream data back to the user as a
result of a previous call to CMdaAudioInputStream::Open(TMdaPackage *)
.
MaiscBufferCopied() will be called multiple times while the FIFO (queued via CMdaAudioInputStream::ReadL(TDes8 &)
) is emptied. Note: Each buffer will be flagged with KErrAbort if received after CMdaAudioInputStream::Stop()
on is called. MaiscRecordComplete is called once all remaining buffers have been read.
MaiscRecordComplete() is called after CMdaAudioInputStream::Stop()
has been called. aError - KErrAbort if MaiscRecordComplete called as a result of a call to CMdaAudioInputStream::Stop()
.
Users of object CMdaAudioInputStream should ensure that implementation of the callback methods MaiscOpenComplete,MaiscBufferCopied
and MaiscRecordComplete in class MMdaAudioInputStreamCallback
do not delete the object,otherwise a Kern-Exec 3 would occur during callback.
MMMFClientUtility
- No description.
CBase
-
Base class for all classes to be instantiated on the heap.
CMdaAudioInputStream
- ...
Defined in CMdaAudioInputStream
:
BitRateL()const
Returns the current bit rate. CustomInterface(TUid)
Retrieves a custom interface to the underlying device.DataType()const
Returns the current data type.Gain()const
Returns the current gain setting.GetBalanceL()const
Returns the current audio balance.GetBytes()
Returns the current number of bytes rendered by audio hardware.GetSupportedBitRatesL(RArray< TInt > &)
Returns the bit rates supported by the sound deviceMaxGain()const
Returns the maximum gain level.NewL(MMdaAudioInputStreamCallback &)
Instantiates a new audio input stream using default priority preferences.NewL(MMdaAudioInputStreamCallback &,TInt,TMdaPriorityPreference)
Instantiates a new audio input stream.Open(TMdaPackage *)
Opens an input audio stream package.Position()
Returns the current position within the data stream in microseconds since the st...ReadL(TDes8 &)
Records streaming raw audio data.RequestStop()
Requests a Stop of the recording process.SetAudioPropertiesL(TInt,TInt)
Sets the sample rate and number of audio channels.SetBalanceL(TInt)
Sets the current audio balance.SetBitRateL(TInt)
Sets the bit rate to a new value. SetDataTypeL(TFourCC)
Sets the data type. If the data type is not explicitly set it will assumed to be...SetGain(TInt)
Sets the gain for the audio device to a specified value.SetPriority(TInt,TMdaPriorityPreference)
Sets the audio priority values.SetSingleBufferMode(TBool)
Indicates that the client wishes to use a single buffer to collect the data. Thi...Stop()
Stops the recording process.Inherited from CBase
:
Delete(CBase *)
Deletes the specified object.Extension_(TUint,TAny *&,TAny *)
Extension function operator new(TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TAny *)
Initialises the object to binary zeroes.operator new(TUint,TLeave)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TLeave,TUint)
Allocates the object from the heap and then initialises its contents to binary z...operator new(TUint,TUint)
Allocates the object from the heap and then initialises its contents to binary z...Capability: | UserEnvironment | For recording - the requesting client process must have a UserEnvironment capability. |
IMPORT_C static CMdaAudioInputStream* NewL(MMdaAudioInputStreamCallback &aCallBack);
Instantiates a new audio input stream using default priority preferences.
|
|
Capability: | MultimediaDD | A process requesting or using this method that has MultimediaDD capability will always have precedence over a process that does not have MultimediaDD. |
Capability: | UserEnvironment | For recording - the requesting client process must have a UserEnvironment capability. |
IMPORT_C static CMdaAudioInputStream* NewL(MMdaAudioInputStreamCallback &aCallBack, TInt aPriority, TMdaPriorityPreference
aPref);
Instantiates a new audio input stream.
|
|
IMPORT_C void SetAudioPropertiesL(TInt aSampleRate, TInt aChannels);
Sets the sample rate and number of audio channels.
|
IMPORT_C void Open(TMdaPackage *aSettings);
Opens an input audio stream package.
The MMdaAudioInputStreamCallback::MaisOpenComplete() callback function is called when the stream has been opened and is ready to record data. If the open was unsuccessful, this is indicated by the aError parameter of the callback.
|
IMPORT_C void SetGain(TInt aNewGain);
Sets the gain for the audio device to a specified value.
|
IMPORT_C TInt Gain() const;
Returns the current gain setting.
|
IMPORT_C TInt MaxGain() const;
Returns the maximum gain level.
|
IMPORT_C void SetBalanceL(TInt aBalance=KMMFBalanceCenter);
Sets the current audio balance.
The balance can be any value between KMMFBalanceMaxLeft and KMMFBalanceMaxRight, the default value being KMMFBalanceCenter.
|
IMPORT_C TInt GetBalanceL() const;
Returns the current audio balance.
|
Capability: | MultimediaDD | A process requesting or using this method that has MultimediaDD capability will always have precedence over a process that does not have MultimediaDD. |
IMPORT_C void SetPriority(TInt aPriority, TMdaPriorityPreference aPref);
Sets the audio priority values.
This function cannot be used while the stream object is open. It is intended for use before an CMdaAudioInputStream::Open(TMdaPackage *)
is issued, or between a previous CMdaAudioInputStream::Stop()
and a new CMdaAudioInputStream::Open(TMdaPackage *)
.
|
IMPORT_C void ReadL(TDes8 &aData);
Records streaming raw audio data.
If this is the first CMdaAudioInputStream::ReadL(TDes8 &)
after a successful CMdaAudioInputStream::Open(TMdaPackage *)
this function starts the audio recording process.
The MMdaAudioInputStreamCallback::MaisBufferCopied() callback function is called when the buffer has been successfully filled. A pointer to the newly filled buffer is returned in the callback.
Note: The MMdaAudioInputStreamCallback::MaisBufferCopied() callback function is also called when a CMdaAudioInputStream::Stop()
is issued, with a pointer to the remaining recorded audio data and the aError parameter of the callback set to indicate recording
has finished.
|
IMPORT_C void Stop();
Stops the recording process.
The MMdaAudioInputStreamCallback::MaisRecordComplete() callback function is called when recording has been halted. Just prior to issuing this callback, the FIFO buffers are read and the remaining audio data passed back by a final MMdaAudioInputStreamCallback::MaisBufferCopied() callback with its aError parameter set to KErrAbort.
Any remaining FIFO buffers are also passed back, with their aError parameter set to KErrAbort.
Stop is immediate and best used for premature stops, for example within destructors. If it is critical to receive all data buffers upto the point that Recording has Stopped, we recommend using RequestStop instead. Otherwise some trailing buffers may be lost from the recording process.
If a Stop is issued after a RequestStop, Stop will take precedent.
CMdaAudioInputStream::RequestStop()
Requests a Stop of the recording process.IMPORT_C const TTimeIntervalMicroSeconds& Position();
Returns the current position within the data stream in microseconds since the start of streaming.
|
IMPORT_C TInt GetBytes();
Returns the current number of bytes rendered by audio hardware.
|
IMPORT_C void SetDataTypeL(TFourCC aAudioType);
Sets the data type. If the data type is not explicitly set it will assumed to be pcm16. If it is set then the hardware must support the data type being set otherwise the function leaves with KErrNotSupported.
|
|
IMPORT_C TFourCC DataType() const;
Returns the current data type.
|
IMPORT_C void GetSupportedBitRatesL(RArray< TInt > &aSupportedBitRates);
Returns the bit rates supported by the sound device
|
|
IMPORT_C TInt BitRateL() const;
Returns the current bit rate.
|
|
IMPORT_C void SetBitRateL(TInt aBitRate);
Sets the bit rate to a new value.
|
|
IMPORT_C TAny* CustomInterface(TUid aInterfaceId);
Retrieves a custom interface to the underlying device.
|
|
IMPORT_C void SetSingleBufferMode(TBool aSingleMode);
Indicates that the client wishes to use a single buffer to collect the data. This buffer is passed via the ReadL api.
|
IMPORT_C void RequestStop();
Requests a Stop of the recording process.
The device is requested to Stop and does so after all unprocessed buffers are processed and passed back to the input stream. The device is actually Stopped when the final empty buffer indicating buffer process completion is received.
CMdaAudioInputStream::Stop()
Stops the recording process.