diff --git a/Userland/Libraries/LibDSP/Track.cpp b/Userland/Libraries/LibDSP/Track.cpp index 20e8829922..aa80b88b00 100644 --- a/Userland/Libraries/LibDSP/Track.cpp +++ b/Userland/Libraries/LibDSP/Track.cpp @@ -4,10 +4,9 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include "AK/NonnullRefPtr.h" -#include "AK/Userspace.h" #include #include +#include #include #include #include @@ -91,8 +90,8 @@ void Track::current_signal(FixedArray& output_signal) } VERIFY(source_signal->type() == SignalType::Sample); VERIFY(output_signal.size() == source_signal->get>().size()); - // This is one final unavoidable memcopy. Otherwise we need to special-case the last processor or - AK::TypedTransfer::copy(output_signal.data(), source_signal->get>().data(), output_signal.size()); + // The last processor is the fixed mastering processor. This can write directly to the output data. We also just trust this processor that it does the right thing :^) + m_track_mastering->process_to_fixed_array(*source_signal, output_signal); } void NoteTrack::compute_current_clips_signal() diff --git a/Userland/Libraries/LibDSP/Track.h b/Userland/Libraries/LibDSP/Track.h index e55c596537..fbb661f194 100644 --- a/Userland/Libraries/LibDSP/Track.h +++ b/Userland/Libraries/LibDSP/Track.h @@ -7,9 +7,9 @@ #pragma once #include +#include #include #include -#include #include #include #include @@ -35,6 +35,7 @@ public: NonnullRefPtrVector const& processor_chain() const { return m_processor_chain; } NonnullRefPtr transport() const { return m_transport; } + NonnullRefPtr track_mastering() { return m_track_mastering; } // FIXME: These two getters are temporary until we have dynamic processor UI NonnullRefPtr synth(); @@ -43,6 +44,7 @@ public: protected: Track(NonnullRefPtr transport, NonnullRefPtr keyboard) : m_transport(move(transport)) + , m_track_mastering(make_ref_counted(m_transport)) , m_keyboard(move(keyboard)) { } @@ -53,6 +55,7 @@ protected: NonnullRefPtrVector m_processor_chain; NonnullRefPtr m_transport; + NonnullRefPtr m_track_mastering; NonnullRefPtr m_keyboard; // The current signal is stored here, to prevent unnecessary reallocation. Signal m_current_signal { FixedArray {} };