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.
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 .
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
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.
but i don't understand MoscoStateChangeEvent and i can't find any code for example
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
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
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.
Forum posts: 78
. the CMdaAudioPlayerUtility doesn't supports amr play back AFAIK.
Forum posts: 78
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.
Forum posts: 22
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*
Forum posts: 78
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
Forum posts: 22
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*
Forum posts: 78
thanks for your patience . Mission accomplished
bye
Forum posts: 42
How can i manage this method
MoscoStateChangeEvent
please
Forum posts: 42
//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
Forum posts: 78
//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
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
void CAudio1Engine::MoscoStateChangeEvent(CBase* aObject, TInt /*aPreviousState*/, TInt aCurrentState, TInt aErrorCode)
{
}
Forum posts: 42
it for change the menu?
but in sound example
the menu have been dinamic change in
{
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
Forum posts: 112
Forum posts: 78
Forum posts: 3
-----------
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
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
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 );
What is the way-out? How can I play AMR on UIQ 2.1?
Forum posts: 4
So - any luck with UIQ? You solved the problem?[/b]
Forum posts: 127
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.