how to play amr file

Login to reply to this topic.
Wed, 2005-02-02 08:35
Joined: 2004-12-09
Forum posts: 78
how can I play amr files in an application  where th files are  stored on the disk. does  the CMdaAudioPlayerUtility can play the amr files.

Wed, 2005-02-02 14:18
Joined: 2004-12-09
Forum posts: 78
reply
seems like no one knows how to play AMR  Sad
. the CMdaAudioPlayerUtility doesn't supports amr play back AFAIK.  Roll Eyes
Mon, 2005-02-07 09:05
Joined: 2004-12-09
Forum posts: 78
SOS
Hi all
       I want to know if .amr files can be played like .wav,.midi files . I tried to do it but couldn,t do it with CMdaPlayerUtilty. I guess it doesnot supports the file format. Am I right.
              So how can one play .amr files  the whole mobile world is talking of . As they are quite smaller in size so I think it makes more snse to use them.
         Can anybody help me out. I am stuck with it  
        Anticipating response.
Mon, 2005-02-07 12:58
Joined: 2004-11-08
Forum posts: 22
how to play amr file
Hi,
AMR files can be very well played. CMdaAudioPlayer utility does not recognize the AMR mime type ( don't know the reason ) but you can very well use CMdaAudioRecoder utility apis for playing purpose. In this case you have to use OpenL instead of OpenfileL. In OpenL() you can specify the UIDs of controller and AMR format.
USe as following:
const TUid KMMFExControllerUID = {0x101F5022};
const TUid KMMFExDesFormatUID = {0x101FAF66};

Use the playL() api to play the AMR file when Open has completed sucessfully.

I am expecting you are using Symbian 7.0 and above .

Hope this will help.

-void*
Tue, 2005-02-08 08:26
Joined: 2004-12-09
Forum posts: 78
hi void
hi
I am trying to use the CMdaAudioRecorderUtility class but the OpenL function seems to be confusing .
Can u please send some code explaining the parameters used I am stuck with TMdaClipLocation.
Thanks
Girish sharma
Tue, 2005-02-08 10:07
Joined: 2004-11-08
Forum posts: 22
how to play amr file
Hi,
 You can use the following API from CMdaAudioRecordutility:
-----------
void OpenFileL(const TDesC& aFileName, TUid aRecordControllerUid, TUid aPlaybackControllerUid=KNullUid, TUid aFormatUid=KNullUid, TFourCC aCodec=NULL);
----------
Where Filename is KAMRFileName ( give your file name )

aRecordControllerUid is KMMFExControllerUID  ( ID in previous post )

aPlaybackControllerUid is KMMFExControllerUID  ( ID in previous post )
// Record and playback controller UID are same since Audio controller in one for both Record and playback.

aFormatUid is KMMFExDesFormatUID  ( ID in previous post )

TFourCC aCodec  is KMMFFourCCCodeAMR

Just use KMMFFourCCCodeAMR. It is already defined in MMF ( MmfFourCC.h)
If this is not defined then give
-------------
const TUint32 KMMFFourCCCodeAMR = 0x524d4120;
-----------

Once OpenFileL completes it goes to call back function called MoscoStateChangeEvent. Its a pure virtual function. I guess you might have already implemented this. Handle the states there ( refer sound example).
Play it when Current state is EOpen using Play() API.

Hope it helps.

-void*
Tue, 2005-02-08 13:16
Joined: 2004-12-09
Forum posts: 78
Thanks
thanks 1000 times void*
thanks for your patience . Mission accomplished
bye
Wed, 2005-02-09 23:21
Joined: 2005-02-08
Forum posts: 42
may be this class can record ?
if i want to record a audio to amr format
How can i manage this method
                 MoscoStateChangeEvent

please
Wed, 2005-02-09 23:24
Joined: 2005-02-08
Forum posts: 42
ddd
in sound example i replace openfile line form your comment

//iMdaAudioRecorderUtility->OpenFileL(KRecorderFile);

iMdaAudioRecorderUtility->OpenFileL(KRecorderFile,KMMFExControllerUID,KMMFExControllerUID,KMMFExDesFormatUID,KMMFFourCCCodeAMR);//

but i don't understand   MoscoStateChangeEvent   and i can't find any code for example Huh
Thu, 2005-02-10 05:58
Joined: 2004-12-09
Forum posts: 78
Re: ddd
Quote from: sang_sorn
in sound example i replace openfile line form your comment

//iMdaAudioRecorderUtility->OpenFileL(KRecorderFile);

iMdaAudioRecorderUtility->OpenFileL(KRecorderFile,KMMFExControllerUID,KMMFExControllerUID,KMMFExDesFormatUID,KMMFFourCCCodeAMR);//

but i don't understand   MoscoStateChangeEvent   and i can't find any code for example Huh



see MoscoStateChangeEvent   is a pure virtual  function . So u shul d implement it in your source code . If u want to some event like dynamically changing the  menu at some event of the MdaAudioRecorderUtility. then u shuld give some body to the function but if u dont want it to do any thing u can leave it empty. like this
Code:



void CAudio1Engine::MoscoStateChangeEvent(CBase* aObject, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
   {
     }
Thu, 2005-02-10 06:14
Joined: 2005-02-08
Forum posts: 42
how to play amr file
hello,
it for change the menu?

but in sound example
the menu have been dinamic change in
Quote
void CRecorderAdapter::UpdateMenuL(CEikMenuPane* aMenuPane)
    {
    aMenuPane->SetItemDimmed(ESoundCmdPlay,   ETrue);
    aMenuPane->SetItemDimmed(ESoundCmdRecord, ETrue);
...
    switch (iMdaAudioRecorderUtility->State())
        {
    case CMdaAudioRecorderUtility::ENotReady:
        aMenuPane->SetItemDimmed(ESoundCmdChange, EFalse);
        break;
    case CMdaAudioRecorderUtility::EOpen:
        aMenuPane->SetItemDimmed(ESoundCmdPlay, EFalse);...
   ...  }
    }

i try to change OpenFileL method
and other environment is the same old sound example

it's compile complete but  when i run and select the record it do nothing

how can command to record from app ui
Thu, 2005-03-24 10:27
Joined: 2005-01-22
Forum posts: 112
exception
well i succeeded in playing amr in nokia 6600 but  the same does not work in 6670 pls help.......
Fri, 2005-03-25 06:43
Joined: 2004-12-09
Forum posts: 78
how to play amr file
what is the problem that u  r facing can u specify it.
Sun, 2005-03-27 13:50
Joined: 2005-02-19
Forum posts: 3
AMR on UIQ
Quote from: void*
 You can use the following API from CMdaAudioRecordutility:
-----------
void OpenFileL(const TDesC& aFileName, TUid aRecordControllerUid, TUid aPlaybackControllerUid=KNullUid, TUid aFormatUid=KNullUid, TFourCC aCodec=NULL);
----------
-void*

Could you please explain to me how to play amr on UIQ?
I have in CMdaAudioRecordUtility void OpenL(TMdaClipLocation* aLocation, TMdaClipFormat* aFormat, TMdaPackage* aArg1, TMdaPackage* aArg2) = 0;
 I try to do the following:
in .h define the Amr classes, derived form TMdaClipFormat/TMdaPackage for codec, format and audio settings
Code:
//uids
const TUid KUidMdaClipFormatAmr = {0x101FAF66};
const TUid KUidMdaAmrCodec = {0x101F5022};
const TUid KUidMdaAmrSettings = {0x524d4120};

//format
class TMdaAmrClipFormat : public TMdaClipFormat
{
   public:
       inline TMdaAmrClipFormat();
};

//codec
class TMdaAmrCodec : public TMdaPackage
{
   public:
       inline TMdaAmrCodec(); // Unknown type
   protected:
       inline TMdaAmrCodec(TUid aUid, TInt aDerivedSize);
};

//audio settings
class TMdaAmrSettings : public TMdaPackage
{
   protected:
       inline TMdaAmrSettings(TUid aUid, TInt aDerivedSize);
   public:
       inline TMdaAmrSettings();
};


inline TMdaAmrClipFormat::TMdaAmrClipFormat() :
        TMdaClipFormat (KUidMdaClipFormatAmr, sizeof(TMdaAmrClipFormat)) {}

inline TMdaAmrCodec::TMdaAmrCodec() :
        TMdaPackage(KUidMdaAmrCodec, KNullUid, sizeof(TMdaAmrCodec))  {}

inline TMdaAmrCodec::TMdaAmrCodec(TUid aUid, TInt aDerivedSize) :
        TMdaPackage(KUidMdaAmrCodec, aUid, aDerivedSize) {}

inline TMdaAmrSettings::TMdaAmrSettings(TUid aUid, TInt aDerivedSize) :
        TMdaPackage(KUidMdaAmrSettings, aUid, aDerivedSize) {}

inline TMdaAmrSettings::TMdaAmrSettings() :   TMdaPackage  (KUidMdaAmrSettings, KUidMdaAmrSettings, sizeof(TMdaAmrSettings)) {}

Then in .cpp do the following
Code:
TMdaAmrClipFormat iFormat;
TMdaAmrCodec iCodec;
TMdaFileClipLocation iLocation( aFileName );
TMdaAudioDataSettings iSettings;
iSettings.iSampleRate = TMdaAudioDataSettings::ESampleRate8000Hz;
iSettings.iChannels = TMdaAudioDataSettings::EChannelsMono;
//even if I do TMdaAmrSettings iSettings, it still fails
   iMdaAudioRecorderUtility->OpenL(&iLocation, &iFormat, &iCodec, &iSettings );
OpenL failes.
What is the way-out? How can I play AMR on UIQ 2.1?
Sun, 2005-05-01 16:53
Joined: 2005-04-04
Forum posts: 4
UIQ
2tensor
So - any luck with UIQ? You solved the problem?[/b]
Sat, 2005-07-16 10:18
Joined: 2005-07-16
Forum posts: 127
Re: how to play amr file
 Hi everybody,

I have been trying to solve the problem "how to play amr file".

I used CMdaRecorderUtility class for this purpose. I did the following:

//Constant declarations

_LIT(KAmrFile,"\\system\\apps\\AudioPlayer\\sample.amr");
const TUid KMMFExControllerUID = {0x101F5022};
const TUid KMMFExDesFormatUID = {0x101FAF66};
const TUint32 KMMFFourCCCodeAMR = 0x524d4120;

void OpenAmrFile()
{
if(iMdaAudioRecorderUtility->State()==iMdaAudioRecorderUtility->ENotReady)
{
    iMdaAudioRecorderUtility->OpenFileL(KAmrFile,KMMFExControllerUID,                  KMMFExControllerUID,KMMFExDesFormatUID,KMMFFourCCCodeAMR);
}
}

//It does not get the EOpen state, so state is not opened here which should be opened.
void CAudioPlayerEngine::MoscoStateChangeEvent(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode)
{
//So I can not use any checking condition
PlayL();
}

void PlayL()
{
    // 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(TTimeIntervalMicroSeconds(0));
    //

    iMdaAudioRecorderUtility->PlayL();
}

//** I get error message "Feature not supported" for PlayL()
iMdaAudioRecorderUtility->PlayL();

I would really appreciate, if anybody comments on this.

  • Login to reply to this topic.