diff options
Diffstat (limited to 'source/frontend/StarVoiceLuaBindings.cpp')
-rw-r--r-- | source/frontend/StarVoiceLuaBindings.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/source/frontend/StarVoiceLuaBindings.cpp b/source/frontend/StarVoiceLuaBindings.cpp index e3271fd..a91937e 100644 --- a/source/frontend/StarVoiceLuaBindings.cpp +++ b/source/frontend/StarVoiceLuaBindings.cpp @@ -6,17 +6,21 @@ namespace Star { LuaCallbacks LuaBindings::makeVoiceCallbacks(Voice* voice) { LuaCallbacks callbacks; + callbacks.registerCallback("getSettings", [voice]() -> Json { return voice->saveJson(); }); + callbacks.registerCallback("mergeSettings", [voice](Json const& settings) { voice->loadJson(settings); }); + callbacks.registerCallback("speakers", [voice](Maybe<bool> onlyPlaying) -> List<Json> { List<Json> list; for (auto& speaker : voice->speakers(onlyPlaying.value(true))) { list.append(JsonObject{ - {"speakerId", speaker->speakerId }, - {"entityId", speaker->entityId }, - {"name", speaker->name }, - {"playing", (bool)speaker->playing }, - {"muted", (bool)speaker->muted }, - {"loudness", (float)speaker->decibelLevel }, + {"speakerId", speaker->speakerId }, + {"entityId", speaker->entityId }, + {"name", speaker->name }, + {"playing", (bool)speaker->playing }, + {"muted", (bool)speaker->muted }, + {"decibels", (float)speaker->decibelLevel }, + {"smoothDecibels", (float)speaker->smoothDb }, }); } |