Just Intonation
Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
|
Scale - a set of PCM waves with a characteristic intensity and length. More...
#include <scale.h>
Public Member Functions | |
Scale () | |
Constructor, creates N=128 empty wave objects. More... | |
Wave & | getWave (int &key) |
Get the wave corresponding to a given key. More... | |
bool | write (QIODevice &iodevice, Voice *voice=nullptr) |
Write scale to device. More... | |
bool | read (QIODevice &iodevice, Voice *voice=nullptr) |
Read data of a scale from a device. More... | |
void | printInfo () |
Scale::printInfo. More... | |
void | generateArtificialSound (Voice *voice=nullptr, int samplerate=44100) |
Generate a scale of artificial sounds in equal temperament. More... | |
void | cancel () |
bool | insert (const int key, const QVector< qint32 > &L, const QVector< qint32 > &R, const bool release, const double amplification) |
Insert a newly recorded or generated waveform into the scale. This function checks the parameters and calls the insert function of the corresponding wave object. More... | |
Private Attributes | |
QVector< Wave > | mWaves |
This is the actual vector of waves. More... | |
const int | ctag = 0x78563412 |
Tag to recognize a scale in a file. More... | |
bool | mCancellationRequested |
Cancel loading. More... | |
Static Private Attributes | |
static constexpr int | N = 128 |
Maximal number of waves in a scale. More... | |
Scale - a set of PCM waves with a characteristic intensity and length.
This class describes a scale of sounds of an instrument. It contains a vector of up to 128 Wave objects, enumerated from 0 to 127 according to the MIDI norm. Not all these objects contain an actual sound. For example, a piano scale runs only from 21 to 108. Nevertheless it is assumed that all 128 wave objects exist.
A given instrument can have different scales. For example, one could have a forte scale and a piano scale as well as a scale for release sounds.
Scale::Scale | ( | ) |
|
inline |
void Scale::generateArtificialSound | ( | Voice * | voice = nullptr , |
int | samplerate = 44100 |
||
) |
Wave & Scale::getWave | ( | int & | key | ) |
bool Scale::insert | ( | const int | key, |
const QVector< qint32 > & | L, | ||
const QVector< qint32 > & | R, | ||
const bool | release, | ||
const double | amplification | ||
) |
Insert a newly recorded or generated waveform into the scale. This function checks the parameters and calls the insert function of the corresponding wave object.
key | : Index of the key according to MIDI norm in the range 0..127 |
L | : int32 vector containing the PCM wave of the left channel |
R | : int32 vector containing the PCM wave of the right channel |
release | : True if the sound is a release sound (the sound that you hear when the key is released, e.g. how the damper settles) |
amplification | : Overall amplification factor |
void Scale::printInfo | ( | ) |
bool Scale::read | ( | QIODevice & | iodevice, |
Voice * | voice = nullptr |
||
) |
bool Scale::write | ( | QIODevice & | iodevice, |
Voice * | voice = nullptr |
||
) |
Write scale to device.
This function writes the entire scale to a QIODevice, e.g. to a file. It writes a tag (named ctag) followed by all 128 wave objects.
iodevice | : QIODevice to which the data is written |
voice | : Pointer back to the voice, needed to report progress |
Definition at line 145 of file scale.cpp.
|
private |
|
private |
|
staticprivate |