Symbian中音频API的运用
2010-07-22 01:41:00 来源:WEB开发网}
else /* if aIsLocal = EFalse, then record to aFileName; use the device microphone. */
{
iSound->SetAudioDeviceMode(CMdaAudioRecorderUtility::ETelephonyNonMixed);
TInt maxGain = iSound->MaxGain();
iSound->SetGain(maxGain / 2);
}
// Delete current audio sample from beginning of file
iSound->SetPosition(TTimeIntervalMicroSeconds(0));
iSound->CropL();
// start recording
iSound->RecordL(); /× 当录音结束之后仍然会调用此通知方法。使用iSound->Close()方法停止录音和播放(Stops the current operation (playback/recording/conversion).) */
iState = ERecord;
break;
case ERecord:
break;
case EPlayInit:
{
// Play through the device speaker and set to max volume
if(iIsLocal)
{
iSound->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal);
}
else
{
iSound->SetAudioDeviceMode(CMdaAudioRecorderUtility::ETelephonyOrLocal);
// iPhone.DeviceSpeakerOff();
}
iSound->SetVolume(iSound->MaxVolume());
// Set the playback position to the start of the file
iSound->SetPosition(TTimeIntervalMicroSeconds(0));
iSound->PlayL(); // 当播放结束之后仍然会调用此通知方法。
iState = EPlay;
// we start the timer
// add a half a second onto the play time to make sure we've finished playing
TInt64 playTime = iSound->Duration().Int64() + KHalfSecond;
if (iTimer)
{
delete iTimer;
iTimer = NULL;
}
iTimer = CAnsPhoneTimer::NewL(*this, playTime.GetTInt());
break;
}
default:
break;
}
}
五. CMdaAudioInputStream
更多精彩
赞助商链接