11#ifndef __AUDACITY_NOTETRACK__
12#define __AUDACITY_NOTETRACK__
29 void Begin ## name(); \
50#ifdef EXPERIMENTAL_MIDI_OUT
75 using Holder = std::shared_ptr<NoteTrack>;
81 void MoveTo(
double origin)
override { mOrigin = origin; }
83 Alg_seq &GetSeq()
const;
85 void WarpAndTransposeNotes(
double t0,
double t1,
88 static void DrawLabelControls
89 (
const NoteTrack *pTrack, wxDC & dc,
const wxRect &rect,
90 int highlightedChannel = -1 );
91 int FindChannel(
const wxRect &rect,
int mx,
int my);
92 bool LabelClick(
const wxRect &rect,
int x,
int y,
bool right);
94 void SetSequence(std::unique_ptr<Alg_seq> &&seq);
97 Alg_seq *MakeExportableSeq(std::unique_ptr<Alg_seq> &cleanup)
const;
98 bool ExportMIDI(
const wxString &f)
const;
99 bool ExportAllegro(
const wxString &f)
const;
105 bool Trim (
double t0,
double t1) ;
106 void Clear(
double t0,
double t1)
override;
107 void Paste(
double t,
const Track &src)
override;
111 bool Shift(
double t) ;
113#ifdef EXPERIMENTAL_MIDI_OUT
114 float GetVelocity()
const {
115 return mVelocity.load(std::memory_order_relaxed); }
116 void SetVelocity(
float velocity);
128 void SetBottomNote(
int note);
130 void SetTopNote(
int note);
132 void SetNoteRange(
int note1,
int note2);
139 void ShiftNoteRange(
int offset);
142 void ZoomOut(
const wxRect &rect,
int y) { Zoom(rect, y, 1.0f / ZoomStep,
true); }
144 void ZoomIn(
const wxRect &rect,
int y) { Zoom(rect, y, ZoomStep,
true); }
147 void Zoom(
const wxRect &rect,
int y,
float multiplier,
bool center);
148 void ZoomTo(
const wxRect &rect,
int start,
int end);
158 void VScroll(
int start,
int end);
174#define NUM_CHANNELS 16
176#define ALL_CHANNELS (1 << NUM_CHANNELS) - 1
177#define CHANNEL_BIT(c) (1 << (c % NUM_CHANNELS))
179 return mVisibleChannels.load(std::memory_order_relaxed);
182 mVisibleChannels.store(value, std::memory_order_relaxed);
185 return (GetVisibleChannels() &
CHANNEL_BIT(c)) != 0;
188 mVisibleChannels.fetch_or(
CHANNEL_BIT(c), std::memory_order_relaxed); }
190 mVisibleChannels.fetch_and(~
CHANNEL_BIT(c), std::memory_order_relaxed); }
192 mVisibleChannels.fetch_xor(
CHANNEL_BIT(c), std::memory_order_relaxed); }
196 auto visibleChannels = 0u;
201 mVisibleChannels.store(visibleChannels, std::memory_order_relaxed);
215 std::shared_ptr<ChannelInterval> DoGetChannel(
size_t iChannel)
override;
219 std::shared_ptr<WideChannelGroupInterval>
DoGetInterval(
size_t iInterval)
222#ifdef EXPERIMENTAL_MIDI_OUT
223 void DoSetVelocity(
float velocity);
226 void AddToDuration(
double delta );
228 const std::optional<double>& oldTempo,
double newTempo)
override;
234 mutable std::unique_ptr<Alg_seq>
mSeq;
238#ifdef EXPERIMENTAL_MIDI_OUT
240 std::atomic<float> mVelocity{ 0.0f };
246 int mStartBottomNote;
253 enum { MinPitch = 0, MaxPitch = 127 };
260 double mOrigin{ 0.0 };
317#define SonifyBeginSonification()
318#define SonifyEndSonification()
319#define SonifyBeginNoteBackground()
320#define SonifyEndNoteBackground()
321#define SonifyBeginNoteForeground()
322#define SonifyEndNoteForeground()
323#define SonifyBeginMeasures()
324#define SonifyEndMeasures()
325#define SonifyBeginSerialize()
326#define SonifyEndSerialize()
327#define SonifyBeginUnserialize()
328#define SonifyEndUnserialize()
329#define SonifyBeginAutoSave()
330#define SonifyEndAutoSave()
331#define SonifyBeginModifyState()
332#define SonifyEndModifyState()
AUDACITY_DLL_API IntSetting MIDISynthLatency_ms
AUDACITY_DLL_API wxString GetMIDIDeviceInfo()
ENUMERATE_TRACK_TYPE(NoteTrack)
AUDACITY_DLL_API StringSetting MIDIRecordingDevice
AUDACITY_DLL_API StringSetting MIDIPlaybackDevice
std::pair< double, double > QuantizedTimeAndBeat
Extends Track with notions of mute and solo setting.
std::function< void(double)> ProgressReporter
std::shared_ptr< TrackList > TrackListHolder
std::vector< Attribute > AttributesList
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Track subclass holding data representing sound (as notes, or samples, or ...)
virtual std::shared_ptr< Interval > DoGetInterval(size_t iInterval)=0
Retrieve an interval.
size_t NIntervals() const
Report the number of intervals.
Specialization of Setting for int.
Data used to display a note track.
int GetPitchHeight(int factor) const
int GetNotePos(int p) const
int GetOctaveHeight() const
NoteTrackDisplayData(const NoteTrack *track, const wxRect &r)
int PitchToY(double p) const
int GetOctaveBottom(int oct) const
int GetNoteMargin() const
int YToIPitch(int y) const
int GetWhitePos(int i) const
int IPitchToY(int p) const
int GetBlackPos(int i) const
A Track that is used for Midi notes. (Somewhat old code).
std::unique_ptr< char[]> mSerializationBuffer
bool IsVisibleChan(int c) const
void MoveTo(double origin) override
Change start time to given time point.
void SetVisibleChannels(unsigned value)
void ZoomMaxExtent()
Zooms so that the entire track is visible.
void ZoomIn(const wxRect &rect, int y)
Zooms in a constant factor (subject to zoom limits)
std::unique_ptr< Alg_seq > mSeq
std::shared_ptr< NoteTrack > Holder
void ZoomOut(const wxRect &rect, int y)
Zooms out a constant factor (subject to zoom limits)
std::weak_ptr< StretchHandle > mStretchHandle
unsigned GetVisibleChannels() const
void ToggleVisibleChan(int c)
void SoloVisibleChan(int c)
void ClearVisibleChan(int c)
int GetBottomNote() const
Gets the current bottom note (a pitch)
static const float ZoomStep
int GetTopNote() const
Gets the current top note (a pitch)
long mSerializationLength
NoteTrack(const NoteTrack &orig, ProtectedCreationArg &&)=delete
Copy construction hasn't been necessary yet.
void SetVisibleChan(int c)
This is defined just to enable dynamic_cast on it.
AudioTrack subclass that can also be audibly replayed by the program.
Specialization of Setting for strings.
Transforms one point in time to another point. For example, a time stretching effect might use one to...
Abstract base class for an object holding data associated with points on a time axis.
virtual TrackListHolder Clone() const =0
virtual void Paste(double t, const Track &src)=0
Weak precondition allows overrides to replicate one channel into many.
virtual Holder PasteInto(AudacityProject &project, TrackList &list) const =0
virtual const TypeInfo & GetTypeInfo() const =0
virtual void InsertSilence(double t, double len)=0
static const TypeInfo & ClassTypeInfo()
virtual TrackListHolder Copy(double t0, double t1, bool forClipboard=true) const =0
Create new tracks and don't modify this track.
virtual void DoOnProjectTempoChange(const std::optional< double > &oldTempo, double newTempo)=0
virtual void Clear(double t0, double t1)=0
std::shared_ptr< Track > Holder
virtual void WriteXML(XMLWriter &xmlFile) const =0
virtual void Silence(double t0, double t1, ProgressReporter reportProgress={})=0
virtual TrackListHolder Cut(double t0, double t1)=0
Create tracks and modify this track.
A flat linked list of tracks supporting Add, Remove, Clear, and Contains, serialization of the list o...
Generates overrides of channel-related functions.
WideChannelGroupInterval(const ChannelGroup &group, double start, double end)
This class is an interface which should be implemented by classes which wish to be able to load and s...
virtual XMLTagHandler * HandleXMLChild(const std::string_view &tag)=0
virtual bool HandleXMLTag(const std::string_view &tag, const AttributesList &attrs)=0
Base class for XMLFileWriter and XMLStringWriter that provides the general functionality for creating...
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for.
Empty argument passed to some public constructors.