Bug in PlaySound?

Non-platform specific questions.

Bug in PlaySound?

Postby imagremlin » Mon Nov 24, 2008 12:16 pm

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?
imagremlin
 
Posts: 15
Joined: Wed Oct 29, 2008 7:16 am
Score: 0 Give a positive score

Re: Bug in PlaySound?

Postby DilloDude » Mon Nov 24, 2008 9:23 pm

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
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron