NiCMidi 1.1.0
A MIDI library derived from J.D.Koftinoff jdksmidi
AdvancedSequencer Class Reference

An enhanced MIDISequencer, able to directly load and play MIDI files and many more. More...

#include <advancedsequencer.h>

Inheritance diagram for AdvancedSequencer:
MIDISequencer MIDITickComponent

Public Member Functions

 AdvancedSequencer (MIDISequencerGUINotifier *n=0)
 Creates an AdvancedSequencer with 17 tracks (one for each channel plus the master track). More...
 
 AdvancedSequencer (MIDIMultiTrack *mlt, MIDISequencerGUINotifier *n=0)
 Creates an AdvancedSequencer from a given MIDIMultiTrack. More...
 
virtual ~AdvancedSequencer ()
 The destructor. More...
 
virtual void Reset ()
 Resets the status of the sequencer (does not empty the MIDIMultiTrack). More...
 
virtual bool Load (const char *fname)
 Loads a MIDIFile into the internal MIDIMultiTrack. More...
 
virtual bool Load (const MIDIMultiTrack *tracks)
 Copies the content of an external MIDIMultiTrack into the sequencer. More...
 
virtual void UnLoad ()
 Clears the contents of the internal MIDIMultiTrack. More...
 
bool IsLoaded () const
 Returns true if the internal MIDIMultiTrack is not empty. More...
 
std::string GetFileName ()
 Returns the name of the loaded file (or an empty string if it is not yet defined). More...
 
const MIDIFileHeaderGetFileHeader ()
 Returns the header of the loaded file. More...
 
MIDIThruGetMIDIThru ()
 Returns the address of the MIDIThru tick component. More...
 
const MIDIThruGetMIDIThru () const
 Returns a pointer to the MIDIThru tick component. More...
 
bool GetMIDIThruEnable () const
 Returns true if MIDIThru is enabled (always false if the thru is not present). More...
 
int GetMIDIThruChannel () const
 Returns the output channel of the MIDIThru, -1 if the thru is not present. More...
 
int GetMIDIThruTranspose () const
 Returns the transpose amount of the MIDIThru, 0 if the thru is not present. More...
 
bool GetSoloMode () const
 Returns true if any track is soloed. More...
 
bool GetTrackSolo (unsigned int trk_num) const
 Returns true if a specific track is soloed. More...
 
bool GetTrackMute (unsigned int trk_num) const
 Returns true if a specific track is muted. More...
 
int GetNumMeasures () const
 Returns the number of measures of the loaded song. More...
 
unsigned int GetCurrentMeasure () const
 Returns the current measure number (first is 0). See Numbering conventions. More...
 
unsigned int GetCurrentBeat () const
 Returns the number of current beat (first is 0). See Numbering conventions. More...
 
MIDIClockTime GetCurrentBeatOffset () const
 Returns the current MIDI time offset respect current beat. More...
 
int GetTimeSigNumerator () const
 Returns the numerator of current time signature. More...
 
int GetTimeSigDenominator () const
 Returns the denominator of current time signature. More...
 
int GetKeySigSharpsFlats () const
 Return the number of sharps or flats of the current key signature. More...
 
int GetKeySigMode () const
 Returns the mode (major/minor) of the he current key signature. More...
 
std::string GetCurrentMarker () const
 Returns the current marker text. More...
 
std::string GetTrackName (unsigned int trk_num) const
 Returns the name of the given track. More...
 
