|
Music
Jul 13, 2004 18:27:12 GMT -5
Post by Candle on Jul 13, 2004 18:27:12 GMT -5
dim sound sound = LoadSound (recycle) PlaySound (recycle) Can someone tell me why this won't play ? have the file in the same folder as the .gb#nosmileys
|
|
|
Music
Jul 13, 2004 21:05:47 GMT -5
Post by osistlk on Jul 13, 2004 21:05:47 GMT -5
Hey Candle, Here is were I think you went wrong.
dim sound sound = LoadSound (recycle) PlaySound (recycle)
You have the right idea but you have to change some things. 1st, to my understanding, Basic4GL only suports PCM Wave files (.wav). So any file you want to make play has to be a Wave file, look for this ending; "example.wav". If it isn't a .wav file then you're going to have to convert it into one or else you can't use it. I'm sure you can find some freeware converters online. 2nd, you can have the sound file anywhere on your computer as long as you specify the path, but you can put it in the "Sounds" folder if you want too. The path must always have the () marks as well as quotation marks or it will not work. 3rd, the "PlaySound" line refers to the dim so it should be "sound" instead of "recycle". So here is what it should look like if the file is in the "Sounds" folder and if everything is "right". Remember, I could still be wrong!!!!
dim sound sound = LoadSound ("C:\Program Files\Basic4GL\Programs\Sounds\recycle.wav") PlaySound (sound)
*I am guessing that is the file path of the recycle sound, if not, find out what it is and put it in for what I wrote instead.
Hope I helped you with your problem! ;D
|
|
|
Music
Jul 13, 2004 21:12:44 GMT -5
Post by GuppyB on Jul 13, 2004 21:12:44 GMT -5
Can someone tell me why this won't play ? have the file in the same folder as the .gb Your code should look like this dim sound sound = LoadSound ("recycle.wav") PlaySound (sound) Basically you need the extension of the sound file type (which I think at this time Basic4Gl only supports wav's and you need to make sure that it's in quotes Hope this helps ...G
|
|
|
Music
Jul 13, 2004 21:18:51 GMT -5
Post by Candle on Jul 13, 2004 21:18:51 GMT -5
Ok the (") I didn't have but then it didn't show that in the help file . I kind go by whats in the help file so if it is wrong what I do will be wrong . lol Thanks for the help .
EDIT Anyway to make it loop ? like background music .
|
|
|
Music
Jul 13, 2004 21:26:38 GMT -5
Post by osistlk on Jul 13, 2004 21:26:38 GMT -5
GuppyB is right, lol, he summerized my whole thing into a few lines I myself wonder about looping and if file size has any signifigance?
|
|
|
Music
Jul 13, 2004 22:44:18 GMT -5
Post by Candle on Jul 13, 2004 22:44:18 GMT -5
Well i hope someone comes along and tells me how to loop the music . I won't die if it don't happen lol but it would be nice to know so if I make a game I can loop the music . maybe doing a call or something ? Right now I have no idea what I'm doing .
|
|
|
Music
Jul 14, 2004 15:17:52 GMT -5
Post by GuppyB on Jul 14, 2004 15:17:52 GMT -5
Try this:
dim sound, currentcount, lastcount, soundtime soundtime = 10000 ' set to length of sound clip in seconds * 1000 sound = LoadSound ("recycle.wav") lastcount = TickCount() while true currentcount = TickCount () if (currentcount - lastcount) > soundtime then PlaySound (sound) lastcount = TickCount() endif wend
Essentially uses the system timer to measure out the length of time of the clip, before hitting play on the clip again (as you see above I arbitrarily set the clip length to 10 secs). Should fit into the game without interrupting the flow as well. Tested it quick, and it seemed to work, you may need to play around with it to fit your need. Hope this helps...G
|
|
|
Music
Jul 14, 2004 15:58:55 GMT -5
Post by Candle on Jul 14, 2004 15:58:55 GMT -5
Thank you . I changed it to 1000 and it work ok then . But it tends to keep running after I close the window . I haven't made the exe yet just testing it in the ide so not sure if it will do it with the exe . or is there a way to shut it down when the game or what every is closed ?
|
|
|
Music
Jul 14, 2004 21:23:27 GMT -5
Post by GuppyB on Jul 14, 2004 21:23:27 GMT -5
Keeps playing after you close the window.... interesting... you might want to let Tom know about that one. ...G
|
|
|
Music
Jul 14, 2004 21:26:57 GMT -5
Post by Candle on Jul 14, 2004 21:26:57 GMT -5
Ya I hit esc and it keeps playing for a few seconds then stops .
|
|
|
Music
Jul 15, 2004 12:09:18 GMT -5
Post by NoVaGene on Jul 15, 2004 12:09:18 GMT -5
|
|