Phase 1 plus some refactoring.
This commit is contained in:
parent
71f7b4d96b
commit
8075e1b79d
17 changed files with 465 additions and 266 deletions
|
|
@ -13,31 +13,31 @@
|
|||
|
||||
int main(void)
|
||||
{
|
||||
xt_app *app = NULL;
|
||||
xt_graph *graph = NULL;
|
||||
xtc_app *app = NULL;
|
||||
xtc_graph *graph = NULL;
|
||||
size_t node_a = 0U;
|
||||
size_t node_b = 0U;
|
||||
float input[4] = {1.0f, -1.0f, 0.5f, 0.0f};
|
||||
float output[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
|
||||
CHECK(xt_app_create(&app) == XT_OK);
|
||||
CHECK(xtc_app_create(&app) == XTC_OK);
|
||||
CHECK(app != NULL);
|
||||
xt_app_destroy(app);
|
||||
xtc_app_destroy(app);
|
||||
|
||||
CHECK(xt_graph_create(4U, &graph) == XT_OK);
|
||||
CHECK(xt_graph_add_gain(graph, 0.5f, &node_a) == XT_OK);
|
||||
CHECK(xt_graph_add_gain(graph, 2.0f, &node_b) == XT_OK);
|
||||
CHECK(xt_graph_connect(graph, node_a, node_b) == XT_OK);
|
||||
CHECK(xt_graph_validate(graph) == XT_OK);
|
||||
CHECK(xt_graph_process_offline(graph, input, output, 4U, 1.0f) == XT_OK);
|
||||
CHECK(xtc_graph_create(4U, &graph) == XTC_OK);
|
||||
CHECK(xtc_graph_add_gain(graph, 0.5f, &node_a) == XTC_OK);
|
||||
CHECK(xtc_graph_add_gain(graph, 2.0f, &node_b) == XTC_OK);
|
||||
CHECK(xtc_graph_connect(graph, node_a, node_b) == XTC_OK);
|
||||
CHECK(xtc_graph_validate(graph) == XTC_OK);
|
||||
CHECK(xtc_graph_process_offline(graph, input, output, 4U, 1.0f) == XTC_OK);
|
||||
CHECK(fabsf(output[0] - 1.0f) < 0.0001f);
|
||||
CHECK(fabsf(output[1] + 1.0f) < 0.0001f);
|
||||
CHECK(fabsf(output[2] - 0.5f) < 0.0001f);
|
||||
|
||||
CHECK(xt_graph_connect(graph, node_b, node_a) == XT_OK);
|
||||
CHECK(xt_graph_validate(graph) == XT_ERR_GRAPH_CYCLE);
|
||||
CHECK(xtc_graph_connect(graph, node_b, node_a) == XTC_ERR_GRAPH_CYCLE);
|
||||
CHECK(xtc_graph_validate(graph) == XTC_OK);
|
||||
|
||||
xt_graph_destroy(graph);
|
||||
xtc_graph_destroy(graph);
|
||||
(void)puts("All xtc core tests passed.");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue