|
|
@@ -10,7 +10,7 @@ |
|
|
|
RtAudio WWW site: http://www.music.mcgill.ca/~gary/rtaudio/ |
|
|
|
|
|
|
|
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 |
|
|
|
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 <iostream> |
|
|
@@ -557,10 +557,14 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device ) |
|
|
|
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( ": " ); |
|
|
|
CFRelease( cfname ); |
|
|
|
free(mname); |
|
|
|
|
|
|
|
property.mSelector = kAudioObjectPropertyName; |
|
|
|
result = AudioObjectGetPropertyData( id, &property, 0, NULL, &dataSize, &cfname ); |
|
|
@@ -571,9 +575,13 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device ) |
|
|
|
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) ); |
|
|
|
CFRelease( cfname ); |
|
|
|
free(name); |
|
|
|
|
|
|
|
// Get the output stream "configuration". |
|
|
|
AudioBufferList *bufferList = nil; |
|
|
@@ -1392,7 +1400,9 @@ void RtApiCore :: stopStream( void ) |
|
|
|
|
|
|
|
if ( stream_.mode == INPUT || ( stream_.mode == DUPLEX && stream_.device[0] != stream_.device[1] ) ) { |
|
|
|
|
|
|
|
MUTEX_UNLOCK( &stream_.mutex ); |
|
|
|
result = AudioDeviceStop( handle->id[1], callbackHandler ); |
|
|
|
MUTEX_LOCK( &stream_.mutex ); |
|
|
|
if ( result != noErr ) { |
|
|
|
errorStream_ << "RtApiCore::stopStream: system error (" << getErrorCode( result ) << ") stopping input callback procedure on device (" << stream_.device[1] << ")."; |
|
|
|
errorText_ = errorStream_.str(); |
|
|
@@ -1472,6 +1482,7 @@ bool RtApiCore :: callbackEvent( AudioDeviceID deviceId, |
|
|
|
status |= RTAUDIO_INPUT_OVERFLOW; |
|
|
|
handle->xrun[1] = false; |
|
|
|
} |
|
|
|
|
|
|
|
handle->drainCounter = callback( stream_.userBuffer[0], stream_.userBuffer[1], |
|
|
|
stream_.bufferSize, streamTime, status, info->userData ); |
|
|
|
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 |
|
|
|
// 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 |
|
|
|
if ( outBuffer == stream_.deviceBuffer && stream_.mode == DUPLEX && |
|
|
@@ -7581,7 +7592,7 @@ void RtApi :: convertBuffer( char *outBuffer, char *inBuffer, ConvertInfo &info |
|
|
|
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; |
|
|
|
for (unsigned int i=0; i<stream_.bufferSize; i++) { |
|
|
|
for (j=0; j<info.channels; j++) { |
|
|
|