Symbian中音频API的运用
2010-07-22 01:41:00 来源:WEB开发网/*
there are several ways to record to a file by the CMdaAudioRecorderUtility:
(1). use OpenFileL()
if we use this method, then the file must all ready exist, and just creating a new file using RFile.CreateL() or RFile.ReplaceL() will not be accepted by the recorder utility therefore, this would put a limit on how many messages could be kept
(2). use OpenL()
if we use this method, then the file name passed to it, will lead it to construct a new file with this filename or it will overwrite an existing file with that name however, in order to use this function, we need to pass in several objects:
(1) file location.
(2) file format to be recorded, this is populated by the function.
(3) recording codec to use.
(4) audio settings, such as sample rate and number of channels.
void CAnsPhoneEngine::MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
{
// if the recording has died, this means that the recording should be finished;
// should only happen when recording on the telephony line
if(iState == ERecord && !iIsLocal && aErrorCode == KErrDied)
{
Stop();
return;
}
User::LeaveIfError(aErrorCode);
if(aCurrentState != CMdaAudioClipUtility::EOpen)
return;
switch(iState)
{
case ERecordInit:
// 设置为电话线路上的记录并设置为最大增益
if(iIsLocal) /* if aIsLocal = ETrue, then record to the user's message; use the telephony line. */
{
iSound->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal); /* CMdaAudioRecorderUtility::TDeviceMode是音频设备模式,指定录音和播放所使用的设备 */
iSound->SetGain(iSound->MaxGain());
更多精彩
赞助商链接