In theory this makes it easier to maintain and upgrade. It also re-opens the possibility of building an ASIO variant for windows.
Unified · Split
| @@ -0,0 +1,3 @@ | |||
| 1 | [submodule "src/rtaudio"] | ||
| 2 | path = src/rtaudio | ||
| 3 | url = https://github.com/thestk/rtaudio | ||
| @@ -1,60 +0,0 @@ | |||
| 1 | /************************************************************************/ | ||
| 2 | /*! \class RtError | ||
| 3 | \brief Exception handling class for RtAudio & RtMidi. | ||
| 4 | |||
| 5 | The RtError class is quite simple but it does allow errors to be | ||
| 6 | "caught" by RtError::Type. See the RtAudio and RtMidi | ||
| 7 | documentation to know which methods can throw an RtError. | ||
| 8 | |||
| 9 | */ | ||
| 10 | /************************************************************************/ | ||
| 11 | |||
| 12 | #ifndef RTERROR_H | ||
| 13 | #define RTERROR_H | ||
| 14 | |||
| 15 | #include <exception> | ||
| 16 | #include <iostream> | ||
| 17 | #include <string> | ||
| 18 | |||
| 19 | class RtError : public std::exception | ||
| 20 | { | ||
| 21 | public: | ||
| 22 | //! Defined RtError types. | ||
| 23 | enum Type { | ||
| 24 | WARNING, /*!< A non-critical error. */ | ||
| 25 | DEBUG_WARNING, /*!< A non-critical error which might be useful for debugging. */ | ||
| 26 | UNSPECIFIED, /*!< The default, unspecified error type. */ | ||
| 27 | NO_DEVICES_FOUND, /*!< No devices found on system. */ | ||
| 28 | INVALID_DEVICE, /*!< An invalid device ID was specified. */ | ||
| 29 | MEMORY_ERROR, /*!< An error occured during memory allocation. */ | ||
| 30 | INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */ | ||
| 31 | INVALID_USE, /*!< The function was called incorrectly. */ | ||
| 32 | DRIVER_ERROR, /*!< A system driver error occured. */ | ||
| 33 | SYSTEM_ERROR, /*!< A system error occured. */ | ||
| 34 | THREAD_ERROR /*!< A thread error occured. */ | ||
| 35 | }; | ||
| 36 | |||
| 37 | //! The constructor. | ||
| 38 | RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {} | ||
| 39 | |||
| 40 | //! The destructor. | ||
| 41 | virtual ~RtError( void ) throw() {} | ||
| 42 | |||
| 43 | //! Prints thrown error message to stderr. | ||
| 44 | virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; } | ||
| 45 | |||
| 46 | //! Returns the thrown error message type. | ||
| 47 | virtual const Type& getType(void) const throw() { return type_; } | ||
| 48 | |||
| 49 | //! Returns the thrown error message string. | ||
| 50 | virtual const std::string& getMessage(void) const throw() { return message_; } | ||
| 51 | |||
| 52 | //! Returns the thrown error message as a c-style string. | ||
| 53 | virtual const char* what( void ) const throw() { return message_.c_str(); } | ||
| 54 | |||
| 55 | protected: | ||
| 56 | std::string message_; | ||
| 57 | Type type_; | ||
| 58 | }; | ||
| 59 | |||
| 60 | #endif | ||
| @@ -157,7 +157,7 @@ void ChuckAudio::probe() · 156 unmodified lines | |||
| 157 | 157 | ||
| 158 | // allocate RtAudio | 158 | // allocate RtAudio |
| 159 | try { audio = new RtAudio( ); } | 159 | try { audio = new RtAudio( ); } |
| 160 | catch( RtError err ) | 160 | catch( RtAudioError err ) |
| 161 | { | 161 | { |
| 162 | // problem finding audio devices, most likely | 162 | // problem finding audio devices, most likely |
| 163 | EM_error2b( 0, "%s", err.getMessage().c_str() ); | 163 | EM_error2b( 0, "%s", err.getMessage().c_str() ); |
| @@ -175,7 +175,7 @@ void ChuckAudio::probe() · 11 unmodified lines | |||
| 175 | for( int i = 0; i < devices; i++ ) | 175 | for( int i = 0; i < devices; i++ ) |
| 176 | { | 176 | { |
| 177 | try { info = audio->getDeviceInfo(i); } | 177 | try { info = audio->getDeviceInfo(i); } |
| 178 | catch( RtError & error ) | 178 | catch( RtAudioError & error ) |
| 179 | { | 179 | { |
| 180 | error.printMessage(); | 180 | error.printMessage(); |
| 181 | break; | 181 | break; |
| @@ -215,7 +215,7 @@ t_CKUINT ChuckAudio::device_named( const std::string & name, t_CKBOOL needs_dac, · 33 unmodified lines | |||
| 215 | 215 | ||
| 216 | // allocate RtAudio | 216 | // allocate RtAudio |
| 217 | try { audio = new RtAudio(); } | 217 | try { audio = new RtAudio(); } |
| 218 | catch( RtError err ) | 218 | catch( RtAudioError err ) |
| 219 | { | 219 | { |
| 220 | // problem finding audio devices, most likely | 220 | // problem finding audio devices, most likely |
| 221 | EM_error2b( 0, "%s", err.getMessage().c_str() ); | 221 | EM_error2b( 0, "%s", err.getMessage().c_str() ); |
| @@ -231,7 +231,7 @@ t_CKUINT ChuckAudio::device_named( const std::string & name, t_CKBOOL needs_dac, · 9 unmodified lines | |||
| 231 | { | 231 | { |
| 232 | // get info | 232 | // get info |
| 233 | try { info = audio->getDeviceInfo(i); } | 233 | try { info = audio->getDeviceInfo(i); } |
| 234 | catch( RtError & error ) | 234 | catch( RtAudioError & error ) |
| 235 | { | 235 | { |
| 236 | error.printMessage(); | 236 | error.printMessage(); |
| 237 | break; | 237 | break; |
| @@ -253,7 +253,7 @@ t_CKUINT ChuckAudio::device_named( const std::string & name, t_CKBOOL needs_dac, · 15 unmodified lines | |||
| 253 | for( int i = 0; i < devices; i++ ) | 253 | for( int i = 0; i < devices; i++ ) |
| 254 | { | 254 | { |
| 255 | try { info = audio->getDeviceInfo(i); } | 255 | try { info = audio->getDeviceInfo(i); } |
| 256 | catch( RtError & error ) | 256 | catch( RtAudioError & error ) |
| 257 | { | 257 | { |
| 258 | error.printMessage(); | 258 | error.printMessage(); |
| 259 | break; | 259 | break; |
| @@ -477,7 +477,7 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT num_dac_channels, · 217 unmodified lines | |||
| 477 | 477 | ||
| 478 | // allocate RtAudio | 478 | // allocate RtAudio |
| 479 | try { m_rtaudio = new RtAudio( ); } | 479 | try { m_rtaudio = new RtAudio( ); } |
| 480 | catch( RtError err ) | 480 | catch( RtAudioError err ) |
| 481 | { | 481 | { |
| 482 | // problem finding audio devices, most likely | 482 | // problem finding audio devices, most likely |
| 483 | EM_error2( 0, "%s", err.getMessage().c_str() ); | 483 | EM_error2( 0, "%s", err.getMessage().c_str() ); |
| @@ -731,7 +731,7 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT num_dac_channels, · 247 unmodified lines | |||
| 731 | CK_RTAUDIO_FORMAT, sample_rate, &bufsize, | 731 | CK_RTAUDIO_FORMAT, sample_rate, &bufsize, |
| 732 | cb, m_cb_user_data, | 732 | cb, m_cb_user_data, |
| 733 | &stream_options ); | 733 | &stream_options ); |
| 734 | } catch( RtError err ) { | 734 | } catch( RtAudioError err ) { |
| 735 | // log | 735 | // log |
| 736 | EM_log( CK_LOG_INFO, "exception caught: '%s'...", err.getMessage().c_str() ); | 736 | EM_log( CK_LOG_INFO, "exception caught: '%s'...", err.getMessage().c_str() ); |
| 737 | EM_error2( 0, "%s", err.getMessage().c_str() ); | 737 | EM_error2( 0, "%s", err.getMessage().c_str() ); |
| @@ -882,7 +882,7 @@ t_CKBOOL ChuckAudio::start( ) · 144 unmodified lines | |||
| 882 | m_rtaudio->startStream(); | 882 | m_rtaudio->startStream(); |
| 883 | m_start = TRUE; | 883 | m_start = TRUE; |
| 884 | } | 884 | } |
| 885 | catch( RtError err ) | 885 | catch( RtAudioError err ) |
| 886 | { | 886 | { |
| 887 | return FALSE; | 887 | return FALSE; |
| 888 | } | 888 | } |
| @@ -904,7 +904,7 @@ t_CKBOOL ChuckAudio::stop( ) · 15 unmodified lines | |||
| 904 | m_rtaudio->stopStream(); | 904 | m_rtaudio->stopStream(); |
| 905 | m_start = FALSE; | 905 | m_start = FALSE; |
| 906 | } | 906 | } |
| 907 | catch( RtError err ) | 907 | catch( RtAudioError err ) |
| 908 | { | 908 | { |
| 909 | return FALSE; | 909 | return FALSE; |
| 910 | } | 910 | } |
| @@ -36,7 +36,7 @@ · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | #include "chuck_def.h" | 37 | #include "chuck_def.h" |
| 38 | #include <string> | 38 | #include <string> |
| 39 | #include "RtAudio/RtAudio.h" | 39 | #include <RtAudio.h> |
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | 42 | ||
| @@ -2,6 +2,7 @@ DESTDIR?=/usr/local/bin · 1 unmodified line | |||
| 2 | COREDIR=core | 2 | COREDIR=core |
| 3 | HOSTDIR=host | 3 | HOSTDIR=host |
| 4 | CK_PLATFORM= | 4 | CK_PLATFORM= |
| 5 | RTAUDIODIR=./rtaudio | ||
| 5 | 6 | ||
| 6 | 7 | ||
| 7 | ########################## DEFAULT MAKE TARGET ################################# | 8 | ########################## DEFAULT MAKE TARGET ################################# |
| @@ -155,8 +156,9 @@ LO_COBJS_CORE+= lo/address.o lo/blob.o lo/bundle.o lo/message.o lo/method.o \ · 147 unmodified lines | |||
| 155 | 156 | ||
| 156 | 157 | ||
| 157 | ############################ CHUCK HOST TARGETS ################################ | 158 | ############################ CHUCK HOST TARGETS ################################ |
| 158 | CXXSRCS_HOST+= RtAudio/RtAudio.cpp chuck_audio.cpp chuck_console.cpp \ | 159 | CXXINC_HOST+= -I${RTAUDIODIR} -I${RTAUDIODIR}/include |
| 159 | chuck_main.cpp | 160 | CXXSRCS_HOST+= chuck_main.cpp chuck_audio.cpp chuck_console.cpp \ |
| 161 | ${RTAUDIODIR}/RtAudio.cpp | ||
| 160 | 162 | ||
| 161 | 163 | ||
| 162 | ############################ OBJECT FILE TARGETS ############################### | 164 | ############################ OBJECT FILE TARGETS ############################### |
| @@ -208,16 +210,18 @@ chuck-core: · 45 unmodified lines | |||
| 208 | make $(MAKECMDGOALS) -C $(COREDIR) $(ARCH_ARGS) | 210 | make $(MAKECMDGOALS) -C $(COREDIR) $(ARCH_ARGS) |
| 209 | @echo ------------- | 211 | @echo ------------- |
| 210 | 212 | ||
| 213 | CFLAGS_HOST= ${CFLAGS} -I${RTAUDIODIR} | ||
| 214 | CFLAGSDEPEND_HOST=${CFLAGSDEPEND} ${CFLAGS_HOST} | ||
| 211 | chuck: chuck-core $(COBJS_HOST) $(CXXOBJS_HOST) | 215 | chuck: chuck-core $(COBJS_HOST) $(CXXOBJS_HOST) |
| 212 | $(LD) -o chuck $(OBJS) $(LDFLAGS) $(ARCHOPTS) | 216 | $(LD) -o chuck $(OBJS) $(LDFLAGS) $(ARCHOPTS) |
| 213 | 217 | ||
| 214 | $(COBJS_HOST): %.o: %.c | 218 | $(COBJS_HOST): %.o: %.c |
| 215 | $(CC) $(CFLAGS) $(ARCHOPTS) -c $< -o $@ | 219 | $(CC) $(CFLAGS_HOST) $(ARCHOPTS) -c $< -o $@ |
| 216 | @$(CC) -MM -MQ "$@" $(CFLAGSDEPEND) $< > $*.d | 220 | @$(CC) -MM -MQ "$@" $(CFLAGSDEPEND_HOST) $< > $*.d |
| 217 | 221 | ||
| 218 | $(CXXOBJS_HOST): %.o: %.cpp | 222 | $(CXXOBJS_HOST): %.o: %.cpp |
| 219 | $(CXX) $(CFLAGS) $(ARCHOPTS) -c $< -o $@ | 223 | $(CXX) $(CFLAGS_HOST) $(ARCHOPTS) -c $< -o $@ |
| 220 | @$(CXX) -MM -MQ "$@" $(CFLAGSDEPEND) $< > $*.d | 224 | @$(CXX) -MM -MQ "$@" $(CFLAGSDEPEND_HOST) $< > $*.d |
| 221 | 225 | ||
| 222 | clean: | 226 | clean: |
| 223 | @rm -rf $(wildcard chuck chuck.exe) *.o *.d */*.{o,d} */*/*.{o,d} $(OBJS) \ | 227 | @rm -rf $(wildcard chuck chuck.exe) *.o *.d */*.{o,d} */*/*.{o,d} $(OBJS) \ |
| @@ -0,0 +1 @@ | |||
| 1 | Subproject commit f9fd8726ccb688baa43aaae642179a69d353f6d2 | ||