#include <player.hh>
Inheritance diagram for yase::Player:
Collaboration diagram for yase::Player:Cycle through a list of pitches, running a callback for each one with the specified duration.
Public Member Functions | |
| void | set (vector< double > pitch_list, function< void(double)> f, double dt) |
| void | init () |
| void | update () |
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 () |
|
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.
| void yase::Player::set | ( | vector< double > | pitch_list, |
| function< void(double)> | f, | ||
| double | dt | ||
| ) |
Set the list of pitches, the callback function, and the duration of each step in the player's cycle. For example,
player.set({ 440, 587.33, 220, 659.26, 246.94, 293.67 }, [&] (double freq) {
osc.set_input("frequency", freq);
}, 1.0);
| pitch_list | the list of pitches |
| f | the callback function, which should take a pitch as an argument |
| dt | The duration of each step |
|
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.