Play Music/Sound string

Game Editor comments and discussion.

Play Music/Sound string

Postby DilloDude » Wed Jul 26, 2006 8:29 am

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

Postby makslane » Wed Jul 26, 2006 2:13 pm

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.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby DilloDude » Wed Jul 26, 2006 11:12 pm

So I would just have to put one for each sound file?
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby makslane » Thu Jul 27, 2006 2:09 am

Yes, if the file will be used through a variable.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Fuzzy » Thu Jul 27, 2006 2:30 am

thats brilliant.
Mortal Enemy of IF....THEN(and Inspector Gadget)

Still ThreeFingerPete to tekdino
User avatar
Fuzzy
 
Posts: 1068
Joined: Thu Mar 03, 2005 9:32 am
Location: Plymostic Programmer
Score: 95 Give a positive score

Postby DilloDude » Sat Jul 29, 2006 2:15 am

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

Postby makslane » Sat Jul 29, 2006 1:12 pm

No, but you can use the repeat option and stopSound to stop
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby Game A Gogo » Sat Jul 29, 2006 4:13 pm

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?
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby makslane » Sat Jul 29, 2006 5:08 pm

channel 1
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby DilloDude » Sat Jul 29, 2006 11:16 pm

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

Postby Game A Gogo » Sun Jul 30, 2006 12:23 am

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?
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby makslane » Sun Jul 30, 2006 12:32 am

No, the channel 1 is always reserved for music.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest