Page 1 of 1

Play Music/Sound string

PostPosted: Wed Jul 26, 2006 8:29 am
by DilloDude
Because the sound file is compressed, the sound path should become invalid when the game is exported. So if I have
Code: Select all
PlaySound2("data/sound.wav", 1, 1, 0);
and
Code: Select all
char *soundpath = "data/sound.wav";
PlaySound2(soundpath, 1, 1, 0);

the first one should work, but the second one shouldn't, correct?
This is annoying because I wnt to have objects that play music and I want to assign it to a variable. I could use a switch with an integer, but that would get tedious as I would have to put the entire code in where as if I could use a string stored in a text actor it would be easier.

PostPosted: Wed Jul 26, 2006 2:13 pm
by makslane
Only the sound found in the PlaySong/PlayMusic functions will be exported.
I think you use a little workaround:

In some place of your code, like in a global code, put the commneted declaration:

Code: Select all
//PlaySound2("data/sound.wav", 1, 1, 0);


Note, this function don't will be executed, but will tell the exporter to include the "data/sound.wav" in the final file and you can execute the real PlaySound calls using strings variables.

PostPosted: Wed Jul 26, 2006 11:12 pm
by DilloDude
So I would just have to put one for each sound file?

PostPosted: Thu Jul 27, 2006 2:09 am
by makslane
Yes, if the file will be used through a variable.

PostPosted: Thu Jul 27, 2006 2:30 am
by Fuzzy
thats brilliant.

PostPosted: Sat Jul 29, 2006 2:15 am
by DilloDude
Another thing: is it possible to detect when the music is no longer playing, so I can
  1. play it again, or
  2. play another one?

PostPosted: Sat Jul 29, 2006 1:12 pm
by makslane
No, but you can use the repeat option and stopSound to stop

PostPosted: Sat Jul 29, 2006 4:13 pm
by Game A Gogo
makslane wrote:No, but you can use the repeat option and stopSound to stop


that reminds me something i wanted to ask you.

on which channel the music plays, is it on the firts one or the firts availebe?

PostPosted: Sat Jul 29, 2006 5:08 pm
by makslane
channel 1

PostPosted: Sat Jul 29, 2006 11:16 pm
by DilloDude
I would really like to have music/sound finish events and infinite loops in the next version. While you can put a large number in as the loop count, it would be easier to put '0' in for infinite loop, and also then you woudn't have to worry about someone leaving his game running for 30,000 years and the music suddenly stopping. Also, with a music finish event, you coould play the same music, creating an infinite loop, or you could playe a different one, with the result of having an intro music that becomes a loop.

PostPosted: Sun Jul 30, 2006 12:23 am
by Game A Gogo
DilloDude wrote:I would really like to have music/sound finish events and infinite loops in the next version. While you can put a large number in as the loop count, it would be easier to put '0' in for infinite loop, and also then you woudn't have to worry about someone leaving his game running for 30,000 years and the music suddenly stopping. Also, with a music finish event, you coould play the same music, creating an infinite loop, or you could playe a different one, with the result of having an intro music that becomes a loop.

Yes! exacly, since GE dosnt support an IT file to go to a different position insted of going to the firts line.

Makslane wrote:channel 1

if there is no music, can a sound go to channel 1?

PostPosted: Sun Jul 30, 2006 12:32 am
by makslane
No, the channel 1 is always reserved for music.