Page 1 of 1

Bug in PlaySound?

PostPosted: Mon Nov 24, 2008 12:16 pm
by imagremlin
I want to use a variable to play a sound. Like this:

Code: Select all
 
  // This happens in one function:
  strcpy(MySound,"data/mysound.wav");   // Where my sound is a global string variable

  // This happens  in some event:
  PlaySound2(MySound, 0.5, 1, 0.000000);


It works while I'm on Game Editor, but when I export the game, I get no sound.

Anyone else noticed this?

Re: Bug in PlaySound?

PostPosted: Mon Nov 24, 2008 9:23 pm
by DilloDude
This is because you are using a reference to a file which doesn't exist in the exported version. You need to have a reference to PlaySound somewhere with the actual file in it. Even a comment will work. It's a good idea to have a page in Global Code for this:
Code: Select all
//PlaySound2("data/mysound.wav", 0.5, 1, 0.000000);
//PlaySound2("data/othersound.wav", 0.5, 1, 0.000000);
//PlaySound2("data/moresound.wav", 0.5, 1, 0.000000);

//any functions you want to do with sound