Forums » General

Custom playlist?

Jan 28, 2009 Verad link
So before any of you jump down my throat, I'm not talking about simply turning down the VO music and running iTunes in the background.

I'm wondering if there is any way to import my MP3s to overwrite the VO music files. Ergo, when I enter a friendly system VO plays track A, B, or C. If I enter a hostile system, VO plays track D, E, F or G. If I enter an empty or neutral system... well, you get the idea.

Now if that's at all possible, I'd like to maybe expand on it, perhaps even having specific sectors having a specific soundtrack.

Is any of this possible? Is there perhaps already a plugin for this?
Jan 28, 2009 slime73 link
It hasn't been done before to my knowledge, but I'm pretty sure it's possible via a plugin.
Jan 29, 2009 maq link
Possible by turning off music and then triggering different tracks based on some events, as slime said.

Describe it in more detail, and maybe someone will make such plugin.
Jan 29, 2009 Hentai_Jeff link
it's possible by changing the mp3s to ogg files and renaming them to the corresponding file that exists in your vendetta install folder.
Jan 29, 2009 Verad link
Problem is, I can't find the files. The only thing I find is a file named "media.rlb". Everything else (aside from some drivers) is far too small (like 4k) to contain any sort of music file...
Jan 29, 2009 maq link
The music, like everytihng else is in media.rlb file, and not as far as i know extractable, much less replacable.

As i said, you could have a plugin that'd trigger your own songs based on whatever you want, duplicating default shouldn't be too hard either.

So, just a matter of writing it, and getting the songs.
Jan 29, 2009 Verad link
Well, I don't know the first thing about writing plugins, but I'm intrigued...

So what are some examples of events? Could this be tied to jumping into a system and playing a different track depending on if the system is friendly/hostile/neutral or perhaps has a queen or ion storm in it?
Jan 29, 2009 a1k0n link
Huh. I guess we don't actually export an event for this from the client, but it would be a simple change. There's a network message that says "start playing music <xyz>" which could theoretically be intercepted by a plugin and replaced, but only if we change the client code to allow it.

So no, right now it's not currently possible... sorry.
Jan 30, 2009 maq link
Well, a1k0n, we couldn't get the original messages but we could easily use the ones we have, jumps, location, who owns the sector, if it is monitored, presence of enemies in the sector, being fired at, whatever we wish, i think we have all the data to emulate the original events, and to even expand on them.

[edit]Tho actually, one could just replace gksound.GKPlayMusic function, play your own songs instead of default ones that way.

So, i think it is possible.
Jan 30, 2009 MSKanaka link
Back before a1k0n added the warp sounds to the effects table (used by JumpSFX, one of the plugins I wrote ages ago), I was forced to use gksound.GKPlayMusic to play those sounds.

Unfortunately, doing so caused the ingame music to stop and require a manual start, so I started working on a system that would attempt to identify which music file should start playing in any given sector using the info we have available. It didn't really get very far, as a1k0n fixed the effects table before I finished.

I'll look around and see if I can find the code for it, but it's probably been scrapped in the last year or so.
Jan 30, 2009 maq link
ok so if you just want to replace original songs something like this should suffice:

local playmusic_old = gksound.GKPlayMusic
function gksound.GKPlayMusic(name, b1, b2, n1, vol)
local new_name = name:gsub('music', 'music1')
playmusic_old(new_name)
end

and then put songs named like original songs in the music1 folder
they are:
itani_newbie.ogg
itani_distant.ogg
itani_home.ogg
itani_battle.ogg

replace 'itani' with 'serco' or 'nt' for the other nations
there are some more but i don't remember right now.

that's the easy way, it's possible to make something more complex if someone wants to.

what are the other arguments for GKPlayMusic btw? i know 5th one is volume but no idea for the rest
also, seems like passing the rest of arguments to original function makes the song not play sometimes, dunno why
Jan 30, 2009 Verad link
Methinks that some customization may become available in 2.0, but for the time being I'd like to try some experimentation with Maq's model. I'll compile a few MP3s.

Is there anyone who can code this into a plugin? I wouldn't even know how to start...
Jan 30, 2009 maq link
copy the code into a text file, rename it to main.lua
put that file in folder called plugins/musicreplacement/
in vo directory

[edit] ah, w/e here's a link: musicreplacement.zip unpack to plugins in vo dir

say what customization you want btw
Jan 30, 2009 mr_spuck link
The arguments for playmusic are called filename, loop, forceplay, looppoint and volume.
Not sure what forceplay and looppoint do. It only ever plays stuff if I set forceplay to true and looppoint has no effect.
Jan 30, 2009 Verad link
Hmmm... I suspect "looppoint" is perhaps a timeset during any given track at which point it goes into a loop. This may be problematic if I'm using MP3s that really aren't design to loop...

Anyway, Thanks for the help folks, I'll put some more work into this when I get a chance (not likely until Sunday).
Jan 30, 2009 mr_spuck link
Could be. I think I read somewhere that oggs support looping in the format. So maybe it's not a position but some kind of selector. If your files have no loop points it will probably just be ignored. That's just a guess though ..I couldn't find anything official on oggs and looping.

Also nothing is stopping you from just always setting the value to whatever you want if you wrap a function like in micks script.
Jan 31, 2009 incarnate link
Looppoint is an offset in samples, if I remember correctly.
Jan 31, 2009 yodaofborg link
Just a side note Verad, the VO engine cannot play mp3's, just ogg vorbis files, so don't expect to use mp3, it wont work.
Jan 31, 2009 maq link
one thing that might make sense is instead of putting files there make a playlist for each file and change code to use GKPlaylist.
or make a file with lua table specifying files, so they can be played at random or something
Feb 01, 2009 Verad link
Well if I can find a way to convert MP3s to OGG then what I'd like to do is have 3-5 different tracks to play in different scenarios.