The International Simutrans Forum

Development => Extension Requests => Topic started by: juhis on August 26, 2008, 09:11:20 AM

Title: Support of OGG music format
Post by: juhis on August 26, 2008, 09:11:20 AM
I was just wondering, is there going to be OGG format in the next version of Simutrans?

I know that Midi musics are supported, but there should be other music formats, so is this okay?
Title: Re: Support of OGG music format
Post by: prissi on August 26, 2008, 10:08:32 AM
No, because this cannot be done in a useful portable way on many platforms.
Title: Re: Support of OGG music format
Post by: Nathan Samson on August 26, 2008, 12:27:37 PM
Can't we have a music-$os.c file with the same functions for each os? (I thought that it was done already this way).

It is then to the music-os.c file to decide what files it could play, and how.

Or maybe a general music.c file that have different loaders (.midi, .ogg, .mp3, ...) and depending on the build options are compiled or not.
Title: Re: Support of OGG music format
Post by: prissi on August 26, 2008, 02:35:14 PM
I would suggest using Itunes/Winamp/whatever parallel to simutrans instead. Something to do for the doozing second core of todays machines ...
Title: Re: Support of OGG music format
Post by: Nathan Samson on August 26, 2008, 02:45:24 PM
Quote from: prissi on August 26, 2008, 02:35:14 PM
I would suggest using Itunes/Winamp/whatever parallel to simutrans instead. Something to do for the doozing second core of todays machines ...

I can agree with that, but since simutrans has opened the sound card, other programs (like banshee (gstreamer)) cant play sound anymore :(
I guess I could fix that with running simutrans with -nomidi, but then a better option would be to fix simutrans itsels (so it don't block other programs, even when no sound/music is playing in simutrans)

Btw I'm using 100.0 from ubuntu repositories, but I had same problems with self compiled simutrans
Title: Re: Support of OGG music format
Post by: juhis on August 26, 2008, 05:22:50 PM
Quote from: prissi on August 26, 2008, 02:35:14 PM
I would suggest using Itunes/Winamp/whatever parallel to simutrans instead. Something to do for the doozing second core of todays machines ...
Then sorry, If I requested that feature, but midi musics are kind of small, but they are not too good comparable to Mp3 format.
Title: Re: Support of OGG music format
Post by: kierongreen on August 27, 2008, 09:29:56 AM
Hint - other music formats are already supported through SDL Mixer (there is some problems with frequency though...) - try it!
Title: Re: Support of OGG music format
Post by: Raven on August 27, 2008, 09:35:24 AM
I've always thought that .mid format suits perfectly an old school game such as simutrans.
Title: Re: Support of OGG music format
Post by: kierongreen on August 27, 2008, 09:37:21 AM
This is true - the current music really wouldn't be that much better as mp3s in my opinion, sounds good the way it is...
Title: Re: Support of OGG music format
Post by: GreaseMonkey on September 11, 2008, 05:13:14 AM
I'm sorry this is a fairly old topic, but this *IS* possible if you use SDL_mixer and you have the right libs and you've compiled it right or something like that.

A few problems though:
1. I believe that this behaviour was not intended.
2. You have to somehow encode it at 22500Hz (yes, there was a typo in the source, so it's not 22050Hz, but that may change), as it will only play at that frequency. Your standard 44100Hz OGG will play at roughly half the intended speed.
3. The song doesn't change when it stops AFAIK - this issue happens with WAV files as well as MOD files.

Seeing as most OSes can use SDL + SDL_mixer, it should still be fairly portable if the issues are fixed, but this would only be available with an SDL binary/build. But it shouldn't be too much work, just a bit of dabbling here and there and we may have support via SDL_mixer.

Actually, I might give this a shot myself. I <3 open source software...

EDIT: Issue #3 did not happen when I tested it with an OGG. It does happen with WAVs and MODs though.
Title: Re: Support of OGG music format
Post by: prissi on September 11, 2008, 08:35:18 AM
Well SDL is not used on Windows with Unicode support for entring (i.e. all Asian languages) and also not working SDL_mixer for BeOS (at least nothing that works on my BeOS installation). Thus all OS might be a little too general ...

Moreover, SDL_mixer is really a pain with its bugs.
Title: Re: Support of OGG music format
Post by: marioxcc on December 03, 2008, 01:07:17 AM
Ogg is a open format.
As far as i know, midi is a propietary format.
1+ for ogg.
EDIT: Changed the translation of "Hasta donde yo sé" from "Unit i know" to "As far as i know", tanks to vilvoh.
Title: Re: Support of OGG music format
Post by: prissi on December 03, 2008, 11:08:00 PM
Midi is a general standard since 1983 (refined 1991), which is much more open than any non-standard open file format. Just use OGG on linux, is works anyway.
Title: Re: Support of OGG music format
Post by: marioxcc on December 03, 2008, 11:36:12 PM
Quote from: prissi on December 03, 2008, 11:08:00 PM
is much more open than any non-standard open file format
Well, if you say it, i trust.