From 0a7feb096a125a8d5c743f2df8c0ea9da89a665c Mon Sep 17 00:00:00 2001 From: Maciej Makowski Date: Wed, 11 Dec 2024 18:56:29 +0100 Subject: [PATCH] ci: yarn format --- .../AudioAPIInstaller/AudioAPIInstaller.cpp | 3 +- .../AudioAPIInstallerHostObject.cpp | 12 ++++--- .../AudioAPIInstallerHostObject.h | 32 ++++++++++--------- .../AudioBufferSourceNodeHostObject.cpp | 4 +-- .../HostObjects/AudioContextHostObject.cpp | 2 +- .../cpp/HostObjects/AudioContextHostObject.h | 5 ++- .../cpp/HostObjects/AudioNodeHostObject.cpp | 12 +++---- .../cpp/HostObjects/AudioNodeHostObject.h | 3 +- .../cpp/HostObjects/AudioParamHostObject.cpp | 4 +-- .../AudioScheduledSourceNodeHostObject.cpp | 9 ++---- .../BaseAudioContextHostObject.cpp | 26 +++++++++------ .../BiquadFilterNodeHostObject.cpp | 3 +- .../HostObjects/BiquadFilterNodeHostObject.h | 3 +- .../cpp/HostObjects/GainNodeHostObject.cpp | 3 +- .../HostObjects/OscillatorNodeHostObject.h | 3 +- .../common/cpp/core/AudioDestinationNode.h | 2 +- .../ios/AudioAPIModule.mm | 3 +- .../ios/AudioDecoder/AudioDecoder.m | 19 ++++++----- 18 files changed, 74 insertions(+), 74 deletions(-) diff --git a/packages/react-native-audio-api/android/src/main/cpp/AudioAPIInstaller/AudioAPIInstaller.cpp b/packages/react-native-audio-api/android/src/main/cpp/AudioAPIInstaller/AudioAPIInstaller.cpp index 16a93bd6..4aba5426 100644 --- a/packages/react-native-audio-api/android/src/main/cpp/AudioAPIInstaller/AudioAPIInstaller.cpp +++ b/packages/react-native-audio-api/android/src/main/cpp/AudioAPIInstaller/AudioAPIInstaller.cpp @@ -13,7 +13,8 @@ AudioAPIInstaller::AudioAPIInstaller( jsCallInvoker_(jsCallInvoker) {} void AudioAPIInstaller::install() { - auto hostObject = std::make_shared(rnRuntime_, jsCallInvoker_); + auto hostObject = + std::make_shared(rnRuntime_, jsCallInvoker_); hostObject->install(); } } // namespace audioapi diff --git a/packages/react-native-audio-api/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.cpp b/packages/react-native-audio-api/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.cpp index 1e38ede7..d999aaf0 100644 --- a/packages/react-native-audio-api/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.cpp @@ -4,8 +4,9 @@ namespace audioapi { using namespace facebook; AudioAPIInstallerHostObject::AudioAPIInstallerHostObject( - jsi::Runtime *runtime, - const std::shared_ptr &jsInvoker): rnRuntime_(runtime) { + jsi::Runtime *runtime, + const std::shared_ptr &jsInvoker) + : rnRuntime_(runtime) { promiseVendor_ = std::make_shared(runtime, jsInvoker); } @@ -33,9 +34,10 @@ jsi::Value AudioAPIInstallerHostObject::get( const jsi::Value &thisValue, const jsi::Value *arguments, size_t count) -> jsi::Value { - auto audioContext = std::make_shared(); - auto audioContextHostObject = std::make_shared( - audioContext, promiseVendor_); + auto audioContext = std::make_shared(); + auto audioContextHostObject = + std::make_shared( + audioContext, promiseVendor_); return jsi::Object::createFromHostObject( runtime, audioContextHostObject); }); diff --git a/packages/react-native-audio-api/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.h b/packages/react-native-audio-api/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.h index 7d849707..12c8dca3 100644 --- a/packages/react-native-audio-api/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.h +++ b/packages/react-native-audio-api/common/cpp/AudioAPIInstaller/AudioAPIInstallerHostObject.h @@ -12,30 +12,32 @@ namespace audioapi { using namespace facebook; -class AudioAPIInstallerHostObject : public jsi::HostObject, public std::enable_shared_from_this { - -public: +class AudioAPIInstallerHostObject + : public jsi::HostObject, + public std::enable_shared_from_this { + public: explicit AudioAPIInstallerHostObject( jsi::Runtime *runtime, const std::shared_ptr &jsInvoker); - jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override; + jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override; - void set( - jsi::Runtime &runtime, - const jsi::PropNameID &name, - const jsi::Value &value) override; + void set( + jsi::Runtime &runtime, + const jsi::PropNameID &name, + const jsi::Value &value) override; - std::vector getPropertyNames(jsi::Runtime &rt) override; + std::vector getPropertyNames(jsi::Runtime &rt) override; - void install() { - auto object = jsi::Object::createFromHostObject(*rnRuntime_, shared_from_this()); - rnRuntime_->global().setProperty( - *rnRuntime_, "__AudioAPIInstaller", std::move(object)); - } + void install() { + auto object = + jsi::Object::createFromHostObject(*rnRuntime_, shared_from_this()); + rnRuntime_->global().setProperty( + *rnRuntime_, "__AudioAPIInstaller", std::move(object)); + } private: std::shared_ptr promiseVendor_; - jsi::Runtime *rnRuntime_; + jsi::Runtime *rnRuntime_; }; } // namespace audioapi diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/AudioBufferSourceNodeHostObject.cpp b/packages/react-native-audio-api/common/cpp/HostObjects/AudioBufferSourceNodeHostObject.cpp index 169ae1be..4b5218e4 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/AudioBufferSourceNodeHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/HostObjects/AudioBufferSourceNodeHostObject.cpp @@ -7,8 +7,8 @@ AudioBufferSourceNodeHostObject::AudioBufferSourceNodeHostObject( const std::shared_ptr &node) : AudioScheduledSourceNodeHostObject(node) {} -std::shared_ptr AudioBufferSourceNodeHostObject:: - getAudioBufferSourceNodeFromAudioNode() { +std::shared_ptr +AudioBufferSourceNodeHostObject::getAudioBufferSourceNodeFromAudioNode() { return std::static_pointer_cast(node_); } diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/AudioContextHostObject.cpp b/packages/react-native-audio-api/common/cpp/HostObjects/AudioContextHostObject.cpp index b023a950..ff1654cc 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/AudioContextHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/HostObjects/AudioContextHostObject.cpp @@ -5,7 +5,7 @@ using namespace facebook; AudioContextHostObject::AudioContextHostObject( const std::shared_ptr &audioContext, - const std::shared_ptr& promiseVendor) + const std::shared_ptr &promiseVendor) : BaseAudioContextHostObject(audioContext, promiseVendor) {} std::vector AudioContextHostObject::getPropertyNames( diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/AudioContextHostObject.h b/packages/react-native-audio-api/common/cpp/HostObjects/AudioContextHostObject.h index dafc266b..d774ffc3 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/AudioContextHostObject.h +++ b/packages/react-native-audio-api/common/cpp/HostObjects/AudioContextHostObject.h @@ -15,7 +15,7 @@ class AudioContextHostObject : public BaseAudioContextHostObject { public: explicit AudioContextHostObject( const std::shared_ptr &audioContext, - const std::shared_ptr& promiseVendor); + const std::shared_ptr &promiseVendor); jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override; @@ -27,7 +27,6 @@ class AudioContextHostObject : public BaseAudioContextHostObject { std::vector getPropertyNames(jsi::Runtime &rt) override; private: - std::shared_ptr - getAudioContextFromBaseAudioContext(); + std::shared_ptr getAudioContextFromBaseAudioContext(); }; } // namespace audioapi diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/AudioNodeHostObject.cpp b/packages/react-native-audio-api/common/cpp/HostObjects/AudioNodeHostObject.cpp index d0e61b47..4cc355ab 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/AudioNodeHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/HostObjects/AudioNodeHostObject.cpp @@ -4,8 +4,7 @@ namespace audioapi { using namespace facebook; -AudioNodeHostObject::AudioNodeHostObject( - const std::shared_ptr &node) +AudioNodeHostObject::AudioNodeHostObject(const std::shared_ptr &node) : node_(node) {} std::vector AudioNodeHostObject::getPropertyNames( @@ -41,8 +40,7 @@ jsi::Value AudioNodeHostObject::get( size_t count) -> jsi::Value { auto node = args[0].getObject(rt).getHostObject(rt); - node_->connect( - std::shared_ptr(node)->node_); + node_->connect(std::shared_ptr(node)->node_); return jsi::Value::undefined(); }); } @@ -59,8 +57,7 @@ jsi::Value AudioNodeHostObject::get( size_t count) -> jsi::Value { auto node = args[0].getObject(rt).getHostObject(rt); - node_->disconnect( - std::shared_ptr(node)->node_); + node_->disconnect(std::shared_ptr(node)->node_); return jsi::Value::undefined(); }); } @@ -78,8 +75,7 @@ jsi::Value AudioNodeHostObject::get( } if (propName == "channelCountMode") { - return jsi::String::createFromUtf8( - runtime, node_->getChannelCountMode()); + return jsi::String::createFromUtf8(runtime, node_->getChannelCountMode()); } if (propName == "channelInterpretation") { diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/AudioNodeHostObject.h b/packages/react-native-audio-api/common/cpp/HostObjects/AudioNodeHostObject.h index 56eb772c..5be9b870 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/AudioNodeHostObject.h +++ b/packages/react-native-audio-api/common/cpp/HostObjects/AudioNodeHostObject.h @@ -11,8 +11,7 @@ using namespace facebook; class AudioNodeHostObject : public jsi::HostObject { public: - explicit AudioNodeHostObject( - const std::shared_ptr &node); + explicit AudioNodeHostObject(const std::shared_ptr &node); jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override; diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/AudioParamHostObject.cpp b/packages/react-native-audio-api/common/cpp/HostObjects/AudioParamHostObject.cpp index 56408087..c8936a1c 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/AudioParamHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/HostObjects/AudioParamHostObject.cpp @@ -53,7 +53,7 @@ jsi::Value AudioParamHostObject::get( const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value { - auto value = static_cast(args[0].getNumber()); + auto value = static_cast(args[0].getNumber()); double startTime = args[1].getNumber(); param_->setValueAtTime(value, startTime); return jsi::Value::undefined(); @@ -70,7 +70,7 @@ jsi::Value AudioParamHostObject::get( const jsi::Value &thisVal, const jsi::Value *args, size_t count) -> jsi::Value { - auto value = static_cast(args[0].getNumber()); + auto value = static_cast(args[0].getNumber()); double endTime = args[1].getNumber(); param_->linearRampToValueAtTime(value, endTime); return jsi::Value::undefined(); diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/AudioScheduledSourceNodeHostObject.cpp b/packages/react-native-audio-api/common/cpp/HostObjects/AudioScheduledSourceNodeHostObject.cpp index 314f755b..ba769770 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/AudioScheduledSourceNodeHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/HostObjects/AudioScheduledSourceNodeHostObject.cpp @@ -4,8 +4,7 @@ namespace audioapi { using namespace facebook; std::shared_ptr -AudioScheduledSourceNodeHostObject:: - getAudioScheduledSourceNodeFromAudioNode() { +AudioScheduledSourceNodeHostObject::getAudioScheduledSourceNodeFromAudioNode() { return std::static_pointer_cast(node_); } @@ -34,8 +33,7 @@ jsi::Value AudioScheduledSourceNodeHostObject::get( const jsi::Value *args, size_t count) -> jsi::Value { auto time = args[0].getNumber(); - auto node = - getAudioScheduledSourceNodeFromAudioNode(); + auto node = getAudioScheduledSourceNodeFromAudioNode(); node->start(time); return jsi::Value::undefined(); }); @@ -52,8 +50,7 @@ jsi::Value AudioScheduledSourceNodeHostObject::get( const jsi::Value *args, size_t count) -> jsi::Value { auto time = args[0].getNumber(); - auto node = - getAudioScheduledSourceNodeFromAudioNode(); + auto node = getAudioScheduledSourceNodeFromAudioNode(); node->stop(time); return jsi::Value::undefined(); }); diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/BaseAudioContextHostObject.cpp b/packages/react-native-audio-api/common/cpp/HostObjects/BaseAudioContextHostObject.cpp index 935d9c55..5d7b8daa 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/BaseAudioContextHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/HostObjects/BaseAudioContextHostObject.cpp @@ -9,7 +9,8 @@ BaseAudioContextHostObject::BaseAudioContextHostObject( const std::shared_ptr &context, const std::shared_ptr &promiseVendor) : context_(context), promiseVendor_(promiseVendor) { - destination_ = std::make_shared(context->getDestination()); + destination_ = std::make_shared( + context->getDestination()); } std::vector BaseAudioContextHostObject::getPropertyNames( @@ -68,7 +69,8 @@ jsi::Value BaseAudioContextHostObject::get( const jsi::Value *arguments, size_t count) -> jsi::Value { auto oscillator = context_->createOscillator(); - auto oscillatorHostObject = std::make_shared(oscillator); + auto oscillatorHostObject = + std::make_shared(oscillator); return jsi::Object::createFromHostObject( runtime, oscillatorHostObject); }); @@ -101,7 +103,8 @@ jsi::Value BaseAudioContextHostObject::get( const jsi::Value *arguments, size_t count) -> jsi::Value { auto stereoPanner = context_->createStereoPanner(); - auto stereoPannerHostObject = std::make_shared(stereoPanner); + auto stereoPannerHostObject = + std::make_shared(stereoPanner); return jsi::Object::createFromHostObject( runtime, stereoPannerHostObject); }); @@ -118,7 +121,8 @@ jsi::Value BaseAudioContextHostObject::get( const jsi::Value *arguments, size_t count) -> jsi::Value { auto biquadFilter = context_->createBiquadFilter(); - auto biquadFilterHostObject = std::make_shared(biquadFilter); + auto biquadFilterHostObject = + std::make_shared(biquadFilter); return jsi::Object::createFromHostObject( runtime, biquadFilterHostObject); }); @@ -135,7 +139,8 @@ jsi::Value BaseAudioContextHostObject::get( const jsi::Value *arguments, size_t count) -> jsi::Value { auto bufferSource = context_->createBufferSource(); - auto bufferSourceHostObject = std::make_shared(bufferSource); + auto bufferSourceHostObject = + std::make_shared(bufferSource); return jsi::Object::createFromHostObject( runtime, bufferSourceHostObject); }); @@ -155,8 +160,9 @@ jsi::Value BaseAudioContextHostObject::get( auto length = static_cast(arguments[1].getNumber()); auto sampleRate = static_cast(arguments[2].getNumber()); auto buffer = - context_->createBuffer(numberOfChannels, length, sampleRate); - auto bufferHostObject = std::make_shared(buffer); + context_->createBuffer(numberOfChannels, length, sampleRate); + auto bufferHostObject = + std::make_shared(buffer); return jsi::Object::createFromHostObject(runtime, bufferHostObject); }); } @@ -191,7 +197,8 @@ jsi::Value BaseAudioContextHostObject::get( auto periodicWave = context_->createPeriodicWave( realData, imagData, disableNormalization, length); - auto periodicWaveHostObject = std::make_shared(periodicWave); + auto periodicWaveHostObject = + std::make_shared(periodicWave); return jsi::Object::createFromHostObject( runtime, periodicWaveHostObject); }); @@ -213,7 +220,8 @@ jsi::Value BaseAudioContextHostObject::get( sourcePath, promise = std::move(promise)]() { auto results = context_->decodeAudioDataSource(sourcePath); - auto audioBufferHostObject = std::make_shared(results); + auto audioBufferHostObject = + std::make_shared(results); promise->resolve(jsi::Object::createFromHostObject( runtime, audioBufferHostObject)); diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/BiquadFilterNodeHostObject.cpp b/packages/react-native-audio-api/common/cpp/HostObjects/BiquadFilterNodeHostObject.cpp index 9db1ad87..4c32e432 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/BiquadFilterNodeHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/HostObjects/BiquadFilterNodeHostObject.cpp @@ -11,7 +11,8 @@ BiquadFilterNodeHostObject::getBiquadFilterNodeFromAudioNode() { BiquadFilterNodeHostObject::BiquadFilterNodeHostObject( const std::shared_ptr &node) : AudioNodeHostObject(node) { - frequencyParam_ = std::make_shared(node->getFrequencyParam()); + frequencyParam_ = + std::make_shared(node->getFrequencyParam()); detuneParam_ = std::make_shared(node->getDetuneParam()); QParam_ = std::make_shared(node->getQParam()); gainParam_ = std::make_shared(node->getGainParam()); diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/BiquadFilterNodeHostObject.h b/packages/react-native-audio-api/common/cpp/HostObjects/BiquadFilterNodeHostObject.h index e835ada8..895fc543 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/BiquadFilterNodeHostObject.h +++ b/packages/react-native-audio-api/common/cpp/HostObjects/BiquadFilterNodeHostObject.h @@ -31,7 +31,6 @@ class BiquadFilterNodeHostObject : public AudioNodeHostObject { std::shared_ptr QParam_; std::shared_ptr gainParam_; - std::shared_ptr - getBiquadFilterNodeFromAudioNode(); + std::shared_ptr getBiquadFilterNodeFromAudioNode(); }; } // namespace audioapi diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/GainNodeHostObject.cpp b/packages/react-native-audio-api/common/cpp/HostObjects/GainNodeHostObject.cpp index 5ee7bf62..5e5eb6a1 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/GainNodeHostObject.cpp +++ b/packages/react-native-audio-api/common/cpp/HostObjects/GainNodeHostObject.cpp @@ -3,8 +3,7 @@ namespace audioapi { using namespace facebook; -GainNodeHostObject::GainNodeHostObject( - const std::shared_ptr &node) +GainNodeHostObject::GainNodeHostObject(const std::shared_ptr &node) : AudioNodeHostObject(node) { auto gainParamWrapper = node->getGainParam(); gainParam_ = std::make_shared(gainParamWrapper); diff --git a/packages/react-native-audio-api/common/cpp/HostObjects/OscillatorNodeHostObject.h b/packages/react-native-audio-api/common/cpp/HostObjects/OscillatorNodeHostObject.h index fb7fc83b..ffb5b89d 100644 --- a/packages/react-native-audio-api/common/cpp/HostObjects/OscillatorNodeHostObject.h +++ b/packages/react-native-audio-api/common/cpp/HostObjects/OscillatorNodeHostObject.h @@ -30,7 +30,6 @@ class OscillatorNodeHostObject : public AudioScheduledSourceNodeHostObject { std::shared_ptr frequencyParam_; std::shared_ptr detuneParam_; - std::shared_ptr - getOscillatorNodeFromAudioNode(); + std::shared_ptr getOscillatorNodeFromAudioNode(); }; } // namespace audioapi diff --git a/packages/react-native-audio-api/common/cpp/core/AudioDestinationNode.h b/packages/react-native-audio-api/common/cpp/core/AudioDestinationNode.h index 9d9a13aa..c8ff0a90 100644 --- a/packages/react-native-audio-api/common/cpp/core/AudioDestinationNode.h +++ b/packages/react-native-audio-api/common/cpp/core/AudioDestinationNode.h @@ -23,7 +23,7 @@ class AudioDestinationNode : public AudioNode { protected: // DestinationNode is triggered by AudioContext using renderAudio // processNode function is not necessary and is never called. - void processNode(AudioBus *, int) final{}; + void processNode(AudioBus *, int) final {}; private: std::size_t currentSampleFrame_; diff --git a/packages/react-native-audio-api/ios/AudioAPIModule.mm b/packages/react-native-audio-api/ios/AudioAPIModule.mm index 74ff86b1..c6451481 100644 --- a/packages/react-native-audio-api/ios/AudioAPIModule.mm +++ b/packages/react-native-audio-api/ios/AudioAPIModule.mm @@ -33,8 +33,7 @@ @implementation AudioAPIModule auto &runtime = *jsRuntime; - auto hostObject = - std::make_shared(jsRuntime, cxxBridge.jsCallInvoker); + auto hostObject = std::make_shared(jsRuntime, cxxBridge.jsCallInvoker); hostObject->install(); NSLog(@"Successfully installed JSI bindings for react-native-audio-api!"); diff --git a/packages/react-native-audio-api/ios/AudioDecoder/AudioDecoder.m b/packages/react-native-audio-api/ios/AudioDecoder/AudioDecoder.m index a6d57471..619a8d06 100644 --- a/packages/react-native-audio-api/ios/AudioDecoder/AudioDecoder.m +++ b/packages/react-native-audio-api/ios/AudioDecoder/AudioDecoder.m @@ -51,16 +51,15 @@ - (AVAudioPCMBuffer *)convertBuffer:(AVAudioPCMBuffer *)buffer ToFormat:(AVAudio [[AVAudioPCMBuffer alloc] initWithPCMFormat:format frameCapacity:(AVAudioFrameCount)buffer.frameCapacity]; AVAudioConverterInputBlock inputBlock = - ^AVAudioBuffer *(AVAudioPacketCount inNumberOfPackets, AVAudioConverterInputStatus *outStatus) - { - if (buffer.frameLength > 0) { - *outStatus = AVAudioConverterInputStatus_HaveData; - return buffer; - } else { - *outStatus = AVAudioConverterInputStatus_NoDataNow; - return nil; - } - }; + ^AVAudioBuffer *(AVAudioPacketCount inNumberOfPackets, AVAudioConverterInputStatus *outStatus) { + if (buffer.frameLength > 0) { + *outStatus = AVAudioConverterInputStatus_HaveData; + return buffer; + } else { + *outStatus = AVAudioConverterInputStatus_NoDataNow; + return nil; + } + }; [converter convertToBuffer:convertedBuffer error:&error withInputFromBlock:inputBlock];