Jump to content

  • Log In with Google      Sign In   
  • Create Account

Audiere Help please


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Vanz   Members   -  Reputation: 204

Like
0Likes
Like

Posted 26 March 2010 - 12:08 PM

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?

Sponsor:

#2 Vanz   Members   -  Reputation: 204

Like
0Likes
Like

Posted 26 March 2010 - 02:09 PM

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]

#3 Vanz   Members   -  Reputation: 204

Like
-1Likes
Like

Posted 26 March 2010 - 06:09 PM

okay i see the problem, nvm...




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS