diff --git a/androidaudioplugin-manager/src/main/cpp/AAPMidiEventTranslator.cpp b/androidaudioplugin-manager/src/main/cpp/AAPMidiEventTranslator.cpp index f70b2d7e..8abe1518 100644 --- a/androidaudioplugin-manager/src/main/cpp/AAPMidiEventTranslator.cpp +++ b/androidaudioplugin-manager/src/main/cpp/AAPMidiEventTranslator.cpp @@ -80,7 +80,7 @@ size_t aap::AAPMidiEventTranslator::runThroughMidi2UmpForMidiMapping(uint8_t* by conversion_helper_buffer, conversion_helper_buffer_size, 0, - instance->aapxsRequestIdSerial(), + aap::RemotePluginInstance::aapxsRequestIdSerial(), preset_urid, AAP_PRESETS_EXTENSION_URI, OPCODE_SET_PRESET_INDEX, diff --git a/androidaudioplugin-manager/src/main/cpp/AAPMidiEventTranslator.h b/androidaudioplugin-manager/src/main/cpp/AAPMidiEventTranslator.h index 870f0321..da49ed89 100644 --- a/androidaudioplugin-manager/src/main/cpp/AAPMidiEventTranslator.h +++ b/androidaudioplugin-manager/src/main/cpp/AAPMidiEventTranslator.h @@ -26,7 +26,7 @@ namespace aap { int32_t detectEndpointConfigurationMessage(uint8_t* bytes, size_t offset, size_t length); public: - AAPMidiEventTranslator(RemotePluginInstance* instance, int32_t midiBufferSize = AAP_MANAGER_MIDI_BUFFER_SIZE, int32_t initialMidiProtocol = CMIDI2_PROTOCOL_TYPE_MIDI2); + explicit AAPMidiEventTranslator(RemotePluginInstance* instance, int32_t midiBufferSize = AAP_MANAGER_MIDI_BUFFER_SIZE, int32_t initialMidiProtocol = CMIDI2_PROTOCOL_TYPE_MIDI2); ~AAPMidiEventTranslator(); void setPlugin(RemotePluginInstance* pluginInstance); diff --git a/androidaudioplugin-manager/src/main/cpp/AudioDevice.h b/androidaudioplugin-manager/src/main/cpp/AudioDevice.h index d544453c..75fc9dc7 100644 --- a/androidaudioplugin-manager/src/main/cpp/AudioDevice.h +++ b/androidaudioplugin-manager/src/main/cpp/AudioDevice.h @@ -31,7 +31,7 @@ namespace aap { class AAP_PUBLIC_API AudioDeviceOut { public: - AudioDeviceOut() {} + AudioDeviceOut() = default; AAP_PUBLIC_API virtual void startCallback() = 0; AAP_PUBLIC_API virtual void stopCallback() = 0; diff --git a/androidaudioplugin-manager/src/main/cpp/AudioDeviceManager.h b/androidaudioplugin-manager/src/main/cpp/AudioDeviceManager.h index 2fe44487..ee71b92b 100644 --- a/androidaudioplugin-manager/src/main/cpp/AudioDeviceManager.h +++ b/androidaudioplugin-manager/src/main/cpp/AudioDeviceManager.h @@ -12,8 +12,8 @@ namespace aap { // This needs to be implemented for each platform static AudioDeviceManager* getInstance(); - virtual AudioDeviceIn* openDefaultInput(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) = 0; - virtual AudioDeviceOut* openDefaultOutput(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) = 0; + virtual AudioDeviceIn* openDefaultInput(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) = 0; + virtual AudioDeviceOut* openDefaultOutput(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) = 0; }; } diff --git a/androidaudioplugin-manager/src/main/cpp/AudioGraphNode.h b/androidaudioplugin-manager/src/main/cpp/AudioGraphNode.h index f77b7cc0..03f6ef86 100644 --- a/androidaudioplugin-manager/src/main/cpp/AudioGraphNode.h +++ b/androidaudioplugin-manager/src/main/cpp/AudioGraphNode.h @@ -17,10 +17,10 @@ namespace aap { protected: AudioGraph* graph; - AudioGraphNode(AudioGraph* ownerGraph) : graph(ownerGraph) {} + explicit AudioGraphNode(AudioGraph* ownerGraph) : graph(ownerGraph) {} public: - virtual ~AudioGraphNode() {} + virtual ~AudioGraphNode() = default; virtual bool shouldSkip() { return false; } virtual void start() = 0; virtual void pause() = 0; @@ -48,7 +48,7 @@ namespace aap { AudioGraphNode(ownerGraph), input(input) { } - virtual ~AudioDeviceInputNode(); + ~AudioDeviceInputNode() override; AudioDeviceIn* getDevice() { return input; } @@ -81,7 +81,7 @@ namespace aap { AudioGraphNode(ownerGraph), output(output) { } - virtual ~AudioDeviceOutputNode(); + ~AudioDeviceOutputNode() override; AudioDeviceOut* getDevice() { return output; } @@ -98,7 +98,7 @@ namespace aap { AudioGraphNode(ownerGraph), plugin(plugin) { } - virtual ~AudioPluginNode(); + ~AudioPluginNode() override; void setPlugin(RemotePluginInstance* instance) { plugin = instance; } @@ -121,7 +121,7 @@ namespace aap { public: explicit AudioDataSourceNode(AudioGraph* ownerGraph); - virtual ~AudioDataSourceNode(); + ~AudioDataSourceNode() override; void start() override; void pause() override; @@ -166,7 +166,7 @@ namespace aap { int32_t initialMidiProtocol = CMIDI2_PROTOCOL_TYPE_MIDI2, int32_t internalBufferSize = AAP_PLUGIN_PLAYER_DEFAULT_MIDI_RING_BUFFER_SIZE); - virtual ~MidiSourceNode(); + ~MidiSourceNode() override; void setPlugin(RemotePluginInstance* instance) { translator.setPlugin(instance); } @@ -183,9 +183,9 @@ namespace aap { NanoSleepLock midi_buffer_mutex{}; public: - MidiDestinationNode(AudioGraph* ownerGraph, int32_t internalBufferSize = AAP_PLUGIN_PLAYER_DEFAULT_MIDI_RING_BUFFER_SIZE); + explicit MidiDestinationNode(AudioGraph* ownerGraph, int32_t internalBufferSize = AAP_PLUGIN_PLAYER_DEFAULT_MIDI_RING_BUFFER_SIZE); - virtual ~MidiDestinationNode(); + ~MidiDestinationNode() override; void start() override; void pause() override; diff --git a/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.cpp b/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.cpp index d347ac7f..4f6d6174 100644 --- a/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.cpp +++ b/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.cpp @@ -14,8 +14,8 @@ namespace aap { protected: std::shared_ptr stream{}; oboe::AudioStreamBuilder builder{}; - void* callback_context; - AudioDeviceCallback *aap_callback; + void* callback_context{}; + AudioDeviceCallback *aap_callback{}; AudioBuffer aap_buffer; void* oboe_buffer; @@ -23,9 +23,9 @@ namespace aap { oboe::DataCallbackResult onAudioOutputReady(oboe::AudioStream *audioStream, void *audioData, int32_t numFrames); public: - explicit OboeAudioDevice(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels, oboe::Direction direction); + explicit OboeAudioDevice(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels, oboe::Direction direction); - virtual ~OboeAudioDevice() noexcept; + ~OboeAudioDevice() noexcept override; void setCallback(AudioDeviceCallback callback, void* callbackContext); @@ -47,7 +47,8 @@ namespace aap { OboeAudioDevice impl; public: - OboeAudioDeviceIn(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels); + OboeAudioDeviceIn(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels); + virtual ~OboeAudioDeviceIn() = default; // required on Android platform bool isPermissionRequired() override { return true; } @@ -68,7 +69,8 @@ namespace aap { OboeAudioDevice impl; public: - OboeAudioDeviceOut(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels); + OboeAudioDeviceOut(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels); + virtual ~OboeAudioDeviceOut() = default; void startCallback() override { impl.startCallback(); } @@ -85,7 +87,7 @@ namespace aap { //-------- aap::AudioDeviceIn * -aap::OboeAudioDeviceManager::openDefaultInput(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) { +aap::OboeAudioDeviceManager::openDefaultInput(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) { // FIXME: this should not be created twice //assert(input == nullptr); input = std::make_shared(sampleRate, framesPerCallback, numChannels); @@ -93,7 +95,7 @@ aap::OboeAudioDeviceManager::openDefaultInput(uint32_t sampleRate, uint32_t fram } aap::AudioDeviceOut * -aap::OboeAudioDeviceManager::openDefaultOutput(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) { +aap::OboeAudioDeviceManager::openDefaultOutput(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) { // FIXME: this should not be created twice //assert(output == nullptr); output = std::make_shared(sampleRate, framesPerCallback, numChannels); @@ -102,7 +104,7 @@ aap::OboeAudioDeviceManager::openDefaultOutput(uint32_t sampleRate, uint32_t fra //-------- -aap::OboeAudioDevice::OboeAudioDevice(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels, oboe::Direction direction) : +aap::OboeAudioDevice::OboeAudioDevice(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels, oboe::Direction direction) : oboe::StabilizedCallback(this), aap_buffer(numChannels, (int32_t) framesPerCallback) { builder.setPerformanceMode(oboe::PerformanceMode::LowLatency) @@ -233,18 +235,18 @@ void aap::OboeAudioDevice::copyAAPBufferForWriting(AudioBuffer *srcAudioData, in choc::buffer::copy(aap_buffer.audio.getFrameRange(range), srcAudioData->audio.getView().getFrameRange(range)); } -bool aap::OboeAudioDevice::onError(oboe::AudioStream *stream, oboe::Result result) { +bool aap::OboeAudioDevice::onError(oboe::AudioStream *audioStream, oboe::Result result) { // Should we log errors here? - return AudioStreamErrorCallback::onError(stream, result); + return AudioStreamErrorCallback::onError(audioStream, result); } //-------- -aap::OboeAudioDeviceIn::OboeAudioDeviceIn(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) : +aap::OboeAudioDeviceIn::OboeAudioDeviceIn(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) : impl(sampleRate, framesPerCallback, numChannels, oboe::Direction::Input) { } -aap::OboeAudioDeviceOut::OboeAudioDeviceOut(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) : +aap::OboeAudioDeviceOut::OboeAudioDeviceOut(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) : impl(sampleRate, framesPerCallback, numChannels, oboe::Direction::Output) { } diff --git a/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.h b/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.h index c7830bc4..d0f36704 100644 --- a/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.h +++ b/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.h @@ -16,9 +16,9 @@ namespace aap { public: OboeAudioDeviceManager() {} - AudioDeviceIn * openDefaultInput(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) override; + AudioDeviceIn * openDefaultInput(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) override; - AudioDeviceOut * openDefaultOutput(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) override; + AudioDeviceOut * openDefaultOutput(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) override; }; } diff --git a/androidaudioplugin-manager/src/main/cpp/PluginPlayer.cpp b/androidaudioplugin-manager/src/main/cpp/PluginPlayer.cpp index 9f9e4a13..c9aaff1f 100644 --- a/androidaudioplugin-manager/src/main/cpp/PluginPlayer.cpp +++ b/androidaudioplugin-manager/src/main/cpp/PluginPlayer.cpp @@ -27,7 +27,7 @@ void aap::PluginPlayer::enableAudioRecorder() { } void -aap::PluginPlayer::addMidiEvents(uint8_t *data, int32_t dataLength, uint64_t timestampInNanoseconds) { +aap::PluginPlayer::addMidiEvents(uint8_t *data, int32_t dataLength, int64_t timestampInNanoseconds) { graph.addMidiEvent(data, dataLength, timestampInNanoseconds); } diff --git a/androidaudioplugin-manager/src/main/cpp/PluginPlayer.h b/androidaudioplugin-manager/src/main/cpp/PluginPlayer.h index d47f5a17..c3c4dcd0 100644 --- a/androidaudioplugin-manager/src/main/cpp/PluginPlayer.h +++ b/androidaudioplugin-manager/src/main/cpp/PluginPlayer.h @@ -11,7 +11,7 @@ namespace aap { SimpleLinearAudioGraph graph; public: - PluginPlayer(PluginPlayerConfiguration &configuration); + explicit PluginPlayer(PluginPlayerConfiguration &configuration); virtual ~PluginPlayer(); @@ -19,7 +19,7 @@ namespace aap { void setAudioSource(uint8_t *data, int32_t dataLength, const char *filename); - void addMidiEvents(uint8_t* data, int32_t dataLength, uint64_t timestampInNanoseconds); + void addMidiEvents(uint8_t* data, int32_t dataLength, int64_t timestampInNanoseconds); void startProcessing(); diff --git a/androidaudioplugin-manager/src/main/cpp/VirtualAudioDeviceManager.h b/androidaudioplugin-manager/src/main/cpp/VirtualAudioDeviceManager.h index 7313b411..e0a07e90 100644 --- a/androidaudioplugin-manager/src/main/cpp/VirtualAudioDeviceManager.h +++ b/androidaudioplugin-manager/src/main/cpp/VirtualAudioDeviceManager.h @@ -11,8 +11,8 @@ namespace aap { class VirtualAudioDeviceIn : public AudioDeviceIn { bool running{false}; public: - explicit VirtualAudioDeviceIn() {} - virtual ~VirtualAudioDeviceIn() {} + explicit VirtualAudioDeviceIn() = default; + virtual ~VirtualAudioDeviceIn() = default; void startCallback() override { running = true; } void stopCallback() override { running = false; } @@ -27,8 +27,8 @@ namespace aap { class VirtualAudioDeviceOut : public AudioDeviceOut { bool running{false}; public: - explicit VirtualAudioDeviceOut() {} - virtual ~VirtualAudioDeviceOut() {} + explicit VirtualAudioDeviceOut() = default; + virtual ~VirtualAudioDeviceOut() = default; void startCallback() override { running = true; } void stopCallback() override { running = false; } @@ -50,8 +50,8 @@ namespace aap { output(std::make_shared()) { } - AudioDeviceIn * openDefaultInput(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) override { return input.get(); } - AudioDeviceOut * openDefaultOutput(uint32_t sampleRate, uint32_t framesPerCallback, int32_t numChannels) override { return output.get(); } + AudioDeviceIn * openDefaultInput(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) override { return input.get(); } + AudioDeviceOut * openDefaultOutput(int32_t sampleRate, int32_t framesPerCallback, int32_t numChannels) override { return output.get(); } }; }