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

Stores current MIDI general parameters for a MIDISequencer object, embedding a MIDISequencerTrackState for each track. More...

#include <sequencer.h>

Inheritance diagram for MIDISequencerState:
MIDIProcessor

Public Member Functions

 MIDISequencerState (MIDIMultiTrack *multitrack_, MIDISequencerGUINotifier *n=0)
 The constructor is called by the MIDISequencer class constructor, which sets appropriate values for parameters. More...
 
 MIDISequencerState (const MIDISequencerState &s)
 The copy constructor. More...
 
virtual ~MIDISequencerState ()
 The destructor. More...
 
const MIDISequencerStateoperator= (const MIDISequencerState &s)
 The assignment operator. See the note to the copy constructor. More...
 
void Reset ()
 Resets the state to default values. More...
 
bool Process (MIDITimedMessage *msg)
 This is the process function inherited from MIDIProcessor. More...
 
void Notify (int group, int item=0) const
 Notifies the GUI when something happens (a parameter was changed, current time is moved, etc.) More...
 
void NotifyTrack (int item) const
 These are used for notifying the GUI when something happens (a parameter was changed, current time is moved, etc.) More...
 
void GoForwardNoEvent (MIDIClockTime t)
 Sets the cur time to the given time. More...
 
- Public Member Functions inherited from MIDIProcessor
 MIDIProcessor ()
 The constructor. More...
 
virtual ~MIDIProcessor ()
 The destructor. More...
 

Public Attributes

MIDISequencerGUINotifiernotifier
 The notifier. More...
 
MIDIMultiTrackmultitrack
 The MIDIMultiTrack holding MIDI messages. More...
 
MIDIMultiTrackIterator iterator
 The iterator for moving along the multitrack. More...
 
MIDIClockTime cur_clock
 The current MIDI clock in MIDI ticks. More...
 
float cur_time_ms
 The current clock in milliseconds. More...
 
unsigned int cur_beat
 The current beat in the measure (1st beat is 0) More...
 
unsigned int cur_measure
 The current measure (1st measure is 0) More...
 
MIDIClockTime beat_length
 The duration of a beat. More...
 
unsigned int number_of_beats
 Number of beats in the measure. More...
 
MIDIClockTime next_beat_time
 The MIDI time of the next beat (for internal use) More...
 
float tempobpm
 The current tempo in beats per minute. More...
 
unsigned int tempo_scale
 The tempo scale in percentage (100 = true time) More...
 
unsigned char timesig_numerator
 The numerator of current time signature. More...
 
unsigned char timesig_denominator
 The denominator of current time signature. More...
 
