Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Strange, unknown exception thrown in openal32.dll  (Read 3396 times)

0 Members and 1 Guest are viewing this topic.

Lakstoties

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Strange, unknown exception thrown in openal32.dll
« on: August 06, 2016, 09:12:35 pm »
I've been trying to rig up some basic pseudo-FM synthesizing/module tracker music system using the basic Sound object in SFML.  It works well enough.  I create a 1 second waveform at 1 hertz at 44.1k sampling rate.  I load it up into the sound buffers, loop it, and plays it just fine.  The trouble happens when I use the pitch control to increase the frequency beyond 557.  At this point, an exception is thrown somewhere within openal32.dll.  The exact message below:

Exception thrown at 0x00202EB4 (openal32.dll) in Drug War X.exe: 0xC0000005: Access violation reading location 0x011A6000.

I don't have the debug symbols for the openal32.dll file, but I thought it was strange.  I don't know if I'm hitting a limitation of the pitch control or if there's something strange I'm doing.  I've tested this by drastically increasing the sample set size by a factor of 10, giving more of a buffer to play at the higher speeds... But it still fails right around pitch = 557.  So, this might be some weirdness with openal32.dll internally.  The only work around I've found is to generate the base sample at a higher frequency (60hz for example) and scaling to that to avoid setting the Sound's pitch control beyond 557.

Here's a link to the project I'm working on...  It's an attempt to create a game engine that gives that pseudo ol' school direct to hardware control feel and is somewhat emulating a strange little game console.  I'm planning on open sourcing it later once I finish up the basics, provide some more helping bits, create a demo game, and drastically clean up the code base.  But, for the curious, here's the test project:

https://www.amazon.com/clouddrive/share/cOBg6N8EG599t5b8fUOufrJNJFsdUSP3QwxW2nQc7x8?ref_=cd_ph_share_link_copy

The top row number keys are rigged up to play simulated voice channels on the sound system, and are set to frequency of the piano around middle C.  Key "0" is special in that "Q" and "W" adjust the volume of it and "A" and "S" adjust the pitch on the fly.  Going past 557hz will trigger the exception in openal32.dll.  The arrow keys will move around the select box in the menu and the cursor in the menu.  The numeric pad "+" and "-" keys will change the characters in the C strings in the menu to another character from the character ROM I've created.

The current goal for the sound system is the provide all the functions to generate basic waveforms and then setup a threaded system to allow someone to program dynamic ADSR envelopes and frequency modulation without needing to regenerate the basic waveform... hence keeping the thing relatively efficient.

Pardon the god awful C/C++ 11, it's been awhile since I did raw C/C++ and my first project with C++ 11 functionality.  (Threads are pretty nice in this one.)  Any help or advice would be appreciated.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Strange, unknown exception thrown in openal32.dll
« Reply #1 on: August 06, 2016, 11:04:11 pm »
I wonder if your problem is possibly related to this?

I've been trying to rig up some basic pseudo-FM synthesizing/module tracker music system using the basic Sound object in SFML.
Done this myself. Was much fun (at first - got irritating quickly). Still need to finish it :)

a higher frequency (60hz for example)
60hz is a very low bass frequency, quite close to sub-bass even.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Lakstoties

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Strange, unknown exception thrown in openal32.dll
« Reply #2 on: August 07, 2016, 12:41:31 am »
Doing some testing... The issue is tied to the sample rate.

At 44100hz, I can get the pitch to 557.
Going from 44100hz to 48000hz, I could only get the pitch to 512.   Inversely proportional to the sample rate change.
Going from 44100hz to 22050hz, I could get the pitch to 1114.  Half the frequency, double the pitch range.

I get the feeling there's some kind of hard limit being hit when it comes to speeding up playback.  I wonder if openal32 is doing something with the sample rate to alter playback and change pitch.

This is quite strange.  Well, if all else fails I may see about creating a SoundStream object with a circular buffer and see if I could do some trickery with frequency and buffer copy jumping to get the same effect desired.


Yes, 60hz is a lower bass frequency but as a base sample to pitch speed from it's about 60 times larger than the original 1hz sample.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Strange, unknown exception thrown in openal32.dll
« Reply #3 on: August 08, 2016, 10:43:40 am »
You're looping a very small sample at a very high loop rate, right? Maybe there is a limit in OpenAL to how often/quickly it can loop.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Lakstoties

  • Newbie
  • *
  • Posts: 3
    • View Profile
    • Email
Re: Strange, unknown exception thrown in openal32.dll
« Reply #4 on: August 21, 2016, 08:07:57 pm »
I did some research and found out the "pitch" aspect of OpenAL is implementation specific when it comes to the ranges.  So, it's different depending on platform and compilation.  Oh well, back to the drawing board, I'll see if I can something working with a custom SoundStream object and some tricky interpolation.