File: test_utf8_open.c

package info (click to toggle)
fluidsynth 2.4.4%2Bdfsg-1%2Bdeb13u1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,328 kB
  • sloc: ansic: 43,529; cpp: 1,434; xml: 1,020; makefile: 71; sh: 46
file content (55 lines) | stat: -rw-r--r-- 1,526 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

#include "test.h"
#include "fluidsynth.h"
#include "utils/fluid_sys.h"


// this tests utf-8 file handling by loading the test .sf2 file
// manually and through the soundfont-related APIs
int main(void)
{
    int id;
    fluid_settings_t *settings;
    fluid_synth_t *synth;
    fluid_player_t *player;

    FILE *file;
    file = FLUID_FOPEN(TEST_SOUNDFONT_UTF8_1, "rb");
    TEST_ASSERT(file != NULL);
    TEST_ASSERT(FLUID_FCLOSE(file) == 0);

    file = FLUID_FOPEN(TEST_SOUNDFONT_UTF8_2, "rb");
    TEST_ASSERT(file != NULL);
    TEST_ASSERT(FLUID_FCLOSE(file) == 0);

    file = FLUID_FOPEN(TEST_MIDI_UTF8, "rb");
    TEST_ASSERT(file != NULL);
    TEST_ASSERT(FLUID_FCLOSE(file) == 0);

    settings = new_fluid_settings();
    synth = new_fluid_synth(settings);

    TEST_ASSERT(settings != NULL);
    TEST_ASSERT(synth != NULL);

    // no sfont loaded
    TEST_ASSERT(fluid_synth_sfcount(synth) == 0);

    TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT_UTF8_1) == TRUE);
    TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_UTF8_1, 1));

    TEST_ASSERT(fluid_is_soundfont(TEST_SOUNDFONT_UTF8_2) == TRUE);
    TEST_SUCCESS(id = fluid_synth_sfload(synth, TEST_SOUNDFONT_UTF8_2, 1));

    player = new_fluid_player(synth);
    TEST_ASSERT(player != NULL);

    TEST_ASSERT(fluid_is_midifile(TEST_MIDI_UTF8) == TRUE);
    TEST_SUCCESS(fluid_player_add(player, TEST_MIDI_UTF8));

    delete_fluid_player(player);
    delete_fluid_synth(synth);
    delete_fluid_settings(settings);

    return EXIT_SUCCESS;
}