Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hey Everyone,
Has anyone had problems with ringtones in v262?

I am trying to preview a ring tone in Motorola v262 and neither ".qcp" nor "mp3"s work. If I save a ".mp3" file, I can then listen to it on the phone and set it to the ringer, but can not listen to it while the app is runing.

Any help or suggestions are greatly appreciated,
Ali

According to the DDS, only MIDI ringtones are supported.
What API are you using to preview the ringtone?

According to the DDS, only MIDI ringtones are supported.
What API are you using to preview the ringtone?

Hey Nathan,
According to the DDS for this phone it should play ".qcp" files.
QCELP -Play Yes
QCELP -Record Yes
And as for the API that I am using:
I try to play a tone that is loaded on the phone using: IMEDIA_Play() and it still does not play it even though as I mentioned above QCELPs should play.
Thanks,
Ali

Hey Nathan,
According to the DDS for this phone it should play ".qcp" files.
QCELP -Play Yes
QCELP -Record Yes
And as for the API that I am using:
I try to play a tone that is loaded on the phone using: IMEDIA_Play() and it still does not play it even though as I mentioned above QCELPs should play.
Thanks,
Ali

You are correct that the device should support QCP audio playback, but only MIDI is officially supported as a ringtone.
As for playing QCP through IMedia, could you elaborate on how you are using this API? Do you make sure to use AEECLSID_MEDIAQCP? Are you playing from a file or buffer?

You are correct that the device should support QCP audio playback, but only MIDI is officially supported as a ringtone.
As for playing QCP through IMedia, could you elaborate on how you are using this API? Do you make sure to use AEECLSID_MEDIAQCP? Are you playing from a file or buffer?

Nathan,
For the example that I was talking about I am just trying to play a file that I load on the phone via cable so it can be played when a user runs my application. I think whatever is preventing this from working is also preventing my ringtone previews from working as well.
Thanks for the quick reply,
Ali

Nathan,
For the example that I was talking about I am just trying to play a file that I load on the phone via cable so it can be played when a user runs my application. I think whatever is preventing this from working is also preventing my ringtone previews from working as well.
Thanks for the quick reply,
Ali

Hi Ali,
I understand that, but in order to help figure out why you are having this problem, I need you to answer my questions above.
Thanks.

Hi Ali,
I understand that, but in order to help figure out why you are having this problem, I need you to answer my questions above.
Thanks.

Nathan,
I am really sorry. I am new to Brew programming so I might not have understood the questions too well.
I looked in my code and realized that AEECLSID_MEDIA was being used so for a test I changed them to AEECLSID_MEDIAQCP and that still did not work. Actually that made the Emulator not to play that sound as well.
As for how I am playing the tone, it is from a file. I give it the file's name and I thought it should play it. This same exact code has been tried on about 6 other handsets and none of them have this problem.
again sorry for not answering your question the first time,
Ali

Nathan,
I am really sorry. I am new to Brew programming so I might not have understood the questions too well.
I looked in my code and realized that AEECLSID_MEDIA was being used so for a test I changed them to AEECLSID_MEDIAQCP and that still did not work. Actually that made the Emulator not to play that sound as well.
As for how I am playing the tone, it is from a file. I give it the file's name and I thought it should play it. This same exact code has been tried on about 6 other handsets and none of them have this problem.
again sorry for not answering your question the first time,
Ali

Hi Ali,
Don't worry about it, everyone is new to BREW at some point. The key is just to make sure you do your research and provide as much information as possible when asking questions on these forums. That way you'll get a much faster response and the information will be out there for future new BREW programmers to see.
If the sound is not playing in the emulator, there is most likely something wrong with your code. Here are the steps I use to play a QCP file in my test application:
1. Create the IMedia interface by calling ISHELL_CreateInstance() with AEECLSID_MEDIAQCP.
2. Register a notification function using IMEDIA_RegisterNotify(). For testing, you should log the status and command notifications you get.
3. Specifiy the media data as follows:
mediaData.clsData = MMD_FILE_NAME;
mediaData.pData = "test.qcp";
mediaData.dwSize = 0;
IMEDIA_SetMediaData(...);
4. Play the file using IMEDIA_Play().
This has worked on pretty much every device and version of the emulator that I have tried it on. Let me know what steps you go through if its still not working for you.