int GetTrackVolume (unsigned int trk_num) const
 Returns the current MIDI volume for the given track (-1 if volume wasn't set at time 0). More...
 
int GetTrackProgram (unsigned int trk_num) const
 Returns the current MIDI program (patch) for the given track (-1 if the program wasn't set at time 0). More...
 
int GetTrackNoteCount (unsigned int trk_num) const
 Returns the number of notes currently sounding on the given track (0 if the sequencer is not playing). More...
 
unsigned int GetTrackVelocityScale (unsigned int trk_num) const
 Returns the velocity scale percentage for the given track. More...
 
int GetTrackRechannelize (unsigned int trk_num) const
 Returns the rechannelized channel for the given track (-1 if the track is not rechannelized). More...
 
int GetTrackChannel (unsigned int trk_num)
 If the track has channel messages all with same channel returns the channel, otherwise -1. More...
 
int GetTrackTranspose (unsigned int trk_num) const
 Returns the transposing amount in semitones for the given track. More...
 
int GetTrackTimeShift (unsigned int trk_num) const
 Returns the time offset (in MIDI ticks) assigned to the given track. More...
 
MIDISequencerTrackProcessorGetTrackProcessor (unsigned int trk_num)
 Returns a pointer to the MIDISequencerTrackProcessor for the given track. More...
 
const MIDISequencerTrackProcessorGetTrackProcessor (unsigned int trk_num) const
 Returns a pointer to the MIDISequencerTrackProcessor for the given track. More...
 
void SetFileName (std::string &fname)
 Sets a name for the content of sequencer. More...
 
bool SetMIDIThruEnable (bool on_off)
 Enables or disables the embedded MIDIthru. More...
 
bool SetMIDIThruChannel (int chan)
 Sets the out channel for MIDIthru. More...
 
bool SetMIDIThruTranspose (int amt)
 Sets a transpose amount in semitones for the messages coming from the MIDIThru. More...
 
bool SetTrackSolo (unsigned int trk_num)
 Soloes the given track muting all others. More...
 
void UnSoloTrack ()
 Unsoloes the soloed track unmuting all others. More...
 
bool SetTrackMute (unsigned int trk_num, bool f)
 Mutes/unmutes the given track (it has no effect on others). More...
 
void UnmuteAllTracks ()
 Unmutes all muted tracks (this has no effect on tracks muted by SoloTrack()). More...
 
bool SetTrackVelocityScale (unsigned int trk_num, unsigned int scale)
 Sets a track velocity scale in percentage for the given track. More...
 
bool SetTrackRechannelize (unsigned int trk_num, int chan)
 Redirects all channel messages in the track on the given channel. More...
 
bool SetTrackTranspose (unsigned int trk_num, int amt)
 Sets a transpose amount in semitones for the given track. More...
 
virtual void GoToZero ()
 Sets the current time to the beginning of the song. More...
 
virtual bool GoToTime (MIDIClockTime time_clk)
 Sets the current time to the given MIDI time. More...
 
virtual bool GoToTimeMs (float time_ms)
 Same as GoToTime(), but the time is given in milliseconds. More...
 
virtual bool GoToMeasure (int measure, int beat=0)
 Sets the current time to the given measure and beat. More...
 
virtual void Start ()
 Starts the sequencer playing from the current time. More...
 
virtual void Stop ()
 Stops the sequencer playing. More...
 
void OutputMessage (MIDITimedMessage &msg, unsigned int port)
 Sends a given MIDI message to an hardware port. More...
 
bool SetSMPTE (SMPTE *s)
 Sets the parameters of the given SMPTE according to the loaded content. More...
 
virtual void UpdateStatus ()
 This should be used to update the sequencer internal parameters after editing the multitrack. More...
 
- Public Member Functions inherited from MIDISequencer
 MIDISequencer (MIDIMultiTrack *m, MIDISequencerGUINotifier *n=0)
 The constructor. More...
 
virtual ~MIDISequencer ()
 The destructor. More...
 
MIDIClockTime GetCurrentMIDIClockTime () const
 Returns current MIDIClockTime in MIDI ticks; it is effective even during playback. More...
 
float GetCurrentTimeMs () const
 Returns current time in milliseconds; it is effective even during playback. More...
 
unsigned int GetCurrentMeasure () const
 Returns current measure (1st measure is 0). More...
 
unsigned int GetCurrentBeat () const
 Returns current beat in the measure (1st beat is 0). More...
 
MIDIClockTime GetCurrentBeatOffset () const
 Returns the current MIDI time offset respect to current beat. More...
 
unsigned int GetClksPerBeat () const
 Returns the base MIDI ticks per beat ratio of the internal MIDIMultiTrack. More...
 
MIDIMultiTrackGetMultiTrack ()
 Returns a pointer to the internal MIDIMultiTrack. More...
 
const MIDIMultiTrackGetMultiTrack () const
 Returns a pointer to the internal MIDIMultiTrack. More...
 
MIDITrackGetTrack (unsigned int trk_num)
 Returns a pointer to the given track, or 0 if _num_trk is not a valid number. More...
 
unsigned int GetNumTracks () const
 Returns the number of tracks of the multitrack. More...
 
unsigned int GetTempoScale () const
 Returns current tempo scale in percentage (100 = no scaling, 200 = twice faster, etc.). More...
 
float GetTempoWithoutScale () const
 Returns current tempo (BPM) without scaling. More...
 
float GetTempoWithScale () const
 Returns current tempo (BPM) taking into account scaling (this is the true actual tempo). More...
 
bool GetRepeatPlay () const
 Returns the repeat play (loop) status on/off. More...
 
unsigned int GetRepeatPlayStart () const
 Returns the repeat play (loop) start measure. More...
 
unsigned int GetRepeatPlayEnd () const
 Returns the repeat play (loop) end measure. More...
 
bool GetCountInEnable () const
 Returns true if the count in is enabled. More...
 
bool GetCountInPending () const
 Returns true if the count in is pending (the sequencer is counting in). More...
 
bool GetTimeShiftMode () const
 Returns the time shift mode (on or off). More...
 
MIDISequencerStateGetState ()
 Returns a pointer to the current MIDISequencerState (i.e. More...
 
const MIDISequencerStateGetState () const
 Returns a pointer to the current MIDISequencerState (i.e. More...
 
bool GetPlayMode ()
 Returns the play mode state (see SetPlayMode()). More...
 
MIDISequencerTrackStateGetTrackState (unsigned int trk_num)
 Returns a pointer to the MIDISequencerTrackState for a track. More...
 
const MIDISequencerTrackStateGetTrackState (unsigned int trk_num) const
 Returns a pointer to the MIDISequencerTrackState for a track. More...
 
unsigned int GetTrackOutPort (unsigned int trk_num) const
 Returns the number of the out port assigned to a track. More...
 
MIDIProcessorGetTrackProcessor (unsigned int trk_num)
 Returns a pointer to the MIDISequencerTrackProcessor for a track. More...
 
const MIDIProcessorGetTrackProcessor (unsigned int trk_num) const
 Returns a pointer to the MIDISequencerTrackProcessor for a track. More...
 
int GetTrackTimeShift (unsigned int trk_num) const
 Returns the time offset (in MIDI ticks) assigned to a track. More...
 
virtual bool SetRepeatPlay (int on_off, int start_meas=-1, int end_meas=-1)
 Sets the repeat play (loop) parameters: you can set the repeat play status on/off, the start and the end measure. More...
 
virtual void SetCountIn (bool on_off)
 Sets the count in enable or disable. More...
 
virtual bool SetTempoScale (unsigned int scale)
 Sets the global tempo scale. More...
 
virtual void SetTimeShiftMode (bool f)
 Sets the time shifting of events on and off. More...
 
virtual void SetState (MIDISequencerState *s)
 Copies a given MIDISequencerState into the internal sequencer state. More...
 
virtual void SetPlayMode (int mode)
 Sets the play mode. More...
 
virtual bool SetTrackOutPort (unsigned int trk_num, unsigned int port)
 Sets the MIDI out port for a track. More...
 
virtual bool SetTrackProcessor (unsigned int trk_num, MIDIProcessor *p)
 Sets a MIDIProcessor for the given track. More...
 
virtual bool SetTrackTimeShift (unsigned int trk_num, int offset)
 Sets the time shift offset (in MIDI ticks) for a track. More...
 
virtual bool InsertTrack (int trk_num=-1)
 Inserts into the internal MIDIMultiTrack a new empty track with default track parameters (transpose, time offset, etc.). More...
 
virtual bool DeleteTrack (int trk_num=-1)
 Deletes a track and all its events from the internal MIDIMultiTrack. More...
 
virtual bool MoveTrack (int from, int to)
 Moves a track from one position to another in the internal MIDIMultiTrack. More...
 
virtual bool GoToMeasure (unsigned int measure, unsigned int beat=0)
 Sets the current time to the given measure and beat, updating the internal status. More...
 
virtual bool GetNextEvent (int *trk_num, MIDITimedMessage *msg)
 Gets the next event (respect current position). More...
 
virtual bool GetNextEventTime (MIDIClockTime *time_clk)
 Gets the time of the next event (it can be different from current time if at current time there are not events). More...
 
virtual bool GetNextEventTimeMs (float *time_ms)
 Same of GetNextEventTime(), but time is returned in milliseconds from the beginning. More...
 
float MIDItoMs (MIDIClockTime time_clk)
 Converts a time from MIDI ticks into milliseconds, taking into account all tempo changes from the beginning of the song to the given time. More...
 
MIDIClockTime MeasToMIDI (unsigned int meas, unsigned int beat=0, unsigned int offset=0)
 TODO. More...
 
virtual void Play ()
 This is an alias of Start(). More...
 
- Public Member Functions inherited from MIDITickComponent
 MIDITickComponent (tPriority pr, MIDITick func)
 The constructor. More...
 
virtual ~MIDITickComponent ()
 The destructor. More...
 
MIDITickGetFunc () const
 Returns the address of the StaticTickProc() method, which will be called by the MIDIManager at every clock tick. More...
 
tPriority GetPriority () const
 Returns the priority. More...
 
tMsecs GetDevOffset () const
 Returns the user time offset parameter (see SetDevOffset()). More...
 
bool IsPlaying () const
 Returns true if the callback procedure is active. More...
 
void SetDevOffset (tMsecs dev_offs)
 Sets an user defined time offset, which will be added to every time calculation. More...
 

Protected Member Functions

void ExtractWarpPositions ()
 Internal use. More...
 
void CatchEventsBefore ()
 Internal use. More...
 
void CatchEventsBefore (int trk_num)
 Internal use. More...
 
- Protected Member Functions inherited from MIDISequencer
virtual void TickProc (tMsecs sys_time)
 Implements the pure virtual method inherited from MIDITickComponent (you must not call it directly). More...
 

Additional Inherited Members

- Public Types inherited from MIDISequencer
enum  { FOLLOW_MIDI_TIMESIG_MESSAGE , FOLLOW_TIMESIG_DENOMINATOR , FOLLOW_THEORETIC_VALUE }
 Values for the SetMetronomeMode() method. More...
 
enum  { PLAY_BOUNDED , PLAY_UNBOUNDED }
 Values for the play mode. More...
 
enum  { COUNT_IN_ENABLED = 1 , COUNT_IN_PENDING = 2 , AUTO_STOP_PENDING = 4 }
 Values for count_in_status. More...
 
- Static Public Member Functions inherited from MIDISequencer
static void SetMetronomeMode (int mode)
 Selects the way the sequencer calculates metronome beat. More...
 
- Static Protected Member Functions inherited from MIDISequencer
static void StaticTickProc (tMsecs sys_time, void *pt)
 Implements the static method inherited by MIDITickComponent and called at every timer tick. More...
 
static void StaticStopProc (MIDISequencer *p)
 Internal use for auto stop. More...
 
- Static Protected Member Functions inherited from MIDITickComponent
static void StaticTickProc (tMsecs sys_time, void *pt)
 This is the static callback procedure which the MIDIManager will call at every MIDITimer tick. More...
 
- Protected Attributes inherited from MIDITickComponent
const MIDITicktick_proc
 The pointer to the static callback (set by the constructor to StaticTickProc()). More...
 
tMsecs dev_time_offset
 A time offset set by the user and which you can use for your calculations. More...
 
tMsecs sys_time_offset
 The system time of the last call of Start(). More...
 
std::recursive_mutex proc_lock
 A mutex you can use for implementing thread safe methods. More...
 

Detailed Description

An enhanced MIDISequencer, able to directly load and play MIDI files and many more.

These are the improvements:

  • There is no need to manually add it to the MIDIManager queue (the constructor does it)
  • Has methods for loading/unloading a MIDI file into the internal MIDIMultiTrack
  • Embeds a MIDIThru component wich can rechannelize and transpose incoming messages, so you can play your keyboard while the sequencer is playing
  • Embeds a MIDISequencerTrackProcessor for each track, allowing to transpose, rechannelize, scale velocity, solo and mute the tracks
  • Has improved methods for jumping from a time to another: if you start the sequencer from the middle of a song it automatically sets appropriate MIDI controls, programs and sysex
Examples
test_advancedsequencer.cpp, test_advancedsequencer_noinput.cpp, test_recorder.cpp, test_recorder2.cpp, test_stepsequencer.cpp, test_win32_player.cpp, and test_writefile.cpp.

Constructor & Destructor Documentation

◆ AdvancedSequencer() [1/2]

AdvancedSequencer::AdvancedSequencer ( MIDISequencerGUINotifier n = 0)

Creates an AdvancedSequencer with 17 tracks (one for each channel plus the master track).

Adds the sequencer to the MIDIManager queue of tick components, so you can immediately start to edit the MIDIMultiTrack or load MIDI files and play. It raises an exception if in your system there are no MIDI out ports; if in the system there are no MIDI in ports the embedded MIDIThru is not created and its features are disabled.

Note
If you create the object with this constructor the Internal multitrack is owned by the sequencer and will be deleted when you destroy it.
Parameters
na pointer to a MIDISequencerGUINotifier. If you leave 0 the sequencer will not notify the GUI.
Exceptions
RtMidiError::INVALID_DEVICEif in the system are not present MIDI out ports.

◆ AdvancedSequencer() [2/2]

AdvancedSequencer::AdvancedSequencer ( MIDIMultiTrack mlt,
MIDISequencerGUINotifier n = 0 
)

Creates an AdvancedSequencer from a given MIDIMultiTrack.

Adds the sequencer to the MIDIManager queue of tick components, so you can immediately start to play. It raises an exception if in your system there are no MIDI out ports; if in the system there are no MIDI in ports the embedded MIDIThru is not created and its features are disabled.

Note
If you create the object with this constructor the Internal multitrack is not owned by the sequencer and won't be deleted when you destroy it.
Parameters
mltthe MIDIMultiTrack supplied by the user
na pointer to a MIDISequencerGUINotifier. If you leave 0 the sequencer will not notify the GUI.
Exceptions
RtMidiError::INVALID_DEVICEif in the system are not present MIDI out ports.

◆ ~AdvancedSequencer()

virtual AdvancedSequencer::~AdvancedSequencer ( )
virtual

The destructor.

Member Function Documentation

◆ Reset()

virtual void AdvancedSequencer::Reset ( )
virtual

Resets the status of the sequencer (does not empty the MIDIMultiTrack).

Use this if you have modified the MIDIMultiTrack adding, moving or deleting tracks; this moves the time to 0 and resets all the processors.

Reimplemented from MIDISequencer.

◆ Load() [1/2]

virtual bool AdvancedSequencer::Load ( const char *  fname)
virtual

Loads a MIDIFile into the internal MIDIMultiTrack.

It can change the MIDIMultiTrack::clks_per_beat parameter according to the file signature. You can then play the MIDI content with the Play() method.

Parameters
fnamethe file name.
Returns
true if the file has been loaded; if not it returns false and leaves the multitrack in its previous status.
Examples
test_advancedsequencer.cpp, and test_win32_player.cpp.

◆ Load() [2/2]

virtual bool AdvancedSequencer::Load ( const MIDIMultiTrack tracks)
virtual

Copies the content of an external MIDIMultiTrack into the sequencer.

It can change the MIDIMultiTrack::clks_per_beat parameter according to the multitrack signature. You can then play the MIDI content with the Play() method.

Parameters
tracksthe MIDIMultiTrack to be copied.
Returns
always returns true.

◆ UnLoad()

virtual void AdvancedSequencer::UnLoad ( )
virtual

Clears the contents of the internal MIDIMultiTrack.

Moreover it resets its MIDIMultiTrack::clks_per_beat parameter to DEFAULT_CLKS_PER_BEAT.

◆ IsLoaded()

bool AdvancedSequencer::IsLoaded ( ) const
inline

Returns true if the internal MIDIMultiTrack is not empty.

◆ GetFileName()

std::string AdvancedSequencer::GetFileName ( )
inline

Returns the name of the loaded file (or an empty string if it is not yet defined).

◆ GetFileHeader()

const MIDIFileHeader & AdvancedSequencer::GetFileHeader ( )
inline

Returns the header of the loaded file.

◆ GetMIDIThru() [1/2]

MIDIThru * AdvancedSequencer::GetMIDIThru ( )
inline

Returns the address of the MIDIThru tick component.

This is NULL if in the system there are no MIDI in ports and the thru is disabled.

Examples
test_advancedsequencer.cpp.

◆ GetMIDIThru() [2/2]

const MIDIThru * AdvancedSequencer::GetMIDIThru ( ) const
inline

Returns a pointer to the MIDIThru tick component.

This is NULL if in the system there are no MIDI in ports and the thru is disabled.

◆ GetMIDIThruEnable()

bool AdvancedSequencer::GetMIDIThruEnable ( ) const
inline

Returns true if MIDIThru is enabled (always false if the thru is not present).

◆ GetMIDIThruChannel()

int AdvancedSequencer::GetMIDIThruChannel ( ) const
inline

Returns the output channel of the MIDIThru, -1 if the thru is not present.

See Numbering conventions.

◆ GetMIDIThruTranspose()

int AdvancedSequencer::GetMIDIThruTranspose ( ) const
inline

Returns the transpose amount of the MIDIThru, 0 if the thru is not present.

◆ GetSoloMode()

bool AdvancedSequencer::GetSoloMode ( ) const

Returns true if any track is soloed.

◆ GetTrackSolo()

bool AdvancedSequencer::GetTrackSolo ( unsigned int  trk_num) const
inline

Returns true if a specific track is soloed.

Parameters
trk_numthe number of the track

◆ GetTrackMute()

bool AdvancedSequencer::GetTrackMute ( unsigned int  trk_num) const
inline

Returns true if a specific track is muted.

Parameters
trk_numthe number of the track
Examples
test_advancedsequencer.cpp.

◆ GetNumMeasures()

int AdvancedSequencer::GetNumMeasures ( ) const
inline

Returns the number of measures of the loaded song.

◆ GetCurrentMeasure()

unsigned int AdvancedSequencer::GetCurrentMeasure ( ) const

Returns the current measure number (first is 0). See Numbering conventions.

Examples
test_advancedsequencer.cpp, and test_win32_player.cpp.

◆ GetCurrentBeat()

unsigned int AdvancedSequencer::GetCurrentBeat ( ) const

Returns the number of current beat (first is 0). See Numbering conventions.

Examples
test_advancedsequencer.cpp, and test_win32_player.cpp.

◆ GetCurrentBeatOffset()

MIDIClockTime AdvancedSequencer::GetCurrentBeatOffset ( ) const

Returns the current MIDI time offset respect current beat.

◆ GetTimeSigNumerator()

int AdvancedSequencer::GetTimeSigNumerator ( ) const

Returns the numerator of current time signature.

Examples
test_win32_player.cpp.

◆ GetTimeSigDenominator()

int AdvancedSequencer::GetTimeSigDenominator ( ) const

Returns the denominator of current time signature.

Examples
test_win32_player.cpp.

◆ GetKeySigSharpsFlats()

int AdvancedSequencer::GetKeySigSharpsFlats ( ) const

Return the number of sharps or flats of the current key signature.

See MIDIMessage::GetKeySigSharpsFlats().

Examples
test_win32_player.cpp.

◆ GetKeySigMode()

int AdvancedSequencer::GetKeySigMode ( ) const

Returns the mode (major/minor) of the he current key signature.

See MIDIMessage::GetKeySigMode().

Examples
test_win32_player.cpp.

◆ GetCurrentMarker()

std::string AdvancedSequencer::GetCurrentMarker ( ) const

Returns the current marker text.

Examples
test_win32_player.cpp.

◆ GetTrackName()

std::string AdvancedSequencer::GetTrackName ( unsigned int  trk_num) const

Returns the name of the given track.

Examples
test_win32_player.cpp.

◆ GetTrackVolume()

int AdvancedSequencer::GetTrackVolume ( unsigned int  trk_num) const

Returns the current MIDI volume for the given track (-1 if volume wasn't set at time 0).

Examples
test_win32_player.cpp.

◆ GetTrackProgram()

int AdvancedSequencer::GetTrackProgram ( unsigned int  trk_num) const

Returns the current MIDI program (patch) for the given track (-1 if the program wasn't set at time 0).

Examples
test_win32_player.cpp.

◆ GetTrackNoteCount()

int AdvancedSequencer::GetTrackNoteCount ( unsigned int  trk_num) const

Returns the number of notes currently sounding on the given track (0 if the sequencer is not playing).

Examples
test_win32_player.cpp.

◆ GetTrackVelocityScale()

unsigned int AdvancedSequencer::GetTrackVelocityScale ( unsigned int  trk_num) const

Returns the velocity scale percentage for the given track.

◆ GetTrackRechannelize()

int AdvancedSequencer::GetTrackRechannelize ( unsigned int  trk_num) const

Returns the rechannelized channel for the given track (-1 if the track is not rechannelized).

See Numbering conventions.

◆ GetTrackChannel()

int AdvancedSequencer::GetTrackChannel ( unsigned int  trk_num)

If the track has channel messages all with same channel returns the channel, otherwise -1.

See Numbering conventions.

Note
This is not const because it may reanalyze the track setting its status parameter.
Examples
test_win32_player.cpp.

◆ GetTrackTranspose()

int AdvancedSequencer::GetTrackTranspose ( unsigned int  trk_num) const

Returns the transposing amount in semitones for the given track.

◆ GetTrackTimeShift()

int AdvancedSequencer::GetTrackTimeShift ( unsigned int  trk_num) const

Returns the time offset (in MIDI ticks) assigned to the given track.

◆ GetTrackProcessor() [1/2]

MIDISequencerTrackProcessor * AdvancedSequencer::GetTrackProcessor ( unsigned int  trk_num)
inline

Returns a pointer to the MIDISequencerTrackProcessor for the given track.

◆ GetTrackProcessor() [2/2]

const MIDISequencerTrackProcessor * AdvancedSequencer::GetTrackProcessor ( unsigned int  trk_num) const
inline

Returns a pointer to the MIDISequencerTrackProcessor for the given track.

◆ SetFileName()

void AdvancedSequencer::SetFileName ( std::string &  fname)
inline

Sets a name for the content of sequencer.

◆ SetMIDIThruEnable()

bool AdvancedSequencer::SetMIDIThruEnable ( bool  on_off)

Enables or disables the embedded MIDIthru.

This has no effect if the thru is not present.

Returns
true if the thru has been enabled/disabled, false otherwise.
Examples
test_advancedsequencer.cpp.

◆ SetMIDIThruChannel()

bool AdvancedSequencer::SetMIDIThruChannel ( int  chan)

Sets the out channel for MIDIthru.

You can set -1 as parameter for leaving the channel of incoming messages unchanged. This has no effect if the thru is not present. See Numbering conventions.

Returns
true if the channel has been set, false otherwise.

◆ SetMIDIThruTranspose()

bool AdvancedSequencer::SetMIDIThruTranspose ( int  amt)

Sets a transpose amount in semitones for the messages coming from the MIDIThru.

This has no effect if the thru is not present. See MIDIProcessorTransposer.

Returns
true if the transpose has been set, false otherwise.

◆ SetTrackSolo()

bool AdvancedSequencer::SetTrackSolo ( unsigned int  trk_num)

Soloes the given track muting all others.

Returns
true if _trk_num is a valid track number, false otherwise.
Examples
test_advancedsequencer.cpp.

◆ UnSoloTrack()

void AdvancedSequencer::UnSoloTrack ( )

Unsoloes the soloed track unmuting all others.

Examples
test_advancedsequencer.cpp.

◆ SetTrackMute()

bool AdvancedSequencer::SetTrackMute ( unsigned int  trk_num,
bool  f 
)

Mutes/unmutes the given track (it has no effect on others).

Returns
true if _trk_num is a valid track number, false otherwise.
Examples
test_advancedsequencer.cpp.

◆ UnmuteAllTracks()

void AdvancedSequencer::UnmuteAllTracks ( )

Unmutes all muted tracks (this has no effect on tracks muted by SoloTrack()).

Examples
test_advancedsequencer.cpp.

◆ SetTrackVelocityScale()

bool AdvancedSequencer::SetTrackVelocityScale ( unsigned int  trk_num,
unsigned int  scale 
)

Sets a track velocity scale in percentage for the given track.

Returns
true if _trk_num is a valid track number, false otherwise.
Examples
test_advancedsequencer.cpp.

◆ SetTrackRechannelize()

bool AdvancedSequencer::SetTrackRechannelize ( unsigned int  trk_num,
int  chan 
)

Redirects all channel messages in the track on the given channel.

This is done during playback by mean of a TrackProcessor, without changing original messages. Calling this with chan = -1 disables the rechannelizing. See Numbering conventions

Returns
true if _trk_num is a valid track number, false otherwise.

◆ SetTrackTranspose()

bool AdvancedSequencer::SetTrackTranspose ( unsigned int  trk_num,
int  amt 
)

Sets a transpose amount in semitones for the given track.

See MIDIProcessorTransposer.

Returns
true if _trk_num is a valid track number, false otherwise.
Examples
test_advancedsequencer.cpp.

◆ GoToZero()

virtual void AdvancedSequencer::GoToZero ( )
inlinevirtual

Sets the current time to the beginning of the song.

This method is thread-safe and can be called during playback. Notifies the GUI a GROUP_ALL event to signify a full GUI reset.

Reimplemented from MIDISequencer.

Examples
test_advancedsequencer.cpp, test_advancedsequencer_noinput.cpp, test_win32_player.cpp, and test_writefile.cpp.

◆ GoToTime()

virtual bool AdvancedSequencer::GoToTime ( MIDIClockTime  time_clk)
virtual

Sets the current time to the given MIDI time.

This is as MIDISequencer::GoToTime() but uses a faster algorithm and sends to the MIDI out ports all the appropriate sysex, patch, pitch bend and control change messages. Notifies the GUI a GROUP_ALL event to signify a full GUI reset.

Reimplemented from MIDISequencer.

◆ GoToTimeMs()

virtual bool AdvancedSequencer::GoToTimeMs ( float  time_ms)
virtual

Same as GoToTime(), but the time is given in milliseconds.

Reimplemented from MIDISequencer.

◆ GoToMeasure()

virtual bool AdvancedSequencer::GoToMeasure ( int  measure,
int  beat = 0 
)
virtual

Sets the current time to the given measure and beat.

This is as MIDISequencer::GoToMeasure() but uses a faster algorithm and sends to the MIDI out ports all the appropriate sysex, patch, pitch bend and control change messages. Notifies the GUI a GROUP_ALL event to signify a full GUI reset. See Numbering conventions.

Examples
test_advancedsequencer.cpp, and test_win32_player.cpp.

◆ Start()

virtual void AdvancedSequencer::Start ( )
virtual

Starts the sequencer playing from the current time.

Reimplemented from MIDISequencer.

◆ Stop()

virtual void AdvancedSequencer::Stop ( )
virtual

Stops the sequencer playing.

Reimplemented from MIDISequencer.

Examples
test_advancedsequencer.cpp, and test_win32_player.cpp.

◆ OutputMessage()

void AdvancedSequencer::OutputMessage ( MIDITimedMessage msg,
unsigned int  port 
)

Sends a given MIDI message to an hardware port.

This is thread-safe and can be called while playing.

Parameters
msgthe MIDI message
portthe port id

◆ SetSMPTE()

bool AdvancedSequencer::SetSMPTE ( SMPTE s)

Sets the parameters of the given SMPTE according to the loaded content.

If the loaded file contains a MIDI SMPTE offset message, sets the parameters according to the offset and the frame rate of the message, otherwise sets it to standard values (offset=0, frame=30FPS).

Warning
You cannot call this while the sequencer is playing.
Returns
true if the SMPTE has been set, false otherwise.
Examples
test_win32_player.cpp.

◆ UpdateStatus()

virtual void AdvancedSequencer::UpdateStatus ( )
virtual

This should be used to update the sequencer internal parameters after editing the multitrack.

If you have added, deleted or edited events call this before moving time, getting events or playing. For changes in the track structure see InsertTrack(), DeleteTrack() and MoveTrack()).

Reimplemented from MIDISequencer.

Examples
test_advancedsequencer_noinput.cpp, and test_writefile.cpp.

◆ ExtractWarpPositions()

void AdvancedSequencer::ExtractWarpPositions ( )
protected

Internal use.

It registers the state of the sequencer every MEASURES_PER_WARP measures, and creates a std::vector of MIDISequencerState for a quicker jump from a time to another.

◆ CatchEventsBefore() [1/2]

void AdvancedSequencer::CatchEventsBefore ( )
protected

Internal use.

When jumping from a time to another while the sequencer is playing, it examines all events between old and new time (or between start and new time, if lesser then old), sending to the ports the appropriate control, program, pitch bend and sysex messages in order to exactly reproduce the sequencer setting at the new time.

◆ CatchEventsBefore() [2/2]

void AdvancedSequencer::CatchEventsBefore ( int  trk_num)
protected

Internal use.

As above, but only on the given track (this is useful when a formerly muted track is unmuted, and needs to be set with appropriate controls, program etc.


The documentation for this class was generated from the following file: