Mercurial > aopp
changeset 8:65c716ba7cda
Initial commit.
Header file and AOOptions class.
author | Eris Caffee <discordia@eldalin.com> |
---|---|
date | Wed, 25 Mar 2015 12:21:35 -0500 |
parents | be3fa4df4b0b |
children | cf38ffea8def |
files | CMakeLists.txt docs/notes src/AOOption.cpp src/aopp.hpp src/main.cpp |
diffstat | 5 files changed, 122 insertions(+), 9 deletions(-) [+] |
line diff
1.1 --- a/CMakeLists.txt Sun May 26 16:36:48 2013 -0500 1.2 +++ b/CMakeLists.txt Wed Mar 25 12:21:35 2015 -0500 1.3 @@ -66,7 +66,7 @@ 1.4 #set (CMAKE_VERBOSE_MAKEFILE ON) 1.5 1.6 # Name your program! 1.7 -set (App_Name "MYAPPNAME") 1.8 +set (App_Name "libaocpp") 1.9 if (App_Name STREQUAL "MYAPPNAME") 1.10 message (FATAL_ERROR "You must set the App_Name variable!") 1.11 endif () 1.12 @@ -120,7 +120,7 @@ 1.13 # C -std=gnu99 -std=c99 1.14 1.15 if (CMAKE_COMPILER_IS_GNUCXX) 1.16 - add_definitions(-pedantic -Wall) 1.17 + add_definitions(-pedantic -Wall -std=c++11) 1.18 endif () 1.19 1.20 1.21 @@ -137,19 +137,13 @@ 1.22 # The core project files 1.23 1.24 file (GLOB SRCS src/*.c src/*.cpp) 1.25 -file (GLOB HDRS include/*.h include/*.hpp) 1.26 +file (GLOB HDRS src/*.h src/*.hpp) 1.27 1.28 # The directories that contain the libraries we will be linking against. 1.29 # This must come before the ADD_EXECUTABLE directive. 1.30 link_directories ( 1.31 ) 1.32 1.33 -# The directories that contain the include files our programs use. 1.34 -# This must come before the ADD_EXECUTABLE directive. 1.35 -include_directories ( 1.36 - ${CMAKE_SOURCE_DIR}/include 1.37 - ) 1.38 - 1.39 # Define the executable program file we are creating. We must list all of 1.40 # the source files. 1.41 if (WIN32) 1.42 @@ -511,3 +505,28 @@ 1.43 endif () 1.44 1.45 ################################################################################ 1.46 + 1.47 +option(Option_AO_Dev "Build a libao Application." ON) 1.48 + 1.49 +if (Option_AO_Dev) 1.50 + 1.51 + find_path(AO_INCLUDE_DIR ao/ao.h) 1.52 + find_library(AO_LIBRARY NAMES ao) 1.53 + 1.54 + if (AO_INCLUDE_DIR AND AO_LIBRARY) 1.55 + include_directories( 1.56 + ${AO_INCLUDE_DIR} 1.57 + ${INCLUDE_DIRECTORIES} 1.58 + ) 1.59 + 1.60 + target_link_libraries(${App_Name} 1.61 + ${AO_LIBRARY} 1.62 + ${TARGET_LINK_LIBRARIES} 1.63 + ) 1.64 + else () 1.65 + message (FATAL_ERROR "AO not found") 1.66 + endif() 1.67 + 1.68 +endif () 1.69 + 1.70 +################################################################################
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/docs/notes Wed Mar 25 12:21:35 2015 -0500 2.3 @@ -0,0 +1,26 @@ 2.4 +AOSystem 2.5 + ao_initialize 2.6 + ao_shutdown 2.7 + ao_driver_info_list 2.8 + ao_default_driver_id 2.9 + ao_is_big_endian 2.10 + ao_append_global_option 2.11 + 2.12 +AODriver 2.13 + ao_open_live 2.14 + ao_open_file 2.15 + ao_driver_info 2.16 + ao_file_extension 2.17 + ao_driver_id (static) 2.18 + 2.19 +AODevice 2.20 + ao_play 2.21 + ao_close 2.22 + 2.23 +AOOption 2.24 + ao_append_option 2.25 + ao_free_options 2.26 + 2.27 +AOInfo 2.28 + 2.29 +AOSampleFormat 2.30 \ No newline at end of file
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/src/AOOption.cpp Wed Mar 25 12:21:35 2015 -0500 3.3 @@ -0,0 +1,30 @@ 3.4 +#include "aopp.hpp" 3.5 +#include <cstdio> 3.6 + 3.7 +AOPP::AOOptions::AOOptions() : 3.8 + options (NULL) 3.9 + { 3.10 + } 3.11 + 3.12 +AOPP::AOOptions::~AOOptions() { 3.13 + if ( options ) { 3.14 + ao_free_options( options ); 3.15 + } 3.16 + } 3.17 + 3.18 + 3.19 +int AOPP::AOOptions::append( const char *key, const char *value ) { 3.20 + if ( key && value ) { 3.21 + return ao_append_option( &options, key, value ); 3.22 + } 3.23 + return 0; 3.24 + } 3.25 + 3.26 + 3.27 +void AOPP::AOOptions::print_options(void) { 3.28 + ao_option * opt = options; 3.29 + while ( opt ) { 3.30 + printf("%s\t\t%s\n", opt->key, opt->value); 3.31 + opt = opt->next; 3.32 + } 3.33 + }
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/src/aopp.hpp Wed Mar 25 12:21:35 2015 -0500 4.3 @@ -0,0 +1,27 @@ 4.4 +#ifndef __AOPP_H__ 4.5 +#define __AOPP_H__ 4.6 + 4.7 +#include "ao/ao.h" 4.8 + 4.9 +namespace AOPP { 4.10 + 4.11 + typedef ao_sample_format AOSampleFormat; 4.12 + typedef ao_info AOInfo; 4.13 + 4.14 + //////////////////////////////////////////////////////////////////////////// 4.15 + class AOOptions { 4.16 + public: 4.17 + AOOptions(); 4.18 + ~AOOptions(); 4.19 + int append( const char *key, const char *value ); 4.20 + void print_options(void); 4.21 + 4.22 + private: 4.23 + ao_option *options; 4.24 + 4.25 + }; 4.26 + 4.27 + 4.28 + } 4.29 + 4.30 +#endif
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/src/main.cpp Wed Mar 25 12:21:35 2015 -0500 5.3 @@ -0,0 +1,11 @@ 5.4 +#include "aopp.hpp" 5.5 + 5.6 +int main( int argc, char **argv ) { 5.7 + AOPP::AOOptions opts; 5.8 + 5.9 + opts.append( "a", "1" ); 5.10 + opts.append( "b", "2" ); 5.11 + opts.append( "c", "3" ); 5.12 + 5.13 + opts.print_options(); 5.14 + }