Browse Source

Renamed RtError class to RtAudioError and embedded it in RtAudio.h.

Deleted RtError.h from distribution and renamed all references to
RtError in the documentation, test files, and Windows .dsp files.
The version number was incremented to 4.1.0 in anticipation of
the next release, as this change affects the API.
tags/4.1.0
Gary Scavone 10 years ago
parent
commit
07c639e411
24 changed files with 249 additions and 278 deletions
  1. +2
    -2
      Makefile.in
  2. +160
    -160
      RtAudio.cpp
  3. +58
    -2
      RtAudio.h
  4. +0
    -60
      RtError.h
  5. +1
    -1
      doc/doxygen/compiling.txt
  6. +2
    -2
      doc/doxygen/duplex.txt
  7. +2
    -2
      doc/doxygen/playback.txt
  8. +2
    -2
      doc/doxygen/recording.txt
  9. +2
    -2
      doc/doxygen/settings.txt
  10. +1
    -1
      doc/doxygen/tutorial.txt
  11. +4
    -1
      doc/release.txt
  12. +0
    -4
      tests/Windows/audioprobe.dsp
  13. +0
    -4
      tests/Windows/duplex.dsp
  14. +0
    -4
      tests/Windows/playraw.dsp
  15. +0
    -4
      tests/Windows/playsaw.dsp
  16. +0
    -4
      tests/Windows/record.dsp
  17. +0
    -4
      tests/Windows/testall.dsp
  18. +0
    -4
      tests/Windows/teststops.dsp
  19. +2
    -2
      tests/duplex.cpp
  20. +1
    -1
      tests/playraw.cpp
  21. +2
    -2
      tests/playsaw.cpp
  22. +2
    -2
      tests/record.cpp
  23. +3
    -3
      tests/testall.cpp
  24. +5
    -5
      tests/teststops.cpp

+ 2
- 2
Makefile.in View File

@@ -9,7 +9,7 @@ OBJECTS = RtAudio.o @objects@
LIBNAME = librtaudio
STATIC = $(LIBNAME).a
SHARED = @sharedlib@
RELEASE = 4.0.12
RELEASE = 4.1.0
MAJOR = 4
LIBRARIES = $(STATIC) $(SHARED)

@@ -46,7 +46,7 @@ install:
$(LN) -sf @sharedname@ $(PREFIX)/lib/$(SHARED)
$(LN) -sf @sharedname@ $(PREFIX)/lib/$(SHARED).$(MAJOR)
install --mode=644 $(LIBNAME).pc $(PREFIX)/lib/pkgconfig
install --mode=644 RtAudio.h RtError.h $(PREFIX)/include/
install --mode=644 RtAudio.h $(PREFIX)/include/
install --mode=755 rtaudio-config $(PREFIX)/bin/

uninstall:


+ 160
- 160
RtAudio.cpp
File diff suppressed because it is too large
View File


+ 58
- 2
RtAudio.h View File

@@ -47,10 +47,11 @@

#include <string>
#include <vector>
#include "RtError.h"
#include <exception>
#include <iostream>

// RtAudio version
static const std::string VERSION( "4.0.12" );
static const std::string VERSION( "4.1.0pre" );

/*! \typedef typedef unsigned long RtAudioFormat;
\brief RtAudio data format type.
@@ -205,6 +206,7 @@ typedef void (*RtAudioErrorCallback)( RtError::Type type, const std::string &err
//
// **************************************************************** //

class RtAudioError;
class RtApi;

class RtAudio
@@ -1048,6 +1050,60 @@ public:

#endif

/************************************************************************/
/*! \class RtError
\brief Exception handling class for RtAudio & RtMidi.

The RtError class is quite simple but it does allow errors to be
"caught" by RtError::Type. See the RtAudio and RtMidi
documentation to know which methods can throw an RtError.

*/
/************************************************************************/

