Ferrous Moon
http://www.ferrousmoon.com:80/forums/

Uplink - Sound Modification
http://www.ferrousmoon.com:80/forums/viewtopic.php?f=45&t=2881
Page 1 of 2

Author:  someguy [Thu Oct 17, 2013 9:11 pm ]
Post subject:  Uplink - Sound Modification

EDIT: I figured out how to play mp3, ogg, aif, wav, it, xm, mod, s3m etc etc. Essentially all music types including various playlist types like m3u using FMOD


So, i could not figure out how to use other music formats other than mod, s3m, it or xm tracks.

I figured I would enhance the music system anyway. I decided to add 3 buttons and text spot to the HUD next to the speed buttons.

The text spot lists the current track name being played. The 3 buttons (technically 4) are Previous Track, Must/Unmute) and Next Track.

In order to make this more effective I found an awesome website which sports mod type music made by other people, when avoiding the techno type music you end up running into some decent Uplink type tracks and I was able to enhance my tracklist to 23 tracks at over 2 hours of music play.

The tracks sound pretty legit and fit Uplink to a tee.

Here is one of the functions for selecting a previous track in the playlist. This is a soundgarden modification.
Code:
void SgPlaylist_PrevSong () { SgPlaylist *playlist = SgPlaylist_GetPlaylist(currentplaylist); if ( playlist ) { if ( songindex < 1 ){ // songindex 0 = track 1 songindex = 22; }else{ --songindex; } char *songtitle = playlist->songs.GetData(songindex); SgPlayMod ( RsArchiveFileOpen ( songtitle ) ); strcpy ( currentsong, songtitle ); } else printf ("SgPlaylist_PrevSong : Failed because playlist %s does not exist\n", currentplaylist); }
I would post a screenshot but this forum says "Your post looks too spamy for a new user, please remove off-site URLs."

Author:  bioshacker001 [Fri Oct 18, 2013 12:14 am ]
Post subject:  Re: Uplink - Sound Modification

Probably goes without saying, but you never initialized any variables xD

Author:  Mc2m [Fri Oct 18, 2013 1:53 am ]
Post subject:  Re: Uplink - Sound Modification

Quote:
Probably goes without saying, but you never initialized any variables xD
Most of those variables are globally defined, this is why it works.
Quote:
Here is one of the functions for selecting a previous track in the playlist. This is a soundgarden modification.
That piece of code seems to be working but there's something terribly wrong with it :
Code:
songindex = 22;
Use
Code:
songindex = playlist->NumSongs();
instead ;).

On a side note we now have a sound system which support mp3 and ogg now.

Author:  Vertex [Fri Oct 18, 2013 11:05 am ]
Post subject:  Re: Uplink - Sound Modification

Mind sharing the names of the tracks you found? Always looking to expand my library.

Author:  someguy [Fri Oct 18, 2013 1:53 pm ]
Post subject:  Re: Uplink - Sound Modification

Code:
songindex = playlist->NumSongs();
Haha, wow, cant believe I missed that.

How do you manage ogg and mp3?

Author:  Mc2m [Fri Oct 18, 2013 4:01 pm ]
Post subject:  Re: Uplink - Sound Modification

I didn't do that part so I'm not sure how to do it but basically you can use the appropriate modules (libogg, smpeg). There is enough explanation on the web to guide you through.

For mp3 there is a nasty thing about tags that requires you to use id3lib. If the file you use doesn't work, that's probably because of the tag.

Author:  bioshacker001 [Fri Oct 18, 2013 8:23 pm ]
Post subject:  Re: Uplink - Sound Modification

Quote:
Quote:
Probably goes without saying, but you never initialized any variables xD
Most of those variables are globally defined, this is why it works.
I figured, but it couldn't hurt to say it.

Author:  Miah [Sat Oct 19, 2013 10:39 am ]
Post subject:  Re: Uplink - Sound Modification

Quote:
On a side note we now have a sound system which support mp3 and ogg now.
Well, mostly. Let's say I have a new reason to hate iTunes. It seems to encode mp3s is a way that basically no one else does and the soundsystem doesn't know what to do with it.

Plan is to allow people to play from their own lists, but that's proving quite the challenge. At least with this I can distribute my own music if I get any.

Author:  bioshacker001 [Sat Oct 19, 2013 1:02 pm ]
Post subject:  Re: Uplink - Sound Modification

Quote:
Quote:
On a side note we now have a sound system which support mp3 and ogg now.
Well, mostly. Let's say I have a new reason to hate iTunes. It seems to encode mp3s is a way that basically no one else does and the soundsystem doesn't know what to do with it.

Plan is to allow people to play from their own lists, but that's proving quite the challenge. At least with this I can distribute my own music if I get any.
Miah, itunes encodes with an AAC+ codec instead of the traditional mpeg2 audio stream.

Author:  Miah [Sat Oct 19, 2013 4:24 pm ]
Post subject:  Re: Uplink - Sound Modification

I am aware. But even when you have it do mp3 format instead, it till behaves like a special snowflake.

Author:  someguy [Sat Oct 19, 2013 4:37 pm ]
Post subject:  Re: Uplink - Sound Modification

Quote:
I am aware. But even when you have it do mp3 format instead, it till behaves like a special snowflake.
I actually managed today to go ahead and replace the entire sound system to use common formats like mp3, ogg, aif. It works pretty damn flawless regardless of the mp3 tags. I got it working where it accesses the music.dat and plays the tracks using a regular old .m3u playlist file also located in the music.dat (I hate cluttering the main program folder) :D

Works the same as above, skip track, previous track, and a mute/unmute button. If I can figure it out, I may make a volume slider.

Author:  Miah [Sat Oct 19, 2013 8:10 pm ]
Post subject:  Re: Uplink - Sound Modification

Quote:
If I can figure it out, I may make a volume slider.
Well that's easy. I'm interested in seeing your implementation though. Any change of that?

Author:  someguy [Sun Oct 20, 2013 9:08 pm ]
Post subject:  Re: Uplink - Sound Modification

Quote:
Well that's easy. I'm interested in seeing your implementation though. Any change of that?
Couldn't figure it out, seemed impractical anyhow

Author:  Miah [Mon Oct 21, 2013 12:33 am ]
Post subject:  Re: Uplink - Sound Modification

Sorry, I meant your implementation of the sound system.

As for your slider, take a look at the worldmap code, particularly the zoom slider. It's not super awesome but it's a start.

Author:  someguy [Mon Oct 21, 2013 1:03 am ]
Post subject:  Re: Uplink - Sound Modification

Ahh ok. Neat idea on the map slider.

As for the music implementation, I will toss you some code when I get back home, I am using FMOD, fmod . org

Was confusing at first since I have almost no c++ knowledge, but once I got the hang of it, works pretty nice. They have so many versions of things, the one you would want is to go to the downloads section and get your download under this section: "FMOD Ex Programmer’s API"

Finding examples online was hard because the newest version of the API changes the syntax of the old version which you find examples for on the net, so the examples almost become worthless. Will post some code when I get home in the morning.

Page 1 of 2 All times are UTC-05:00
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/