summaryrefslogtreecommitdiffstats
path: root/src/sound.c
diff options
context:
space:
mode:
authorgrm <grm@eyesin.space>2025-03-02 14:42:46 +0200
committergrm <grm@eyesin.space>2025-03-02 14:42:46 +0200
commita043eb3931b58d9370565734211508af1f83fe94 (patch)
tree92df69f9d7511e83b88df5604558b669c5b2a899 /src/sound.c
parent092f4e2740a2e59a6b6c5aa064f59d9970790e23 (diff)
downloadsynth-project-a043eb3931b58d9370565734211508af1f83fe94.tar.gz
synth-project-a043eb3931b58d9370565734211508af1f83fe94.tar.bz2
synth-project-a043eb3931b58d9370565734211508af1f83fe94.zip
Add template and suppress verbose logging
Diffstat (limited to 'src/sound.c')
-rw-r--r--src/sound.c17
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 ) );
+
}