From 0624314bd30803cfa4328f7eb6776c09fcbff108 Mon Sep 17 00:00:00 2001 From: Vektor Date: Thu, 3 Aug 2023 10:05:37 +0200 Subject: [PATCH] audio api changes --- client/src/bindings/Audio.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/src/bindings/Audio.cpp b/client/src/bindings/Audio.cpp index 14c636e6..e43760f5 100644 --- a/client/src/bindings/Audio.cpp +++ b/client/src/bindings/Audio.cpp @@ -10,12 +10,14 @@ static void Constructor(const v8::FunctionCallbackInfo& info) { V8_GET_ISOLATE_CONTEXT_RESOURCE(); V8_CHECK_CONSTRUCTOR(); - V8_CHECK_ARGS_LEN(2); + V8_CHECK_ARGS_LEN_MIN_MAX(1, 3); V8_ARG_TO_STRING(1, source); - V8_ARG_TO_NUMBER(2, volume); + V8_ARG_TO_NUMBER_OPT(2, volume, 1.f); + V8_ARG_TO_BOOLEAN_OPT(3, radio, false); - auto audio = alt::ICore::Instance().CreateAudio(source, volume, resource->GetResource()); + std::string origin = V8Helpers::GetCurrentSourceOrigin(isolate); + auto audio = alt::ICore::Instance().CreateAudio(source, volume, radio, origin, resource->GetResource()); V8_BIND_BASE_OBJECT(audio, "Failed to create Audio"); }