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_copyThe 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.