[openal] My code runs with no errors, but no sound
Patrick Baggett
baggett.patrick at gmail.com
Tue Mar 1 14:30:50 EST 2022
Hi Jana,
I think your problem is that you're immediately deleting stuff after
alSourcePlay().
Specifically here:
* Play source.
*--------------*/
alGetError();
alSourcePlay(sources[0]);
if ((error = alGetError()) != AL_NO_ERROR) std::cout << "Error
alSourcePlay()\n";
else std::cout << "No error playing source.\n";
/*****************
* Close down.
*--------------*/
alDeleteSources(NUM_SOURCES, sources);
alDeleteBuffers(NUM_BUFFERS, buffers);
- /*****************
if (!alcMakeContextCurrent(nullptr)) // Move currentcy away from the
context I want to close.
Try inserting a pause or use alGetSourcei(... AL_SOURCE_STATE...) to see
when the source has finished playing:
int value = AL_STOPPED;
do {
sleep(250);
alGetSourcei(sources[0], AL_SOURCE_STATE, &value);
while(value != AL_STOPPED);
Let me know if that works.
Patrick Baggett
On Tue, Mar 1, 2022 at 1:16 PM Jana Cole <quikscor at ix.netcom.com> wrote:
> Hello,
>
>
>
> I'm hoping to get some help with some code where I'm getting no errors,
> but also no sound. It seems to be correct, based on the programmer's guide,
> but I must be missing something.
>
>
>
> I posted the code here, it's 368 lines: https://pastebin.com/mqCrx2KX
>
>
>
> I've tried everything I can think of, checking for errors, checking all
> return types, putting couts in strategic places, my sound generally works
> on my laptop, I tried different sound files. The one I'm using plays fine
> on Windows Media Player. It's 44100Hz, 16-bit stereo. It's one second long.
>
>
>
> I'm on Visual Studio, Windows 10.
>
> I'm linking to OpenAL32.lib.
>
>
>
> I'd be very grateful for any help or suggestions on this.
>
>
>
> Thanks in advance for any suggestions.
>
>
>
> Jana in San Francisco
>
>
> _______________________________________________
> openal mailing list
> openal at openal.org
> http://openal.org/mailman/listinfo/openal
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openal.org/pipermail/openal/attachments/20220301/40e05e0c/attachment.htm>
More information about the openal
mailing list