andrewrk / libsoundio

C library for cross-platform real-time audio input and output
http://libsound.io/
MIT License
1.94k stars 230 forks source link

fix microphone example fill with zeros case #152

Closed ul closed 7 years ago

ul commented 7 years ago

Usually when microphone example is run you never hit buffer underflow and "fill with zeros" branch is never executed. But when it's executed it fails with "invalid value" because of checks performed on frame_count. This platform-independent check https://github.com/andrewrk/libsoundio/blob/8094dc52498dc97dcadd60c35df737c86d6c6614/src/soundio.c#L447 sometimes passed because unitialized local frame_count have arbitrary value, but this CoreAudio one https://github.com/andrewrk/libsoundio/blob/8094dc52498dc97dcadd60c35df737c86d6c6614/src/coreaudio.c#L1078 is not passed, and "fill with zeros" scenario always fails on MacOS.

andrewrk commented 7 years ago

Thank you