--- orig/xwave/src/audio.c Tue Nov 26 11:13:44 1996 +++ src/audio.c Fri Feb 20 23:46:06 1998 @@ -40,6 +40,9 @@ #elif defined(FreeBSD) #include +#elif defined(__NetBSD__) +#include + #elif defined(sgi) #include @@ -55,7 +58,7 @@ #include "sample_settings.h" #include "audio.h" -#if defined(linux) || defined (FreeBSD) || defined(sun) +#if defined(linux) || defined (FreeBSD) || defined(sun) || defined(__NetBSD__) static int set_dsp(int o_mode,int res,int channels,int freq,int *buf_size); #endif @@ -67,7 +70,7 @@ static Audio_File af; static int stop_record; -#if defined (linux) || defined (FreeBSD) +#if defined (linux) || defined (FreeBSD) || defined(__NetBSD__) int set_dsp(int o_mode,int res, int channels, int freq, int *buf_size) { int check; @@ -274,7 +277,7 @@ } #endif -#ifdef sun +#if defined(sun) void check_audio(Main_Bool *mb) /* test if there is a play device, and how fast we can play */ { @@ -307,7 +310,7 @@ case AUDIO_ENCODING_LINEAR: printf("ULAW\n");break; default: - printf("unknown encoding\n"); + printf("unknown encoding: %d\n",au_info.play.encoding); } close(audio); } else { @@ -370,7 +373,7 @@ void play_file(char *fname,Main_Bool *mb) { -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) int audio; #elif defined(sgi) ALport port; @@ -384,7 +387,7 @@ return; } -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) if ((audio=set_dsp(O_WRONLY,af.bps,af.channels,af.freq,&buf_size))==-1) { fprintf(stderr,"XWave: Error ! Cannot set dsp !\n"); close(af.fd); @@ -404,7 +407,7 @@ if ((buffer=malloc(buf_size))==NULL) { fprintf(stderr,"XWave: Error ! Cannot alloc mem !\n"); close(af.fd); -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) close(audio); #elif defined(sgi) ALcloseport(port); @@ -413,7 +416,7 @@ return; } -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) while ((length=af_read(af,buffer,buf_size))>0) { if (write(audio, buffer, length)==-1) break; } @@ -440,7 +443,7 @@ int offset=0,playlength,length; #ifdef sgi ALport port; -#elif defined(linux) || defined (FreeBSD) || defined (sun) +#elif defined(linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) int audio; if ((audio=set_dsp(O_WRONLY,wd->res,wd->channels,wd->freq,&buf_size))==-1) { @@ -473,7 +476,7 @@ buffer=wd->buffer+offset; while (playlength>0) { if (playlength0) { if (playlengthmg->fbuf,buf_size))==-1) { -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) close(audio); #elif defined(sgi) ALcloseport(port); @@ -518,7 +521,7 @@ kill((pid_t) getppid(),SIGUSR1); return; } -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) if (write(audio,(char*) md->mg->fbuf,length)==-1) { close(audio); kill((pid_t) getppid(),SIGUSR1); @@ -536,7 +539,7 @@ } } -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) close(audio); #elif defined(sgi) while (ALgetfilled(port)) sginap(2); @@ -556,7 +559,7 @@ void write_length(); byte *data=NULL; int abuf_size,count; -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) int audio; if ((audio=set_dsp(O_RDONLY,res,mode,freq,&abuf_size))==-1) { @@ -577,7 +580,7 @@ if ((data = (byte *) malloc(abuf_size)) == NULL) { fprintf(stderr,"XWave: Error while alloc mem for audio_buffer !\n"); -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) close(audio); #elif defined(sgi) ALcloseport(port); @@ -595,7 +598,7 @@ if (af_open(fname,&af,AF_NEW)==AF_ERROR) { free(data); -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) close(audio); #elif defined(sgi) ALcloseport(port); @@ -608,7 +611,7 @@ signal(SIGUSR1,write_length); while(1) { -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) if ((count=read(audio, data, abuf_size))==-1) { close(audio); af_close(af); @@ -632,7 +635,7 @@ return; } if ((count=af_write(af,(char*)data,count))==AF_ERROR) { -#if defined (linux) || defined (FreeBSD) || defined (sun) +#if defined (linux) || defined (FreeBSD) || defined (sun) || defined(__NetBSD__) close(audio); #elif defined(sgi) ALcloseport(port);