×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    11

    WHY NO ONE REPLIES - CMdaAudioInputStream

    i wrote a code, but the compiler doesnt want to compile it, even iam sure there's no errors
    the compiler is not accepting:
    Code:
    TMdaPriorityPreference::EMdaPriorityPreferenceTime
    SetGain()
    MaxGain()
    SetAudioPropertiesL()
    Code:
    // helloworld.h
    #ifndef __HELLOWORLD_H
    #define __HELLOWORLD_H
    #include <MdaAudioOutputStream.h>
    #include <MdaAudioInputStream.h>
    #include <mda\common\audio.h>
    const TInt KBufferSize = 16000;
    #include <eikenv.h>
    #include <eikappui.h>
    #include <eikapp.h>
    #include <eikdoc.h>
    #include <eikmenup.h>
    #include <eikon.hrh>
    #include <helloworld.rsg>
    #include "helloworld.hrh"
    class CExampleApplication : public CEikApplication
    {
    private: 
    	           // Inherited from class CApaApplication
    	CApaDocument* CreateDocumentL();
    	TUid AppDllUid() const;
    };
    
    class CExampleAppView : public CCoeControl
    {
    public:
    	static CExampleAppView* NewL(const TRect& aRect);
    	CExampleAppView();
    	~CExampleAppView();
        void ConstructL(const TRect& aRect);
    
    private:
    	           // Inherited from CCoeControl
    	void Draw(const TRect& /*aRect*/) const;
    
    private:
    	HBufC*  iExampleText;
    };
    
    
    class CExampleAppUi : public CEikAppUi, public MMdaAudioInputStreamCallback, public MMdaAudioOutputStreamCallback
    {
    public:
        void ConstructL();
    	~CExampleAppUi();
    private:
                  // Inherirted from class CEikAppUi
    	void HandleCommandL(TInt aCommand);
    
    private:
    	CCoeControl* iAppView;
    private:
    	CMdaAudioInputStream* iInputStream;
    	CMdaAudioOutputStream* iOutputStream;
    	void MaiscOpenComplete(TInt aError);
    	void MaiscBufferCopied(TInt aError, const TDesC8& aBuffer);
    	void MaiscRecordComplete(TInt aError);
    	void MaoscOpenComplete(TInt aError);
    	void MaoscBufferCopied(TInt aError, const TDesC8& aBuffer);
    	void MaoscPlayComplete(TInt aError);
    	void OpenCompleteL(TInt aError);
    	void RecordL();
    	void PlayL();
    	
    	RPointerArray<TDes8> iBuffer;
    	enum TState{EClosed,EFirstOpenSuccessful,EOpen,EPlaying,ERecording};
    	TState iState;
    };
    
    
    class CExampleDocument : public CEikDocument
    	{
    public:
    	static CExampleDocument* NewL(CEikApplication& aApp);
    	CExampleDocument(CEikApplication& aApp);
    	void ConstructL();
    private: 
    	           // Inherited from CEikDocument
    	CEikAppUi* CreateAppUiL();
    	};
    #endif
    Code:
    // HelloWorld_Main.cpp
    #include "HelloWorld.h"
    EXPORT_C CApaApplication* NewApplication()
    	{
    	return new CExampleApplication;
    	}
    GLDEF_C TInt E32Dll(TDllReason)
    	{
    	return KErrNone;
    	}
    Code:
    // HelloWorld_Document.cpp
    #include "HelloWorld.h"
    CExampleDocument::CExampleDocument(CEikApplication& aApp)
    		: CEikDocument(aApp){}
    CEikAppUi* CExampleDocument::CreateAppUiL()	
    {return new(ELeave) CExampleAppUi;}


    Code:
    // HelloWorld_AppView.cpp
    #include "HelloWorld.h"
    CExampleAppView::CExampleAppView(){}
    CExampleAppView* CExampleAppView::NewL(const TRect& aRect)
    {
    	CExampleAppView* self = new(ELeave) CExampleAppView();
    	CleanupStack::PushL(self);
    	self->ConstructL(aRect);
    	CleanupStack::Pop();
    	return self;
    }
    CExampleAppView::~CExampleAppView()
    {
    	delete iExampleText;
    }
    void CExampleAppView::ConstructL(const TRect& aRect)
    {
    iExampleText = iEikonEnv->AllocReadResourceL(R_EXAMPLE_TEXT_HELLO);
    CreateWindowL();
    SetRect(aRect);
    ActivateL();
    }
    void CExampleAppView::Draw(const TRect& /*aRect*/) const
    {
    CWindowGc& gc = SystemGc();
    TRect      drawRect = Rect();
    const CFont*     fontUsed;
    gc.Clear();
    drawRect.Shrink(10,10);
    gc.DrawRect(drawRect);
    fontUsed = iEikonEnv->TitleFont();
    gc.UseFont(fontUsed);
    TInt   baselineOffset=(drawRect.Height() - fontUsed->HeightInPixels())/2; 
    gc.DrawText(*iExampleText,drawRect,baselineOffset,CGraphicsContext::ECenter, 0);
    gc.DiscardFont();
    }
    Code:
    // HelloWorld_AppUi.cpp
    #include "HelloWorld.h"
    void CExampleAppUi::ConstructL()
    {
    BaseConstructL();
    iAppView = CExampleAppView::NewL(ClientRect());
    iInputStream = CMdaAudioInputStream::NewL(*this);
    iOutputStream = CMdaAudioOutputStream::NewL(*this);
    iInputStream->SetAudioPropertiesL(TMdaAudioDataSettings::ESampleRate8000Hz,TMdaAudioDataSettings::EChannelsMono);
    iInputStream->SetGain(iInputStream->MaxGain());
    iInputStream->SetPriority(EMdaPriorityNormal,TMdaPriorityPreference::EMdaPriorityPreferenceTime);
    TDes8* buffer = new(ELeave) TBuf8<KBufferSize>;
    buffer->SetMax();
    CleanupStack::PushL(buffer);
    User::LeaveIfError(iBuffer.Append(buffer));
    CleanupStack::Pop(buffer);
    buffer = new(ELeave) TBuf8<KBufferSize>;
    buffer->SetMax();
    CleanupStack::PushL(buffer);
    User::LeaveIfError(iBuffer.Append(buffer));
    CleanupStack::Pop(buffer);
    buffer = new(ELeave) TBuf8<KBufferSize>;
    buffer->SetMax();
    CleanupStack::PushL(buffer);
    User::LeaveIfError(iBuffer.Append(buffer));
    CleanupStack::Pop(buffer);
    }
    CExampleAppUi::~CExampleAppUi()
    	{
    	delete iAppView;
    	delete iInputStream;
    	delete iOutputStream;
    	iBuffer.ResetAndDestroy();
    	}
    void CExampleAppUi::HandleCommandL(TInt aCommand)
    {
    	switch (aCommand)
    	{
    	case EExampleItem0:
    		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM0);
    		break;
    	case EExampleItem1:
    		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM1);
    		break;
    	case EExampleItem2:
    		iEikonEnv->InfoMsg(R_EXAMPLE_TEXT_ITEM2);
    		break;
    	case EEikCmdExit: 
    		Exit();
    		break;
    	case ETInputStreamCmdRecord:
    		RecordL();
    		break;
    	case ETInputStreamCmdPlay:
    		PlayL();
    		break;
    	};
    }
    //*******************************************************
    void CExampleAppUi::MaiscOpenComplete(TInt aError)
    {
    	if (aError != KErrNone)
    	{
    		_LIT(buf,"input error");
    		iEikonEnv->InfoMsg(buf);
    	}
    	OpenCompleteL(aError);
    }
    //*******************************************************
    void CExampleAppUi::MaiscBufferCopied(TInt aError, const TDesC8& aBuffer)
    {
    	TBuf<32> buf(_L("Buf "));
    	if (&aBuffer == iBuffer[0])
    		buf.AppendNum(1);
    	else if (&aBuffer == iBuffer[1])
    		buf.AppendNum(2);
    	else if (&aBuffer == iBuffer[2])
    	{
    		buf.AppendNum(3);
    		iState = EOpen;
    	}
    	buf.Append(_L(" full, err "));
    	buf.AppendNum(aError);
    	iEikonEnv->InfoMsg(buf);
    	User::LeaveIfError(aError);
    }
    //********************************************************
    void CExampleAppUi::MaiscRecordComplete(TInt aError)
    {
    	iState = EOpen;
    	TBuf<32> buf(_L("Record complete, err "));
    	buf.AppendNum(aError);
    	iEikonEnv->InfoMsg(buf);
    	User::LeaveIfError(aError);
    }
    //********************************************************
    void CExampleAppUi::MaoscOpenComplete(TInt aError)
    {
    	if (aError != KErrNone)
    	{
    		TBuf<32> buf(_L("Output err "));
    		buf.AppendNum(aError);
    		iEikonEnv->InfoMsg(buf);
    	}
    	OpenCompleteL(aError);
    }
    //********************************************************
    void CExampleAppUi::MaoscBufferCopied(TInt aError, const TDesC8& aBuffer)
    {
    	TBuf<32> buf(_L("Buf "));
    	if (&aBuffer == iBuffer[0])
    		buf.AppendNum(1);
    	else if (&aBuffer == iBuffer[1])
    		buf.AppendNum(2);
    	else if (&aBuffer == iBuffer[2])
    		buf.AppendNum(3);
    	buf.Append(_L(" played, err "));
    	buf.AppendNum(aError);
    	iEikonEnv->InfoMsg(buf);
    	User::LeaveIfError(aError);
    }
    //********************************************************
    void CExampleAppUi::MaoscPlayComplete(TInt aError)
    {
    	iState = EOpen;
    	if (aError == KErrUnderflow)
    		aError = KErrNone;
    	TBuf<32> buf(_L("Play complete, err "));
    	buf.AppendNum(aError);
    	iEikonEnv->InfoMsg(buf);
    	User::LeaveIfError(aError);
    }
    //*****************************************************
    void CExampleAppUi::OpenCompleteL(TInt aError)
    {
    	User::LeaveIfError(aError);
    
    	if (iState == EClosed)
    	{
    		iState = EFirstOpenSuccessful;
    	}
    	else
    	{
    		iState = EOpen;
    		iEikonEnv->InfoMsg(_L("Ready"));
    		iInputStream->SetGain(iInputStream->MaxGain());
    		iOutputStream->SetVolume(iOutputStream->MaxVolume() / 2);
    	}
    }
    //****************************************************
    void CExampleAppUi::RecordL()
    {
    	if (iState != EOpen)
    		User::Leave(KErrNotReady);
    
    	iState = ERecording;
    
    	for (TInt index = 0; index < iBuffer.Count(); index++)
    	{
    		iInputStream->ReadL(*iBuffer[index]);
    	}
    }
    //*******************************************************
    void CExampleAppUi::PlayL()
    {
    	if (iState != EOpen)
    		User::Leave(KErrNotReady);
    
    	iState = EPlaying;
    
    	for (TInt index = 0; index < iBuffer.Count(); index++)
    	{
    		iOutputStream->WriteL(*iBuffer[index]);
    	}
    }

    Code:
    // HelloWorld_Application.cpp
    #include "HelloWorld.h"
    const TUid KUidHelloWorld = { 0X10008ACE }; 
    TUid CExampleApplication::AppDllUid() const
    {
                 return KUidHelloWorld;
    }CApaDocument* CExampleApplication::CreateDocumentL()
    {
    	return new (ELeave) CExampleDocument(*this);
    }

    Code:
    helloworld.mmp
    TARGET        HelloWorld.app
    TARGETTYPE    app
    UID           0x100039CE 0x10005BAE
    TARGETPATH    \system\apps\HelloWorld
    SOURCEPATH    .
    SOURCE        HelloWorld_Main.cpp
    SOURCE        HelloWorld_Application.cpp
    SOURCE        HelloWorld_Document.cpp
    SOURCE        HelloWorld_AppUi.cpp
    SOURCE        HelloWorld_AppView.cpp
    
    USERINCLUDE   .
    SYSTEMINCLUDE \epoc32\include
    
    RESOURCE      HelloWorld.rss
    LIBRARY       euser.lib apparc.lib cone.lib eikcore.lib MediaClientAudioStream.lib
    Last edited by elhasab; 2006-01-31 at 15:15. Reason: I NEED HELP URGENTLY

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    11

    WHY NO ONE REPLIES - (CMdaAudioInputStream)

    why no one replies
    someone please reply
    why does i have this error
    Code:
    HELLOWORLDBASICAPPUI.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMdaAudioInputStream::SetPriority(int,enum TMdaPriorityPreference)" (?SetPriority@CMdaAudioInputStream@@QAEXHW4TMdaPriorityPreference@@@Z)
    HELLOWORLDBASICAPPUI.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMdaAudioInputStream::SetGain(int)" (?SetGain@CMdaAudioInputStream@@QAEXH@Z)
    HELLOWORLDBASICAPPUI.obj : error LNK2001: unresolved external symbol "public: int __thiscall CMdaAudioInputStream::MaxGain(void)const " (?MaxGain@CMdaAudioInputStream@@QBEHXZ)
    HELLOWORLDBASICAPPUI.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMdaAudioInputStream::Open(class TMdaPackage *)" (?Open@CMdaAudioInputStream@@QAEXPAVTMdaPackage@@@Z)
    HELLOWORLDBASICAPPUI.obj : error LNK2001: unresolved external symbol "public: static class CMdaAudioInputStream * __cdecl CMdaAudioInputStream::NewL(class MMdaAudioInputStreamCallback &)" (?NewL@CMdaAudioInputStream@@SAPAV1@AAVMMdaAudioInputStreamCa
    llback@@@Z)
    HELLOWORLDBASICAPPUI.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMdaAudioInputStream::ReadL(class TDes8 &)" (?ReadL@CMdaAudioInputStream@@QAEXAAVTDes8@@@Z)
    Last edited by elhasab; 2006-01-31 at 15:14. Reason: i need help

  3. #3
    Registered User
    Join Date
    Nov 2005
    Location
    California, USA
    Posts
    33

    Re: CMdaAudioInputStream

    Input stream is another library that you did not include in your .mmp!

  4. #4
    Registered User
    Join Date
    Jan 2006
    Posts
    11

    Re: CMdaAudioInputStream

    Input stream is another library that you did not include in your .mmp!
    what's the library, i already included (MediaClientAudioStream.lib) and this is what i found in the S80_SDL.chm provided with the SDK

  5. #5
    Registered User
    Join Date
    Mar 2003
    Posts
    33

    Re: CMdaAudioInputStream

    You should use MediaClientAudioInputStream.lib for input stream.

  6. #6
    Regular Contributor
    Join Date
    Jan 2010
    Posts
    69

    Re: WHY NO ONE REPLIES - CMdaAudioInputStream

    i have the same problems with you! do you solve it? please help me! thanks

  7. #7
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: WHY NO ONE REPLIES - CMdaAudioInputStream

    this seems a linker error and you need to add coorect library into your mmp file as twlai mentioned.
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

Similar Threads

  1. Recording an Audio Input stream using CMdaAudioInputStream
    By rastapasta in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2006-01-30, 23:26
  2. CMdaAudioInputStream & CMdaAudioOutputStream problem
    By vsawant in forum Symbian Media (Closed)
    Replies: 7
    Last Post: 2005-10-03, 18:33
  3. CMdaAudioInputStream on emulator
    By lnetsch in forum Symbian
    Replies: 2
    Last Post: 2005-09-17, 08:17
  4. CMdaAudioInputStream on Emulator
    By lnetsch in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2004-07-09, 22:11
  5. CMdaAudioInputStream v7
    By damien.vil in forum Symbian Tools & SDKs
    Replies: 0
    Last Post: 2004-02-24, 17:57

Posting Permissions

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