[openal] My code runs with no errors, but no sound

Patrick Baggett baggett.patrick at gmail.com
Wed Mar 2 11:04:28 EST 2022


You can also reduce the test case to "can I hear anything or not" by
filling a buffer with white noise instead of trying a WAV file if you think
the file loader is the problem:

const ALsizei freq = 44100; //samples / sec
const ALsizei noise_size = freq * sizeof(int16_t) ; // 1 second * 44100
samples / second  * 2 bytes  / sample = 88200 bytes

//Generate white noise
srand(time(NULL));
int16_t* noise = malloc(noise_size);
for(int i=0; i<freq; i++) {
     noise[i] = (int16_t)(rand() & 0xFFFF);
}

alBufferData(source[0], AL_FORMAT_MONO16, noise, noise_size, freq);


On Wed, Mar 2, 2022 at 8:17 AM Sean <s.tolstoyevski at gmail.com> wrote:

> Use dr_libs to load wav files correctly.
>
> On 01/03/2022 22:16, Jana Cole 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 listopenal at openal.orghttp://openal.org/mailman/listinfo/openal
>
> _______________________________________________
> 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/20220302/6413932e/attachment-0001.htm>


More information about the openal mailing list