11#ifndef __AUDACITY_NOTETRACK__
12#define __AUDACITY_NOTETRACK__
28 void Begin ## name(); \
49#ifdef EXPERIMENTAL_MIDI_OUT
73 using Holder = std::shared_ptr<NoteTrack>;
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;
103 Track::Holder Copy (
double t0,
double t1,
bool forClipboard =
true)
const override;
104 bool Trim (
double t0,
double t1) ;
105 void Clear(
double t0,
double t1)
override;
106 void Paste(
double t,
const Track *src)
override;
107 void Silence(
double t0,
double t1)
override;
109 bool Shift(
double t) ;
111#ifdef EXPERIMENTAL_MIDI_OUT
112 float GetVelocity()
const {
113 return mVelocity.load(std::memory_order_relaxed); }
114 void SetVelocity(
float velocity);
126 void SetBottomNote(
int note);
128 void SetTopNote(
int note);
130 void SetNoteRange(
int note1,
int note2);
137 void ShiftNoteRange(
int offset);
140 void ZoomOut(
const wxRect &rect,
int y) { Zoom(rect, y, 1.0f / ZoomStep,
true); }
142 void ZoomIn(
const wxRect &rect,
int y) { Zoom(rect, y, ZoomStep,
true); }
145 void Zoom(
const wxRect &rect,
int y,
float multiplier,
bool center);
146 void ZoomTo(
const wxRect &rect,
int start,
int end);
156 void VScroll(
int start,
int end);
172#define NUM_CHANNELS 16
174#define ALL_CHANNELS (1 << NUM_CHANNELS) - 1
175#define CHANNEL_BIT(c) (1 << (c % NUM_CHANNELS))
177 return mVisibleChannels.load(std::memory_order_relaxed);
180 mVisibleChannels.store(value, std::memory_order_relaxed);
183 return (GetVisibleChannels() &
CHANNEL_BIT(c)) != 0;
186 mVisibleChannels.fetch_or(
CHANNEL_BIT(c), std::memory_order_relaxed); }
188 mVisibleChannels.fetch_and(~
CHANNEL_BIT(c), std::memory_order_relaxed); }
190 mVisibleChannels.fetch_xor(
CHANNEL_BIT(c), std::memory_order_relaxed); }
194 auto visibleChannels = 0u;
199 mVisibleChannels.store(visibleChannels, std::memory_order_relaxed);
211#ifdef EXPERIMENTAL_MIDI_OUT
212 void DoSetVelocity(
float velocity);
215 void AddToDuration(
double delta );
221 mutable std::unique_ptr<Alg_seq>
mSeq;
225#ifdef EXPERIMENTAL_MIDI_OUT
227 std::atomic<float> mVelocity{ 0.0f };
233 int mStartBottomNote;
240 enum { MinPitch = 0, MaxPitch = 127 };
303#define SonifyBeginSonification()
304#define SonifyEndSonification()
305#define SonifyBeginNoteBackground()
306#define SonifyEndNoteBackground()
307#define SonifyBeginNoteForeground()
308#define SonifyEndNoteForeground()
309#define SonifyBeginMeasures()
310#define SonifyEndMeasures()
311#define SonifyBeginSerialize()
312#define SonifyEndSerialize()
313#define SonifyBeginUnserialize()
314#define SonifyEndUnserialize()
315#define SonifyBeginAutoSave()
316#define SonifyEndAutoSave()
317#define SonifyBeginModifyState()
318#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::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 ...)
static const TypeInfo & ClassTypeInfo()
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 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)
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 void Paste(double WXUNUSED(t), const Track *WXUNUSED(src))=0
virtual Holder Cut(double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual Holder PasteInto(AudacityProject &) const =0
Find or create the destination track for a paste, maybe in a different project.
virtual void Clear(double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual const TypeInfo & GetTypeInfo() const =0
virtual double GetStartTime() const =0
virtual Holder Clone() const =0
virtual Holder Copy(double WXUNUSED(t0), double WXUNUSED(t1), bool forClipboard=true) const =0
std::shared_ptr< Track > Holder
virtual ConstIntervals GetIntervals() const
Report times on the track where important intervals begin and end, for UI to snap to.
virtual void WriteXML(XMLWriter &xmlFile) const =0
virtual void Silence(double WXUNUSED(t0), double WXUNUSED(t1))=0
virtual double GetOffset() const =0
virtual double GetEndTime() const =0
virtual void InsertSilence(double WXUNUSED(t), double WXUNUSED(len))=0
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.