Hi Ali,
Don't worry about it, everyone is new to BREW at some point. The key is just to make sure you do your research and provide as much information as possible when asking questions on these forums. That way you'll get a much faster response and the information will be out there for future new BREW programmers to see.
If the sound is not playing in the emulator, there is most likely something wrong with your code. Here are the steps I use to play a QCP file in my test application:
1. Create the IMedia interface by calling ISHELL_CreateInstance() with AEECLSID_MEDIAQCP.
2. Register a notification function using IMEDIA_RegisterNotify(). For testing, you should log the status and command notifications you get.
3. Specifiy the media data as follows:
mediaData.clsData = MMD_FILE_NAME;
mediaData.pData = "test.qcp";
mediaData.dwSize = 0;
IMEDIA_SetMediaData(...);
4. Play the file using IMEDIA_Play().
This has worked on pretty much every device and version of the emulator that I have tried it on. Let me know what steps you go through if its still not working for you.

Nathan,
Isn't AEECLSID_MEDIAQCP set in the AEEMediaUtil.c? And AEEMediaUtil.c is one of the files that is provided for us? We don't actually write that file.
Other than that my code does what you have suggested except for the fact that AEECLSID_MEDIA is used istead of AEECLSID_MEDIAQCP. However, when that is the case the Emulator plays both ".mp3"s and ".qcp"s.
Again I might be missing something here but I don't get why on the emulator AEECLSID_MEDIA works for both ".mp3" and ".gcp" if AEECLSID_MEDIAQCP is needed to play ".qcp" files?
Also, even though I can not preview a ".mp3" on the V262, if I save the file and then go through the UI and play it plays but I recently noticed that the phone saves it as a ".mid" file, which is strange in itself.
Could it be that this phone just can't play ".qcp"s or ".mp3"s in Brew?
Thanks a lot for all of your suggestions and if you or anyone else has any more suggestion they are greatly appreciate.
Ali

Nathan,
Isn't AEECLSID_MEDIAQCP set in the AEEMediaUtil.c? And AEEMediaUtil.c is one of the files that is provided for us? We don't actually write that file.
Other than that my code does what you have suggested except for the fact that AEECLSID_MEDIA is used istead of AEECLSID_MEDIAQCP. However, when that is the case the Emulator plays both ".mp3"s and ".qcp"s.
Again I might be missing something here but I don't get why on the emulator AEECLSID_MEDIA works for both ".mp3" and ".gcp" if AEECLSID_MEDIAQCP is needed to play ".qcp" files?
Also, even though I can not preview a ".mp3" on the V262, if I save the file and then go through the UI and play it plays but I recently noticed that the phone saves it as a ".mid" file, which is strange in itself.
Could it be that this phone just can't play ".qcp"s or ".mp3"s in Brew?
Thanks a lot for all of your suggestions and if you or anyone else has any more suggestion they are greatly appreciate.
Ali

First of all, you should never be directly creating an instance of AEECLSID_MEDIA. This is an abstract base class. You should always either create an instance of the specific media type directly (MEDIAMIDI, MEDIAQCP, etc.) or use AEEMediaUtil_CreateMedia().
The discrepancy you are seeing between what is playable in BREW and the native UI is partly due to differences in the way the APIs handle the media. Some APIs only use the file extension to determine the media type. Others will read the file header and ignore the extension. So in BREW for example, the OEM may have decided not to support MP3 playback. Even though the MP3 decoder may exist on the device, because the .mp3 file extension is not supported in BREW, the file will not play. The native UI, on the other hand, is probably inspecting the file header in order to determine what decoder to use, in which case you are more or less tricking the device into playing MP3.
Could you post the code you are using to create the IMedia instance and set it in the ready state?

First of all, you should never be directly creating an instance of AEECLSID_MEDIA. This is an abstract base class. You should always either create an instance of the specific media type directly (MEDIAMIDI, MEDIAQCP, etc.) or use AEEMediaUtil_CreateMedia().
The discrepancy you are seeing between what is playable in BREW and the native UI is partly due to differences in the way the APIs handle the media. Some APIs only use the file extension to determine the media type. Others will read the file header and ignore the extension. So in BREW for example, the OEM may have decided not to support MP3 playback. Even though the MP3 decoder may exist on the device, because the .mp3 file extension is not supported in BREW, the file will not play. The native UI, on the other hand, is probably inspecting the file header in order to determine what decoder to use, in which case you are more or less tricking the device into playing MP3.
Could you post the code you are using to create the IMedia instance and set it in the ready state?

