From 3cdbf8bf014f72827906ef1ba1715845a95e9919 Mon Sep 17 00:00:00 2001 From: Kae <80987908+Novaenia@users.noreply.github.com> Date: Wed, 19 Jul 2023 18:15:49 +1000 Subject: Lua functions for updating Voice settings, improve loudness visualization --- source/frontend/StarVoiceLuaBindings.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'source/frontend/StarVoiceLuaBindings.cpp') 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 onlyPlaying) -> List { List 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 }, }); } -- cgit v1.2.3