blob: 259466039c5ea5b4ea42f39b756486c95cc62c77 (
plain)
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
|
// This file is part of the 64k demo project.
// It tests the core functionality of the audio synthesis engine.
// Verifies voice triggering, registration, and rendering state.
#include "audio/synth.h"
#include <assert.h>
#include <stdio.h>
void test_registration() {
synth_init();
float data[DCT_SIZE * 2] = {0};
Spectrogram spec = {data, data, 2};
int id = synth_register_spectrogram(&spec);
assert(id >= 0);
assert(synth_get_active_voice_count() == 0);
}
void test_trigger() {
synth_init();
float data[DCT_SIZE * 2] = {0};
Spectrogram spec = {data, data, 2};
int id = synth_register_spectrogram(&spec);
synth_trigger_voice(id, 1.0f, 0.0f);
assert(synth_get_active_voice_count() == 1);
}
int main() {
printf("Running SynthEngine tests...\n");
test_registration();
test_trigger();
printf("SynthEngine tests PASSED\n");
return 0;
}
|