Hi there,
I started exploring JUCE to build a static library for my iOS app to use.
I found a blog post online that seems to be a good starting point, at: Play any sound in an Android or iOS app with JUCE (3/3) | by Matthieu Regnauld | Medium
However at runtime, when the code attempts to create an instance of juce::AudioDeviceManager
, it always hits the assertion failure of JUCE_ASSERT_MESSAGE_THREAD
and prints in the console: JUCE Assertion failure in juce_CoreMidi_mac.mm:591
. See stack trace at the bottom for details.
Does anyone know how this can be resolved?
Following the code from stack trace I can see this code comment in juce_CoreMidi_mac.mm
:
// It seems that OSX can be a bit picky about the thread that's first used to
// search for devices. It's safest to use the message thread for calling this.
JUCE_ASSERT_MESSAGE_THREAD
… and my code is actually running on an iOS device so I wonder if there are some flags I have to set in order for JUCE to not execute the “mac” code?
I have also tried running the JUCE code from background thread, no difference.
If anyone has more docs about setting up a static library for iOS project to use, that will be really great too!
Thank you.
|#1|0x00000001005ff280 in juce::CoreMidiHelpers::findDevices(bool) at /Documents/JUCE/modules/juce_audio_devices/native/juce_CoreMidi_mac.mm:591|
|---|---|
|#2|0x00000001005ff21c in juce::MidiInput::getAvailableDevices() at /Documents/JUCE/modules/juce_audio_devices/native/juce_CoreMidi_mac.mm:1087|
|#3|0x0000000100616c94 in juce::MidiDeviceListConnectionBroadcaster::State::State() at /Documents/JUCE/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp:75|
|#4|0x00000001006169f8 in juce::MidiDeviceListConnectionBroadcaster::State::State() at /Documents/JUCE/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp:73|
|#5|0x00000001006195a0 in juce::MidiDeviceListConnectionBroadcaster::MidiDeviceListConnectionBroadcaster() at /Documents/JUCE/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp:71|
|#6|0x0000000100619514 in juce::MidiDeviceListConnectionBroadcaster::MidiDeviceListConnectionBroadcaster() at /Documents/JUCE/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp:71|
|#7|0x0000000100600eac in juce::MidiDeviceListConnectionBroadcaster::get() at /Documents/JUCE/modules/juce_audio_devices/midi_io/juce_MidiDevices.cpp:66|
|#8|0x0000000100600db4 in juce::MidiDeviceListConnection::make(std::__1::function<void ()>) at /Documents/JUCE/modules/juce_audio_devices/native/juce_CoreMidi_mac.mm:1278|
|#9|0x0000000100601298 in juce::AudioDeviceManager::AudioDeviceManager() at /Documents/JUCE/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.h:505|
|#10|0x0000000100601afc in juce::AudioDeviceManager::AudioDeviceManager() at /Documents/JUCE/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp:114|
|#11|0x00000001005f3f30 in jad::AudioSamplePlayer::AudioSamplePlayer() at /Documents/Workspaces/JuceProjects/JuiceDemo/Source/AudioSamplePlayer.cpp:15|
|#12|0x00000001005f41a4 in jad::AudioSamplePlayer::AudioSamplePlayer() at /Documents/Workspaces/JuceProjects/JuiceDemo/Source/AudioSamplePlayer.cpp:16|
|#13|0x00000001005eeba0 in AudioPlayer::AudioPlayer() at /Documents/Workspaces/XcodeProjects/JuiceDemoRunner/JuiceDemoRunner/Native/Cpp/AudioPlayer.cpp:4|
|#14|0x00000001005eec38 in AudioPlayer::AudioPlayer() at /Documents/Workspaces/XcodeProjects/JuiceDemoRunner/JuiceDemoRunner/Native/Cpp/AudioPlayer.cpp:5|
|#15|0x00000001005ec268 in NativeLib::createPlayer() at /Documents/Workspaces/XcodeProjects/JuiceDemoRunner/JuiceDemoRunner/Native/Cpp/NativeLib.cpp:20|
|#16|0x00000001005ee8a8 in -[NativeLibWrapper createPlayer] at /Documents/Workspaces/XcodeProjects/JuiceDemoRunner/JuiceDemoRunner/Native/ObjC/NativeLibWrapper.cpp:41|
|#17|0x00000001005f1e7c in NativeManager.setup() at /Documents/Workspaces/XcodeProjects/JuiceDemoRunner/JuiceDemoRunner/NativeManager.swift:30|
|#18|0x00000001005f0470 in closure #2 in ContentView.body.getter at /Documents/Workspaces/XcodeProjects/JuiceDemoRunner/JuiceDemoRunner/ContentView.swift:29|