Gwion coverage report


Directory: src/
File: src/vm/driver.c
Date: 2023-01-30 18:32:28
Exec Total Coverage
Lines: 30 30 100.0%
Functions: 6 6 100.0%
Branches: 7 8 87.5%

Line Branch Exec Source
1 #include <time.h>
2 #include "gwion_util.h"
3 #include "gwion_ast.h"
4 #include "gwion_env.h"
5 #include "vm.h"
6 #include "gwion.h"
7 #include "driver.h"
8
9 712 ANN Driver *new_driver(MemPool p) {
10 712 Driver *di = (Driver *)mp_calloc(p, BBQ);
11 712 di->func = dummy_driver;
12 712 di->driver = (DriverData *)mp_calloc(p, DriverData);
13 712 di->is_running = true;
14 712 return di;
15 }
16
17 707 ANN void free_driver(Driver *d, VM *vm) {
18
2/2
✓ Branch 0 taken 638 times.
✓ Branch 1 taken 69 times.
707 if (d->in) xfree(d->in);
19
2/2
✓ Branch 0 taken 638 times.
✓ Branch 1 taken 69 times.
707 if (d->out) xfree(d->out);
20 707 mp_free(vm->gwion->mp, SoundInfo, d->si);
21
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 707 times.
707 if (d->driver->del) d->driver->del(vm, d);
22 707 mp_free(vm->gwion->mp, DriverData, d->driver);
23 707 mp_free(vm->gwion->mp, BBQ, d);
24 707 }
25
26 638 ANN void driver_alloc(Driver *d) {
27 638 d->out = (m_float *)xcalloc(d->si->out, SZ_FLOAT);
28 638 d->in = (m_float *)xcalloc(d->si->in, SZ_FLOAT);
29 638 }
30
31 638 static DRVRUN(dummy_run) {
32
2/2
✓ Branch 0 taken 3287132 times.
✓ Branch 1 taken 638 times.
3287770 while (di->is_running) {
33 3287132 di->run(vm);
34 3287132 next_bbq_pos(vm);
35 }
36 638 }
37
38 638 static DRVINI(dummy_ini) {
39 638 gw_err("{-/}using dummy driver{0}\n");
40 638 return GW_OK;
41 }
42
43 643 void dummy_driver(DriverData *dd) {
44 643 dd->ini = dummy_ini;
45 643 dd->run = dummy_run;
46 643 }
47