I have been working on an application which can record voice and play it back.I am using the example given in series 60 SDk(Sound Example).I am able to record voice but when I play it back the recorded voice is not clear.There is a pause and then the voice is heard.There is a lag in the voice.Can anyone tell me what could be the problem?Do I need to install or set any environment for the voice to play back?Please help
Hi,
I havent tried my application on the phone but I have tried only on the series 60 emulator.the foll is the code.I have sent only 2 cpp files where I felt could be the problem.If u want the rest then I will send the rest
// Open an existing sample file for playback or recording
// causes MMdaObjectStateChangeObserver::MoscoStateChangeEvent to be called
iMdaAudioRecorderUtility->OpenFileL(KRecorderFile);
}
if (iMdaAudioRecorderUtility != NULL)
{
// Play through the device speaker
iMdaAudioRecorderUtility->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal);
// Set maximum volume for playback
iMdaAudioRecorderUtility->SetVolume(iMdaAudioRecorderUtility->MaxVolume());
// Set the playback position to the start of the file
//iMdaAudioRecorderUtility->SetPosition(start);
//
start = 0;
iMdaAudioRecorderUtility->SetPosition(start);
if (iMdaAudioRecorderUtility != NULL)
{
// Record from the device microphone
iMdaAudioRecorderUtility->SetAudioDeviceMode(CMdaAudioRecorderUtility::ELocal);
// Set maximum gain for recording
iMdaAudioRecorderUtility->SetGain(iMdaAudioRecorderUtility->MaxGain());
// Delete current audio sample from beginning of file
start = 0;
iMdaAudioRecorderUtility->SetPosition(start);
iMdaAudioRecorderUtility->CropL();
void CPlayerAdapter::ConstructL(const TDesC& aFileName)
{
// Create an audio player utility instance for playing sample data from a file
// causes MMdaAudioPlayerCallback::MapcInitComplete to be called
iMdaAudioPlayerUtility = CMdaAudioPlayerUtility::NewFilePlayerL(aFileName, *this);
}
// Note that this implementation of the virtual function does not leave.
void CPlayerAdapter::UpdateMenuL(CEikMenuPane* aMenuPane)
{
aMenuPane->SetItemDimmed(ESoundCmdPlay, ETrue);
aMenuPane->SetItemDimmed(ESoundCmdRecord, ETrue);
aMenuPane->SetItemDimmed(ESoundCmdStop, ETrue);
aMenuPane->SetItemDimmed(ESoundCmdChange, ETrue);
switch (iState)
{
case ENotReady:
aMenuPane->SetItemDimmed(ESoundCmdChange, EFalse);
break;
case EReadyToPlay:
aMenuPane->SetItemDimmed(ESoundCmdPlay, EFalse);
aMenuPane->SetItemDimmed(ESoundCmdChange, EFalse);
break;
case EPlaying:
aMenuPane->SetItemDimmed(ESoundCmdStop, EFalse);
break;
default:
__ASSERT_ALWAYS(EFalse, User::Panic(KPlayerAdapter, KSoundPanicInvalidMdaState));
break;
}
}
// Note that this implementation of the virtual function does not leave.
void CPlayerAdapter::PlayL()
{
iMdaAudioPlayerUtility->Play();
iState = EPlaying;
}
// CMdaAudioPlayerUtility is not able to record
void CPlayerAdapter::RecordL()
{
}
// Note that this implementation of the virtual function does not leave.
void CPlayerAdapter::StopL()
{
iMdaAudioPlayerUtility->Stop();
iState = EReadyToPlay;
}