11#ifndef __AUDACITY_NOTETRACK__
12#define __AUDACITY_NOTETRACK__
30 void Begin ## name(); \
51#ifdef EXPERIMENTAL_MIDI_OUT
100 using Holder = std::shared_ptr<NoteTrack>;
106 void MoveTo(
double origin)
override { mOrigin = origin; }
108 Alg_seq &GetSeq()
const;
110 void WarpAndTransposeNotes(
double t0,
double t1,
113 void SetSequence(std::unique_ptr<Alg_seq> &&seq);
114 void PrintSequence();
116 Alg_seq *MakeExportableSeq(std::unique_ptr<Alg_seq> &cleanup)
const;
117 bool ExportMIDI(
const wxString &f)
const;
118 bool ExportAllegro(
const wxString &f)
const;
124 bool Trim (
double t0,
double t1) ;
125 void Clear(
double t0,
double t1)
override;
126 void Paste(
double t,
const Track &src)
override;
130 bool Shift(
double t) ;
132#ifdef EXPERIMENTAL_MIDI_OUT
133 float GetVelocity()
const {
134 return mVelocity.load(std::memory_order_relaxed); }
135 void SetVelocity(
float velocity);
155#define NUM_CHANNELS 16
157#define ALL_CHANNELS (1 << NUM_CHANNELS) - 1
158#define CHANNEL_BIT(c) (1 << (c % NUM_CHANNELS))
160 return mVisibleChannels.load(std::memory_order_relaxed);
163 mVisibleChannels.store(value, std::memory_order_relaxed);
166 return (GetVisibleChannels() &
CHANNEL_BIT(c)) != 0;
169 mVisibleChannels.fetch_or(
CHANNEL_BIT(c), std::memory_order_relaxed); }
171 mVisibleChannels.fetch_and(~
CHANNEL_BIT(c), std::memory_order_relaxed); }
173 mVisibleChannels.fetch_xor(
CHANNEL_BIT(c), std::memory_order_relaxed); }
177 auto visibleChannels = 0u;
182 mVisibleChannels.store(visibleChannels, std::memory_order_relaxed);
196 std::shared_ptr<ChannelInterval> DoGetChannel(
size_t iChannel)
override;
200 std::shared_ptr<WideChannelGroupInterval>
DoGetInterval(
size_t iInterval)
203#ifdef EXPERIMENTAL_MIDI_OUT
204 void DoSetVelocity(
float velocity);
207 void AddToDuration(
double delta );
209 const std::optional<double>& oldTempo,
double newTempo)
override;
215 mutable std::unique_ptr<Alg_seq>
mSeq;
219#ifdef EXPERIMENTAL_MIDI_OUT
221 std::atomic<float> mVelocity{ 0.0f };
226 double mOrigin{ 0.0 };
239#define SonifyBeginSonification()
240#define SonifyEndSonification()
241#define SonifyBeginNoteBackground()
242#define SonifyEndNoteBackground()
243#define SonifyBeginNoteForeground()
244#define SonifyEndNoteForeground()
245#define SonifyBeginMeasures()
246#define SonifyEndMeasures()
247#define SonifyBeginSerialize()
248#define SonifyEndSerialize()
249#define SonifyBeginUnserialize()
250#define SonifyEndUnserialize()
251#define SonifyBeginAutoSave()
252#define SonifyEndAutoSave()
253#define SonifyBeginModifyState()
254#define SonifyEndModifyState()
ClientData::Site< NoteTrack, NoteTrackAttachment, ClientData::DeepCopying > NoteTrackAttachments
NOTE_TRACK_API wxString GetMIDIDeviceInfo()
CRTP_BASE(NoteTrackAttachmentBase, struct, ClientData::Cloneable< NoteTrackAttachment, ClientData::UniquePtr >)
NOTE_TRACK_API StringSetting MIDIPlaybackDevice
ENUMERATE_TRACK_TYPE(NoteTrack)
NOTE_TRACK_API IntSetting MIDISynthLatency_ms
NOTE_TRACK_API StringSetting MIDIRecordingDevice
struct NOTE_TRACK_API NoteTrackAttachment
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::pair< std::string_view, XMLAttributeValueView > Attribute
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.
Utility to register hooks into a host class that attach client data.
Specialization of Setting for int.
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)
std::unique_ptr< Alg_seq > mSeq
std::shared_ptr< NoteTrack > Holder
static EnumSetting< bool > AllegroStyleSetting
unsigned GetVisibleChannels() const
void ToggleVisibleChan(int c)
void SoloVisibleChan(int c)
void ClearVisibleChan(int c)
long mSerializationLength
NoteTrack(const NoteTrack &orig, ProtectedCreationArg &&)=delete
NoteTrack(const NoteTrack &orig)=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 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.
virtual TrackListHolder Clone(bool backup) const =0
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...
@ DeepCopying
point to new sub-objects; these must define a Clone() member; won't compile for std::weak_ptr
A convenient base class defining abstract virtual Clone() for a given kind of pointer.
virtual void WriteXML(XMLWriter &xmlFile) const
Default implementation does nothing.
virtual bool HandleAttribute(const Attribute &attribute)
Return whether the attribute was used; default returns false.
~NoteTrackAttachment() override
Empty argument passed to some public constructors.