#include <sequencer.hh>
Inheritance diagram for yase::Sequencer:
Collaboration diagram for yase::Sequencer:A general purpose sequencers.
Sequences can be built in two ways.
| [input] | clock Should be wired to the "signal" output of a Clock object. |
| [input] | duration The fraction of the clock period between 0 and 1 to hold a note down before releasing it. |
Public Member Functions | |
| void | init () |
| void | update () |
| void | keydown (const Event &e) |
| void | keyup (const Event &e) |
| void | insert_rest () |
| Insert a rest onto the end of the sequence. | |
| void | reset () |
| Reset the sequence counter to the beginning of the sequence. | |
| void | record () |
| Put the sequencer into record mode so it will respond to calls to keydown() | |
| void | stop () |
| Stop the sequencer playing. | |
| void | play () |
| void | clear () |
| Clear the sequence, erasing all events. | |
| void | allocate (int n) |
| void | set (int index, int note) |
| bool | is_rest (int index) |
| void | rest (int index) |
| void | decrease_duration (double amount) |
| void | increase_duration (double amount) |
| bool | is_playing () |
| Returns true if the sequencer is playing (because of a previous call to play()) | |
Public Member Functions inherited from yase::Module | |
| virtual void | init ()=0 |
| virtual void | update ()=0 |
| int | add_input (string name) |
| int | add_output (string name) |
| int | get_input_index (string name) const |
| string | get_input_name (int index) const |
| string | get_output_name (int index) const |
| int | get_output_index (string name) const |
| void | set_input (string name, double value) |
| void | set_input (int index, double value) |
| double | get_input (int index) const |
| double | get_input (string name) const |
| double | get_output (string name) const |
| double | get_output (int index) const |
| void | set_output (int index, double value) |
| void | copy_inputs (const Module &source) |
| void | copy_outputs (Module &destination) const |
| void | configure (std::vector< std::tuple< string, double > > assignments) |
| int | num_inputs () const |
| int | num_outputs () const |
| void | emit (Event e) |
| void | set_ts (double s) |
| double | get_ts () |
| void yase::Sequencer::allocate | ( | int | n | ) |
Allocate a sequence of n steps, and initialize all of them to be rests.
| n | The length of the sequence |
| void yase::Sequencer::decrease_duration | ( | double | amount | ) |
Increase the duration, as a fraction of the period, of time between a MIDI_KEYDOWN and a MIDI_KEYUP event. Does bounds checking. Note that the default duration is 0.5.
| amount | The amount. |
| void yase::Sequencer::increase_duration | ( | double | amount | ) |
Decrease the duration, as a fraction of the period, of time between a MIDI_KEYDOWN and a MIDI_KEYUP event. Does bounds checking. Note that the default duration is 0.5.
| amount | The amount. |
|
virtual |
This method should be overridden by derived classes. It will usually be called once, after all modules and connections objects have been added to a synthesizer, but before the synthesizer starts running.
Implements yase::Module.
| bool yase::Sequencer::is_rest | ( | int | index | ) |
Return true of the sequence at the given index is a rest
| index | The given index |
| void yase::Sequencer::keydown | ( | const Event & | e | ) |
| void yase::Sequencer::keyup | ( | const Event & | e | ) |
Not used
| e | The keyup event |
| void yase::Sequencer::play | ( | ) |
Play the sequencer. It will emit MIDI events that look just like MIDI events coming from a Midi device. So if you, for example, have a midi keyboard set up with Container listen() handlers, it will also "see" the sequencer events. Note that normally a sequencer needs to be added to a Container to work.
| void yase::Sequencer::rest | ( | int | index | ) |
Set the sequence at the given index to a rest
| index | The given index |
| void yase::Sequencer::set | ( | int | index, |
| int | note | ||
| ) |
Set the a sequence event at the given index to play the given note
| index | The index of the event |
| note | The MIDI id ot eh note to play |
|
virtual |
This method should be overridden by derived classes. It will be called repeatedly by a synthesizer at a frequency determined by SAMPLE_RATE.
Implements yase::Module.