<div dir="ltr"><div>Hi Jana,</div><div><br></div><div>I think your problem is that you're immediately deleting stuff after alSourcePlay().</div><div><br></div><div>Specifically here:</div><div><br></div><div>
<div class="gmail-de1"><span style="font-family:monospace"><span class="gmail-coMULTI"> * Play source.</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"><span class="gmail-coMULTI"> *--------------*/</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> alGetError<span class="gmail-br0">(</span><span class="gmail-br0">)</span><span class="gmail-sy4">;</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> alSourcePlay<span class="gmail-br0">(</span>sources<span class="gmail-br0">[</span><span class="gmail-nu0">0</span><span class="gmail-br0">]</span><span class="gmail-br0">)</span><span class="gmail-sy4">;</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> <span class="gmail-kw1">if</span> <span class="gmail-br0">(</span><span class="gmail-br0">(</span>error <span class="gmail-sy1">=</span> alGetError<span class="gmail-br0">(</span><span class="gmail-br0">)</span><span class="gmail-br0">)</span> <span class="gmail-sy3">!</span><span class="gmail-sy1">=</span> AL_NO_ERROR<span class="gmail-br0">)</span> std<span class="gmail-sy4">::</span><span class="gmail-kw3">cout</span> <span class="gmail-sy1"><<</span> <span class="gmail-st0">"Error alSourcePlay()<span class="es1">\n</span>"</span><span class="gmail-sy4">;</span></span> </div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> <span class="gmail-kw1">else</span> std<span class="gmail-sy4">::</span><span class="gmail-kw3">cout</span> <span class="gmail-sy1"><<</span> <span class="gmail-st0">"No error playing source.<span class="es1">\n</span>"</span><span class="gmail-sy4">;</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> </span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> <span class="gmail-coMULTI">/*****************</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"><span class="gmail-coMULTI"> * Close down.</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"><span class="gmail-coMULTI"> *--------------*/</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> </span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> alDeleteSources<span class="gmail-br0">(</span>NUM_SOURCES, sources<span class="gmail-br0">)</span><span class="gmail-sy4">;</span></span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> alDeleteBuffers<span class="gmail-br0">(</span>NUM_BUFFERS, buffers<span class="gmail-br0">)</span><span class="gmail-sy4">;</span></span></div><span style="font-family:monospace">
</span><li class="gmail-li1"><div class="gmail-de1"><span style="font-family:monospace"> <span class="gmail-coMULTI">/*****************</span></span></div></li></div><div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> </span></div><span style="font-family:monospace">
</span><div class="gmail-de1"><span style="font-family:monospace"> <span class="gmail-kw1">if</span> <span class="gmail-br0">(</span><span class="gmail-sy3">!</span>alcMakeContextCurrent<span class="gmail-br0">(</span>nullptr<span class="gmail-br0">)</span><span class="gmail-br0">)</span> <span class="gmail-co1">// Move currentcy away from the context I want to close.</span></span></div><span style="font-family:monospace">
</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">Try inserting a pause or use alGetSourcei(... AL_SOURCE_STATE...) to see when the source has finished playing:</font></span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:monospace">
</span><div><span style="font-family:monospace">int value = AL_STOPPED;<br></span></div><div><span style="font-family:monospace"> </span></div>
<span style="font-family:monospace">do {</span></div><div><span style="font-family:monospace"> sleep(250);<br></span></div><span style="font-family:monospace"> alGetSourcei(sources[0], AL_SOURCE_STATE, &value);</span><br><span style="font-family:monospace"></span><div><span style="font-family:monospace">while(value != AL_STOPPED);<br></span></div><br><div>
<div><span style="font-family:monospace">
</span><div><span style="font-family:monospace"><font face="arial,sans-serif">Let me know if that works.</font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif"><br></font></span></div><div><span style="font-family:monospace"><font face="arial,sans-serif">Patrick Baggett<br></font></span></div><div><span style="font-family:monospace"><br></span></div>
</div><div><span style="font-family:monospace"><br></span></div>
</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 1, 2022 at 1:16 PM Jana Cole <<a href="mailto:quikscor@ix.netcom.com">quikscor@ix.netcom.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:12pt"><p style="margin:0.1rem 0px;line-height:1">Hello,</p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1">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. </p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1">I posted the code here, it's 368 lines: <a href="https://pastebin.com/mqCrx2KX" target="_blank">https://pastebin.com/mqCrx2KX</a></p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1">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.</p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1">I'm on Visual Studio, Windows 10.</p>
<p style="margin:0.1rem 0px;line-height:1">I'm linking to OpenAL32.lib. </p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1">I'd be very grateful for any help or suggestions on this.</p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1">Thanks in advance for any suggestions.</p>
<p style="margin:0.1rem 0px;line-height:1"> </p>
<p style="margin:0.1rem 0px;line-height:1">Jana in San Francisco</p>
<p style="margin:0.1rem 0px;line-height:1"> </p></div>_______________________________________________<br>
openal mailing list<br>
<a href="mailto:openal@openal.org" target="_blank">openal@openal.org</a><br>
<a href="http://openal.org/mailman/listinfo/openal" rel="noreferrer" target="_blank">http://openal.org/mailman/listinfo/openal</a><br>
</blockquote></div>