Browse Source

Various changes in preparation for release 4.0.8

including fix of MinGW ASIO compile problem (iasiothiscallresolver),
OS-X problem handling device names in some languages (CFString
conversion), small change to OS-X MUTEX lock location to avoid
lockups, and correction to documentation regarding 24-bit data (should
be lower 3 bytes, not upper 3 bytes).
tags/4.0.8
Gary Scavone Stephen Sinclair 14 years ago
parent
commit
24a98a1971
10 changed files with 628 additions and 586 deletions
  1. +12
    -4
      Makefile.in
  2. +17
    -6
      RtAudio.cpp
  3. +5
    -3
      RtAudio.h
  4. +12
    -1
      configure.ac
  5. +5
    -1
      doc/release.txt
  6. +572
    -563
      include/iasiothiscallresolver.cpp
  7. +2
    -1
      include/iasiothiscallresolver.h
  8. +1
    -1
      tests/Makefile.in
  9. +1
    -1
      tests/duplex.cpp
  10. +1
    -5
      tests/playraw.cpp

+ 12
- 4
Makefile.in View File

@@ -2,11 +2,13 @@
### RtAudio library Makefile ### RtAudio library Makefile


RM = /bin/rm RM = /bin/rm
LN = /bin/ln


OBJECTS = RtAudio.o @objects@ OBJECTS = RtAudio.o @objects@


STATIC = librtaudio.a STATIC = librtaudio.a
SHARED = librtaudio.so
SHARED = @sharedlib@
RELEASE = 4.0.7
LIBRARIES = $(STATIC) $(SHARED) LIBRARIES = $(STATIC) $(SHARED)


CC = @CXX@ CC = @CXX@
@@ -24,7 +26,10 @@ tests:
$(LIBRARIES): $(OBJECTS) $(LIBRARIES): $(OBJECTS)
$(AR) ruv $(STATIC) $(OBJECTS) $(AR) ruv $(STATIC) $(OBJECTS)
ranlib $(STATIC) ranlib $(STATIC)
$(CC) -shared $(OBJECTS) -o $(SHARED) @LIBS@
$(CC) -fPIC @libflags@ $(OBJECTS) @LIBS@
$(LN) -s @sharedname@ $(SHARED)

# $(CC) -shared $(OBJECTS) -o $(SHARED) @LIBS@


%.o : %.cpp %.o : %.cpp
$(CC) $(CFLAGS) $(DEFS) -c $(<) -o $@ $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $@
@@ -33,12 +38,15 @@ $(LIBRARIES): $(OBJECTS)
$(CC) $(CFLAGS) $(DEFS) -c $(<) -o $@ $(CC) $(CFLAGS) $(DEFS) -c $(<) -o $@


clean : clean :
$(RM) -f $(LIBRARIES)
$(RM) -f $(LIBRARIES) @sharedname@ $(SHARED)*
$(RM) -f $(OBJECTS) $(RM) -f $(OBJECTS)
$(RM) -f *~ $(RM) -f *~
cd tests && $(MAKE) clean cd tests && $(MAKE) clean


distclean: clean
distclean:
$(RM) -f $(LIBRARIES) @sharedname@ $(SHARED)*
$(RM) -f $(OBJECTS)
$(RM) -f *~
$(RM) -rf config.log config.status autom4te.cache Makefile rtaudio-config $(RM) -rf config.log config.status autom4te.cache Makefile rtaudio-config
cd tests && $(MAKE) distclean cd tests && $(MAKE) distclean




+ 17
- 6
RtAudio.cpp View File

@@ -10,7 +10,7 @@
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/ RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/


RtAudio: realtime audio i/o C++ classes RtAudio: realtime audio i/o C++ classes
Copyright (c) 2001-2010 Gary P. Scavone
Copyright (c) 2001-2011 Gary P. Scavone


Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files obtaining a copy of this software and associated documentation files
@@ -38,7 +38,7 @@
*/ */
/************************************************************************/ /************************************************************************/


// RtAudio: Version 4.0.7
// RtAudio: Version 4.0.8


#include "RtAudio.h" #include "RtAudio.h"
#include <iostream> #include <iostream>
@@ -557,10 +557,14 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device )
return info; return info;
} }


const char *mname = CFStringGetCStringPtr( cfname, CFStringGetSystemEncoding() );
//const char *mname = CFStringGetCStringPtr( cfname, CFStringGetSystemEncoding() );
int length = CFStringGetLength(cfname);
char *mname = (char *)malloc(length * 3 + 1);
CFStringGetCString(cfname, mname, length * 3 + 1, CFStringGetSystemEncoding());
info.name.append( (const char *)mname, strlen(mname) ); info.name.append( (const char *)mname, strlen(mname) );
info.name.append( ": " ); info.name.append( ": " );
CFRelease( cfname ); CFRelease( cfname );
free(mname);


property.mSelector = kAudioObjectPropertyName; property.mSelector = kAudioObjectPropertyName;
result = AudioObjectGetPropertyData( id, &property, 0, NULL, &dataSize, &cfname ); result = AudioObjectGetPropertyData( id, &property, 0, NULL, &dataSize, &cfname );
@@ -571,9 +575,13 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device )
return info; return info;
} }


