2 Calf Box, an open source musical instrument.
3 Copyright (C) 2010-2011 Krzysztof Foltman
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "config-api.h"
33 const char *cbox_io_section
= "io";
35 gboolean
cbox_io_init(struct cbox_io
*io
, struct cbox_open_params
*const params
, GError
**error
)
37 if (cbox_config_get_int(cbox_io_section
, "use_usb", 0))
38 return cbox_io_init_usb(io
, params
, error
);
39 return cbox_io_init_jack(io
, params
, error
);
42 int cbox_io_get_sample_rate(struct cbox_io
*io
)
44 return io
->impl
->getsampleratefunc(io
->impl
);
47 void cbox_io_poll_ports(struct cbox_io
*io
)
49 io
->impl
->pollfunc(io
->impl
);
52 int cbox_io_get_midi_data(struct cbox_io
*io
, struct cbox_midi_buffer
*destination
)
54 return io
->impl
->getmidifunc(io
->impl
, destination
);
57 int cbox_io_start(struct cbox_io
*io
, struct cbox_io_callbacks
*cb
)
60 return io
->impl
->startfunc(io
->impl
, NULL
);
63 gboolean
cbox_io_get_disconnect_status(struct cbox_io
*io
, GError
**error
)
65 return io
->impl
->getstatusfunc(io
->impl
, error
);
68 gboolean
cbox_io_cycle(struct cbox_io
*io
, GError
**error
)
70 return io
->impl
->cyclefunc(io
->impl
, error
);
73 int cbox_io_stop(struct cbox_io
*io
)
75 return io
->impl
->stopfunc(io
->impl
, NULL
);
78 void cbox_io_close(struct cbox_io
*io
)
80 io
->impl
->destroyfunc(io
->impl
);