mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:17:44 +00:00
Piano+LibDSP: Move Track to LibDSP
This is a tangly commit and it fixes all the bugs that a plain move would have caused (i.e. we need to touch other logic which had wrong assumptions).
This commit is contained in:
parent
125122a9ab
commit
4941cffdd0
29 changed files with 322 additions and 413 deletions
|
@ -6,12 +6,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DisjointChunks.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>
|
||||
#include <LibDSP/Music.h>
|
||||
#include <LibDSP/Processor.h>
|
||||
#include <LibDSP/Synthesizers.h>
|
||||
|
||||
namespace DSP {
|
||||
|
||||
|
@ -32,9 +36,17 @@ public:
|
|||
NonnullRefPtrVector<Processor> const& processor_chain() const { return m_processor_chain; }
|
||||
NonnullRefPtr<Transport const> transport() const { return m_transport; }
|
||||
|
||||
float volume() const;
|
||||
void set_volume(float volume) const;
|
||||
|
||||
// FIXME: These two getters are temporary until we have dynamic processor UI
|
||||
NonnullRefPtr<Synthesizers::Classic> synth();
|
||||
NonnullRefPtr<Effects::Delay> delay();
|
||||
|
||||
protected:
|
||||
Track(NonnullRefPtr<Transport> transport)
|
||||
Track(NonnullRefPtr<Transport> transport, NonnullRefPtr<Keyboard> keyboard)
|
||||
: m_transport(move(transport))
|
||||
, m_keyboard(move(keyboard))
|
||||
{
|
||||
}
|
||||
bool check_processor_chain_valid_with_initial_type(SignalType initial_type) const;
|
||||
|
@ -44,6 +56,7 @@ protected:
|
|||
|
||||
NonnullRefPtrVector<Processor> m_processor_chain;
|
||||
NonnullRefPtr<Transport> m_transport;
|
||||
NonnullRefPtr<Keyboard> m_keyboard;
|
||||
// The current signal is stored here, to prevent unnecessary reallocation.
|
||||
Signal m_current_signal { FixedArray<Sample> {} };
|
||||
|
||||
|
@ -58,8 +71,19 @@ class NoteTrack final : public Track {
|
|||
public:
|
||||
virtual ~NoteTrack() override = default;
|
||||
|
||||
NoteTrack(NonnullRefPtr<Transport> transport, NonnullRefPtr<Keyboard> keyboard)
|
||||
: Track(move(transport), move(keyboard))
|
||||
{
|
||||
m_current_signal = RollNotes {};
|
||||
}
|
||||
|
||||
bool check_processor_chain_valid() const override;
|
||||
NonnullRefPtrVector<NoteClip> const& clips() const { return m_clips; }
|
||||
Span<NonnullRefPtr<NoteClip> const> notes() const { return m_clips.span(); }
|
||||
|
||||
void set_note(RollNote note);
|
||||
void remove_note(RollNote note);
|
||||
|
||||
void add_clip(u32 start_time, u32 end_time);
|
||||
|
||||
protected:
|
||||
void compute_current_clips_signal() override;
|
||||
|
@ -72,6 +96,11 @@ class AudioTrack final : public Track {
|
|||
public:
|
||||
virtual ~AudioTrack() override = default;
|
||||
|
||||
AudioTrack(NonnullRefPtr<Transport> transport, NonnullRefPtr<Keyboard> keyboard)
|
||||
: Track(move(transport), move(keyboard))
|
||||
{
|
||||
}
|
||||
|
||||
bool check_processor_chain_valid() const override;
|
||||
NonnullRefPtrVector<AudioClip> const& clips() const { return m_clips; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue