mackron / miniaudio

Audio playback and capture library written in C, in a single source file.
https://miniaud.io
Other
4.07k stars 361 forks source link

Is it possible to use init_file/init_file_w with resource manager? #696

Closed mackron closed 1 year ago

mackron commented 1 year ago

Discussed in https://github.com/mackron/miniaudio/discussions/695

Originally posted by **bjorn-nesby** June 26, 2023 I'm working on a wrapper around the OS-provided decoder in macOS (Audio Toolbox framework), and have a quick question with regard to this: Our implementation is using the miniaudio resource manager to handle loading files. When supplying a custom decoder, I'm wondering if it would be possible to somehow instruct the resource manager to invoke the init_file or init_file_w methods when it's initializing the decoder? The reason I'm asking is that the audio toolbox framework has some very handy (high level) methods for decoding compressed files, but these methods only accept file path. And yes, I guess I'm basically sidestepping the resource manager by doing this. But someone told me that lazyness is a virtue when programming, and the alternative here seems to be to re-implement a lot of the audiotoolbox functionality using its (callback-based) lower level API :-)
mackron commented 1 year ago

The dev branch has been updated with a potential fix for this issue.