Ejemplo n.º 1
0
bool Tuning_state_retune_with_source(
        Tuning_state* ts, const Tuning_table* table, const Tuning_table* source)
{
    assert(ts != NULL);
    assert(table != NULL);
    assert(source != NULL);

    if (Tuning_table_get_note_count(table) != Tuning_table_get_note_count(source))
        return false;

    for (int i = 0; i < ts->note_count; ++i)
        ts->note_offsets[i] = Tuning_table_get_pitch_offset(source, i);

    return true;
}
Ejemplo n.º 2
0
void Tuning_state_reset(Tuning_state* ts, const Tuning_table* table)
{
    assert(ts != NULL);

    if (table == NULL)
    {
        ts->note_count = 0;
        ts->ref_note = 0;
        ts->fixed_point = 0;
        ts->global_offset = 0;
        ts->drift = 0;
        for (int i = 0; i < KQT_TUNING_TABLE_NOTES_MAX; ++i)
            ts->note_offsets[i] = 0;
    }
    else
    {
        ts->note_count = Tuning_table_get_note_count(table);
        ts->ref_note = Tuning_table_get_ref_note(table);
        ts->fixed_point = 0;
        ts->global_offset = Tuning_table_get_global_offset(table);
        ts->drift = 0;
        for (int i = 0; i < ts->note_count; ++i)
            ts->note_offsets[i] = Tuning_table_get_pitch_offset(table, i);
        for (int i = ts->note_count; i < KQT_TUNING_TABLE_NOTES_MAX; ++i)
            ts->note_offsets[i] = 0;
    }

    return;
}
Ejemplo n.º 3
0
double Tuning_table_get_pitch_offset(const Tuning_table* tt, int index)
{
    rassert(tt != NULL);
    rassert(index >= 0);
    rassert(index < Tuning_table_get_note_count(tt));

    return tt->note_offsets[index];
}