PortAudio
2.0
|
Test different ways of stopping audio. More...
Data Structures | |
struct | paTestData |
Macros | |
#define | OUTPUT_DEVICE (Pa_GetDefaultOutputDevice()) |
#define | SLEEP_DUR (200) |
#define | SAMPLE_RATE (44100) |
#define | FRAMES_PER_BUFFER (256) |
#define | LATENCY_SECONDS (3.f) |
#define | FRAMES_PER_NOTE (SAMPLE_RATE/2) |
#define | MAX_REPEATS (2) |
#define | FUNDAMENTAL (400.0f / SAMPLE_RATE) |
#define | NOTE_0 (FUNDAMENTAL * 1.0f / 1.0f) |
#define | NOTE_1 (FUNDAMENTAL * 5.0f / 4.0f) |
#define | NOTE_2 (FUNDAMENTAL * 4.0f / 3.0f) |
#define | NOTE_3 (FUNDAMENTAL * 3.0f / 2.0f) |
#define | NOTE_4 (FUNDAMENTAL * 2.0f / 1.0f) |
#define | MODE_FINISH (0) |
#define | MODE_STOP (1) |
#define | MODE_ABORT (2) |
#define | M_PI (3.14159265) |
#define | TABLE_SIZE (400) |
Functions | |
int | TestStopMode (paTestData *data) |
float | LookupWaveform (paTestData *data, float phase) |
int | main (void) |
Test different ways of stopping audio.
Test the three ways of stopping audio:
A long latency is set up so that you can hear the difference. Then a simple 8 note sequence is repeated twice. The program will print what you should hear.
#define FRAMES_PER_BUFFER (256) |
Referenced by TestStopMode().
#define FRAMES_PER_NOTE (SAMPLE_RATE/2) |
#define FUNDAMENTAL (400.0f / SAMPLE_RATE) |
#define LATENCY_SECONDS (3.f) |
Referenced by TestStopMode().
#define M_PI (3.14159265) |
#define MAX_REPEATS (2) |
Referenced by TestStopMode().
#define MODE_ABORT (2) |
Referenced by TestStopMode().
#define MODE_FINISH (0) |
Referenced by TestStopMode().
#define MODE_STOP (1) |
#define NOTE_0 (FUNDAMENTAL * 1.0f / 1.0f) |
#define NOTE_1 (FUNDAMENTAL * 5.0f / 4.0f) |
#define NOTE_2 (FUNDAMENTAL * 4.0f / 3.0f) |
#define NOTE_3 (FUNDAMENTAL * 3.0f / 2.0f) |
#define NOTE_4 (FUNDAMENTAL * 2.0f / 1.0f) |
#define OUTPUT_DEVICE (Pa_GetDefaultOutputDevice()) |
Referenced by TestStopMode().
#define SAMPLE_RATE (44100) |
Referenced by TestStopMode().
#define SLEEP_DUR (200) |
Referenced by TestStopMode().
#define TABLE_SIZE (400) |
Referenced by LookupWaveform().
float LookupWaveform | ( | paTestData * | data, |
float | phase | ||
) |
References TABLE_SIZE, and paTestData::waveform.
int main | ( | void | ) |
int TestStopMode | ( | paTestData * | data | ) |
References PaStreamParameters::channelCount, PaStreamParameters::device, paTestData::done, paTestData::frameCounter, FRAMES_PER_BUFFER, PaStreamParameters::hostApiSpecificStreamInfo, LATENCY_SECONDS, MAX_REPEATS, MODE_ABORT, MODE_FINISH, paTestData::noteCounter, OUTPUT_DEVICE, Pa_AbortStream(), Pa_CloseStream(), Pa_GetErrorText(), Pa_Initialize(), Pa_IsStreamActive(), Pa_OpenStream(), Pa_Sleep(), Pa_StartStream(), Pa_StopStream(), Pa_Terminate(), paClipOff, paFloat32, paNoDevice, paNoError, paTestData::phase, paTestData::phase_increment, paTestData::repeatCounter, SAMPLE_RATE, PaStreamParameters::sampleFormat, SLEEP_DUR, paTestData::stopMode, PaStreamParameters::suggestedLatency, and paTestData::tune.