Author Topic: File existance?  (Read 2558 times)

0 Members and 1 Guest are viewing this topic.

Offline PotzUK

  • 28
    • PyroPort
Is there a way to check for the existance of a file in fred? 

What I'm trying to do is add my own music to my campaign.  I gave up trying to work out the music tables, so I'm SEXP'ing it instead and it works surprisingly well.  As the music files are quite large, I aim to have them as an optional download, but I need to have the game play a standard track if it doesn't find my music.

I've seen the music / alternative music options in the mission specs editor, but the alternative menu does not appear to have any affect...

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Wow, this is the first person I've seen use this outside of FSPort. :) :yes:

If it works in the regular link, it'll work in the alternate link.  The "alternate" dropdown is for the optional track: if it doesn't find the alternate music, it'll play the standard music.

What I'm trying to do is add my own music to my campaign.  I gave up trying to work out the music tables, so I'm SEXP'ing it instead and it works surprisingly well.

Those sexps are primarily for cutscenes.  Don't use them to play event music; they'll work very poorly.  You'll just have to figure out the music table.

 

Offline PotzUK

  • 28
    • PyroPort
Hi Goober,

Thanks for the reply :)

Ahh, I had the logic reversed - I was putting my tracks as standard and the FS2 tracks as the substitute. I'll give it a go

You say they work poorly, but I've got a mission that works a charm using the SEXPs.  The only drawback I can see is not being able to fall back to the FS2 music and the inability to play any other sound files by that sexp?



I'm not saying you're wrong, but after spending over a week fiddling the music table I need a more motivation to go back to it :)  I think my problem with it stems from the fact that I can't work out how many bars my tracks have.  I know what they are and how to get them, but some of the tracks are pretty fast paced and it's hard to listen out where each bar stars  :lol:
« Last Edit: October 04, 2006, 03:07:33 am by PotzUK »

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
I'm not saying you're wrong, but after spending over a week fiddling the music table I need a more motivation to go back to it :)  I think my problem with it stems from the fact that I can't work out how many bars my tracks have.  I know what they are and how to get them, but some of the tracks are pretty fast paced and it's hard to listen out where each bar stars  :lol:

Okay, I probably should have said "don't use cutscene sexps for event music, since they're not designed for it".  They make work well, they may work poorly, I don't know.  But they don't have all the features event music has.

You don't have to count all the bars in the music track.  Just make an estimate, then play a mission using that music.  If the music cuts off, increase the number of bars.  If there's a gap between tracks, decrease the number of bars.

Also, make sure you've read this:
http://www.hard-light.net/forums/index.php/topic,14157.0.html

 

Offline PotzUK

  • 28
    • PyroPort
The problem I had with the music table was that the music didn't change when it should, sometimes it was lagged by upwards of a minute and sometimes it changed too soon. :(

I found the thread you linked when I first started trying to do it, but it didn't help  ::)

 

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
The problem I had with the music table was that the music didn't change when it should, sometimes it was lagged by upwards of a minute and sometimes it changed too soon. :(

That's precisely what I mean by revising your estimate.  Use the "rule of halves": if one value is much too short, and one value is much too long, try a new value halfway between them.  Then, if that value is too long or too short, pick a new value halfway between that and one of the original values.

 

Offline PotzUK

  • 28
    • PyroPort
What of the samples_per_measure?  That was always a ***** to work out

AIUI, for my music that is 44100hz, it's (44100 * length of song in seconds) / the number of bars I think are in the music ...

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
That should be more or less correct. I'm not 100% sure if it'll take into account stereo/mono though.
-C

  

Offline PotzUK

  • 28
    • PyroPort
I think it may do, I'm finding that I am having to double the bar count for the num_measures and using that formula for samples_per_measure.  So far so good though  :yes: