how to play audio file? | developer.brewmp.com how to play audio file? | developer.brewmp.com

Developer

how to play audio file?

Forums:

hi!

I'm using the interface of ISoundPlayer to play audio files, but somehing must be wrong while i'm trying to load them.

in my initialization method, some of my codes look like this:
//pInfo is an AEESoundPlayerInfo member varialbe of my applet
pMe->pInfo.eInput=SDT_FILE;
pMe->pInfo.pData="test.mp3";
pMe->pInfo.dwSize=0;

ISOUNDPLAYER_SetInfo(pMe->m_pISoundPlayer, &pMe->pInfo);

the problem is, the ISOUNDPLAYER_SetInfo always returns an EBADPARM value.

I think i must have made somthing wrong with the settings of pInfo, can you help me out?

thanx!

--freemind

Hi,
you may use different technique to play the sound files. Below code snippet will work fine in Emulator.
Quote:
ISOUNDPLAYER_Set(pMe->m_pISoundPlayer,SDT_FILE,"test.mp3");
ISOUNDPLAYER_Play(pMe->m_pISoundPlayer);
Hope it helps.
Regards,
Ali Naqvi

Hi,
you may use different technique to play the sound files. Below code snippet will work fine in Emulator.
Quote:
ISOUNDPLAYER_Set(pMe->m_pISoundPlayer,SDT_FILE,"test.mp3");
ISOUNDPLAYER_Play(pMe->m_pISoundPlayer);
Hope it helps.
Regards,
Ali Naqvi

Sorry, Ali Naqvi.
It simply doen's work :( .
Do you have some other good idea?
The SDK i'm using is version 2.1.0 and the API reference recommand not using the ISOUNDPLAYER_Set.
Thanx for your reply! :)

Sorry, Ali Naqvi.
It simply doen's work :( .
Do you have some other good idea?
The SDK i'm using is version 2.1.0 and the API reference recommand not using the ISOUNDPLAYER_Set.
Thanx for your reply! :)

Try using IMEDIA interface. Usage of IMedia interface is very straight forward.
Are you trying this on emulator or device?
ruben

Try using IMEDIA interface. Usage of IMedia interface is very straight forward.
Are you trying this on emulator or device?
ruben

ruben, I'm using emulator. And I'm trying to use the IMedia interface, can you give me some hint? ;)

ruben, I'm using emulator. And I'm trying to use the IMedia interface, can you give me some hint? ;)

Refer MediaPlayer example in SDK.
ruben

Refer MediaPlayer example in SDK.
ruben

It's too hard for me to understand the MediaPlayer example at the moment. :(
I just don't know why the return value is EBADPARM, which means the function encounters a bad parameter, according to the API ref.
i have changed the code in my init_app method to:
pMe->m_pInfo=MALLOCREC(AEESoundPlayerInfo);
pMe->m_pInfo->eInput=SDT_FILE;
STRCPY(szFilename, "test.mp3");
pMe->m_pInfo->pData=(void*)szFilename;
pMe->m_pInfo->dwSize=0;
and it still doesn't work:(
when i call ISOUNDPLAYER_SetInfo, it just returns EBADPARAM!!!
can you help me out?
Thanks a lot!!!!

It's too hard for me to understand the MediaPlayer example at the moment. :(
I just don't know why the return value is EBADPARM, which means the function encounters a bad parameter, according to the API ref.
i have changed the code in my init_app method to:
pMe->m_pInfo=MALLOCREC(AEESoundPlayerInfo);
pMe->m_pInfo->eInput=SDT_FILE;
STRCPY(szFilename, "test.mp3");
pMe->m_pInfo->pData=(void*)szFilename;
pMe->m_pInfo->dwSize=0;
and it still doesn't work:(
when i call ISOUNDPLAYER_SetInfo, it just returns EBADPARAM!!!
can you help me out?
Thanks a lot!!!!

Quote:Originally posted by freemind
STRCPY(szFilename, "test.mp3");
pMe->m_pInfo->pData=(void*)szFilename;
pMe->m_pInfo->dwSize=0;
I'm setting pData to the start of the binary file (offset for MIME string at the beginning if you need to) (not the file name string). Also, dwSize cannot be 0, it should be the size of your binary file.
-hth

Quote:Originally posted by freemind
STRCPY(szFilename, "test.mp3");
pMe->m_pInfo->pData=(void*)szFilename;
pMe->m_pInfo->dwSize=0;
I'm setting pData to the start of the binary file (offset for MIME string at the beginning if you need to) (not the file name string). Also, dwSize cannot be 0, it should be the size of your binary file.
-hth

Quote:Originally posted by ThePhoneWiz
I'm setting pData to the start of the binary file (offset for MIME string at the beginning if you need to) ([b]not the file name string). Also, dwSize cannot be 0, it should be the size of your binary file.
-hth [/B]
It still doesn't work :(
according to the ref,
pData Pointer to the file name or buffer based on the input type.
dwSize Size of the data in the buffer. Valid only for buffer input type.
i tried your way, ThePhoneWiz, but it still retruns EBADPARM. and I'm not sure how to get the beginning of the file.
I used the IFILEMGR to open a file, getting an IFILE pointer as the return value, is that what pData be pointed to?

Quote:Originally posted by ThePhoneWiz
I'm setting pData to the start of the binary file (offset for MIME string at the beginning if you need to) ([b]not the file name string). Also, dwSize cannot be 0, it should be the size of your binary file.
-hth [/B]
It still doesn't work :(
according to the ref,
pData Pointer to the file name or buffer based on the input type.
dwSize Size of the data in the buffer. Valid only for buffer input type.
i tried your way, ThePhoneWiz, but it still retruns EBADPARM. and I'm not sure how to get the beginning of the file.
I used the IFILEMGR to open a file, getting an IFILE pointer as the return value, is that what pData be pointed to?

You are right, dwSize should be 0 if you're passing the file name.
Try IFILE_Read() to read content of your file to a buffer, and then point to that buffer (agian, offset for a MIME type string if necessary). In that case you need to set size of the binary file. Try with some MIDI file as well, to see if it works. Make sure that file exists (and it can be opened).
2nd: download brew sdk v1.1 and use examples from Examples\isoundplayer\isoundplayer.c or Examples\Midi\MIDIPlayer.c, that should be quite straight forward.
hth

You are right, dwSize should be 0 if you're passing the file name.
Try IFILE_Read() to read content of your file to a buffer, and then point to that buffer (agian, offset for a MIME type string if necessary). In that case you need to set size of the binary file. Try with some MIDI file as well, to see if it works. Make sure that file exists (and it can be opened).
2nd: download brew sdk v1.1 and use examples from Examples\isoundplayer\isoundplayer.c or Examples\Midi\MIDIPlayer.c, that should be quite straight forward.
hth

It's finally got to work! THanx your buddy!
Thanx!

It's finally got to work! THanx your buddy!
Thanx!