Jump to content

Releasing source causes AL_INVALID_OPERATION


bandrewk
 Share

Recommended Posts

Hello,

 

when trying to release an Leadwerks::Source my program immediately crashes with error code 1:

 

The thread 0x26f8 has exited with code 1 (0x1).

The thread 0x2734 has exited with code 1 (0x1).

The thread 0x26fc has exited with code 1 (0x1).

The thread 0x24f4 has exited with code 1 (0x1).

The thread 0x4a8 has exited with code 1 (0x1).

The thread 0x2620 has exited with code 1 (0x1).

The thread 0x2674 has exited with code 1 (0x1).

The thread 0x27e4 has exited with code 1 (0x1).

The thread 0x2670 has exited with code 1 (0x1).

The thread 0x17b8 has exited with code 1 (0x1).

The thread 0x2730 has exited with code 1 (0x1).

The program '[10184] Client.debug.exe' has exited with code 1 (0x1).

 

Loading:

Sound* buffer;
buffer = Sound::Load("Sounds/Weapons/" + name + "/fire.wav");
source[sND_FIRE] = Source::Create();
source[sND_FIRE]->SetSound(buffer);
buffer->Release();
buffer = nullptr;

 

Playing:

  // Play source
  if (source[sND_FIRE]->GetState() == Source::Playing)
  {
   source[sND_FIRE]->Stop();
  }
  source[sND_FIRE]->SetPosition(entity->GetPosition(true));
  source[sND_FIRE]->Play();

 

Deleting:

for (int i = 0; i < NUM_SOUNDS; i++)
{
 if (source[i])
 {
  if (source[i]->GetState() == Source::Playing)
  {
   source[i]->Stop();
  }
  source[i]->Release(); // Crashes here
  source[i] = nullptr;
 }
}

 

The last thing Leadwerks writes to console is "Open AL: AL_INVALID_OPERATION". I noticed exactly the same behavior when trying to play a sound that is already playing. I attached the sound used in the example above. A screenshot of the object after the crash:

source[0] is the object on which the crash occurred.

 

zsqs02.jpg

Link to comment
Share on other sites

  • 2 months later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...