diff options
Diffstat (limited to 'src/sound.c')
-rw-r--r-- | src/sound.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/sound.c b/src/sound.c index d4b0242..570ec71 100644 --- a/src/sound.c +++ b/src/sound.c @@ -57,7 +57,12 @@ void init_sound(synth_t * synth, PaStreamCallback *streamCallback, const char* device_name) { printf("Will try to initialized pulseaudion device [ %s ]\n", device_name); - Pa_Initialize(); + freopen("/dev/null","w",stderr); + PaError err = Pa_Initialize(); + freopen("/dev/tty", "w", stderr); + if (err != paNoError) { + fprintf(stderr, "PortAudio error: %s\n", Pa_GetErrorText(err)); + } int i=0; const PaDeviceInfo *deviceInfo; @@ -77,7 +82,7 @@ init_sound(synth_t * synth, PaStreamCallback *streamCallback, const char* device PaStreamParameters outputParameters; outputParameters.device = i;// Pa_GetDefaultOutputDevice(); /* default output device */ - printf("-------\nSelected device: dev: %s || %f || id:%d out:%d || lil:%f lol:%f\n-------\n", deviceInfo->name, + printf("Selected device: dev: %s || %f || id:%d out:%d || lil:%f lol:%f\n", deviceInfo->name, deviceInfo->defaultSampleRate, deviceInfo->maxInputChannels, deviceInfo->maxOutputChannels, deviceInfo->defaultLowInputLatency, deviceInfo->defaultLowOutputLatency); @@ -86,7 +91,6 @@ init_sound(synth_t * synth, PaStreamCallback *streamCallback, const char* device outputParameters.suggestedLatency = deviceInfo->defaultLowOutputLatency; outputParameters.hostApiSpecificStreamInfo = NULL; - PaError err; err = Pa_OpenStream(&(synth->stream), NULL, /* no input */ &outputParameters, @@ -110,16 +114,17 @@ init_sound(synth_t * synth, PaStreamCallback *streamCallback, const char* device Pa_SetStreamFinishedCallback(synth->stream, &StreamFinished); Pa_StartStream(synth->stream); - printf("<3 <3 <3 <3 Portaudio stream started <3 <3 <3 <3\n"); synth->sound_active = 1; } void destroy_sound(synth_t * synth) { - printf(":( :( :( stopping stream </3 </3 </3\n"); synth->sound_active = 0; Pa_StopStream( synth->stream ); Pa_CloseStream( synth->stream ); - Pa_Terminate(); + PaError err = Pa_Terminate(); + if( err != paNoError ) + fprintf(stderr, "PortAudio error: %s\n", Pa_GetErrorText( err ) ); + } |