currently i’m trying to implement a small audio player with fmod ex, which should also be able to play web radio streams (shoutcasts).
i tried to play some random pls-files, which are played by other players without problems (mainly, i am using qcd player (quinnware.com)).
these are some:
none of them were played by fmod ex without downloading and parsing them myself (then of course passing the contained urls to fmod ex).
but when i did it like this, most of them weren’t a problem anymore …
but what should i do with files like http://listen.to.techno4ever.net/dsl/mp3, where you get a pls-file if you send a http-request (at least i guess so), which only contains the same url again to be played by an audio player which probably sends a different request?
this is my code to play it (working well for various files and streams, on my hard disk and on web servers):
(sorry if it’s a bit messed up, actually i have it all in a class, but that’s too much irrelevant stuff to post here …)
unsigned int m_bufferSize = 65536; // at least for shoutcasts
// m_info: struct containing some infos, such as the url to be played :-)
FMOD_RESULT res = FMOD::System_Create( &m_system );
if( !check( res ) ) // check for it to be correct, set error string and stuff ...
res = m_system->init( 10, FMOD_INIT_NORMAL, NULL );
if( !check( res ) )
res = m_system->setStreamBufferSize( m_bufferSize, FMOD_TIMEUNIT_RAWBYTES );
if( !check( res ) )
if( m_info.url.empty() )
res = m_system->createStream( m_info.url.c_str(), FMOD_DEFAULT, NULL, &m_sound );
if( !check( res ) )
m_system->playSound( FMOD_CHANNEL_FREE, m_sound, false, &m_channel );[/code:2rd11jb2]
as you probably noticed, i took the main idea from the net streamer example.
so, is there a way to play these (or better: to play all :)) pls-files/shoutcasts with fmod ex directly?
thanks in advance!
- -=Freaky=- asked 9 years ago
alright, thanks for the reply.
i hope there’s going to be a new release out soon.
btw. i’m currently using the stable version of fmod ex, but i guess from your answer that there are the same issues with the development-version?
The reason your playlists are not working is because you can’t simply call System::playSound() on a playlist. You need to use Sound::getTag() to extract the information from the playlist. If you take a look at the playlist example you can see how to use these tags.
I also checked up on that particular stream you were having problems with. It would appear the server doesn’t like the identification we are using so I have added a fallback, it should work fine in our next release (this week).
oh damn … i’m really sorry for not seeing the playlist-example!
that made it clear.
i’ll try it the next days.
and of course thanks for the fix to make fmod ex support the stream i had troubles with!
i’m exitedly awaiting your next release! 😉
ps: sorry if my post sounds somewhat strange since i’m really tired and english isn’t my native language …
sorry but i’ve been pretty busy during the last few weeks …
thanks mathew, i’m glad you understand me.
i just reimplemented the stuff i had written so far in the last week and it works like a charm for all the radio streams i have listed above and some more i tested today.
(now using getFormat to determine if it’s a playlist and getTag for the content … :)).
thanks a lot for that!!
now i have another problem with local playlists:
when i try playing a playlist from my hard disk, this line always crashes:
[code:3q3otwdt]// m_playlist: FMOD::Sound*
// m_system: FMOD::System*
// m_url: std::string containing the file to be played
FMOD_RESULT res = m_system->createSound( m_url.c_str(), FMOD_HARDWARE | FMOD_2D | FMOD_CREATESTREAM, 0, &m_playlist );[/code:3q3otwdt]
and i don’t really know why or what to do about it …
when m_url is for example "http://www.defjay.de/listen.pls", there’s no problem at all.
it also works just fine when m_url is a local music file like "C:\someSong.mp3".
but when it’s a playlist like "C:\somePlaylist.pls" (tried pls and m3u), it crashes …
… sorry for posting this problem here, if it’s not an obvious mistake i made i’m going to open another thread for this one.
sorry i had some stupid mistakes in my code.
but i still have a problem with certain m3u-files. the one that comes with the fmod ex examples (media/playlist.m3u) works fine.
but i have some simple ones generated by qcd player, looking like this:
NaS\Untitled\09_N.I.G.G.E.R. (The Slave And The Master).mp3
NaS\Untitled\13_Y’All My Niggas.mp3
NaS\Untitled\14_We’re Not Alone.mp3
NaS\Untitled\01_Queens Get The Money.mp3
NaS\Untitled\02_You Can’t Stop Us Now.mp3
NaS\Untitled\04_Make The World Go Round.mp3
these are still causing my application to crash when calling createSound as i explained above.
That m3u file is marked at the top as an extended m3u, yet there is no extended information fields, check against the FMOD example playlist to see what I mean. There should be info for each file in the playlist.
If you simply remove the tag at the top "#EXTM3U" it will load as a simple M3U file, basically a list of file paths.
Please login first to submit.