const char *name = CFStringGetCStringPtr( cfname, CFStringGetSystemEncoding() );
//const char *name = CFStringGetCStringPtr( cfname, CFStringGetSystemEncoding() );
length = CFStringGetLength(cfname);
char *name = (char *)malloc(length * 3 + 1);
CFStringGetCString(cfname, name, length * 3 + 1, CFStringGetSystemEncoding());
info.name.append( (const char *)name, strlen(name) ); info.name.append( (const char *)name, strlen(name) );
CFRelease( cfname ); CFRelease( cfname );
free(name);


// Get the output stream "configuration". // Get the output stream "configuration".
AudioBufferList *bufferList = nil; AudioBufferList *bufferList = nil;
@@ -1392,7 +1400,9 @@ void RtApiCore :: stopStream( void )


if ( stream_.mode == INPUT || ( stream_.mode == DUPLEX && stream_.device[0] != stream_.device[1] ) ) { if ( stream_.mode == INPUT || ( stream_.mode == DUPLEX && stream_.device[0] != stream_.device[1] ) ) {


MUTEX_UNLOCK( &stream_.mutex );
result = AudioDeviceStop( handle->id[1], callbackHandler ); result = AudioDeviceStop( handle->id[1], callbackHandler );
MUTEX_LOCK( &stream_.mutex );
if ( result != noErr ) { if ( result != noErr ) {
errorStream_ << "RtApiCore::stopStream: system error (" << getErrorCode( result ) << ") stopping input callback procedure on device (" << stream_.device[1] << ")."; errorStream_ << "RtApiCore::stopStream: system error (" << getErrorCode( result ) << ") stopping input callback procedure on device (" << stream_.device[1] << ").";
errorText_ = errorStream_.str(); errorText_ = errorStream_.str();
@@ -1472,6 +1482,7 @@ bool RtApiCore :: callbackEvent( AudioDeviceID deviceId,
status |= RTAUDIO_INPUT_OVERFLOW; status |= RTAUDIO_INPUT_OVERFLOW;
handle->xrun[1] = false; handle->xrun[1] = false;
} }

handle->drainCounter = callback( stream_.userBuffer[0], stream_.userBuffer[1], handle->drainCounter = callback( stream_.userBuffer[0], stream_.userBuffer[1],
stream_.bufferSize, streamTime, status, info->userData ); stream_.bufferSize, streamTime, status, info->userData );
if ( handle->drainCounter == 2 ) { if ( handle->drainCounter == 2 ) {
@@ -7393,7 +7404,7 @@ void RtApi :: convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info
{ {
// This function does format conversion, input/output channel compensation, and // This function does format conversion, input/output channel compensation, and
// data interleaving/deinterleaving. 24-bit integers are assumed to occupy // data interleaving/deinterleaving. 24-bit integers are assumed to occupy
// the upper three bytes of a 32-bit integer.
// the lower three bytes of a 32-bit integer.


// Clear our device buffer when in/out duplex device channels are different // Clear our device buffer when in/out duplex device channels are different
if ( outBuffer == stream_.deviceBuffer && stream_.mode == DUPLEX && if ( outBuffer == stream_.deviceBuffer && stream_.mode == DUPLEX &&
@@ -7581,7 +7592,7 @@ void RtApi :: convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info
out += info.outJump; out += info.outJump;
} }
} }
else if (info.inFormat == RTAUDIO_SINT24) {
else if (info.inFormat == RTAUDIO_SINT24) { // Hmmm ... we could just leave it in the lower 3 bytes
Int32 *in = (Int32 *)inBuffer; Int32 *in = (Int32 *)inBuffer;
for (unsigned int i=0; i<stream_.bufferSize; i++) { for (unsigned int i=0; i<stream_.bufferSize; i++) {
for (j=0; j<info.channels; j++) { for (j=0; j<info.channels; j++) {


+ 5
- 3
RtAudio.h View File

@@ -10,7 +10,7 @@
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/ RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/


RtAudio: realtime audio i/o C++ classes RtAudio: realtime audio i/o C++ classes
Copyright (c) 2001-2010 Gary P. Scavone
Copyright (c) 2001-2011 Gary P. Scavone


Permission is hereby granted, free of charge, to any person Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files obtaining a copy of this software and associated documentation files
@@ -42,7 +42,7 @@
\file RtAudio.h \file RtAudio.h
*/ */


// RtAudio: Version 4.0.7
// RtAudio: Version 4.0.8


#ifndef __RTAUDIO_H #ifndef __RTAUDIO_H
#define __RTAUDIO_H #define __RTAUDIO_H
@@ -59,10 +59,12 @@
internal routines will automatically take care of any necessary internal routines will automatically take care of any necessary
byte-swapping between the host format and the soundcard. Thus, byte-swapping between the host format and the soundcard. Thus,
endian-ness is not a concern in the following format definitions. endian-ness is not a concern in the following format definitions.
Note that 24-bit data is expected to be encapsulated in a 32-bit
format.


- \e RTAUDIO_SINT8: 8-bit signed integer. - \e RTAUDIO_SINT8: 8-bit signed integer.
- \e RTAUDIO_SINT16: 16-bit signed integer. - \e RTAUDIO_SINT16: 16-bit signed integer.
- \e RTAUDIO_SINT24: Upper 3 bytes of 32-bit signed integer.
- \e RTAUDIO_SINT24: Lower 3 bytes of 32-bit signed integer.
- \e RTAUDIO_SINT32: 32-bit signed integer. - \e RTAUDIO_SINT32: 32-bit signed integer.
- \e RTAUDIO_FLOAT32: Normalized between plus/minus 1.0. - \e RTAUDIO_FLOAT32: Normalized between plus/minus 1.0.
- \e RTAUDIO_FLOAT64: Normalized between plus/minus 1.0. - \e RTAUDIO_FLOAT64: Normalized between plus/minus 1.0.


+ 12
- 1
configure.ac View File

@@ -44,9 +44,20 @@ fi


CXXFLAGS="$CXXFLAGS $cxxflag" CXXFLAGS="$CXXFLAGS $cxxflag"


AC_CANONICAL_HOST

AC_SUBST( sharedlib, ["librtaudio.so"] )
AC_SUBST( sharedname, ["librtaudio.so.\$(RELEASE)"] )
AC_SUBST( libflags, ["-shared -Wl,-soname,\$(SHAREDLIB).\$(MAJOR) -o \$(SHAREDLIB).\$(RELEASE)"] )
case $host in
*-apple*)
AC_SUBST( sharedlib, ["librtaudio.dylib"] )
AC_SUBST( sharedname, ["librtaudio.\$(RELEASE).dylib"] )
AC_SUBST( libflags, ["-dynamiclib -o librtaudio.\$(RELEASE).dylib"] )
esac

# Checks for package options and external software # Checks for package options and external software
AC_SUBST( api, [""] ) AC_SUBST( api, [""] )
AC_CANONICAL_HOST
AC_MSG_CHECKING(for audio API) AC_MSG_CHECKING(for audio API)
case $host in case $host in
*-*-netbsd*) *-*-netbsd*)


+ 5
- 1
doc/release.txt View File

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


By Gary P. Scavone, 2001-2010.
By Gary P. Scavone, 2001-2011.

v4.0.8: (?? February 2011)
- fix for MinGW4 problem enumerating and setting sample rates



v4.0.7: (4 February 2010) v4.0.7: (4 February 2010)
- revised Windows DS code and device enumeration to speed up device queries - revised Windows DS code and device enumeration to speed up device queries


+ 572
- 563
include/iasiothiscallresolver.cpp
File diff suppressed because it is too large
View File


+ 2
- 1
include/iasiothiscallresolver.h View File

@@ -115,7 +115,8 @@
// We only need IASIOThiscallResolver at all if we are on Win32. For other // We only need IASIOThiscallResolver at all if we are on Win32. For other
// platforms we simply bypass the IASIOThiscallResolver definition to allow us // platforms we simply bypass the IASIOThiscallResolver definition to allow us
// to be safely #include'd whatever the platform to keep client code portable // to be safely #include'd whatever the platform to keep client code portable
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
//#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__)) && !defined(_WIN64)
// If microsoft compiler we can call IASIO directly so IASIOThiscallResolver // If microsoft compiler we can call IASIO directly so IASIOThiscallResolver


+ 1
- 1
tests/Makefile.in View File

@@ -49,7 +49,7 @@ clean :
$(RM) -fR *.dSYM $(RM) -fR *.dSYM


distclean: clean distclean: clean
$(RM) Makefile
$(RM) -f Makefile


strip : strip :
strip $(PROGRAMS) strip $(PROGRAMS)

+ 1
- 1
tests/duplex.cpp View File

@@ -53,7 +53,7 @@ int inout( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames,
// a simple buffer copy operation here. // a simple buffer copy operation here.
if ( status ) std::cout << "Stream over/underflow detected." << std::endl; if ( status ) std::cout << "Stream over/underflow detected." << std::endl;


unsigned long *bytes = (unsigned long *) data;
unsigned int *bytes = (unsigned int *) data;
memcpy( outputBuffer, inputBuffer, *bytes ); memcpy( outputBuffer, inputBuffer, *bytes );
return 0; return 0;
} }


+ 1
- 5
tests/playraw.cpp View File

@@ -26,11 +26,7 @@ typedef signed short MY_TYPE;
#define SCALE 32767.0 #define SCALE 32767.0


/* /*
typedef signed long MY_TYPE;
#define FORMAT RTAUDIO_SINT24
#define SCALE 8388607.0

typedef signed long MY_TYPE;
typedef signed int MY_TYPE;
#define FORMAT RTAUDIO_SINT32 #define FORMAT RTAUDIO_SINT32
#define SCALE 2147483647.0 #define SCALE 2147483647.0




Loading…
Cancel
Save