]> Repos - portaudio/commitdiff
Added patest_write_sine_nonint to Makefile.
authorphilburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57>
Mon, 28 Feb 2011 23:56:48 +0000 (23:56 +0000)
committerphilburk <philburk@0f58301d-fd10-0410-b4af-bbb618454e57>
Mon, 28 Feb 2011 23:56:48 +0000 (23:56 +0000)
Check for paNonInterleaved on Mac and return paSampleFormatNotSupported.
Fix pa_minlat.c. Linux was complaining about not checking fgets return value.

Makefile.in
qa/loopback/src/paqa.c
src/hostapi/coreaudio/pa_mac_core.c
src/hostapi/coreaudio/pa_mac_core_blocking.c
test/pa_minlat.c

index 87e6c7c65056ade1839e3aa6e4dfcf434603d47b..c613ca1879f66d5fef9b6f4dd57fe7551abfd926 100644 (file)
@@ -95,6 +95,7 @@ TESTS = \
        bin/patest_underflow \
        bin/patest_wire \
        bin/patest_write_sine \
+       bin/patest_write_sine_nonint \
        bin/pa_devs \
        bin/pa_fuzz \
        bin/pa_minlat
index c5d9ecaf0d6cbaf4bb013db3cdbb4a78f0689d25..5ad9368d603efc4d9649461e5c569ddff84c7997 100644 (file)
@@ -292,7 +292,7 @@ static int RecordAndPlayBlockingIO( PaStream *inStream,
        long framesPerBuffer = test->framesPerBuffer;
        if( framesPerBuffer <= 0 )
        {
-               framesPerBuffer = 64; // bigger values might run past end of recording
+               framesPerBuffer = maxPerBuffer; // bigger values might run past end of recording
        }
        
        // Read in audio.
@@ -553,7 +553,7 @@ static void PaQa_TeardownLoopbackContext( LoopbackContext *loopbackContextPtr )
 /*******************************************************************/
 static void PaQa_PrintShortErrorReport( PaQaAnalysisResult *analysisResultPtr, int channel )
 {
-       printf("#%d ", channel);
+       printf("channel %d ", channel);
        if( analysisResultPtr->popPosition > 0 )
        {
                printf("POP %0.3f at %d, ", (double)analysisResultPtr->popAmplitude, (int)analysisResultPtr->popPosition );     
@@ -1008,7 +1008,7 @@ int main( int argc, char **argv )
                }
        }
                
-       result = PaQa_TestAnalyzer();
+       //result = PaQa_TestAnalyzer();
        
        if( (result == 0) && (justMath == 0) )
        {
index 7862d0e6525c78e59c299d90b2b954a8c9b71b6d..d1decc95d91268e751c6b6972efb8781756d763e 100644 (file)
@@ -1340,13 +1340,19 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
                 (float) sampleRate,
                 framesPerBuffer ));
     VDBUG( ("Opening Stream.\n") );
-
+       
     /*These first few bits of code are from paSkeleton with few modifications.*/
     if( inputParameters )
     {
         inputChannelCount = inputParameters->channelCount;
         inputSampleFormat = inputParameters->sampleFormat;
 
+               /* @todo Blocking read/write on Mac is not yet supported. */
+               if( inputSampleFormat & paNonInterleaved )
+               {
+                       return paSampleFormatNotSupported;
+               }
+               
         /* unless alternate device specification is supported, reject the use of
             paUseHostApiSpecificDeviceSpecification */
 
@@ -1371,6 +1377,12 @@ static PaError OpenStream( struct PaUtilHostApiRepresentation *hostApi,
         outputChannelCount = outputParameters->channelCount;
         outputSampleFormat = outputParameters->sampleFormat;
         
+               /* @todo Blocking read/write on Mac is not yet supported. */
+               if( outputSampleFormat & paNonInterleaved )
+               {
+                       return paSampleFormatNotSupported;
+               }
+               
         /* unless alternate device specification is supported, reject the use of
             paUseHostApiSpecificDeviceSpecification */
 
index 6d31a713dba7bab4968421c1d71f0b97ccb15565..5a98826b62b98fc68548540ba6b9d551917b81ac 100644 (file)
 #endif\r
 \r
 /*\r
- * This fnuction determines the size of a particular sample format.\r
+ * This function determines the size of a particular sample format.\r
  * if the format is not recognized, this returns zero.\r
  */\r
 static size_t computeSampleSizeFromFormat( PaSampleFormat format )\r
 {\r
-   switch( format ) {\r
+   switch( format & (~paNonInterleaved) ) {\r
    case paFloat32: return 4;\r
    case paInt32: return 4;\r
    case paInt24: return 3;\r
@@ -91,7 +91,7 @@ static size_t computeSampleSizeFromFormat( PaSampleFormat format )
  */\r
 static size_t computeSampleSizeFromFormatPow2( PaSampleFormat format )\r
 {\r
-   switch( format ) {\r
+   switch( format & (~paNonInterleaved) ) {\r
    case paFloat32: return 4;\r
    case paInt32: return 4;\r
    case paInt24: return 4;\r
index c9dad0b800a0e69376b01f997231e8e8a57c5565..0106cf3be160866328c3e099180046df60865266 100644 (file)
@@ -107,6 +107,7 @@ int main( int argc, char **argv )
     int    framesPerBuffer;
     double sampleRate = 44100.0;
     char   str[256];
+       char  *line;
 
     printf("pa_minlat - Determine minimum latency for your computer.\n");
     printf("  usage:         pa_minlat {userBufferSize}\n");
@@ -157,24 +158,34 @@ int main( int argc, char **argv )
         /* Ask user for a new nlatency. */
         printf("\nMove windows around to see if the sound glitches.\n");
         printf("Latency now %d, enter new number of frames, or 'q' to quit: ", outLatency );
-        fgets( str, 256, stdin );
-        {
-            /* Get rid of newline */
-            size_t l = strlen( str ) - 1;
-            if( str[ l ] == '\n')
-                str[ l ] = '\0';
-        }
-        if( str[0] == 'q' ) go = 0;
-        else
-        {
-            outLatency = atol( str );
-            if( outLatency < minLatency )
-            {
-                printf( "Latency below minimum of %d! Set to minimum!!!\n", minLatency );
-                outLatency = minLatency;
-            }
-        }
-        /* Stop sound until ENTER hit. */
+        line = fgets( str, 256, stdin );
+               if( line == NULL )
+               {
+                       go = 0;
+               }
+               else
+               {
+                       {
+                               /* Get rid of newline */
+                               size_t l = strlen( str ) - 1;
+                               if( str[ l ] == '\n')
+                                       str[ l ] = '\0';
+                       }
+                       
+                       
+                       if( str[0] == 'q' ) go = 0;
+                       else
+                       {
+                               outLatency = atol( str );
+                               if( outLatency < minLatency )
+                               {
+                                       printf( "Latency below minimum of %d! Set to minimum!!!\n", minLatency );
+                                       outLatency = minLatency;
+                               }
+                       }
+                       
+               }
+               /* Stop sound until ENTER hit. */
         err = Pa_StopStream( stream );
         if( err != paNoError ) goto error;
         err = Pa_CloseStream( stream );