class RtAudioError : public std::exception
{
public:
//! Defined RtAudioError types.
enum Type {
WARNING, /*!< A non-critical error. */
DEBUG_WARNING, /*!< A non-critical error which might be useful for debugging. */
UNSPECIFIED, /*!< The default, unspecified error type. */
NO_DEVICES_FOUND, /*!< No devices found on system. */
INVALID_DEVICE, /*!< An invalid device ID was specified. */
MEMORY_ERROR, /*!< An error occured during memory allocation. */
INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
INVALID_USE, /*!< The function was called incorrectly. */
DRIVER_ERROR, /*!< A system driver error occured. */
SYSTEM_ERROR, /*!< A system error occured. */
THREAD_ERROR /*!< A thread error occured. */
};

//! The constructor.
RtAudioError( const std::string& message, Type type = RtAudioError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
//! The destructor.
virtual ~RtAudioError( void ) throw() {}

//! Prints thrown error message to stderr.
virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }

//! Returns the thrown error message type.
virtual const Type& getType(void) const throw() { return type_; }

//! Returns the thrown error message string.
virtual const std::string& getMessage(void) const throw() { return message_; }

//! Returns the thrown error message as a c-style string.
virtual const char* what( void ) const throw() { return message_.c_str(); }

protected:
std::string message_;
Type type_;
};

#endif

#endif

// Indentation settings for Vim and Emacs


+ 0
- 60
RtError.h View File

@@ -1,60 +0,0 @@
/************************************************************************/
/*! \class RtError
\brief Exception handling class for RtAudio & RtMidi.

The RtError class is quite simple but it does allow errors to be
"caught" by RtError::Type. See the RtAudio and RtMidi
documentation to know which methods can throw an RtError.

*/
/************************************************************************/

#ifndef RTERROR_H
#define RTERROR_H

#include <exception>
#include <iostream>
#include <string>

class RtError : public std::exception
{
public:
//! Defined RtError types.
enum Type {
WARNING, /*!< A non-critical error. */
DEBUG_WARNING, /*!< A non-critical error which might be useful for debugging. */
UNSPECIFIED, /*!< The default, unspecified error type. */
NO_DEVICES_FOUND, /*!< No devices found on system. */
INVALID_DEVICE, /*!< An invalid device ID was specified. */
MEMORY_ERROR, /*!< An error occured during memory allocation. */
INVALID_PARAMETER, /*!< An invalid parameter was specified to a function. */
INVALID_USE, /*!< The function was called incorrectly. */
DRIVER_ERROR, /*!< A system driver error occured. */
SYSTEM_ERROR, /*!< A system error occured. */
THREAD_ERROR /*!< A thread error occured. */
};

//! The constructor.
RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {}
//! The destructor.
virtual ~RtError( void ) throw() {}

//! Prints thrown error message to stderr.
virtual void printMessage( void ) const throw() { std::cerr << '\n' << message_ << "\n\n"; }

//! Returns the thrown error message type.
virtual const Type& getType(void) const throw() { return type_; }

//! Returns the thrown error message string.
virtual const std::string& getMessage(void) const throw() { return message_; }

//! Returns the thrown error message as a c-style string.
virtual const char* what( void ) const throw() { return message_.c_str(); }

protected:
std::string message_;
Type type_;
};

#endif

+ 1
- 1
doc/doxygen/compiling.txt View File

@@ -78,7 +78,7 @@ In order to compile RtAudio for a specific OS and audio API, it is necessary to
</TABLE>
<P>

The example compiler statements above could be used to compile the <TT>audioprobe.cpp</TT> example file, assuming that <TT>audioprobe.cpp</TT>, <TT>RtAudio.h</TT>, <tt>RtError.h</tt>, and <TT>RtAudio.cpp</TT> all exist in the same directory.
The example compiler statements above could be used to compile the <TT>audioprobe.cpp</TT> example file, assuming that <TT>audioprobe.cpp</TT>, <TT>RtAudio.h</TT> and <TT>RtAudio.cpp</TT> all exist in the same directory.


*/

+ 2
- 2
doc/doxygen/duplex.txt View File

@@ -40,7 +40,7 @@ int main()
try {
adac.openStream( &oParams, &iParams, RTAUDIO_SINT32, 44100, &bufferFrames, &inout, (void *)&bufferBytes );
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
exit( 0 );
}
@@ -57,7 +57,7 @@ int main()
// Stop the stream.
adac.stopStream();
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}


+ 2
- 2
doc/doxygen/playback.txt View File

@@ -52,7 +52,7 @@ int main()
sampleRate, &bufferFrames, &saw, (void *)&data );
dac.startStream();
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
exit( 0 );
}
@@ -65,7 +65,7 @@ int main()
// Stop the stream
dac.stopStream();
}
catch (RtError& e) {
catch (RtAudioError& e) {
e.printMessage();
}



+ 2
- 2
doc/doxygen/recording.txt View File

@@ -40,7 +40,7 @@ int main()
sampleRate, &bufferFrames, &record );
adc.startStream();
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
exit( 0 );
}
@@ -53,7 +53,7 @@ int main()
// Stop the stream
adc.stopStream();
}
catch (RtError& e) {
catch (RtAudioError& e) {
e.printMessage();
}



+ 2
- 2
doc/doxygen/settings.txt View File

@@ -24,7 +24,7 @@ int main()
dac.openStream( &parameters, NULL, RTAUDIO_FLOAT32,
sampleRate, &bufferFrames, &myCallback, NULL, &options );
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
std::cout << '\n' << e.getMessage() << '\n' << std::endl;
exit( 0 );
}
@@ -33,7 +33,7 @@ int main()
}
\endcode

The RtAudio::openStream() function attempts to open a stream with a specified set of parameter values. In the above example, we attempt to open a two channel playback stream using the default output device, 32-bit floating point data, a sample rate of 44100 Hz, and a frame rate of 256 sample frames per output buffer. If the user specifies an invalid parameter value (such as a device id greater than or equal to the number of enumerated devices), an RtError is thrown of type = INVALID_USE. If a system error occurs or the device does not support the specified parameter values, an RtError of type = SYSTEM_ERROR is thrown. In either case, a descriptive error message is bundled with the exception and can be queried with the RtError::getMessage() or RtError::what() functions.
The RtAudio::openStream() function attempts to open a stream with a specified set of parameter values. In the above example, we attempt to open a two channel playback stream using the default output device, 32-bit floating point data, a sample rate of 44100 Hz, and a frame rate of 256 sample frames per output buffer. If the user specifies an invalid parameter value (such as a device id greater than or equal to the number of enumerated devices), an RtAudioError is thrown of type = INVALID_USE. If a system error occurs or the device does not support the specified parameter values, an RtAudioError of type = SYSTEM_ERROR is thrown. In either case, a descriptive error message is bundled with the exception and can be queried with the RtAudioError::getMessage() or RtAudioError::what() functions.

RtAudio provides four signed integer and two floating point data formats which can be specified using the RtAudioFormat parameter values mentioned earlier. If the opened device does not natively support the given format, RtAudio will automatically perform the necessary data format conversion.



+ 1
- 1
doc/doxygen/tutorial.txt View File

@@ -5,7 +5,7 @@ RtAudio is a set of C++ classes that provide a common API (Application Programmi
<UL>
<LI>object-oriented C++ design</LI>
<LI>simple, common API across all supported platforms</LI>
<LI>only one source and two header files for easy inclusion in programming projects</LI>
<LI>only one source and one header file for easy inclusion in programming projects</LI>
<LI>allow simultaneous multi-api support</LI>
<LI>support dynamic connection of devices</LI>
<LI>provide extensive audio device parameter control</LI>


+ 4
- 1
doc/release.txt View File

@@ -1,6 +1,9 @@
RtAudio - a set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio, and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound and ASIO) operating systems.

By Gary P. Scavone, 2001-2013.
By Gary P. Scavone, 2001-2014.

v4.1.0: (?? 2014)
- RtError class renamed RtAudioError and embedded in RtAudio.h (RtError.h deleted)

v4.0.12: (16 April 2013)
- new functionality to allow error reporting via a client-supplied function (thanks to Pavel Mogilevskiy)


+ 0
- 4
tests/Windows/audioprobe.dsp View File

@@ -149,10 +149,6 @@ SOURCE=..\..\include\iasiothiscallresolver.h
SOURCE=..\..\RtAudio.h
# End Source File
# Begin Source File
SOURCE=..\..\RtError.h
# End Source File
# End Group
# Begin Group "Resource Files"


+ 0
- 4
tests/Windows/duplex.dsp View File

@@ -149,10 +149,6 @@ SOURCE=..\..\include\iasiothiscallresolver.h
SOURCE=..\..\RtAudio.h
# End Source File
# Begin Source File
SOURCE=..\..\RtError.h
# End Source File
# End Group
# Begin Group "Resource Files"


+ 0
- 4
tests/Windows/playraw.dsp View File

@@ -149,10 +149,6 @@ SOURCE=..\..\include\iasiothiscallresolver.h
SOURCE=..\..\RtAudio.h
# End Source File
# Begin Source File
SOURCE=..\..\RtError.h
# End Source File
# End Group
# Begin Group "Resource Files"


+ 0
- 4
tests/Windows/playsaw.dsp View File

@@ -149,10 +149,6 @@ SOURCE=..\..\include\iasiothiscallresolver.h
SOURCE=..\..\RtAudio.h
# End Source File
# Begin Source File
SOURCE=..\..\RtError.h
# End Source File
# End Group
# Begin Group "Resource Files"


+ 0
- 4
tests/Windows/record.dsp View File

@@ -149,10 +149,6 @@ SOURCE=..\..\include\iasiothiscallresolver.h
SOURCE=..\..\RtAudio.h
# End Source File
# Begin Source File
SOURCE=..\..\RtError.h
# End Source File
# End Group
# Begin Group "Resource Files"


+ 0
- 4
tests/Windows/testall.dsp View File

@@ -149,10 +149,6 @@ SOURCE=..\..\include\iasiothiscallresolver.h
SOURCE=..\..\RtAudio.h
# End Source File
# Begin Source File
SOURCE=..\..\RtError.h
# End Source File
# End Group
# Begin Group "Resource Files"


+ 0
- 4
tests/Windows/teststops.dsp View File

@@ -149,10 +149,6 @@ SOURCE=..\..\include\iasiothiscallresolver.h
SOURCE=..\..\RtAudio.h
# End Source File
# Begin Source File
SOURCE=..\..\RtError.h
# End Source File
# End Group
# Begin Group "Resource Files"


+ 2
- 2
tests/duplex.cpp View File

@@ -103,7 +103,7 @@ int main( int argc, char *argv[] )
try {
adac.openStream( &oParams, &iParams, FORMAT, fs, &bufferFrames, &inout, (void *)&bufferBytes, &options );
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
std::cout << '\n' << e.getMessage() << '\n' << std::endl;
exit( 1 );
}
@@ -123,7 +123,7 @@ int main( int argc, char *argv[] )
// Stop the stream.
adac.stopStream();
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
std::cout << '\n' << e.getMessage() << '\n' << std::endl;
goto cleanup;
}


+ 1
- 1
tests/playraw.cpp View File

@@ -130,7 +130,7 @@ int main( int argc, char *argv[] )
dac.openStream( &oParams, NULL, FORMAT, fs, &bufferFrames, &output, (void *)&data );
dac.startStream();
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
std::cout << '\n' << e.getMessage() << '\n' << std::endl;
goto cleanup;
}


+ 2
- 2
tests/playsaw.cpp View File

@@ -172,7 +172,7 @@ int main( int argc, char *argv[] )
dac.openStream( &oParams, NULL, FORMAT, fs, &bufferFrames, &saw, (void *)data, &options );
dac.startStream();
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}
@@ -190,7 +190,7 @@ int main( int argc, char *argv[] )
// Stop the stream
dac.stopStream();
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
}
}


+ 2
- 2
tests/record.cpp View File

@@ -126,7 +126,7 @@ int main( int argc, char *argv[] )
try {
adc.openStream( NULL, &iParams, FORMAT, fs, &bufferFrames, &input, (void *)&data );
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
std::cout << '\n' << e.getMessage() << '\n' << std::endl;
goto cleanup;
}
@@ -148,7 +148,7 @@ int main( int argc, char *argv[] )
try {
adc.startStream();
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
std::cout << '\n' << e.getMessage() << '\n' << std::endl;
goto cleanup;
}


+ 3
- 3
tests/testall.cpp View File

@@ -160,7 +160,7 @@ int main( int argc, char *argv[] )
std::cout << "Playing again ... press <enter> to close the stream.\n";
std::cin.get( input );
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}
@@ -180,7 +180,7 @@ int main( int argc, char *argv[] )
std::cout << "\nPlaying ... press <enter> to stop.\n";
std::cin.get( input );
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}
@@ -216,7 +216,7 @@ int main( int argc, char *argv[] )
std::cout << "\nRunning ... press <enter> to stop.\n";
std::cin.get( input );
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
}



+ 5
- 5
tests/teststops.cpp View File

@@ -141,7 +141,7 @@ int main( int argc, char *argv[] )
SLEEP( pausetime );
}
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}
@@ -168,7 +168,7 @@ int main( int argc, char *argv[] )
SLEEP( pausetime );
}
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}
@@ -193,7 +193,7 @@ int main( int argc, char *argv[] )
SLEEP( pausetime );
}
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}
@@ -222,7 +222,7 @@ int main( int argc, char *argv[] )
SLEEP( pausetime );
}
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}
@@ -253,7 +253,7 @@ int main( int argc, char *argv[] )
SLEEP( pausetime );
}
}
catch ( RtError& e ) {
catch ( RtAudioError& e ) {
e.printMessage();
goto cleanup;
}


Loading…
Cancel
Save