Sound in my program, yup really nice.. But..
As I''ve said it, I got sound in my program, I''m using fmod to load and play the sound file because I''m too lazy to write my own sound thingy, and secondly.. I can''t do it =)
anyways, i get the file loaded and played all right. But here comes the "but". I want the freaking sound file to be played while the program is going on, and not like it''s not. FIRST it plays the whole sound file, which happen to be a music file of 3 minutes, and THEN it begins to draw the scene. yeah, really nice I must say. So here''s the 10 point question to you gurus and generally nice guys out there: How?
here''s a example on how I''ve done this by code..
int LoadSong()
{
FSOUND_SAMPLE *pSound;
int soundChannel = 0;
if (!FSOUND_Init(44100, 32, FSOUND_INIT_GLOBALFOCUS))
{
printf("%s\n", FMOD_ErrorString(FSOUND_GetError()));
exit(1);
}
printf("Loading Song...\n\n");
pSound = FSOUND_Sample_Load(FSOUND_FREE,SONG_NAME,0,0);
if (!pSound)
{
printf("%s\n", FMOD_ErrorString(FSOUND_GetError()));
exit(1);
}
soundChannel = FSOUND_PlaySound(FSOUND_FREE,pSound);
getch();
printf("\n");
FSOUND_StopSound(soundChannel);
FSOUND_Close();
return(0);
}
and then, I call it in my
void RenderScene()
{
glLoadIdentity(); // loadidentity and all that
LoadSong();
// do the drawing stuff, models and stuff
}
Yeah, I know... This is not how it''s done right, that''s why I''m asking you
Thanks in advance
Kenneth Wilhelmsen
Download my little game project HERE
--------------------------
He who joyfully marches to music in rank and file has already earned my contempt. He has
been given a large brain by mistake, since for him the spinal cord would fully suffice. This
disgrace to civilization should be done away with at once. Heroism at command, senseless
brutality, deplorable love-of-country stance, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action! It is my conviction that killing under the cloak of war is nothing but an act of murder
Not sure if you programming environment allows it, but have you thought of creating a separate thread to play music? I''m pretty sure that would do it.
If you are using Win32, I think the way to do it is with _beginthread and _endthread, but I''m not sure.
If you are using Win32, I think the way to do it is with _beginthread and _endthread, but I''m not sure.
Hi,
On my site, I''ve a little example who use FMOD.
========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
On my site, I''ve a little example who use FMOD.
========================
Leyder Dylan
http://ibelgique.ifrance.com/Slug-Production/
Based on NeHe''s tutorials and if your only using wav files a simple (and lame) way of achieveing this would be:
PlaySound("Data/yourFileHere.wav", NULL,SND_LOOP | SND_ASYNC);
while(!done) // Loop That Runs While done=FALSE
{
That should play sound along with the main.
PlaySound("Data/yourFileHere.wav", NULL,SND_LOOP | SND_ASYNC);
while(!done) // Loop That Runs While done=FALSE
{
That should play sound along with the main.
Dont load the song in render
Load the song in Init() or at the begining of your Windows method
Calling during rendering will contuially load it up and screw it up
Load the song in Init() or at the begining of your Windows method
Calling during rendering will contuially load it up and screw it up
Hm, I think I''ve tried that before (putting it in the init())but I''m not sure.. However, I''ll try that =)
Hm, I think I''ve tried that before (putting it in the init())but I''m not sure.. However, I''ll try that =)
Kenneth Wilhelmsen
Download my little game project HERE
--------------------------
He who joyfully marches to music in rank and file has already earned my contempt. He has
been given a large brain by mistake, since for him the spinal cord would fully suffice. This
disgrace to civilization should be done away with at once. Heroism at command, senseless
brutality, deplorable love-of-country stance, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action! It is my conviction that killing under the cloak of war is nothing but an act of murder
Kenneth Wilhelmsen
Download my little game project HERE
--------------------------
He who joyfully marches to music in rank and file has already earned my contempt. He has
been given a large brain by mistake, since for him the spinal cord would fully suffice. This
disgrace to civilization should be done away with at once. Heroism at command, senseless
brutality, deplorable love-of-country stance, how violently I hate all this, how despicable and ignoble war is; I would rather be torn to shreds than be a part of so base an action! It is my conviction that killing under the cloak of war is nothing but an act of murder
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement