Changes to fix display issue for non-ASCII device names and some compile warnings...
authorGary Scavone <gary@music.mcgill.ca>
Sat, 18 Jan 2014 21:35:12 +0000 (16:35 -0500)
committerGary Scavone <gary@music.mcgill.ca>
Sat, 18 Jan 2014 21:35:12 +0000 (16:35 -0500)
RtAudio.cpp
configure.ac
tests/playsaw.cpp

index 0a7d9ebda0537975a6c247acde50b46ae201d797..e5d12d17c96026b60dd986c2a64dae38568cbf76 100644 (file)
@@ -602,7 +602,11 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device )
   //const char *mname = CFStringGetCStringPtr( cfname, CFStringGetSystemEncoding() );\r
   int length = CFStringGetLength(cfname);\r
   char *mname = (char *)malloc(length * 3 + 1);\r
+#if defined( UNICODE ) || defined( _UNICODE )\r
+  CFStringGetCString(cfname, mname, length * 3 + 1, kCFStringEncodingUTF8);\r
+#else\r
   CFStringGetCString(cfname, mname, length * 3 + 1, CFStringGetSystemEncoding());\r
+#endif\r
   info.name.append( (const char *)mname, strlen(mname) );\r
   info.name.append( ": " );\r
   CFRelease( cfname );\r
@@ -620,7 +624,11 @@ RtAudio::DeviceInfo RtApiCore :: getDeviceInfo( unsigned int device )
   //const char *name = CFStringGetCStringPtr( cfname, CFStringGetSystemEncoding() );\r
   length = CFStringGetLength(cfname);\r
   char *name = (char *)malloc(length * 3 + 1);\r
+#if defined( UNICODE ) || defined( _UNICODE )\r
+  CFStringGetCString(cfname, name, length * 3 + 1, kCFStringEncodingUTF8);\r
+#else\r
   CFStringGetCString(cfname, name, length * 3 + 1, CFStringGetSystemEncoding());\r
+#endif\r
   info.name.append( (const char *)name, strlen(name) );\r
   CFRelease( cfname );\r
   free(name);\r
@@ -2775,7 +2783,7 @@ RtAudio::DeviceInfo RtApiAsio :: getDeviceInfo( unsigned int device )
   return info;\r
 }\r
 \r
-static void bufferSwitch( long index, ASIOBool processNow )\r
+static void bufferSwitch( long index, ASIOBool /*processNow*/ )\r
 {\r
   RtApiAsio *object = (RtApiAsio *) asioCallbackInfo->object;\r
   object->callbackEvent( index );\r
@@ -3458,7 +3466,7 @@ static void sampleRateChanged( ASIOSampleRate sRate )
   std::cerr << "\nRtApiAsio: driver reports sample rate changed to " << sRate << " ... stream stopped!!!\n" << std::endl;\r
 }\r
 \r
-static long asioMessages( long selector, long value, void* message, double* opt )\r
+static long asioMessages( long selector, long value, void* /*message*/, double* /*opt*/ )\r
 {\r
   long ret = 0;\r
 \r
@@ -3697,7 +3705,7 @@ unsigned int RtApiDs :: getDeviceCount( void )
   for ( unsigned int i=0; i<indices.size(); i++ )\r
     dsDevices.erase( dsDevices.begin()-nErased++ );\r
 \r
-  return dsDevices.size();\r
+  return static_cast<unsigned int>(dsDevices.size());\r
 }\r
 \r
 RtAudio::DeviceInfo RtApiDs :: getDeviceInfo( unsigned int device )\r
@@ -3885,7 +3893,7 @@ bool RtApiDs :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigned
     return FAILURE;\r
   }\r
 \r
-  unsigned int nDevices = dsDevices.size();\r
+  size_t nDevices = dsDevices.size();\r
   if ( nDevices == 0 ) {\r
     // This should not happen because a check is made before this function is called.\r
     errorText_ = "RtApiDs::probeDeviceOpen: no devices found!";\r
@@ -5027,7 +5035,7 @@ static std::string convertTChar( LPCTSTR name )
 \r
 static BOOL CALLBACK deviceQueryCallback( LPGUID lpguid,\r
                                           LPCTSTR description,\r
-                                          LPCTSTR module,\r
+                                          LPCTSTR /*module*/,\r
                                           LPVOID lpContext )\r
 {\r
   struct DsProbeData& probeInfo = *(struct DsProbeData*) lpContext;\r
index b89fdb0086ecebb5cdc5a9fcbab972ab96b1f077..df34d03dd996ed81c202a9d591d361e011e8142c 100644 (file)
@@ -45,7 +45,7 @@ AC_ARG_ENABLE(debug,
 AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
 
 # Set paths if prefix is defined
-if test x"$prefix" != x; then
+if test x"$prefix" != x && test x$prefix != xNONE; then
   LIBS="$LIBS -L$prefix/lib"
   CPPFLAGS="$CPPFLAGS -I$prefix/include"
 fi
index a590ca18ddf59f655efe8a8434fc0cce9d77e332..cd5f1e102b11ca2e8beaf68e5176904a9ac7de67 100644 (file)
@@ -64,6 +64,17 @@ void usage( void ) {
   exit( 0 );
 }
 
+void errorCallback( RtAudioError::Type type, const std::string &errorText )
+{
+  // This example error handling function does exactly the same thing
+  // as the embedded RtAudio::error() function.
+  std::cout << "in errorCallback" << std::endl;
+  if ( type == RtAudioError::WARNING )
+    std::cerr << '\n' << errorText << "\n\n";
+  else if ( type != RtAudioError::WARNING )
+    throw( RtAudioError( errorText, type ) );
+}
+
 unsigned int channels;
 RtAudio::StreamOptions options;
 unsigned int frameCounter = 0;
@@ -169,7 +180,7 @@ int main( int argc, char *argv[] )
   options.flags |= RTAUDIO_NONINTERLEAVED;
 #endif
   try {
-    dac.openStream( &oParams, NULL, FORMAT, fs, &bufferFrames, &saw, (void *)data, &options );
+    dac.openStream( &oParams, NULL, FORMAT, fs, &bufferFrames, &saw, (void *)data, &options, &errorCallback );
     dac.startStream();
   }
   catch ( RtAudioError& e ) {