Skip to content

How can I switch device in ma_engine #871

Closed Answered by mackron
m1maker asked this question in Q&A
Discussion options

You must be logged in to vote

I somehow missed this one. You don't change the internal device when using ma_engine. What you can do instead is use the ma_device API directly and initialize your ma_engine object to not use it's own self-managed ma_device. To do this, you configure the engine's config:

engineConfig.noDevice = MA_TRUE; // <-- This tells miniaudio to not use an internal `ma_device` with the `ma_engine` object.
engineConfig.channels = YOUR_CHANNEL_COUNT; // <-- This and `sampleRate` *must* be specified when `noDevice` is set.
engineConfig.sampleRate = YOUR_SAMPLE_RATE;

Then you need to manually call ma_engine_read_pcm_frames() in your ma_device data callback. With this technique you are using both the low-…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by m1maker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants