Song controls
Displaying 1-18 of 18 total.
1
Time_Wizard
|
How do you make it so a song only plays once? I figured you would put something like this in the gameloop:
if(getsongpos(music)>= [song length] ){ stopsong(music); }
But I don't understand what getsongpos is returning exactly (seconds?) and even when I put the song length as 1, the song just keeps repeating forever.
Posted on 2005-10-09 22:29:19
|
Overkill
|
If you have a song that only plays once, why not just load it as a sound?
EDIT: For module music files there's a better suggestion, though. Add a final pattern that mutes all channels and keeps jumping back to the top row.
Posted on 2005-10-09 22:35:35 (last edited on 2005-10-09 22:37:50)
|
Time_Wizard
|
The song in question is a MIDI, so it it won't play as a sound.
Posted on 2005-10-09 22:45:02
|
mcgrue
|
I think getsongpos() returns the module pattern being played, but don't quote me on that. If that's the case, it's useless for anything but mods.
What you want to do is something like this:
/// this is the length of your song in 100ths of a second, somewhere in global space.
int mySongLength = 1350; //this demo example is 13.5 seconds.
/// this is at the song's start:
mySongStart = systemtime;
/// this is in the main loop:
if( systemtime >= mySongStart + mySongLength )
{
StopMusic();
}
Posted on 2005-10-10 08:31:37
|
Time_Wizard
|
Ah, okay. Thanks.
Posted on 2005-10-10 21:52:49
|
mcgrue
|
Was all of that clear?
Posted on 2005-10-11 01:17:54
|
Time_Wizard
|
Crystal.
Posted on 2005-10-11 22:29:08
|
resident
|
Does anyone know if there's a way to kill all sound effects being played on any channel?
Posted on 2005-10-14 03:41:40
|
Overkill
|
Posted on 2005-10-14 15:35:05
|
resident
|
No, that only *seems* to stop sounds on a specific channel, unless I'm misunderstanding how it works. Being lazy, I don't keep a track of which sounds are playing on any given channel, just run Playsound and damned be to which channel it's on.
I don't know how many channels VERGE has access to or whether the amount is a hardcoded limit or dependant on your sound card, or I'd just for loop through all the known channels doing a stopsound on each one.
ideally i'm looking for a void shutthehellup();
basically, I want to kill every currently playing sound effect before moving to a Game Over screen (which is actually a different map) that plays it's own sound effects. At the moment, the sound effects that the game is playing at the time the map is changed overlap.
Posted on 2005-10-15 02:41:38
|
yhnmzwcs
|
Add a whirring sound, so it sound like the action of the game goes on while the player is wiped out.
That might not work, but workarounds and concealments are important here.
Posted on 2005-10-15 07:50:34
|
Omni
|
Make your own Playsound() and do a search and replace for it in your source.
void Resident_PlaySound(arguments...)
{
temp = PlaySound(sound from arguments);
//add temp to your own array of channel values
*code here*
}
void Resident_STHU()
{
//loop through array
StopSound(channel);
}
Posted on 2005-10-15 10:14:24
|
resident
|
I was afraid I was going to have to do something like this. Oh well.
Posted on 2005-10-15 20:33:14 (last edited on 2005-10-15 20:34:40)
|
Omni
|
Hey, it's not all that bad. This is much easier and better than not being able to stop sounds at all :)
Posted on 2005-10-15 22:03:49
|
resident
|
but it's also significantly more work than telling the engine to stop playing StopSounds();
Right now it works(-ish), even if it's not polished to have the sounds overlapping. I'll live with it. I've got a whole damn inventory menu style system to code.
Posted on 2005-10-16 00:24:43
|
Overkill
|
Verge2 had something called FreeAllSounds(); but I think that freed the sounds completely from memory. However, it would stop all of them! I propose Verge3 get a MuteSounds(); function to silence all sound channels. Then again, Fmod probably makes this moderately more difficult to do.
Posted on 2005-10-17 19:08:26
|
resident
|
Handy if you want to temporarily make the game silent, not so if you want to stop any currently playing sound so you can play something different!
Posted on 2005-10-18 02:43:47
|
resident
|
void snd_stopallsounds() {
int i;
for ( i=0; i<255; i++ ) {
stopsound( i );
}
}
This is sad and pitiful, but seems to do the job. I know my card can't try and play 100 sound effects before it all starts to go hideously wrong anyway. For what is basically a for-loop, it is agreeably effective.
Posted on 2005-10-19 10:36:23 (last edited on 2005-10-19 10:37:28)
|