Audiere Help please

Started by
1 comment, last by Vanz 14 years ago
So far Audiere is working great, I can play background music and sound effects all at the some time and am pretty happy, but I need to be able to call sounds and music from functions like BOOL cApp::PlaySound(int SoundName) Unfortunately it seems that the sound start and exits right after the function returns a value. Here's some quick test code that shows my problem.

#include "stdafx.h"
#include <string>
#include <cstdio>
#include "audiere.h"

using namespace audiere;
AudioDevicePtr  device3(OpenDevice());

bool test();

bool test()
{
OutputStreamPtr sound3(OpenSound(device3, "sData/Bolero.ogg", true)); //../../api/inc/
sound3->play();
sound3->setRepeat(true);
sound3->setVolume(1.0f);
getchar();
return 1;
}
 
int main(void)
{
long i, a;

test();

AudioDevicePtr  device2(OpenDevice());
OutputStreamPtr sound2(OpenSound(device2, "sData/SW1.ogg", false)); //../../api/inc/
sound2->play();
sound2->setRepeat(false);
sound2->setVolume(0.4f);

AudioDevicePtr  device1(OpenDevice());
OutputStreamPtr sound1(OpenSound(device1, "sData/SW2.ogg", false)); //../../api/inc/
sound1->play();
sound1->setRepeat(false);
sound1->setVolume(0.4f);

for(i=0;i<6655555555;i++)
{
if (i==1111255555) 	sound1->play();
if (i==411655555) 	sound2->play();
} // End for i

return 0;
}




So I want to play the song called out in the function "bool test()", but once the function executes "return 1;" the sound stops. If I place the code inside the function "bool test()" into "int main(void)" then it works... but I really need these sounds to play out of functions located in separate .cpp files... Any advice would be appreciated... Thanks, rhuala ps. Is there also a way to tell when the music file is over, so I know when to start the next one?
Advertisement
well found the answer to my last question...

while (sound1->isPlaying())


Unfortunately, VC++2008 gives me the following error when trying to use that function... grrr...[depressed]

Inconsistent values for /Ym between creation and use of precompiled header


Any ideas how to fix this error, can't seem to find the answer with [google]
okay i see the problem, nvm...

This topic is closed to new replies.

Advertisement