5 ms·
libsoundio has a working implementation of this. It's been tested on Linux, Windows, and MacOS. http://libsound.io/ http://libsound.io/ Interesting bits of th
by AndyKelley 11y ago
libsoundio has a working implementation of this. It's been tested on Linux, Windows, and MacOS.
http://libsound.io/ http://libsound.io/
Interesting bits of the implementation are here: https://github.com/andrewrk/libsoundio/blob/1fe64770bde0a4fb4a9a7f08e3bce8d4ee89b7c2/src/os.c#L617 https://github.com/andrewrk/libsoundio/blob/1fe64770bde0a4fb...
- 0x0 11y agoIs it missing a "close(fd)" in the "if (address == MAP_FAILED)" case?
- AndyKelley 11y agoNice catch. Fixed.
- 0x0 11y agoThat was quick :)
- AstralStorm 11y agoWhat are those locks I see in realtime functions? Sources of unbounded runtime and hanged machines? Can you prove they are always safe? (at least on the level of linux kernel LOCKDEP) I bet you cannot, because 1.1.0 changelog mentions "fixing" a deadlock by tossing functionality. Likewise, I see a lot of places that do reference counting (those _ref/_unref calls). Those are probable deallocations on heap from RT side, which have unbounded runtime unless you have a realtime memory allocator. I haven't noticed anything like that in the code. This coming from a guy who supposedly "has carefully read the documentation for every audio backend and understands the purpose of every line of code." For people who want to get a primer on such issues, I recommend this book: http://www.amazon.com/Real-Time-Systems-Programming-Languages-International/dp/0321417453 http://www.amazon.com/Real-Time-Systems-Programming-Language... It's a bit old despite updates (e.g. no C++11, no C99), but still highly relevant. The techniques themselves and the analysis parts are well written.
- anon4 11y agoIt's a reasonably small, sane implementation under a liberal license. I posit that you wouldn't be able to do better on your first try and your time would be better spent improving the corner cases on it, rather than reinventing the wheel.
- AndyKelley 11y agoYou are mistaken about the presence of locks and memory deallocation in real-time functions. I invite you to point out specific lines of code and I'll help you fix your understanding.
- biokoda 11y agoIt's very unfortunate libsound does not have iOS/Android support. So much development is on those platforms at the moment and nothing good is available. Whereas there are a number of high quality desktop libraries anyone can use.
- fit2rule 11y agoAudioKit: http://audiokit.io http://audiokit.io SFML: http://www.sfml-dev.org/ http://www.sfml-dev.org/ FMOD: http://www.fmod.org/wpfb-file/fmodapi375xbox-zip/ http://www.fmod.org/wpfb-file/fmodapi375xbox-zip/ OpenAL: http://openal.org http://openal.org .. I think the problem is there are too many of these libraries .. seems like nobody does a search, decides to roll their own, and we now have a glut ..
- biokoda 11y agoEither GPL so can't be used commercially, or they do not have both android and ios support.