signed char keysig_sharpflat
 The current key signature accidents (. More...
 
unsigned char keysig_mode
 Major mode (0) or minor (1) More...
 
std::string marker_text
 The current marker. More...
 
std::vector< MIDISequencerTrackState * > track_states
 A track state for every track. More...
 
int last_event_track
 Internal use. More...
 
MIDIClockTime last_beat_time
 Internal use. More...
 
float ms_per_clock
 Internal use. More...
 
float last_time_ms
 Internal use. More...
 
MIDIClockTime last_tempo_change
 Internal use. More...
 
MIDIClockTime count_in_time
 Internal use. More...
 
unsigned char playing_status
 Flag affecting the TickProc (count in, auto stop, etc.) More...
 

Static Public Attributes

static int metronome_mode
 Flag affecting how metronome beat is calculated. More...
 

Detailed Description

Stores current MIDI general parameters for a MIDISequencer object, embedding a MIDISequencerTrackState for each track.

It contains a MIDIMultiTrackIterator, allowing to set a 'now' time: when current time changes (because the sequencer is playing or time is changed by the user) the object keep tracks of current timesig, keysig, tempo(BPM), marker, measure and beat data. Moreover it contains an independent MIDISequencerTrackState for every MIDI Track of the MIDISequencer, and you can examine them for knowing actual track parameters. It inherits from the pure virtual MIDIProcessor: the MIDISequencer sends to it MIDI messages and it processes them remembering actual parameters and notifying changes to the GUI. All methods and attributes are public because they are used by MIDISequencer class; the advanced class AdvancedSequencer allows you to know actual parameters without directly examining them, so the use of this class is mainly internal. However, you could subclass it if you want to keep track of other parameters.

Constructor & Destructor Documentation

◆ MIDISequencerState() [1/2]

MIDISequencerState::MIDISequencerState ( MIDIMultiTrack multitrack_,
MIDISequencerGUINotifier n = 0 
)

The constructor is called by the MIDISequencer class constructor, which sets appropriate values for parameters.

◆ MIDISequencerState() [2/2]

MIDISequencerState::MIDISequencerState ( const MIDISequencerState s)

The copy constructor.

Note
This only copies the pointers to the sequencer and the notifier, so you can use it only if you are copying different states of the same MIDISequencer class instance.

◆ ~MIDISequencerState()

virtual MIDISequencerState::~MIDISequencerState ( )
virtual

The destructor.

The sequencer and notifier pointers are not owned by the class and they won't freed.

Member Function Documentation

◆ operator=()

const MIDISequencerState & MIDISequencerState::operator= ( const MIDISequencerState s)

The assignment operator. See the note to the copy constructor.

◆ Reset()

void MIDISequencerState::Reset ( )
virtual

Resets the state to default values.

These are: cur_clock = 0, tempo = 120 bpm, time = 4/4, keysig = C Maj, no marker. Moreover resets all track states (see MIDISequencerTrackState::Reset()).

Implements MIDIProcessor.

◆ Process()

bool MIDISequencerState::Process ( MIDITimedMessage msg)
virtual

This is the process function inherited from MIDIProcessor.

When you get a MIDI message from the sequencer, it is processed by the state, which updates its parameters and notifies the GUI if required.

Returns
true if msg is a real MIDI message, false if it is a service message (a NoOp or beat marker).

Implements MIDIProcessor.

◆ Notify()

void MIDISequencerState::Notify ( int  group,
int  item = 0 
) const

Notifies the GUI when something happens (a parameter was changed, current time is moved, etc.)

◆ NotifyTrack()

void MIDISequencerState::NotifyTrack ( int  item) const

These are used for notifying the GUI when something happens (a parameter was changed, current time is moved, etc.)

◆ GoForwardNoEvent()

void MIDISequencerState::GoForwardNoEvent ( MIDIClockTime  t)

Sets the cur time to the given time.

This assumes t > cur_time and no events in the interval. It is used, for example, by the sequencer when it must go to a time with no event, or after the end time in UNBOUNDED mode.

Warning
this doesn't check anything and doesn't process any event.

Member Data Documentation

◆ notifier

MIDISequencerGUINotifier* MIDISequencerState::notifier

The notifier.

◆ multitrack

MIDIMultiTrack* MIDISequencerState::multitrack

The MIDIMultiTrack holding MIDI messages.

◆ iterator

MIDIMultiTrackIterator MIDISequencerState::iterator

The iterator for moving along the multitrack.

◆ cur_clock

MIDIClockTime MIDISequencerState::cur_clock

The current MIDI clock in MIDI ticks.

◆ cur_time_ms

float MIDISequencerState::cur_time_ms

The current clock in milliseconds.

◆ cur_beat

unsigned int MIDISequencerState::cur_beat

The current beat in the measure (1st beat is 0)

◆ cur_measure

unsigned int MIDISequencerState::cur_measure

The current measure (1st measure is 0)

◆ beat_length

MIDIClockTime MIDISequencerState::beat_length

The duration of a beat.

◆ number_of_beats

unsigned int MIDISequencerState::number_of_beats

Number of beats in the measure.

◆ next_beat_time

MIDIClockTime MIDISequencerState::next_beat_time

The MIDI time of the next beat (for internal use)

◆ tempobpm

float MIDISequencerState::tempobpm

The current tempo in beats per minute.

◆ tempo_scale

unsigned int MIDISequencerState::tempo_scale

The tempo scale in percentage (100 = true time)

◆ timesig_numerator

unsigned char MIDISequencerState::timesig_numerator

The numerator of current time signature.

◆ timesig_denominator

unsigned char MIDISequencerState::timesig_denominator

The denominator of current time signature.

◆ keysig_sharpflat

signed char MIDISequencerState::keysig_sharpflat

The current key signature accidents (.

Examples
test_win32_player.cpp.

◆ keysig_mode

unsigned char MIDISequencerState::keysig_mode

Major mode (0) or minor (1)

Examples
test_win32_player.cpp.

◆ marker_text

std::string MIDISequencerState::marker_text

The current marker.

◆ track_states

std::vector<MIDISequencerTrackState*> MIDISequencerState::track_states

A track state for every track.

◆ last_event_track

int MIDISequencerState::last_event_track

Internal use.

◆ last_beat_time

MIDIClockTime MIDISequencerState::last_beat_time

Internal use.

◆ ms_per_clock

float MIDISequencerState::ms_per_clock

Internal use.

◆ last_time_ms

float MIDISequencerState::last_time_ms

Internal use.

◆ last_tempo_change

MIDIClockTime MIDISequencerState::last_tempo_change

Internal use.

◆ count_in_time

MIDIClockTime MIDISequencerState::count_in_time

Internal use.

◆ playing_status

unsigned char MIDISequencerState::playing_status

Flag affecting the TickProc (count in, auto stop, etc.)

◆ metronome_mode

int MIDISequencerState::metronome_mode
static

Flag affecting how metronome beat is calculated.


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