mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-07 08:29:58 +00:00
LibDSP: Add a fixed mastering processor to Track
This processor will not appear in the normal processor chain later on, but is used for final mixing of the track.
This commit is contained in:
parent
ab2d8edcbb
commit
b29d27c948
|
@ -4,10 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "AK/NonnullRefPtr.h"
|
||||
#include "AK/Userspace.h"
|
||||
#include <AK/FixedArray.h>
|
||||
#include <AK/NoAllocationGuard.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <AK/TypedTransfer.h>
|
||||
|
@ -91,8 +90,8 @@ void Track::current_signal(FixedArray<Sample>& output_signal)
|
|||
}
|
||||
VERIFY(source_signal->type() == SignalType::Sample);
|
||||
VERIFY(output_signal.size() == source_signal->get<FixedArray<Sample>>().size());
|
||||
// This is one final unavoidable memcopy. Otherwise we need to special-case the last processor or
|
||||
AK::TypedTransfer<Sample>::copy(output_signal.data(), source_signal->get<FixedArray<Sample>>().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()
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/DisjointChunks.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/NonnullRefPtrVector.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <LibDSP/Clip.h>
|
||||
#include <LibDSP/Effects.h>
|
||||
#include <LibDSP/Keyboard.h>
|
||||
|
@ -35,6 +35,7 @@ public:
|
|||
|
||||
NonnullRefPtrVector<Processor> const& processor_chain() const { return m_processor_chain; }
|
||||
NonnullRefPtr<Transport const> transport() const { return m_transport; }
|
||||
NonnullRefPtr<DSP::Effects::Mastering> track_mastering() { return m_track_mastering; }
|
||||
|
||||
// FIXME: These two getters are temporary until we have dynamic processor UI
|
||||
NonnullRefPtr<Synthesizers::Classic> synth();
|
||||
|
@ -43,6 +44,7 @@ public:
|
|||
protected:
|
||||
Track(NonnullRefPtr<Transport> transport, NonnullRefPtr<Keyboard> keyboard)
|
||||
: m_transport(move(transport))
|
||||
, m_track_mastering(make_ref_counted<Effects::Mastering>(m_transport))
|
||||
, m_keyboard(move(keyboard))
|
||||
{
|
||||
}
|
||||
|
@ -53,6 +55,7 @@ protected:
|
|||
|
||||
NonnullRefPtrVector<Processor> m_processor_chain;
|
||||
NonnullRefPtr<Transport> m_transport;
|
||||
NonnullRefPtr<Effects::Mastering> m_track_mastering;
|
||||
NonnullRefPtr<Keyboard> m_keyboard;
|
||||
// The current signal is stored here, to prevent unnecessary reallocation.
|
||||
Signal m_current_signal { FixedArray<Sample> {} };
|
||||
|
|
Loading…
Reference in a new issue