Mercurial > hg > octave-jordi
changeset 19474:b9df6b3fd5ef
Fix includes in player and recorder class files, add instructions to build them
* module-files: lines to build player_class.cc and recorder_class.cc
* player_class.cc, recorder_class.cc: change includes to use local versions
of Octave headers, also added bits_to_format utility function
author | Vytautas Jančauskas <unaudio@gmail.com> |
---|---|
date | Wed, 11 Sep 2013 22:38:04 +0300 |
parents | 91ee78cdba6c |
children | e1f98e402a7e |
files | libinterp/dldfcn/module-files libinterp/dldfcn/player_class.cc libinterp/dldfcn/player_class.h libinterp/dldfcn/recorder_class.cc libinterp/dldfcn/recorder_class.h |
diffstat | 5 files changed, 69 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/dldfcn/module-files +++ b/libinterp/dldfcn/module-files @@ -23,4 +23,6 @@ audioread.cc|$(SNDFILE_CPPFLAGS)|$(SNDFILE_LDFLAGS)|$(SNDFILE_LIBS) audiowrite.cc|$(SNDFILE_CPPFLAGS)|$(SNDFILE_LDFLAGS)|$(SNDFILE_LIBS) audioinfo.cc|$(SNDFILE_CPPFLAGS)|$(SNDFILE_LDFLAGS)|$(SNDFILE_LIBS) -audiodevinfo.cc|$(PORTAUDIO_CPPFLAGS)|$(PORTAUDIO_LDFLAGS)|$(PORTAUDIO_LIBS) \ No newline at end of file +audiodevinfo.cc|$(PORTAUDIO_CPPFLAGS)|$(PORTAUDIO_LDFLAGS)|$(PORTAUDIO_LIBS) +player_class.cc|$(PORTAUDIO_CPPFLAGS)|$(PORTAUDIO_LDFLAGS)|$(PORTAUDIO_LIBS) +recorder_class.cc|$(PORTAUDIO_CPPFLAGS)|$(PORTAUDIO_LDFLAGS)|$(PORTAUDIO_LIBS) \ No newline at end of file
--- a/libinterp/dldfcn/player_class.cc +++ b/libinterp/dldfcn/player_class.cc @@ -1,12 +1,39 @@ -#include <octave/oct.h> -#include <octave/ov.h> -#include <octave/parse.h> +#include "oct.h" +#include "ov.h" +#include "parse.h" #include <portaudio.h> #include <stdint.h> -#include "common.h" #include "player_class.h" +PaSampleFormat bits_to_format(int bits) +{ + if (bits == 8) + { + return paInt8; + } + else if (bits == 16) + { + return paInt16; + } + else if (bits == 24) + { + return paInt24; + } + else if (bits == 32) + { + return paInt32; + } + else if (bits == -1) + { + return paFloat32; + } + else + { + return 0; + } +} + #define BUFFER_SIZE 512 DEFINE_OCTAVE_ALLOCATOR (audioplayer);
--- a/libinterp/dldfcn/player_class.h +++ b/libinterp/dldfcn/player_class.h @@ -2,8 +2,8 @@ #define PLAYER_CLASS_H #include <string> -#include <octave/oct.h> -#include <octave/ov-int32.h> +#include "oct.h" +#include "ov-int32.h" #include <portaudio.h> #include "player_class.h"
--- a/libinterp/dldfcn/recorder_class.cc +++ b/libinterp/dldfcn/recorder_class.cc @@ -1,13 +1,40 @@ -#include <octave/oct.h> -#include <octave/ov.h> -#include <octave/parse.h> +#include "oct.h" +#include "ov.h" +#include "parse.h" #include <portaudio.h> #include <stdint.h> -#include "common.h" #include "player_class.h" #include "recorder_class.h" +PaSampleFormat bits_to_format(int bits) +{ + if (bits == 8) + { + return paInt8; + } + else if (bits == 16) + { + return paInt16; + } + else if (bits == 24) + { + return paInt24; + } + else if (bits == 32) + { + return paInt32; + } + else if (bits == -1) + { + return paFloat32; + } + else + { + return 0; + } +} + #define BUFFER_SIZE 512 DEFINE_OCTAVE_ALLOCATOR (audiorecorder);