Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
Problem with stopping a Singlesound

sebir
Registered User
Quote
2012-10-29 14:28:59

I have the following problem: I am currently working in a groupproject and we create a spaceshooter game and i am trying to stop a single sound in this case the Move-sound which plays if the Shuttle moves (meaning the User presses the Button to move forward). Right now i have 4 files (SoundEngine.h/SoundEngine.cpp/ShuttleSoundComponent.h/ShuttleSoundComponent.cpp)
I will now post some parts of the code and wright down where the problem is after that:
//SoundEngine.h
class SoundEngine : public Core::IEngine
{public:
irrklang::ISound* Play(int, bool = false);
void StopSingle(irrklang::ISound* sound);
}


//SoundEngine.cpp
ISound* Sound::SoundEngine::Play(int soundSource, bool looped)
{
return this->mp_Sound->play2D(this->m_SoundMap[soundSource], looped);
}
void Sound::SoundEngine::StopSingle(ISound* sound)
{
sound->stop();
}


//ShuttleSoundComponent.h
class ShuttleSoundComponent : public ISoundComponent
{
private:


Sound::SoundEngine* mp_SoundEngine;

irrklang::ISound* mp_Move;
}


//ShuttleSoundComponent.cpp
void Components::ShuttleSoundComponent::VUpdate(float deltaSec)
{
if(this->mp_ParentActor->GetShuttleStateArray()[Core::Actors::Shuttle::ShuttleState::Move])
{
cout << "set move sound" << endl;
this->mp_Move = this->mp_SoundEngine->Play(Sound::ShuttleSounds::ShuttleMove, true);
}
else
{
cout << "stop move sound" << endl;
this->mp_Move->stop();
}

}


This should be all the code required to see my problem. What happens is that everytime i get into the else in the ShuttleSoundComponent.cpp i get a break. When klicking on mp_Move it tells me: _vfptr <Unable to read memory>

I hope my explanation was kinda helpful and i am willing to provide any information missing


Greetings Sebastian


niko
Moderator
Quote
2012-10-31 07:49:25

What do you mean with "you get a break"? Does it crash? Or did you put a breakpoint somewhere?


sebir
Registered User
Quote
2012-10-31 15:09:08

We managed to fix the problem on our own. Thanks for the effort though.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact