summaryrefslogtreecommitdiff
path: root/libs/ardour/luaproc.cc
diff options
context:
space:
mode:
authorJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-04 18:03:24 +0200
committerJulien "_FrnchFrgg_" RIVAUD <frnchfrgg@free.fr>2016-08-06 19:38:09 +0200
commit43cd3fd7606bc765c6ff3af43eada389eddb1beb (patch)
treee8b260952a36a38e9386983e7df677fa7dee7c64 /libs/ardour/luaproc.cc
parent66470b96b71571a0de34a9c4e64edff318211c30 (diff)
Use a default configuration instead of bailing out
If the script doesn't provide a dsp_ioconfig() function, or if it does not return a table of tables, provide an empty table of table as default, which means a single configuration with default values.
Diffstat (limited to 'libs/ardour/luaproc.cc')
-rw-r--r--libs/ardour/luaproc.cc26
1 files changed, 15 insertions, 11 deletions
diff --git a/libs/ardour/luaproc.cc b/libs/ardour/luaproc.cc
index e157467094..e73b18ee21 100644
--- a/libs/ardour/luaproc.cc
+++ b/libs/ardour/luaproc.cc
@@ -329,22 +329,24 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
lua_State* L = lua.getState ();
luabridge::LuaRef ioconfig = luabridge::getGlobal (L, "dsp_ioconfig");
- if (!ioconfig.isFunction ()) {
- return false;
- }
luabridge::LuaRef *_iotable = NULL; // can't use reference :(
- try {
- luabridge::LuaRef iotable = ioconfig ();
- if (iotable.isTable ()) {
- _iotable = new luabridge::LuaRef (iotable);
+
+ if (ioconfig.isFunction ()) {
+ try {
+ luabridge::LuaRef iotable = ioconfig ();
+ if (iotable.isTable ()) {
+ _iotable = new luabridge::LuaRef (iotable);
+ }
+ } catch (luabridge::LuaException const& e) {
+ _iotable = NULL;
}
- } catch (luabridge::LuaException const& e) {
- return false;
}
if (!_iotable) {
- return false;
+ /* empty table as default */
+ luabridge::LuaRef iotable = luabridge::newTable(L);
+ _iotable = new luabridge::LuaRef (iotable);
}
// now we can reference it.
@@ -352,7 +354,9 @@ LuaProc::can_support_io_configuration (const ChanCount& in, ChanCount& out, Chan
delete _iotable;
if ((iotable).length () < 1) {
- return false;
+ /* empty table as only config, to get default values */
+ luabridge::LuaRef ioconf = luabridge::newTable(L);
+ iotable[1] = ioconf;
}
const int audio_in = in.n_audio ();