Commit e04a0760 authored by Miller Puckette's avatar Miller Puckette
Browse files

msw fix

parent ee23ddc6
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "s_stuff.h" #include "s_stuff.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h>
#include <portaudio.h> #include <portaudio.h>
#include "s_audio_pablio.h" #include "s_audio_pablio.h"
...@@ -30,11 +29,15 @@ static t_audiocallback pa_callback; ...@@ -30,11 +29,15 @@ static t_audiocallback pa_callback;
int pa_foo; int pa_foo;
#ifndef MSW
#include <unistd.h>
#endif
static void pa_init(void) static void pa_init(void)
{ {
static int initialized; static int initialized;
if (!initialized) if (!initialized)
{ {
#ifndef MSW
/* Initialize PortAudio */ /* Initialize PortAudio */
/* for some reason Pa_Initialize(0 closes file descriptor 1. /* for some reason Pa_Initialize(0 closes file descriptor 1.
As a workaround, dup it to another number and dup2 it back As a workaround, dup it to another number and dup2 it back
...@@ -46,6 +49,9 @@ static void pa_init(void) ...@@ -46,6 +49,9 @@ static void pa_init(void)
dup2(newfd, 1); dup2(newfd, 1);
close(newfd); close(newfd);
} }
#else
int err = Pa_Initialize();
#endif
if ( err != paNoError ) if ( err != paNoError )
{ {
fprintf( stderr, fprintf( stderr,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment