×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    104

    CMdaAudioInputStream problem

    Hello everyone,

    I need to make a program that records data in a stream while I'm playing data from another stream. I'm using CMdaAudioOutputStream and CMdaAudioInputStream. Problem is, when I run the code on my phone, the file in which I record data is always empty. I don't get any kernel error or anything on screen. Program plays sound as it should, I can terminate it normally.

    When I run the code on emulator I get the Audio Streaming Panic USER 29 on console a few moments after MaiscOpenComplete is executed. Could anyone tell me what could be wrong?

    Here's what I do:

    In AppUI.cpp
    Code:
    #if defined(__WINS__)
    	_LIT(KFileName, "c:\\data\\sample_stream.wav");
    	_LIT(KRecordedStream, "c:\\data\\recs.dat" );
    #else
    	_LIT(KFileName, "\\data\\sample_stream.wav");
    	_LIT(KRecordedStream, "\\data\\recs.dat" );
    #endif
    ...
    iAudioPlayer->RecordL(iCoeEnv->FsSession(), KRecordedStream);
    iAudioPlayer->PlayL(iCoeEnv->FsSession(), KFileName);
    In method RecordL:
    Code:
    iFile.Close();
    TRAPD(err, iFile.Replace(aFs, aFileName, EFileWrite));
    
    if(err < 0)
    	{
    	User::Exit(err);
    	}
    	
    iStreamSettings.iChannels=TMdaAudioDataSettings::EChannelsMono;
    iStreamSettings.iSampleRate=TMdaAudioDataSettings::ESampleRate8000Hz;
    
    // Open the input audio device for streaming.
    TRAP(err, iInputStream->Open(&iStreamSettings));
    if(err < 0)
    	{
    	User::Exit(err);
    	}
    In MaiscOpenComplete:
    Code:
    // Set the data type.
    TRAP(err, iInputStream->SetDataTypeL(KMMFFourCCCodePCM16));
    		
    if (KErrNone == err)
    	{
    	// set stream input gain to maximum
    	iInputStream->SetGain(iInputStream->MaxGain()); 
    	// set stream priority to normal and time sensitive
    	iInputStream->SetPriority(EPriorityNormal, EMdaPriorityPreferenceTime);
    
    	// Create a buffer to be written to the file.				
    	RBuf8 buffer;
    	User::LeaveIfError(buffer.CreateMax(KMaxBuffer));
    	CleanupClosePushL(buffer);
    	buffer.Zero();	
    	// Fill the buffer with your data.
    	iInputStream->ReadL(buffer);
    	// Write buffer to the file.
    	User::LeaveIfError(iFile.Write(buffer, buffer.Length()));
    
    	// Delete the buffer
    	CleanupStack::PopAndDestroy(&buffer);
    	}
    In MaiscBufferCopied:
    Code:
    if (KErrNone == aError)
    	{
    	RBuf8 buffer;
    	User::LeaveIfError(buffer.CreateMax(KMaxBuffer));
    	CleanupClosePushL(buffer);
    	buffer.Zero();
    		
    	iInputStream->ReadL(buffer);
    
    	// Write buffer to the file.
    	User::LeaveIfError(iFile.Write(buffer, buffer.Length()));
    
    	// Delete the buffer
    	CleanupStack::PopAndDestroy(&buffer);
    	}
    In MaiscRecordComplete:
    Code:
    iFile.Close();
    Console output:
    Code:
    61.625	26020310:CMMFDevSoundAdaptation::CBody::SetPrioritySettings(const TMMFPrioritySettings &)>ENTR
        61.625	26020310:CMMFDevSoundAdaptation::CBody::SetPrioritySettings(const TMMFPrioritySettings &)>EXIT
        61.625	26020310:CMMFDevSoundAdaptation::CBody::MaxVolume()>ENTR
        61.625	26020310:CMMFDevSoundAdaptation::CBody::MaxVolume()>ENTR
        61.625	26020310:CMMFDevSoundAdaptation::CBody::SetDeviceVolume(int)>ENTR
        61.625	26020310:CMMFDevSoundAdaptation::CBody::SetDeviceVolume(int)>EXIT
        61.630	26020310:CMMFDevSoundAdaptation::CBody::PlayToneSequenceL(const TDesC8 &)>ENTR
        61.635	44720310:CMMFDevSoundAdaptation::CBody::SetClientConfig(const TMMFClientConfig &)>ENTR
        61.635	44720310:CMMFDevSoundAdaptation::CBody::InitializeL(MDevSoundAdaptationObserver &, TFourCC, TMMFState)>ENTR
        61.640	44720310:CMMFDevSoundAdaptation::CBody::InitializeL(MDevSoundAdaptationObserver &, TUid, TMMFState)>ENTR
        61.640	44720310:CMMFDevSoundAdaptation::CBody::InitializeFormat(TPckgBuf<RMdaDevSound::TSoundFormatsSupported> &, TPckgBuf<RMdaDevSound::TCurrentSoundFormat> &)>ENTR
        61.640	44720310:CMMFDevSoundAdaptation::CBody::InitializeFormat(TPckgBuf<RMdaDevSound::TSoundFormatsSupported> &, TPckgBuf<RMdaDevSound::TCurrentSoundFormat> &)>EXIT
        61.645	44720310:CMMFDevSoundAdaptation::CBody::InitializeHwDevice()>ENTR
        61.645	44720310:CMMFDevSoundAdaptation::CBody::InitializeHwDevice()>EXIT
        61.645	44720310:CMMFDevSoundAdaptation::CBody::InitializeL(MDevSoundAdaptationObserver &, TUid, TMMFState)>EXIT
        61.645	44720310:CMMFDevSoundAdaptation::CBody::InitializeL(MDevSoundAdaptationObserver &, TFourCC, TMMFState)>EXIT
        61.645	44720310:CMMFDevSoundAdaptation::CBody::Config() const>ENTR
        61.650	44720310:CMMFDevSoundAdaptation::CBody::SetConfigL(const TMMFCapabilities &)>ENTR
        61.650	44720310:CMMFDevSoundAdaptation::CBody::SetConfigL(const TMMFCapabilities &)>EXIT
        61.650	3e480310:CMMFDevSoundAdaptation::CBody::SetClientConfig(const TMMFClientConfig &)>ENTR
        61.650	3e480310:CMMFDevSoundAdaptation::CBody::InitializeL(MDevSoundAdaptationObserver &, TFourCC, TMMFState)>ENTR
        61.650	3e480310:CMMFDevSoundAdaptation::CBody::InitializeL(MDevSoundAdaptationObserver &, TUid, TMMFState)>ENTR
        61.655	3e480310:CMMFDevSoundAdaptation::CBody::InitializeL(MDevSoundAdaptationObserver &, TUid, TMMFState)>EXIT
        61.655	3e480310:CMMFDevSoundAdaptation::CBody::InitializeL(MDevSoundAdaptationObserver &, TFourCC, TMMFState)>EXIT
        61.670	44720310:CMMFDevSoundAdaptation::CBody::Config() const>ENTR
        61.675	44720310:CMMFDevSoundAdaptation::CBody::SetConfigL(const TMMFCapabilities &)>ENTR
        61.675	44720310:CMMFDevSoundAdaptation::CBody::SetConfigL(const TMMFCapabilities &)>EXIT
        61.675	44720310:CMMFDevSoundAdaptation::CBody::MaxGain()>ENTR
        61.675	44720310:CMMFDevSoundAdaptation::CBody::SetGain(int)>ENTR
        61.675	44720310:CMMFDevSoundAdaptation::CBody::SetDeviceRecordLevel(int)>ENTR
        61.675	44720310:CMMFDevSoundAdaptation::CBody::SetDeviceRecordLevel(int)>EXIT
        61.675	44720310:CMMFDevSoundAdaptation::CBody::SetGain(int)>EXIT
        61.675	44720310:CMMFDevSoundAdaptation::CBody::SetPrioritySettings(const TMMFPrioritySettings &)>ENTR
        61.680	44720310:CMMFDevSoundAdaptation::CBody::SetPrioritySettings(const TMMFPrioritySettings &)>EXIT
        61.690	44720310:CMMFDevSoundAdaptation::CBody::RecordInitL()>ENTR
        61.695	44720310:CMMFDevSoundAdaptation::CBody::RequestPolicy()>ENTR
        61.695	44720310:CMMFDevSoundAdaptation::CBody::RequestPolicy()>EXIT
        61.700	44720310:CMMFDevSoundAdaptation::CBody::RecordInitL()>EXIT
        61.700	44720310:CMMFDevSoundAdaptation::CBody::StartRecordDataL()>ENTR
        61.700	44720310:CMMFDevSoundAdaptation::CBody::SetRecordFormat(TPckgBuf<RMdaDevSound::TCurrentSoundFormat> &)>ENTR
        61.700	44720310:CMMFDevSoundAdaptation::CBody::SetRecordFormat(TPckgBuf<RMdaDevSound::TCurrentSoundFormat> &)>EXIT
        61.700	44720310:CMMFDevSoundAdaptation::CBody::SetDeviceRecordLevel(int)>ENTR
        61.700	44720310:CMMFDevSoundAdaptation::CBody::SetDeviceRecordLevel(int)>EXIT
        61.760	3e480310:CMMFDevSoundAdaptation::CBody::Config() const>ENTR
        61.765	3e480310:CMMFDevSoundAdaptation::CBody::SetConfigL(const TMMFCapabilities &)>ENTR
        61.765	3e480310:CMMFDevSoundAdaptation::CBody::SetConfigL(const TMMFCapabilities &)>EXIT
        61.765	3e480310:CMMFDevSoundAdaptation::CBody::MaxVolume()>ENTR
        61.765	3e480310:CMMFDevSoundAdaptation::CBody::MaxVolume()>ENTR
        61.770	3e480310:CMMFDevSoundAdaptation::CBody::SetDeviceVolume(int)>ENTR
        61.770	3e480310:CMMFDevSoundAdaptation::CBody::SetDeviceVolume(int)>EXIT
        61.770	3e480310:CMMFDevSoundAdaptation::CBody::PlayInitL()>ENTR
        61.770	3e480310:CMMFDevSoundAdaptation::CBody::RequestPolicy()>ENTR
        61.770	3e480310:CMMFDevSoundAdaptation::CBody::RequestPolicy()>EXIT
        61.775	3e480310:CMMFDevSoundAdaptation::CBody::PlayInitL()>EXIT
        61.775	3e480310:CMMFDevSoundAdaptation::CBody::SendEventToClient(const TMMFEvent &)>ENTR
        61.775	3e480310:CMMFDevSoundAdaptation::CBody::Error(int)>ENTR
        61.775	3e480310:CMMFDevSoundAdaptation::CBody::UpdateBytesPlayed()>ENTR
        61.775	3e480310:CMMFDevSoundAdaptation::CBody::UpdateBytesPlayed()>EXIT
        61.775	3e480310:CMMFDevSoundAdaptation::CBody::SamplesPlayed()>ENTR
        61.775	3e480310:CMMFDevSoundAdaptation::CBody::SamplesPlayed()>EXIT
        61.775	CMMFDevSoundSession[0x3e480238]::PlayError [-14]
        61.780	3e480310:CMMFDevSoundAdaptation::CBody::Error(int)>EXIT
        61.780	3e480310:CMMFDevSoundAdaptation::CBody::Stopped()>ENTR
        61.780	3e480310:CMMFDevSoundAdaptation::CBody::UpdateBytesPlayed()>ENTR
        61.780	3e480310:CMMFDevSoundAdaptation::CBody::UpdateBytesPlayed()>EXIT
        61.780	3e480310:CMMFDevSoundAdaptation::CBody::UpdatePolicyState()>ENTR
        61.780	3e480310:CMMFDevSoundAdaptation::CBody::UpdatePolicyState()>EXIT
        61.780	3e480310:CMMFDevSoundAdaptation::CBody::Stopped()>EXIT
        61.785	3e480310:CMMFDevSoundAdaptation::CBody::SendEventToClient(const TMMFEvent &)>EXIT
        62.105	44720310:CMMFDevSoundAdaptation::CBody::StartRecordDataL()>EXIT
        62.405	44720310:CMMFDevSoundAdaptation::CBody::EmptyThisHwBuffer(CMMFBuffer &)>ENTR
        62.405	CMMFDevSoundSession[0x44720238]::CreateChunk [0]
        62.405	CMMFDevSoundSession[0x44720238]::BufferToBeEmptied - Exit [0]
        62.405	44720310:CMMFDevSoundAdaptation::CBody::EmptyThisHwBuffer(CMMFBuffer &)>EXIT
        62.405	Thread Audio Streaming::Audio Streaming Panic USER 29

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,752

    Re: CMdaAudioInputStream problem

    USER 29 is documented in the SDK Help.
    Your concept about CMdaAudioInputStream::ReadL is wrong, it is also documented in the SDK Help.

    Note that you can find working a audio stream example in Docs, Tools & Code above, Documentation, Symbian C++, Multimedia.

Similar Threads

  1. Problem with CAknDoubleStyleListBox with a CAknSearchField
    By jjig in forum Symbian User Interface
    Replies: 2
    Last Post: 2009-09-17, 00:58
  2. SyncML link problem
    By samuel_ in forum Symbian
    Replies: 4
    Last Post: 2009-03-27, 08:02
  3. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  4. CMdaAudioInputStream & CMdaAudioOutputStream problem
    By vsawant in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2005-10-03, 18:33
  5. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×