[Audacity-cvs] lib-src/portaudio-v19/test patest_sine_channelmaps.c, NONE, 1.1 debug_convert.c, 1.2, 1.3 debug_dither_calc.c, 1.2, 1.3 debug_dual.c, 1.2, 1.3 debug_multi_in.c, 1.2, 1.3 debug_multi_out.c, 1.2, 1.3 debug_record.c, 1.2, 1.3 debug_record_reuse.c, 1.2, 1.3 debug_sine.c, 1.2, 1.3 debug_sine_amp.c, 1.2, 1.3 debug_sine_formats.c, 1.2, 1.3 debug_srate.c, 1.2, 1.3 debug_test1.c, 1.2, 1.3 pa_devs.c, 1.2, 1.3 pa_fuzz.c, 1.2, 1.3 pa_minlat.c, 1.2, 1.3 paqa_devs.c, 1.2, 1.3 paqa_errs.c, 1.2, 1.3 patest1.c, 1.2, 1.3 patest_buffer.c, 1.2, 1.3 patest_callbackstop.c, 1.2, 1.3 patest_clip.c, 1.2, 1.3 patest_dither.c, 1.2, 1.3 patest_hang.c, 1.2, 1.3 patest_in_overflow.c, 1.2, 1.3 patest_latency.c, 1.2, 1.3 patest_leftright.c, 1.2, 1.3 patest_longsine.c, 1.2, 1.3 patest_many.c, 1.2, 1.3 patest_maxsines.c, 1.2, 1.3 patest_mono.c, 1.2, 1.3 patest_mono_asio_channel_select.c, 1.2, 1.3 patest_multi_sine.c, 1.2, 1.3 patest_out_underflow.c, 1.2, 1.3 patest_pink.c, 1.2, 1.3 patest_prime.c, 1.2, 1.3 patest_read_record.c, 1.2, 1.3 patest_read_write_wire.c, 1.2, 1.3 patest_record.c, 1.2, 1.3 patest_ringmix.c, 1.2, 1.3 patest_saw.c, 1.2, 1.3 patest_sine.c, 1.2, 1.3 patest_sine8.c, 1.2, 1.3 patest_sine_formats.c, 1.2, 1.3 patest_sine_time.c, 1.2, 1.3 patest_start_stop.c, 1.2, 1.3 patest_stop.c, 1.2, 1.3 patest_stop_playout.c, 1.2, 1.3 patest_sync.c, 1.2, 1.3 patest_timing.c, 1.1, 1.2 patest_toomanysines.c, 1.2, 1.3 patest_two_rates.c, 1.2, 1.3 patest_underflow.c, 1.2, 1.3 patest_wire.c, 1.2, 1.3 patest_write_sine.c, 1.2, 1.3 patest_write_stop.c, 1.2, 1.3

Sun, 03 Jun 2007 01:31:30 -0700

Update of /cvsroot/audacity/lib-src/portaudio-v19/test
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv27584/portaudio-v19/test

Modified Files:
        debug_convert.c debug_dither_calc.c debug_dual.c 
        debug_multi_in.c debug_multi_out.c debug_record.c 
        debug_record_reuse.c debug_sine.c debug_sine_amp.c 
        debug_sine_formats.c debug_srate.c debug_test1.c pa_devs.c 
        pa_fuzz.c pa_minlat.c paqa_devs.c paqa_errs.c patest1.c 
        patest_buffer.c patest_callbackstop.c patest_clip.c 
        patest_dither.c patest_hang.c patest_in_overflow.c 
        patest_latency.c patest_leftright.c patest_longsine.c 
        patest_many.c patest_maxsines.c patest_mono.c 
        patest_mono_asio_channel_select.c patest_multi_sine.c 
        patest_out_underflow.c patest_pink.c patest_prime.c 
        patest_read_record.c patest_read_write_wire.c patest_record.c 
        patest_ringmix.c patest_saw.c patest_sine.c patest_sine8.c 
        patest_sine_formats.c patest_sine_time.c patest_start_stop.c 
        patest_stop.c patest_stop_playout.c patest_sync.c 
        patest_timing.c patest_toomanysines.c patest_two_rates.c 
        patest_underflow.c patest_wire.c patest_write_sine.c 
        patest_write_stop.c 
Added Files:
        patest_sine_channelmaps.c 
Log Message:

Update portaudio to 2007-jun-01 snapshot






























Index: patest_callbackstop.c
===================================================================
RCS file: /cvsroot/audacity/lib-src/portaudio-v19/test/patest_callbackstop.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- patest_callbackstop.c       23 Sep 2006 18:42:51 -0000      1.2
+++ patest_callbackstop.c       3 Jun 2007 08:30:34 -0000       1.3
@@ -211,6 +211,9 @@
 
         err = Pa_StopStream( stream );
         if( err != paNoError ) goto error;
+
+        printf( "sleeping for 1 second...\n" );
+        Pa_Sleep( 1000 );
     }
 
     err = Pa_CloseStream( stream );






Index: patest_sine8.c
===================================================================
RCS file: /cvsroot/audacity/lib-src/portaudio-v19/test/patest_sine8.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- patest_sine8.c      23 Sep 2006 18:42:52 -0000      1.2
+++ patest_sine8.c      3 Jun 2007 08:30:35 -0000       1.3
@@ -184,7 +184,8 @@
     while( (Pa_GetStreamTime( stream ) - streamOpened) < (PaTime)NUM_SECONDS / 
2.0 )
         Pa_Sleep(10);
 
-    /* Stop sound until ENTER hit. (Hu? don't see any keyboard-input here.) */
+    /* Stop sound. */
+    printf("Stopping Stream.\n");
     err = Pa_StopStream( stream );
     if( err != paNoError )
         goto error;
@@ -192,6 +193,7 @@
     printf("Pause for 2 seconds.\n");
     Pa_Sleep( 2000 );
 
+    printf("Starting again.\n");
     err = Pa_StartStream( stream );
     if( err != paNoError )
         goto error;




















--- NEW FILE: patest_sine_channelmaps.c ---
/** @file patest_sine.c
        @ingroup test_src
        @brief Plays sine waves using sme simple channel maps.
          Designed for use with COreAudio, but should made to work with other 
APIs
        @author Bjorn Roche <[EMAIL PROTECTED]>
   @author Ross Bencina <[EMAIL PROTECTED]>
   @author Phil Burk <[EMAIL PROTECTED]>
*/
/*
 * $Id: patest_sine_channelmaps.c,v 1.1 2007/06/03 08:30:35 llucius Exp $
 *
 * This program uses the PortAudio Portable Audio Library.
 * For more information see: http://www.portaudio.com/
 * Copyright (c) 1999-2000 Ross Bencina and Phil Burk
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files
 * (the "Software"), to deal in the Software without restriction,
 * including without limitation the rights to use, copy, modify, merge,
 * publish, distribute, sublicense, and/or sell copies of the Software,
 * and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

/*
 * The text above constitutes the entire PortAudio license; however, 
 * the PortAudio community also makes the following non-binding requests:
 *
 * Any person wishing to distribute modifications to the Software is
 * requested to send the modifications to the original developer so that
 * they can be incorporated into the canonical version. It is also 
 * requested that these non-binding requests be included along with the 
 * license above.
 */
#include <stdio.h>
#include <math.h>
#include "portaudio.h"

#ifdef __APPLE__
#include "pa_mac_core.h"
#endif

#define NUM_SECONDS   (5)
#define SAMPLE_RATE   (44100)
#define FRAMES_PER_BUFFER  (64)

#ifndef M_PI
#define M_PI  (3.14159265)
#endif

#define TABLE_SIZE   (200)
typedef struct
{
    float sine[TABLE_SIZE];
    int left_phase;
    int right_phase;
}
paTestData;

