format
This commit is contained in:
parent
cfe823b25d
commit
cd1efe40ad
5 changed files with 46 additions and 47 deletions
|
|
@ -5,28 +5,28 @@
|
|||
|
||||
typedef struct driver_context {
|
||||
ao_sample_format format;
|
||||
ao_device* device;
|
||||
ao_device* device;
|
||||
} driver_context_t;
|
||||
|
||||
#include "pthread/decl.c"
|
||||
|
||||
static void drv_write(driver_t* drv, void* data, int frames){
|
||||
static void drv_write(driver_t* drv, void* data, int frames) {
|
||||
ao_play(drv->context.device, (char*)data, frames * 2 * 2);
|
||||
}
|
||||
|
||||
static int drv_open(driver_t* drv){
|
||||
static int drv_open(driver_t* drv) {
|
||||
int id;
|
||||
|
||||
ao_initialize();
|
||||
|
||||
drv->context.format.bits = 16;
|
||||
drv->context.format.rate = MDEAudioRate;
|
||||
drv->context.format.channels = 2;
|
||||
drv->context.format.bits = 16;
|
||||
drv->context.format.rate = MDEAudioRate;
|
||||
drv->context.format.channels = 2;
|
||||
drv->context.format.byte_format = AO_FMT_NATIVE;
|
||||
drv->context.format.matrix = NULL;
|
||||
drv->context.format.matrix = NULL;
|
||||
|
||||
id = ao_default_driver_id();
|
||||
if((drv->context.device = ao_open_live(id, &drv->context.format, NULL)) == NULL){
|
||||
if((drv->context.device = ao_open_live(id, &drv->context.format, NULL)) == NULL) {
|
||||
MDEAudioClose(drv);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -36,8 +36,8 @@ static int drv_open(driver_t* drv){
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void drv_close(driver_t* drv){
|
||||
if(drv->context.device != NULL){
|
||||
static void drv_close(driver_t* drv) {
|
||||
if(drv->context.device != NULL) {
|
||||
ao_close(drv->context.device);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue