patest_sync.c File Reference
Test time stamping and synchronization of audio and video.
More...
#include <stdio.h>
#include <math.h>
#include "portaudio.h"
#include "pa_util.h"
Detailed Description
Test time stamping and synchronization of audio and video.
A high latency is used so we can hear the difference in time. Random durations are used so we know we are hearing the right beep and not the one before or after.
Sequence of events:
- Foreground requests a beep.
- Background randomly schedules a beep.
- Foreground waits for the beep to be heard based on PaUtil_GetTime().
- Foreground outputs video (printf) in sync with audio.
- Repeat.
- Author:
- Phil Burk http://www.softsynth.com
Define Documentation
#define BEEP_DURATION (400) |
#define FRAMES_PER_BUFFER (256) |
#define LATENCY_MSEC (2000) |
#define SAMPLE_PERIOD (1.0/44100.0) |
#define SAMPLE_RATE (44100) |
#define STATE_BKG_BEEPING (2) |
#define STATE_BKG_IDLE (0) |
#define STATE_BKG_PENDING (1) |
#define TIMEOUT_MSEC (15000) |
Function Documentation
References paTestData::beepTime, PaStreamParameters::channelCount, PaStreamParameters::device, FRAMES_PER_BUFFER, PaStreamParameters::hostApiSpecificStreamInfo, paTestData::latency, LATENCY_MSEC, paTestData::left_phase, NUM_BEEPS, Pa_CloseStream(), Pa_GetDefaultOutputDevice(), Pa_GetErrorText(), Pa_GetStreamTime(), Pa_Initialize(), Pa_OpenStream(), Pa_Sleep(), Pa_StartStream(), Pa_StopStream(), Pa_Terminate(), paClipOff, paFloat32, paNoError, PaUtil_GetTime(), paTestData::requestBeep, paTestData::right_phase, SAMPLE_RATE, PaStreamParameters::sampleFormat, SLEEP_MSEC, paTestData::state, STATE_BKG_IDLE, PaStreamParameters::suggestedLatency, and TIMEOUT_MSEC.