/* This routine will be called by the PortAudio engine when audio is needed.
** It may called at interrupt level on some machines so don't do anything
** that could mess up the system like calling malloc() or free().
*/
static int patestCallback( const void *inputBuffer, void *outputBuffer,
                            unsigned long framesPerBuffer,
                            const PaStreamCallbackTimeInfo* timeInfo,
                            PaStreamCallbackFlags statusFlags,
                            void *userData )
{
    paTestData *data = (paTestData*)userData;
    float *out = (float*)outputBuffer;
    unsigned long i;

    (void) timeInfo; /* Prevent unused variable warnings. */
    (void) statusFlags;
    (void) inputBuffer;
    
    for( i=0; i<framesPerBuffer; i++ )
    {
        *out++ = data->sine[data->left_phase];  /* left */
        *out++ = data->sine[data->right_phase];  /* right */
        data->left_phase += 1;
        if( data->left_phase >= TABLE_SIZE ) data->left_phase -= TABLE_SIZE;
        data->right_phase += 3; /* higher pitch so we can distinguish left and 
right. */
        if( data->right_phase >= TABLE_SIZE ) data->right_phase -= TABLE_SIZE;
    }
    
    return paContinue;
}

/*******************************************************************/
int main(void);
int main(void)
{
    PaStreamParameters outputParameters;
    PaStream *stream;
    PaError err;
    paTestData data;
#ifdef __APPLE__
    PaMacCoreStreamInfo macInfo;
    const long channelMap[4] = { -1, -1, 0, 1 };
#endif
    int i;

    
    printf("PortAudio Test: output sine wave. SR = %d, BufSize = %d\n", 
SAMPLE_RATE, FRAMES_PER_BUFFER);
    printf("Output will be mapped to channels 2 and 3 instead of 0 and 1.\n");
    
    /* initialise sinusoidal wavetable */
    for( i=0; i<TABLE_SIZE; i++ )
    {
        data.sine[i] = (float) sin( ((double)i/(double)TABLE_SIZE) * M_PI * 2. 
);
    }
    data.left_phase = data.right_phase = 0;
    
    err = Pa_Initialize();
    if( err != paNoError ) goto error;

    /** setup host specific info */
#ifdef __APPLE__
    PaMacCore_SetupStreamInfo( &macInfo, paMacCorePlayNice );
    PaMacCore_SetupChannelMap( &macInfo, channelMap, 4 );

    for( i=0; i<4; ++i )
       printf( "channel %d name: %s\n", i, PaMacCore_GetChannelName( 
Pa_GetDefaultOutputDevice(), i, false ) );
#else
    printf( "Channel mapping not supported on this platform. Reverting to 
normal sine test.\n" );
#endif

    outputParameters.device = Pa_GetDefaultOutputDevice(); /* default output 
device */
    outputParameters.channelCount = 2;       /* stereo output */
    outputParameters.sampleFormat = paFloat32; /* 32 bit floating point output 
*/
    outputParameters.suggestedLatency = Pa_GetDeviceInfo( 
outputParameters.device )->defaultLowOutputLatency;
#ifdef __APPLE__
    outputParameters.hostApiSpecificStreamInfo = &macInfo;
#else
    outputParameters.hostApiSpecificStreamInfo = NULL;
#endif

    err = Pa_OpenStream(
              &stream,
              NULL, /* no input */
              &outputParameters,
              SAMPLE_RATE,
              FRAMES_PER_BUFFER,
              paClipOff,      /* we won't output out of range samples so don't 
bother clipping them */
              patestCallback,
              &data );
    if( err != paNoError ) goto error;

    err = Pa_StartStream( stream );
    if( err != paNoError ) goto error;

    printf("Play for %d seconds.\n", NUM_SECONDS );
    Pa_Sleep( NUM_SECONDS * 1000 );

    err = Pa_StopStream( stream );
    if( err != paNoError ) goto error;

    err = Pa_CloseStream( stream );
    if( err != paNoError ) goto error;

    Pa_Terminate();
    printf("Test finished.\n");
    
    return err;
error:
    Pa_Terminate();
    fprintf( stderr, "An error occured while using the portaudio stream\n" );
    fprintf( stderr, "Error number: %d\n", err );
    fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
    return err;
}



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to