hab dazu mal was geschrieben, was aber eider nicht funktioniert. bin da nicht ganz firm drin. kann mir wer n tipp geben was hier ran nicht stimmt?
Code:
//***********************************************************************************//
namespace sound device
{
ISoundEngine engine_ = createIrrKlangDevice();
vector<ISoundSource*> file_array_;
vector<ISound*> sound_array_;
int register_sound(const char* filename);
void play_sound(unsigned int index);
void stop_sound(unsigned int index);
}
//***********************************************************************************//
int sound_device::register_sound(const char* filename)
{
ISoundSource* temp_source = engine_->addSoundSource(filename);
ISound* temp_sound;
temp_sound = engine_->play2D(temp_source, temp_mode.looped, true);
file_array_.push_back(temp_source);
sound_array_.push_back(temp_sound);
file_cursor_ ++;
return(file_cursor_);
}
//***********************************************************************************//
void sound_device::play_sound(unsigned int index)
{
if(index < 0 || index > file_array_.size())
return;
engine_->play2D(sound_array_[index]->getSoundSource(), mode_[index].looped);
}
//***********************************************************************************//
void sound_device::stop_sound(unsigned int index)
{
if(index < 0 || index > sound_array_.size())
return;
sound_array_[index]->stop();
}
//***********************************************************************************//
int main(void)
{
int a = sound_device::register_sound("a song.ogg");
sound_device::play_sound(a);
//n bissl zeug
sound_device::stop_sound(a); //und hier spielt er einfach fröhlich weiter, was er eig nicht sollte
//noch n bissl zeug
return(0);
}
es erfolgt kein vector-zugriffsfehler, er ignoriert einfach "sound_array_[index]->stop();" o.o
_________________
Irrlicht - From Noob To Pro A Guideline
--
Sonstige Projekte, Blog :
http://www.rpdev.net