view src/AODriver.cpp @ 9:cf38ffea8def

Added AODevice and AODriver. Renamed AOOptions.cpp file.
author Eris Caffee <discordia@eldalin.com>
date Wed, 25 Mar 2015 16:25:10 -0500
parents
children 9f0ed655b46c
line source
1 #include "aopp.hpp"
3 using namespace AOPP;
5 AODriver::AODriver( int id ) :
6 driver_id (id) {
7 }
9 AOInfo * AODriver::driver_info( void ) {
10 return ao_driver_info( driver_id );
11 }
13 #if 0
14 // ao_file_extension not in my libao ?
15 const char * AODriver::file_extension( void ) {
16 return ao_file_extension( driver_id );
17 }
18 #endif
20 AODevice * AODriver::open_file( const char *filename, int overwrite, AOSampleFormat *format, AOOptions *options ) {
21 ao_device * dev = ao_open_file(
22 driver_id,
23 filename,
24 overwrite,
25 static_cast<ao_sample_format *> (format),
26 options->options
27 );
28 if ( dev ) {
29 AODevice *d;
30 *d = AODevice( dev );
31 return d;
32 }
33 return NULL;
34 }
36 AODevice * AODriver::open_live( AOSampleFormat *format, AOOptions *options ) {
37 ao_device * dev = ao_open_live(
38 driver_id,
39 static_cast<ao_sample_format *> (format),
40 options->options
41 );
42 if ( dev ) {
43 AODevice *d;
44 *d = AODevice( dev );
45 return d;
46 }
47 return NULL;
48 }
50 int AODriver::get_driver_id( const char *short_name ) {
51 return ao_driver_id( short_name );
52 }