Hey Nathan,
Here is exactly what I do to play the tone that I call intro.qcp.
p->mData.clsData = MMD_FILE_NAME;
p->mData.pData = p->mediaFileName; //mediaFileName being the "intro.qcp" file
p->mData.dwSize = 0;
.
.
.
rv = AEEMediaUtil_CreateMedia(pme->a.m_pIShell, &p->mData, (IMedia**)&p->pImedia); //rv being an int AND this function takes care of the ISHELL_CreateInstance, which uses AEECLSID_MEDIA and not AEECLSID_MEDIAQCP, and uses IMEDIA_SetMediaData()
.
.
.
IMEDIA_SetRect(p->pImedia, p->rect, p->rect);
rv = IMEDIA_RegisterNotify(p->pImedia, (PFNMEDIANOTIFY)pCB, pme);
rv = IMEDIA_Play(p->pImedia);
Thanks,
Ali

Hey Nathan,
Here is exactly what I do to play the tone that I call intro.qcp.
p->mData.clsData = MMD_FILE_NAME;
p->mData.pData = p->mediaFileName; //mediaFileName being the "intro.qcp" file
p->mData.dwSize = 0;
.
.
.
rv = AEEMediaUtil_CreateMedia(pme->a.m_pIShell, &p->mData, (IMedia**)&p->pImedia); //rv being an int AND this function takes care of the ISHELL_CreateInstance, which uses AEECLSID_MEDIA and not AEECLSID_MEDIAQCP, and uses IMEDIA_SetMediaData()
.
.
.
IMEDIA_SetRect(p->pImedia, p->rect, p->rect);
rv = IMEDIA_RegisterNotify(p->pImedia, (PFNMEDIANOTIFY)pCB, pme);
rv = IMEDIA_Play(p->pImedia);
Thanks,
Ali

I compiled my app using pretty much the same code, and everything ran smoothly.
Note that AEEMediaUtil_CreateMedia() does NOT create an instance of AEECLSID_MEDIA. It uses ISHELL_GetHandler() to obtain the classid it needs, and AEECLSID is specified as the base class to start from. You should not need to modify this code.
In what way does the media fail? Is there simply no sound played, or does AEEMediaUtil_CreateMedia() fail to create the interface?

I compiled my app using pretty much the same code, and everything ran smoothly.
Note that AEEMediaUtil_CreateMedia() does NOT create an instance of AEECLSID_MEDIA. It uses ISHELL_GetHandler() to obtain the classid it needs, and AEECLSID is specified as the base class to start from. You should not need to modify this code.
In what way does the media fail? Is there simply no sound played, or does AEEMediaUtil_CreateMedia() fail to create the interface?

Nathan,
The phone just doesn't play any sounds, but the emulator does. Also, since the same code works on few other phones, I am thinking that this is a phone issue.
But it is strange that you can play ".qcp" files on the phone. Can you also save a ".qcp" file and play/set it as a ringtone?
Thanks,
Ali

Nathan,
The phone just doesn't play any sounds, but the emulator does. Also, since the same code works on few other phones, I am thinking that this is a phone issue.
But it is strange that you can play ".qcp" files on the phone. Can you also save a ".qcp" file and play/set it as a ringtone?
Thanks,
Ali

I was able to get ".qcp"s to play in the V262 but for some reason they only play in the earpiece. I have even tried using the IMEDIA_SetAudioPath(pMe->pImedia, MM_APATH_LOCAL, 0); as well as MM_APATH_LOCAL_RINGER but it still only plays in the earpiece.
Does anyone have any idea as to why this is?
Thank you in advance,
Ali

I was able to get ".qcp"s to play in the V262 but for some reason they only play in the earpiece. I have even tried using the IMEDIA_SetAudioPath(pMe->pImedia, MM_APATH_LOCAL, 0); as well as MM_APATH_LOCAL_RINGER but it still only plays in the earpiece.
Does anyone have any idea as to why this is?
Thank you in advance,
Ali

For anyone who was wondering, if I play ".MP3" files the phone plays it and it actually uses the correct speaker.
Ali

For anyone who was wondering, if I play ".MP3" files the phone plays it and it actually uses the correct speaker.
Ali