TIGSource Forums

Developer => Technical => Topic started by: todd on January 22, 2012, 09:45:30 AM



Title: Going through a set with Super Sound DLL
Post by: todd on January 22, 2012, 09:45:30 AM
I'm trying to have different songs play one after another using the Super Sound System Dll in Game Maker. For example- when song[0] finishes it goes to song[1], then song[2], and then back to song[0].

Here's my code so far
Code:
if SS_IsSoundPlaying(song[0]) && SS_GetSoundLength(song[0])==SS_GetSoundPosition(song[0])
{
    SS_StopSound(song[0]);
    SS_PlaySound(song[1]);
}
if SS_IsSoundPlaying(song[1]) &&  SS_GetSoundLength(song[1])==SS_GetSoundPosition(song[1])
{
    SS_StopSound(song[1]);
    SS_PlaySound(song[2]);
}
if SS_IsSoundPlaying(song[2]) &&  SS_GetSoundLength(song[2])==SS_GetSoundPosition(song[2])
{
    SS_StopSound(song[2]);
    SS_PlaySound(song[0]);
}

After the first song plays it just stops. Any help would be greatly appreciated.  :handthumbsupR:


Title: Re: Going through a set with Super Sound DLL
Post by: ஒழுக்கின்மை on January 22, 2012, 10:31:06 AM
you know there's also SS_LoopSound, right? (i don't remember the exact function name, but i've used supersound for years and am 100% sure that you need to use the looping function if you want it to loop)


Title: Re: Going through a set with Super Sound DLL
Post by: --- on January 22, 2012, 10:36:28 AM
you know there's also SS_LoopSound, right? (i don't remember the exact function name, but i've used supersound for years and am 100% sure that you need to use the looping function if you want it to loop)

well duh

but he wants to play a few songs in succession, for example, a playlist


Title: Re: Going through a set with Super Sound DLL
Post by: ஒழுக்கின்மை on January 22, 2012, 10:45:13 AM
hmm, i'm still not sure it'd work that way

i'd suggest removing all the "&& SS_GetSoundLength(song[0])==SS_GetSoundPosition(song[0]" stuff, because the length of a song will *never* equal the sound position, because a) they aren't in equivalent units, and b) you can't get the sound position of a song that is never playing, so you'll *never* have a situation when simultaneously the sound is not playing and the sound's position isn't a null value


Title: Re: Going through a set with Super Sound DLL
Post by: todd on January 22, 2012, 10:50:32 AM
@Paul Eres - Yeah, like Shelby said I'm trying to play a few songs in succession. I'll setup some debug text to find the correct units for GetSoundPosition and see if I can change it that way. Do you know if GetSoundPosition does it by percentages or is it by the file size of the song(bits or whatever)?


Title: Re: Going through a set with Super Sound DLL
Post by: ஒழுக்கின்மை on January 22, 2012, 10:58:22 AM
i'd suggest not using position at all. you don't need to do that. all you need to do is check for when the last sound has stopped playing


Title: Re: Going through a set with Super Sound DLL
Post by: todd on January 22, 2012, 11:37:31 AM
Awesome. Thanks Paul. I got it working with this. Way simpler.

Code:
if !SS_IsSoundPlaying(song[0]) && lastSong=0
{
    SS_PlaySound(song[1]);
    lastSong=1;
}
if !SS_IsSoundPlaying(song[1]) && lastSong=1
{
    SS_PlaySound(song[2]);
    lastSong=2;
}
if !SS_IsSoundPlaying(song[2]) && lastSong=2
{
    SS_PlaySound(song[0]);
    lastSong=0;
}


Title: Re: Going through a set with Super Sound DLL
Post by: --- on January 22, 2012, 10:30:44 PM
Why don't you use parentheses around your comparisons? It's important! I bet you're the kind of person who doesn't wear underwear. Why don't you wear underwear?!


Title: Re: Going through a set with Super Sound DLL
Post by: JMickle on January 23, 2012, 04:35:17 AM
Gml teaches bad habits. Very bad habits


Title: Re: Going through a set with Super Sound DLL
Post by: ஒழுக்கின்மை on January 23, 2012, 05:31:12 AM
he's also using a single = instead of == in the conditionals

i don't think GML itself teaches these habits. it's more like GM users teach these habits to each other


Title: Re: Going through a set with Super Sound DLL
Post by: --- on January 23, 2012, 02:03:39 PM
odd

in the first example he used ==, but in the second, one =.