bool found = false;
bool exact_match = false;
- const int32_t audio_in = in.n_audio ();
- int32_t midi_out = _has_midi_output ? 1 : 0;
+ const int audio_in = in.n_audio ();
+ int midi_out = _has_midi_output ? 1 : 0;
// preferred setting (provided by plugin_insert)
- assert (out.n_audio () > 0 || midi_out > 0);
const int preferred_out = out.n_audio ();
for (luabridge::Iterator i (iotable); !i.isNil (); ++i) {
- assert (i.value ().type () == LUA_TTABLE);
luabridge::LuaRef io (i.value ());
+ if (!io.isTable()) {
+ continue;
+ }
- int possible_in = io["audio_in"];
- int possible_out = io["audio_out"];
+ int possible_in = io["audio_in"].isNumber() ? io["audio_in"] : -1;
+ int possible_out = io["audio_out"].isNumber() ? io["audio_out"] : -1;
// exact match
if ((possible_in == audio_in) && (possible_out == preferred_out)) {
}
/* now allow potentially "imprecise" matches */
- int32_t audio_out = -1;
+ int audio_out = -1;
float penalty = 9999;
#define FOUNDCFG(nch) { \
}
for (luabridge::Iterator i (iotable); !i.isNil (); ++i) {
- assert (i.value ().type () == LUA_TTABLE);
luabridge::LuaRef io (i.value ());
+ if (!io.isTable()) {
+ continue;
+ }
- int possible_in = io["audio_in"];
- int possible_out = io["audio_out"];
+ int possible_in = io["audio_in"].isNumber() ? io["audio_in"] : -1;
+ int possible_out = io["audio_out"].isNumber() ? io["audio_out"] : -1;
if (possible_out == 0) {
if (possible_in == 0) {
if (found && imprecise) {
*imprecise = in;
- imprecise->set (DataType::MIDI, _has_midi_input ? 1 : 0);
}
if (!found && imprecise) {
/* try harder */
for (luabridge::Iterator i (iotable); !i.isNil (); ++i) {
- assert (i.value ().type () == LUA_TTABLE);
luabridge::LuaRef io (i.value ());
+ if (!io.isTable()) {
+ continue;
+ }
- int possible_in = io["audio_in"];
- int possible_out = io["audio_out"];
+ int possible_in = io["audio_in"].isNumber() ? io["audio_in"] : -1;
+ int possible_out = io["audio_out"].isNumber() ? io["audio_out"] : -1;
if (possible_out == 0 && possible_in == 0 && _has_midi_output) {
assert (audio_in > 0); // no input is handled above
}
assert (possible_in > 0); // all other cases will have been matched above
- assert (possible_out !=0 || possible_in !=0); // already handled above
imprecise->set (DataType::AUDIO, possible_in);
if (possible_out == -1 || possible_out == -2) {
lin.set (DataType::MIDI, c);
}
}
- _info->n_inputs = lin;
if (io["midi_out"].type() == LUA_TNUMBER) {
const int c = io["midi_out"].cast<int> ();
if (c >= 0) {