playsound(#)
Displaying 1-9 of 9 total.
1
oldB
|
I went to the verge source and looked at the sound articles... I saw the coding and stuff.. but it says to make my sound to play put playsound(#) in a file...
I got a little confused by this so i tried it in my map.vc, then i compiled it, it gave me som mumbojumbo about an identifier being expected..( i am new to coding so i wondered what is an identifier?) well anyways i took that out and put it next to my FX string for the cachesound command, that gave me the same recompile error, what is wrong??
hear is my system
void FX(string filename)
{
CacheSound("Module3.wav");
PlaySound(#);
}
Posted on 2000-11-19 18:53:31
|
Narad
|
void FX(string filename)
{
int pointer;
pointer = CacheSound(filename);
PlaySound(pointer);
free(pointer);
}
That ought to solve your problems. If not, sorry, but I'm sorta rusty. ~_^
Anime . . . nya! =)
http://www.geocities.com/narad_mav/Narad-AnimeList.html
Posted on 2000-11-19 19:07:04
|
TheGerf
|
An identifier is mumble mumble mumble. I'm not sure. But to fix your code, you need to declare an int to store the sound.
int tempsound;
void FX(string filename)
{
tempsound = CacheSound(filename); // stores sound
playsound(tempsound); // plays the stored sound
free(tempsound); /* frees the memory needed. It might not be neccesary, I'm unfamiliar with the sound functions */
}
Well anyways, hope that helps.
TheGerf, not just any gerf.
Posted on 2000-11-19 19:07:32
|
TheGerf
|
¿·º®:
TheGerf, not just any gerf.
Posted on 2000-11-19 19:09:23
|
oldB
|
duh, i said no text, now there are going to be a bunch of mad, big angry gorrials ready to eat you up...
( at you door) " knock knock"
Posted on 2000-11-19 20:27:44
|
oldB
|
ok, i put in the coding, but, now whenever i want to play my wave the wave goes about 10X slower, what up wit that?
Posted on 2000-11-19 20:50:07
|
Mythril
|
Don't free sounds with free()!!!!
Use FreeAllSounds(). free() is for memory pointers, and using it for freeing sound slots may crash the comp, for all i know.
Mythril. I like it with y, so don't try to make me change it to "Mithril".
Posted on 2000-11-21 14:45:11
|
Ear
|
Free() deallocates a region of memory. malloc() or loadimage() allocate a region of memory and then store the location of that memory in a variable. (A pointer.) CacheSound() returns and INDEX NUMBER, not a pointer. So, in essense you'd be freeing() a region of memory you DON'T WANT TO. Which should crash your computer completely. To free sounds, use the freeallsounds() function. Also, what's the point of loading a sound JUST to free it? You should load all your sounds into memory and then access them as you need them... and then when your game is done running free them with freeallsounds().
- Ear
Posted on 2000-11-21 21:41:41
|
Ear
|
[nt]
- Ear
Posted on 2000-11-21 21:43:37
|