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 | 158 | // allocate RtAudio |
| 159 | 159 | try { audio = new RtAudio( ); } |
| 160 | − catch( RtError err ) | |
| 160 | + catch( RtAudioError err ) | |
| 161 | 161 | { |
| 162 | 162 | // problem finding audio devices, most likely |
| 163 | 163 | EM_error2b( 0, "%s", err.getMessage().c_str() ); |
| @@ -175,7 +175,7 @@ void ChuckAudio::probe() · 11 unmodified lines | ||
| 175 | 175 | for( int i = 0; i < devices; i++ ) |
| 176 | 176 | { |
| 177 | 177 | try { info = audio->getDeviceInfo(i); } |
| 178 | − catch( RtError & error ) | |
| 178 | + catch( RtAudioError & error ) | |
| 179 | 179 | { |
| 180 | 180 | error.printMessage(); |
| 181 | 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 | 216 | // allocate RtAudio |
| 217 | 217 | try { audio = new RtAudio(); } |
| 218 | − catch( RtError err ) | |
| 218 | + catch( RtAudioError err ) | |
| 219 | 219 | { |
| 220 | 220 | // problem finding audio devices, most likely |
| 221 | 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 | 232 | // get info |
| 233 | 233 | try { info = audio->getDeviceInfo(i); } |
| 234 | − catch( RtError & error ) | |
| 234 | + catch( RtAudioError & error ) | |
| 235 | 235 | { |
| 236 | 236 | error.printMessage(); |
| 237 | 237 | break; |
| @@ -253,7 +253,7 @@ t_CKUINT ChuckAudio::device_named( const std::string & name, t_CKBOOL needs_dac, · 15 unmodified lines | ||
| 253 | 253 | for( int i = 0; i < devices; i++ ) |
| 254 | 254 | { |
| 255 | 255 | try { info = audio->getDeviceInfo(i); } |
| 256 | − catch( RtError & error ) | |
| 256 | + catch( RtAudioError & error ) | |
| 257 | 257 | { |
| 258 | 258 | error.printMessage(); |
| 259 | 259 | break; |
| @@ -477,7 +477,7 @@ t_CKBOOL ChuckAudio::initialize( t_CKUINT num_dac_channels, · 217 unmodified lines | ||
| 477 | 477 | |
| 478 | 478 | // allocate RtAudio |
| 479 | 479 | try { m_rtaudio = new RtAudio( ); } |
| 480 | − catch( RtError err ) | |
| 480 | + catch( RtAudioError err ) | |
| 481 | 481 | { |
| 482 | 482 | // problem finding audio devices, most likely |
| 483 | 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 | 731 | CK_RTAUDIO_FORMAT, sample_rate, &bufsize, |
| 732 | 732 | cb, m_cb_user_data, |
| 733 | 733 | &stream_options ); |
| 734 | − } catch( RtError err ) { | |
| 734 | + } catch( RtAudioError err ) { | |
| 735 | 735 | // log |
| 736 | 736 | EM_log( CK_LOG_INFO, "exception caught: '%s'...", err.getMessage().c_str() ); |
| 737 | 737 | EM_error2( 0, "%s", err.getMessage().c_str() ); |
| @@ -882,7 +882,7 @@ t_CKBOOL ChuckAudio::start( ) · 144 unmodified lines | ||
| 882 | 882 | m_rtaudio->startStream(); |
| 883 | 883 | m_start = TRUE; |
| 884 | 884 | } |
| 885 | − catch( RtError err ) | |
| 885 | + catch( RtAudioError err ) | |
| 886 | 886 | { |
| 887 | 887 | return FALSE; |
| 888 | 888 | } |
| @@ -904,7 +904,7 @@ t_CKBOOL ChuckAudio::stop( ) · 15 unmodified lines | ||
| 904 | 904 | m_rtaudio->stopStream(); |
| 905 | 905 | m_start = FALSE; |
| 906 | 906 | } |
| 907 | − catch( RtError err ) | |
| 907 | + catch( RtAudioError err ) | |
| 908 | 908 | { |
| 909 | 909 | return FALSE; |
| 910 | 910 | } |
| @@ -36,7 +36,7 @@ · 35 unmodified lines | ||
| 36 | 36 | |
| 37 | 37 | #include "chuck_def.h" |
| 38 | 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 | 2 | COREDIR=core |
| 3 | 3 | HOSTDIR=host |
| 4 | 4 | CK_PLATFORM= |
| 5 | +RTAUDIODIR=./rtaudio | |
| 5 | 6 | |
| 6 | 7 | |
| 7 | 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 | 158 | ############################ CHUCK HOST TARGETS ################################ |
| 158 | −CXXSRCS_HOST+= RtAudio/RtAudio.cpp chuck_audio.cpp chuck_console.cpp \ | |
| 159 | − chuck_main.cpp | |
| 159 | +CXXINC_HOST+= -I${RTAUDIODIR} -I${RTAUDIODIR}/include | |
| 160 | +CXXSRCS_HOST+= chuck_main.cpp chuck_audio.cpp chuck_console.cpp \ | |
| 161 | + ${RTAUDIODIR}/RtAudio.cpp | |
| 160 | 162 | |
| 161 | 163 | |
| 162 | 164 | ############################ OBJECT FILE TARGETS ############################### |
| @@ -208,16 +210,18 @@ chuck-core: · 45 unmodified lines | ||
| 208 | 210 | make $(MAKECMDGOALS) -C $(COREDIR) $(ARCH_ARGS) |
| 209 | 211 | @echo ------------- |
| 210 | 212 | |
| 213 | +CFLAGS_HOST= ${CFLAGS} -I${RTAUDIODIR} | |
| 214 | +CFLAGSDEPEND_HOST=${CFLAGSDEPEND} ${CFLAGS_HOST} | |
| 211 | 215 | chuck: chuck-core $(COBJS_HOST) $(CXXOBJS_HOST) |
| 212 | 216 | $(LD) -o chuck $(OBJS) $(LDFLAGS) $(ARCHOPTS) |
| 213 | 217 | |
| 214 | 218 | $(COBJS_HOST): %.o: %.c |
| 215 | − $(CC) $(CFLAGS) $(ARCHOPTS) -c $< -o $@ | |
| 216 | − @$(CC) -MM -MQ "$@" $(CFLAGSDEPEND) $< > $*.d | |
| 219 | + $(CC) $(CFLAGS_HOST) $(ARCHOPTS) -c $< -o $@ | |
| 220 | + @$(CC) -MM -MQ "$@" $(CFLAGSDEPEND_HOST) $< > $*.d | |
| 217 | 221 | |
| 218 | 222 | $(CXXOBJS_HOST): %.o: %.cpp |
| 219 | − $(CXX) $(CFLAGS) $(ARCHOPTS) -c $< -o $@ | |
| 220 | − @$(CXX) -MM -MQ "$@" $(CFLAGSDEPEND) $< > $*.d | |
| 223 | + $(CXX) $(CFLAGS_HOST) $(ARCHOPTS) -c $< -o $@ | |
| 224 | + @$(CXX) -MM -MQ "$@" $(CFLAGSDEPEND_HOST) $< > $*.d | |
| 221 | 225 | |
| 222 | 226 | clean: |
| 223 | 227 | @rm -rf $(wildcard chuck chuck.exe) *.o *.d */*.{o,d} */*/*.{o,d} $(OBJS) \ |
| @@ -0,0 +1 @@ | ||
| 1 | +Subproject commit f9fd8726ccb688baa43aaae642179a69d353f6d2 | |