Example #1
0
END_TEST


START_TEST(Skipping_moves_position_forwards)
{
    set_audio_rate(mixing_rates[MIXING_RATE_LOW]);
    set_mix_volume(0);
    setup_debug_instrument();
    setup_debug_single_pulse();

    set_data("album/p_manifest.json", "{}");
    set_data("album/p_tracks.json", "[0]");
    set_data("song_00/p_manifest.json", "{}");
    set_data("song_00/p_order_list.json", "[ [0, 0] ]");
    set_data("pat_000/p_manifest.json", "{}");
    set_data("pat_000/p_length.json", "[8, 0]");
    set_data("pat_000/instance_000/p_manifest.json", "{}");
    set_data("pat_000/col_00/p_triggers.json",
            "[ [[0, 0], [\"n+\", \"0\"]],"
            "  [[1, 0], [\"n+\", \"0\"]],"
            "  [[2, 0], [\"n+\", \"0\"]],"
            "  [[3, 0], [\"n+\", \"0\"]],"
            "  [[4, 0], [\"n+\", \"0\"]] ]");

    validate();

    static const long long second = 1000000000LL;
    kqt_Handle_set_position(handle, 0, _i * second / 2);
    //Player_skip(player, _i * mixing_rates[MIXING_RATE_LOW] / 2);
    check_unexpected_error();

    float actual_buf[buf_len] = { 0.0f };
    mix_and_fill(actual_buf, buf_len);

    float expected_buf[buf_len] = { 0.0f };
    for (int i = 0; i < 5 - _i; ++i)
        expected_buf[i * mixing_rates[MIXING_RATE_LOW] / 2] = 1.0f;

    check_buffers_equal(expected_buf, actual_buf, buf_len, 0.0f);
}
Example #2
0
END_TEST


START_TEST(Add_and_remove_internal_effect_and_render)
{
    set_audio_rate(220);
    set_mix_volume(0);

    setup_debug_instrument();
    setup_debug_single_pulse();

    float actual_buf[buf_len] = { 0.0f };

    // Add silence
    set_data("album/p_manifest.json", "{}");
    set_data("album/p_tracks.json", "[0]");
    set_data("song_00/p_manifest.json", "{}");
    set_data("song_00/p_order_list.json", "[ [0, 0] ]");
    set_data("pat_000/p_manifest.json", "{}");
    set_data("pat_000/p_length.json", "[16, 0]");
    set_data("pat_000/instance_000/p_manifest.json", "{}");

    // Add internal audio unit
    set_data("au_00/au_00/p_manifest.json", "{ \"type\": \"effect\" }");
    set_data("au_00/au_00/in_00/p_manifest.json", "{}");
    set_data("au_00/au_00/out_00/p_manifest.json", "{}");
    set_data(
            "au_00/p_connections.json",
            "[ [\"proc_00/C/out_00\", \"out_00\"]"
            ", [\"proc_00/C/out_00\", \"au_00/in_00\"]"
            ", [\"au_00/out_00\", \"out_00\"] ]");

    // Add processor inside the internal audio unit
    set_data("au_00/au_00/proc_00/in_00/p_manifest.json", "{}");
    set_data("au_00/au_00/proc_00/out_00/p_manifest.json", "{}");
    set_data("au_00/au_00/proc_00/p_manifest.json", "{ \"type\": \"volume\" }");
    set_data("au_00/au_00/proc_00/p_signal_type.json", "\"mixed\"");
    set_data(
            "au_00/au_00/p_connections.json",
            "[ [\"in_00\", \"proc_00/C/in_00\"]"
            ", [\"proc_00/C/out_00\", \"out_00\"] ]");

    validate();
    check_unexpected_error();

    // Test rendering
    mix_and_fill(actual_buf, buf_len);

    // Remove the internal audio unit
    set_data("au_00/p_connections.json", "[ [\"proc_00/C/out_00\", \"out_00\"] ]");
    set_data("au_00/au_00/in_00/p_manifest.json", "");
    set_data("au_00/au_00/out_00/p_manifest.json", "");
    set_data("au_00/au_00/p_connections.json", "");
    set_data("au_00/au_00/p_manifest.json", "");
    set_data("au_00/au_00/proc_00/in_00/p_manifest.json", "");
    set_data("au_00/au_00/proc_00/out_00/p_manifest.json", "");
    set_data("au_00/au_00/proc_00/p_manifest.json", "");
    set_data("au_00/au_00/proc_00/p_signal_type.json", "");

    validate();
    check_unexpected_error();

    // Test rendering again
    kqt_Handle_set_position(handle, 0, 0);
    mix_and_fill(actual_buf, buf_len);
}