I have BIG problem with getSound

magistr

14-01-2008 15:24:39

I have following problem.

In my project exists back ground music, and two sounds:
1. Sound for button press in GUI
2. Sound for my game objects in 3D

My projects is started normaly, but getSound give many problems:
1. After one of call getSound function, project is crashed (in getSound function!!!, not after!)

2. In my project I get one of my sound, but sometimes getSound ceases correct work, and return ONE sound for ALL SOUND NAMES.
i.e. i call this lines:
OgreAL::SoundManager::getSingleton().getSound("GUIBtn")->stop();
OgreAL::SoundManager::getSingleton().getSound("GUIBtn")->play();

and
OgreAL::SoundManager::getSingleton().getSound("CubeClick1")->stop();
OgreAL::SoundManager::getSingleton().getSound("CubeClick1")->play();

But SoudManager play CubeClick1 sound for both calls (CubeClick1 and GUIBtn or any other)

My code for load sounds:

sndButtonClick = OgreAL::SoundManager::getSingleton().createSound("GUIBtn", "buttonClick.wav", false, false);
sndButtonClick->setPriority(OgreAL::Sound::Priority::HIGH);
sndButtonClick->setRelativeToListener(true);

cubeSound1 = OgreAL::SoundManager::getSingleton().createSound("CubeClick1", "cubeClick.wav", false, false);

cubeSound2 = OgreAL::SoundManager::getSingleton().createSound("CubeClick2", "cubeClick.wav", false, false);

cubeSound1->setGain(0.4);
cubeSound2->setGain(0.4);


Code for load BG music:
OgreAL::Sound *sound = OgreAL::SoundManager::getSingleton().createSound("SoundStream3", "gamemusic1.ogg", true, true);
sound->setGain(0.15);
sound->setPriority(OgreAL::Sound::LOW);
sound->setLoop(true);
sound->play();

magistr

14-01-2008 15:42:49

I have many crashes on getSound function.
Application crash only in release.
If I start debug it works normaly.
I find this creashes with logging.

Also this crashes I take after compile with THREADEDING support.

But second mistake I have in any version. (Play only one sound for all)

stickymango

14-01-2008 15:49:47

sounds like either a pointer initialisation problem or mixed up dll's, try a clean build of your application and make sure the correct dll's are being used by your release application.

magistr

14-01-2008 16:30:43

Before create topic I am double check all file versions.
My project has dll such in OgreAL release/debug folder.

And I am write simple test in standart Basic Demo.

Please comment default code for play roar sound and try this code for imitate error:

In createScene paste this code:
OgreAL::Sound * cubeSound1 = OgreAL::SoundManager::getSingleton().createSound("CubeClick1", "cubeClick.wav", false, false);
OgreAL::Sound * cubeSound2 = OgreAL::SoundManager::getSingleton().createSound("CubeClick2", "cubeClick.wav", false, false);
cubeSound1->setGain(0.4);
cubeSound2->setGain(0.4);
OgreAL::Sound * sndButtonClick = OgreAL::SoundManager::getSingleton().createSound("GUIBtn", "buttonClick.wav", false, false);
sndButtonClick->setRelativeToListener(true);


In frame listener in startFrame function paste following code:
static float MyTime1 = 0.5;
static float MyTime2 = 0.3;
static float MyTime3 = 0.6;
if (MyTime1>0)
MyTime1-=evt.timeSinceLastFrame;
else
{
OgreAL::Sound* snd;
snd = OgreAL::SoundManager::getSingleton().getSound("GUIBtn");
if (snd->isPlaying())
snd->stop();
snd->play();
MyTime1 = 0.5;
}
if (MyTime2>0)
MyTime2-=evt.timeSinceLastFrame;
else
{
OgreAL::Sound* snd;
snd = OgreAL::SoundManager::getSingleton().getSound("CubeClick1");

if (snd->isPlaying())
snd->stop();
snd->play();

MyTime2 = 0.5;
}
if (MyTime3>0)
MyTime3-=evt.timeSinceLastFrame;
else
{
OgreAL::Sound* snd;
snd = OgreAL::SoundManager::getSingleton().getSound("CubeClick2");

if (snd->isPlaying())
snd->stop();
snd->play();

MyTime3 = 0.5;
}

After one of call getSound function appication generate error :-(

You can download sounds used by this code:
http://www.switlle.net/art/Audio.zip

CaseyB

14-01-2008 21:20:49

I'll take a look tonight when I get home and see if I can recreate this. And then see what can be done about it.

magistr

14-01-2008 21:32:13

OK.
P.s. I am use OgreAL compiled with THREADEDING support.

hyper

25-01-2008 12:31:38

Also, I don't have a crash problem, but I'm having the same problem of mixing sounds, that means, I ask for a specific sound like "A" and play it, but sound "B" gets played.
Could there be a problem with sound buffers, or is it just a pointer management issue?

CaseyB

25-01-2008 14:40:05

Things have been crazy here, but I'll look into this as soon as I can, I am really sorry for the delay!

magistr

28-01-2008 09:45:25

I have same problem of mixing sounds too.

CaseyB, You are dont review this???

CaseyB

03-02-2008 07:28:38

I have just committed some stuff, this is the very next issue I am going ot be looking at.

CaseyB

04-02-2008 15:57:55

Is this only happening for people who have enabled threading?

stickymango

04-02-2008 19:29:42

I don't seem to have any problem with accessing the correct sound....

Kuebel

07-03-2008 18:14:23

On my PC with Creative Audigy I do not have this problem, but on a Mac running XP with Realtek audio card (I 'm not sure) it happend as you described: Wrong sounds were played, but only one or two minutes into the game. When I removed my large intro music file, it took a little longer for the error to occur.

I'm using the current SVN version of OgreAL and Ogre 1.4.6