RPGDXThe center of Indie-RPG gaming
Not logged in. [log in] [register]
 
 
Post new topic Reply to topic  
View previous topic - View next topic  
Author Message
syn9
Wandering Minstrel


Joined: 31 Aug 2002
Posts: 120
Location: USA

PostPosted: Sat Jan 31, 2004 7:19 am    Post subject: anyone know how to....? [quote]

add mp3s into a game in c? im currently using uncompressed wavs... and i'd rather not require people to download 120 megs to play my game >)

thanks

we're still on for a sunday night release
Back to top  
janus
Mage


Joined: 29 Jun 2002
Posts: 464
Location: Issaquah, WA

PostPosted: Sat Jan 31, 2004 8:50 am    Post subject: [quote]

Well, how are you playing your audio?
DirectSound?
Allegro?
SDL?
Any audio library worth its salt will already have support for some sort of compressed audio format (even though MP3 sucks because it has royalties)
Back to top  
LeoDraco
Demon Hunter


Joined: 24 Jun 2003
Posts: 584
Location: Riverside, South Cali

PostPosted: Sat Jan 31, 2004 12:51 pm    Post subject: [quote]

Janus wrote:
Well, how are you playing your audio?
DirectSound?
Allegro?
SDL?
Any audio library worth its salt will already have support for some sort of compressed audio format (even though MP3 sucks because it has royalties)


If you read up on the royalties, you'll see that they really are not an issue; for independant developers, you can throw a mp3 decoder in your source an more than likely not have to pay anything. (Your product must not be disseminated more than 5000 times.) The nice thing about mp3 is that practically all users have them; therefore you could add support for user-mp3s (like the Sims games or the GTAs), without requiring the user to have to convert his files.

mp3 decoders are not terribly difficult to find; just google it.
_________________
"...LeoDraco is a pompus git..." -- Mandrake
Back to top  
syn9
Wandering Minstrel


Joined: 31 Aug 2002
Posts: 120
Location: USA

PostPosted: Sat Jan 31, 2004 5:46 pm    Post subject: [quote]

i'm currently using allegro
Back to top  
janus
Mage


Joined: 29 Jun 2002
Posts: 464
Location: Issaquah, WA

PostPosted: Sat Jan 31, 2004 6:04 pm    Post subject: [quote]

syn9 wrote:
i'm currently using allegro

DOS, Win32, Mac, or Linux? (I'm pretty sure MP3 doesn't work very well in DOS)

Anyway, check these links:
http://www.allegro.cc/resource/resource-view.php?id=1&request=1075572472&
http://www.allegro.cc/resource/resource-view.php?id=62&request=1075572472& (for OGGs, but same difference eh?)

Also, FMod should work fine from inside allegro if you're on Win32, Linux, or OS X.
You could also try Audiere.
Back to top  
grenideer
Wandering Minstrel


Joined: 28 May 2002
Posts: 149

PostPosted: Sat Jan 31, 2004 11:10 pm    Post subject: [quote]

The easiest way to incorporate streaming mp3s is probably DirectShow. I've seen Ogg Vorbis done in OpenAL, but I have no idea how well it would work with DirectX (and I don't know jack about OpenAL). Ogg Vorbis is comparable to the mp3 format and is completely free of royalties.
_________________
Diver Down
Back to top  
ThousandKnives
Wandering Minstrel


Joined: 17 May 2003
Posts: 147
Location: Boston

PostPosted: Sun Feb 01, 2004 4:02 am    Post subject: [quote]

This topic was delt with in this thread quite extensively.

My conclusion after researching MP3 play quite extensively was to go with OGG files instead. They are every bit as small and the libraries are much much easier to work with. You can make OGG files from MP3 or WAV files by downloading OGGDrop for free. In fact, its all open-source GPL stuff. Yay.

Edit: grenidier wasn't sure about Direct X compatibility: I can assure you OGG Vorbis plays quite nicely with DirectSound. I implemented the whole thing in a few hours. not sure the relevance since you said you are developing with Ah! Allegra allergy-relief though. Oh well.
Back to top  
Bjorn
Demon Hunter


Joined: 29 May 2002
Posts: 1425
Location: Germany

PostPosted: Mon Feb 02, 2004 2:17 am    Post subject: [quote]

The engine we used for the Blues Brothers RPG is done in Allegro and can play OGGs using alogg. We chose that one as it was working fine with both MinGW and gcc in Linux. Basically how you use it it:

Code:
// Start streaming music
struct alogg_stream *stream = alogg_start_streaming(filename, BLOCK_SIZE);

// Get Allegro audio stream structure
AUDIOSTREAM *allegro_stream = alogg_get_audio_stream(stream);

// Set volume using Allegro function
voice_set_volume(allegro_stream->voice, music_volume);

...

// Keep polling (we do 10 times a sec)
int ret = alogg_update_streaming(stream);
if (ret == 0) {
    // Stream ended, you could restart it here
}

I think it has near minimum integration costs. You can also use multiple streams to fade to a different song for example. Our engine is on SourceForge so you can look at our code (a bit of a mess though, that's why I provided example above :-)).

I think for compiling in Windows, we downloaded a binary distribution of the Vorbis and OGG libraries because we had problems compiling those with MinGW.

Also, most Linux distro's will include the oggenc tool with which you can just "oggenc file.wav" to create an ogg.
Back to top  
syn9
Wandering Minstrel


Joined: 31 Aug 2002
Posts: 120
Location: USA

PostPosted: Mon Feb 02, 2004 6:33 am    Post subject: [quote]

cool, thanks, i think ogg will be the way we need to go, as long as i can finish this damn thing within the next 12 hours, heh
Back to top  
Post new topic Reply to topic Page 1 of 1 All times are GMT
 



Display posts from previous:   
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum