Fulqrum Publishing Home   |   Register   |   Today Posts   |   Members   |   UserCP   |   Calendar   |   Search   |   FAQ

Go Back   Official Fulqrum Publishing forum > Fulqrum Publishing > IL-2 Sturmovik

IL-2 Sturmovik The famous combat flight simulator.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 01-23-2013, 04:10 PM
Pfeil Pfeil is offline
Approved Member
 
Join Date: Jan 2012
Posts: 126
Default

The method I would use is this:

Music in a subfolder of the station you're using has an underscore prefix(I.E. "_artist - song.wav").

When you're ready to change songs, you move the .wav file you need to the radio station directory and rename it with the prefix you're using by replacing everything in front of the underscore with the next ID(If 999 is playing, rename to "998_artist - song.wav") and refresh the station.
This can be done using a keyboard macro to press the previous/next radio station buttons in sequence, or by having it open the console and using the proper command(This method has the issue of momentarily pausing the game while you're typing to the console, which needs some delay to properly register all keypresses).

After the game exe stops and the files are unlocked, move them back to their subdirectory so you can repeat the cycle next time the game is started.
This is why I propose the underscore(or other symbol) prefix, so you can easily rename the files without worrying about what they're currently called.


Moving the files will also ensure no song is played twice within one session of play.
You could also move recently played files to a seperate directory and move them back when they haven't been played for a while(applying a datestamp when you move them) if you're hearing the same music too often.

Randomly picking a song to start with could be done by counting the .wav files in the folder you're looking to play, then generating a random number within the file count and playing the file corresponding with that number.
Your program/script would be running along with the game keeping track of what number is next in the cue. Alternatively you could have it check which numbers are already in the radio station directory. The latter allows you to only run the program/script when you're actually switching song, but requires reading all file names each to you do run it as opposed to just getting a numeric value from a variable.

Perhaps the biggest question surrounding this problem is when to actually switch songs. I don't know of a way to determine when a song has stopped playing within IL2.
In theory you could have it trigger when the next file in the cue is read(I.E. when file "998_artist - song.wav" is done, IL2 should read "999_artist - song.wav", this does require an exception when only one file is currently present).
Provided already played songs aren't read directly from memory, you could monitor the filesystem to see when the next file is read.

A much easier method is to use a set interval, or a keypress(which would allow you to skip songs).


I will say the theoretical part of the problem is solvable, but I personally lack the programming experience to tackle the practical side(especially the filesystem voodoo).
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:25 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.