Fix for ALSA runnable flag update mistake; moved streamname declaration in PULSE...
authorGary Scavone <gary@music.mcgill.ca>
Mon, 31 Mar 2014 20:46:04 +0000 (16:46 -0400)
committerGary Scavone <gary@music.mcgill.ca>
Mon, 31 Mar 2014 20:46:04 +0000 (16:46 -0400)
RtAudio.cpp
configure.ac

index efed868e185b26d8db4eb279102e5a5d4ec7e5c0..7d60e7716aab8c5df2ec30c937d40384bdd99c0e 100644 (file)
@@ -180,14 +180,15 @@ RtAudio :: RtAudio( RtAudio::Api api ) throw()
   // It should not be possible to get here because the preprocessor\r
   // definition __RTAUDIO_DUMMY__ is automatically defined if no\r
   // API-specific definitions are passed to the compiler. But just in\r
-  // case something weird happens, we'll print out an error message.\r
+  // case something weird happens, we'll thow an error.\r
   std::string errorText = "\nRtAudio: no compiled API support found ... critical error!!\n\n";\r
   throw( RtAudioError( errorText, RtAudioError::UNSPECIFIED ) );\r
 }\r
 \r
 RtAudio :: ~RtAudio() throw()\r
 {\r
-  delete rtapi_;\r
+  if ( rtapi_ )\r
+    delete rtapi_;\r
 }\r
 \r
 void RtAudio :: openStream( RtAudio::StreamParameters *outputParameters,\r
@@ -6143,7 +6144,6 @@ void RtApiAlsa :: startStream()
   stream_.state = STREAM_RUNNING;\r
 \r
  unlock:\r
-  apiInfo->runnable = false; // fixes high CPU usage when stopped\r
   pthread_cond_signal( &apiInfo->runnable_cv );\r
   MUTEX_UNLOCK( &stream_.mutex );\r
 \r
@@ -6229,6 +6229,7 @@ void RtApiAlsa :: abortStream()
   }\r
 \r
  unlock:\r
+  apiInfo->runnable = false; // fixes high CPU usage when stopped\r
   MUTEX_UNLOCK( &stream_.mutex );\r
 \r
   if ( result >= 0 ) return;\r
@@ -6804,6 +6805,7 @@ bool RtApiPulse::probeDeviceOpen( unsigned int device, StreamMode mode,
   stream_.nUserChannels[mode] = channels;\r
   stream_.nDeviceChannels[mode] = channels + firstChannel;\r
   stream_.channelOffset[mode] = 0;\r
+  std::string streamName = "RtAudio";\r
 \r
   // Allocate necessary internal buffers.\r
   bufferBytes = stream_.nUserChannels[mode] * *bufferSize * formatBytes( stream_.userFormat );\r
@@ -6857,7 +6859,6 @@ bool RtApiPulse::probeDeviceOpen( unsigned int device, StreamMode mode,
   pah = static_cast<PulseAudioHandle *>( stream_.apiHandle );\r
 \r
   int error;\r
-  std::string streamName = "RtAudio";\r
   if ( !options->streamName.empty() ) streamName = options->streamName;\r
   switch ( mode ) {\r
   case INPUT:\r
index df34d03dd996ed81c202a9d591d361e011e8142c..6d6474d24979c9f558ebd9d488c9537f530e7eec 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 && test x$prefix != xNONE; then
+if test "x$prefix" != "x" && test "x$prefix" != "xNONE"; then
   LIBS="$LIBS -L$prefix/lib"
   CPPFLAGS="$CPPFLAGS -I$prefix/include"
 fi
@@ -59,7 +59,7 @@ CXXFLAGS="$cxxflag"
 
 # Check compiler and use -Wall if gnu.
 if [test $GXX = "yes" ;] then
-  AC_SUBST( cxxflag, [-Wall] )
+  AC_SUBST( cxxflag, ["-Wall -Wextra"] )
 fi
 
 CXXFLAGS="$CXXFLAGS $cxxflag"