#ifndef __DRIVER
#define __DRIVER
-typedef struct BBQ_ DriverInfo;
+
typedef m_bool (*f_drvini)(VM*, struct BBQ_*);
typedef void (*f_drvrun)(VM*, struct BBQ_*);
typedef void (*f_drvdel)(VM*, struct BBQ_*);
-typedef struct Driver_ {
+typedef struct DriverData_ {
f_drvini ini;
f_drvrun run;
f_drvdel del;
void* data;
-} Driver;
+} DriverData;
-ANN void dummy_driver(Driver*);
-ANN void bbq_alloc(DriverInfo*);
+ANN void dummy_driver(DriverData*);
+ANN void bbq_alloc(struct BBQ_*);
#endif
#include "driver.h"
struct Gwion_ {
PlugInfo* plug;
-// DriverInfo* di;
struct Arg_* arg;
// sym
// mem
struct SoundInfo_ *si;
f_bbqset func;
f_bbqrun run;
- struct Driver_* driver;
+ struct DriverData_* driver;
};
typedef struct Shreduler_* Shreduler;
#define VMBENCH_END
#endif
-ANN static DriverInfo* new_driverinfo(void) {
- DriverInfo *di = (DriverInfo*)xcalloc(1, sizeof(DriverInfo));
+ANN static struct BBQ_ * new_driverinfo(void) {
+ struct BBQ_ * di = (struct BBQ*)xcalloc(1, sizeof(struct BBQ_));
di->func = dummy_driver;
di->run = vm_run;
- di->driver = (Driver*)xcalloc(1, sizeof(Driver));
+ di->driver = (DriverData*)xcalloc(1, sizeof(DriverData));
return di;
}
}
ANN m_bool gwion_audio(const Gwion gwion) {
- DriverInfo *di = gwion->vm->bbq;
+ struct BBQ_ *di = gwion->vm->bbq;
// get driver from string.
if(di->si->arg) {
for(m_uint i = 0; i < map_size(&gwion->plug->drv); ++i) {
VMBENCH_END
}
-ANN /* static */ void free_driverinfo(DriverInfo* di, VM* vm) {
+ANN /* static */ void free_driverinfo(struct BBQ_* di, VM* vm) {
mp_free(SoundInfo, di->si);
if(di->driver->del)
di->driver->del(vm, di);
free_env(gwion->env);
free_emitter(gwion->emit);
free_vm(gwion->vm);
-// free_driverinfo(gwion->vm->bbq, gwion->vm);
xfree(gwion->plug);
free_symbols();
}
#include "driver.h"
#include "sound.h"
-ANN void bbq_alloc(DriverInfo* di) {
- struct BBQ_* bbq = (struct BBQ_*)di;
- bbq->out = (m_float*)xcalloc(di->si->out, SZ_FLOAT);
- bbq->in = (m_float*)xcalloc(di->si->in, SZ_FLOAT);
+ANN void bbq_alloc(struct BBQ_ *bbq) {
+ bbq->out = (m_float*)xcalloc(bbq->si->out, SZ_FLOAT);
+ bbq->in = (m_float*)xcalloc(bbq->si->in, SZ_FLOAT);
}
-static void dummy_run(VM* vm, DriverInfo* di) {
+static void dummy_run(VM* vm, struct BBQ_* di) {
while(di->is_running) {
di->run(vm);
++di->pos;
}
}
-static m_bool dummy_ini(VM* vm __attribute__((unused)), DriverInfo* di __attribute__((unused))) {
+static m_bool dummy_ini(VM* vm __attribute__((unused)), struct BBQ_* di __attribute__((unused))) {
return GW_OK;
}
-void dummy_driver(Driver* d) {
+void dummy_driver(DriverData* d) {
d->ini = dummy_ini;
d->run = dummy_run;
}