PortAudio 2.0
|
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <memory.h>
#include <pthread.h>
#include "portaudio.h"
Macros | |
#define | SAMPLE_RATE (44100) |
#define | FRAMES_PER_BUFFER (2048) |
Functions | |
void * | stop_thread_proc (void *arg) |
int | main (void) |
#define FRAMES_PER_BUFFER (2048) |
Referenced by main().
#define SAMPLE_RATE (44100) |
Referenced by main().
int main | ( | void | ) |
References PaStreamParameters::channelCount, PaDeviceInfo::defaultHighOutputLatency, PaStreamParameters::device, FRAMES_PER_BUFFER, PaStreamParameters::hostApiSpecificStreamInfo, Pa_CloseStream(), Pa_GetDefaultOutputDevice(), Pa_GetDeviceInfo(), Pa_GetErrorText(), Pa_Initialize(), Pa_IsStreamActive(), Pa_OpenStream(), Pa_StartStream(), Pa_Terminate(), Pa_WriteStream(), paClipOff, paFloat32, paNoError, SAMPLE_RATE, PaStreamParameters::sampleFormat, stop_thread_proc(), and PaStreamParameters::suggestedLatency.
void * stop_thread_proc | ( | void * | arg | ) |
WARNING: PortAudio is NOT thread safe. DO NOT call PortAudio from multiple threads without synchronization. This test uses PA in an ILLEGAL WAY in order to try to flush out potential hang bugs. The test calls Pa_WriteStream() and Pa_StopStream() simultaneously from separate threads in order to try to cause Pa_StopStream() to hang. In the main thread we write to the stream in a loop. Then try stopping PA from another thread to see if it hangs.
References Pa_GetStreamTime(), and Pa_StopStream().
Referenced by main().