28#ifndef _NICMIDI_METRONOME_H
29#define _NICMIDI_METRONOME_H
142 unsigned int out_port;
144 unsigned char meas_note;
145 unsigned char beat_note;
146 unsigned char subd_note;
147 unsigned char subd_type;
148 unsigned char timesig_numerator;
152 unsigned int tempo_scale;
156 unsigned int cur_beat;
157 unsigned int cur_measure;
160 float msecs_per_beat;
173 static const unsigned char DEFAULT_CHAN = 9;
174 static const unsigned char DEFAULT_MEAS_NOTE = 60;
175 static const unsigned char DEFAULT_BEAT_NOTE = 58;
176 static const unsigned char DEFAULT_SUBD_NOTE = 56;
177 static const unsigned char MEAS_NOTE_VEL = 120;
178 static const unsigned char BEAT_NOTE_VEL = 100;
179 static const unsigned char SUBD_NOTE_VEL = 80;
180 static const int MIN_NOTE_LEN = 20;
186 unsigned int new_out_port;
187 unsigned char new_chan;
188 unsigned char new_meas_note;
189 unsigned char new_beat_note;
190 unsigned char new_subd_note;
191 unsigned char new_subd_type;
192 unsigned char new_timesig_numerator;
193 unsigned char new_timesig_denominator;
195 unsigned int new_tempo_scale;
A pure virtual class implementing a device that can send MIDISequencerGUIEvent messages to a GUI.
Definition: notifier.h:162
A pure virtual class implementing an object which has a callback procedure to be called at every tick...
Definition: tick.h:65
A MIDITickComponent implementing a metronome.
Definition: metronome.h:46
unsigned char GetTimeSigNumerator() const
Returns the numerator of the current timesig.
Definition: metronome.h:87
bool SetOutPort(unsigned int port)
Sets the MIDI out port for the metronome clicks.
unsigned int GetCurrentBeat() const
Returns current beat in the measure (1st beat is 0).
Definition: metronome.h:65
Metronome(MIDISequencerGUINotifier *n=0)
The constructor.
unsigned int GetOutChannel() const
Returns the number of the MIDI channel assigned to the metronome.
Definition: metronome.h:76
bool SetTempoScale(unsigned int scale)
Sets the global tempo scale.
static void StaticTickProc(tMsecs sys_time, void *pt)
Implements the static method inherited from MIDITickComponent and called at every timer tick.
unsigned char GetSubdNote() const
Returns the MIDI note number for the subdivision click.
Definition: metronome.h:82
virtual void Stop()
Stops the metronome.
float GetTempoWithoutScale() const
Returns current tempo (BPM) without scaling.
Definition: metronome.h:69
void SetSubdNote(unsigned char note)
Sets the MIDI note number for the subdivision click.
unsigned char GetSubdType() const
Returns the subdivision type. It can be 0 (subd clicks disabled), 2, 3, 4, 5, 6.
Definition: metronome.h:84
virtual void Start()
Starts the metronome.
void UpdateValues()
Copies the temp values assigned by the set methods into the effective ones.
virtual void Reset()
Stops the metronome and resets it to its default values.
void SetMeasNote(unsigned char note)
Sets the MIDI note number for the measure click (the 1st beat of the measure).
unsigned char GetBeatNote() const
Returns the MIDI note number for the ordinary beat click.
Definition: metronome.h:80
void SetTimeSigNumerator(unsigned char n)
Sets the numerator of the current timesig.
unsigned int GetOutPort() const
Returns the number of the MIDI out port assigned to the metronome.
Definition: metronome.h:73
virtual ~Metronome()
The destructor. The MIDISequencerGUINotifier is not owned by the Metronome.
Definition: metronome.h:54
unsigned int GetCurrentMeasure() const
Returns current measure (1st measure is 0).
Definition: metronome.h:63
void SetBeatNote(unsigned char note)
Sets the MIDI note number for the ordinary beat click.
virtual void TickProc(tMsecs sys_time)
Implements the pure virtual method inherited from MIDITickComponent (you must not call it directly).
unsigned char GetMeasNote() const
Returns the MIDI note number for the measure click.
Definition: metronome.h:78
bool SetTempo(float t)
Sets the musical tempo.
float GetCurrentTimeMs() const
Returns current time in milliseconds from the start of the metronome.
MIDIClockTime GetCurrentMIDIClockTime() const
Returns current MIDIClockTime in MIDI ticks from the start of the metronome.
Definition: metronome.h:58
unsigned int GetTempoScale() const
Returns current tempo scale in percentage (100 = no scaling, 200 = twice faster, etc....
Definition: metronome.h:67
bool SetOutChannel(unsigned int chan)
Sets the MIDI channel for the metronome clicks.
bool SetSubdType(unsigned char type)
Sets the subdivision type.
float GetTempoWithScale() const
Returns current tempo (BPM) taking into account scaling (this is the true actual tempo).
Definition: metronome.h:71
unsigned long MIDIClockTime
The type of a variable which can hold a time in MIDI ticks.
Definition: midi.h:40
unsigned long long tMsecs
The type of a variable which can hold the elapsed time in milliseconds.
Definition: timer.h:44
const unsigned int DEFAULT_CLKS_PER_BEAT
The default clocks per beat parameter when initializing a MIDIMultiTrack.
Definition: midi.h:51
Contains the MIDI values enumerations (to have readable values instead of hexadecimal values) and som...
Contains the definition of the classes MIDISequencerGUIEvent, MIDISequencerGUINotifier (abstract),...
Contains the definition of the pure virtual class MIDITickComponent.