libmetro
|
#include <libmetro.h>
Public Types | |
enum | Timbre { Sine, Drum } |
Public Member Functions | |
Note () | |
Empty Note constructor. More... | |
Note (Timbre timbre, float frequency, float volume) | |
Note constructor with timbre. More... | |
Note (std::string triplet) | |
Note constructor with convenient string represenation. More... | |
float & | operator[] (size_t index) |
index into underlying vector of floats. | |
const float & | operator[] (size_t index) const |
index into underlying vector of floats. | |
std::vector< float > & | get_frames () |
get a reference to the underlying vector of floats. | |
size_t | size () |
size of underlying vector of floats. | |
Note | operator+ (const Note &other) |
sum underlying vectors and return new Note | |
Note class.
Notes wrap a vector of floats to represent a sound. Notes are always 2*48,000 = 96,000 samples long (1 second of data per channel, 2 channels).
The actual duration of 96,000 depends on the software_latency param in libsoundio:
>Ignoring hardware latency, this is the number of seconds it takes for the last sample in a full buffer to be played.
http://libsound.io/doc-2.0.0/structSoundIoOutStream.html#a20aac1422d3cc64b679616bb8447f06d
enum metro::Note::Timbre |
|
inline |
Empty Note constructor.
Empty notes are essential to libmetro to always keep streams warm by supplying them with 0s even if no audio is being output at a tick.
metro::Note::Note | ( | Timbre | timbre, |
float | frequency, | ||
float | volume | ||
) |
Note constructor with timbre.
[in] | timbre | Sine or Drum. |
[in] | frequency | for Sine, frequency represents the frequency. For Drum, frequency represents the frequency to General MIDI percussion note number. |
[in] | volume | loudness in percent, i.e. 100% is max volume |
metro::Note::Note | ( | std::string | triplet | ) |
Note constructor with convenient string represenation.
[in] | triplet | string in format 'timbre,freq,vol' |