| @@ -1,20 +1,20 @@ | | | @@ -1,20 +1,20 @@ |
1 | $NetBSD: patch-src_hostapi_sun_pa__unix__sun.c,v 1.3 2021/01/16 21:06:52 reinoud Exp $ | | 1 | $NetBSD: patch-src_hostapi_sun_pa__unix__sun.c,v 1.4 2021/09/09 21:42:00 nia Exp $ |
2 | | | 2 | |
3 | Sun/NetBSD audio support. | | 3 | Sun/NetBSD audio support. |
4 | | | 4 | |
5 | --- src/hostapi/sun/pa_unix_sun.c.orig 2021-01-16 19:57:35.080979704 +0000 | | 5 | --- src/hostapi/sun/pa_unix_sun.c.orig 2021-09-09 21:10:47.132269006 +0000 |
6 | +++ src/hostapi/sun/pa_unix_sun.c | | 6 | +++ src/hostapi/sun/pa_unix_sun.c |
7 | @@ -0,0 +1,1140 @@ | | 7 | @@ -0,0 +1,1123 @@ |
8 | +/* | | 8 | +/* |
9 | + * $Id" | | 9 | + * $Id" |
10 | + * PortAudio Portable Real-Time Audio Library | | 10 | + * PortAudio Portable Real-Time Audio Library |
11 | + * Latest Version at: http://www.portaudio.com | | 11 | + * Latest Version at: http://www.portaudio.com |
12 | + * Sun implementation by: | | 12 | + * Sun implementation by: |
13 | + * Nia Alarie | | 13 | + * Nia Alarie |
14 | + * | | 14 | + * |
15 | + * Based on the Open Source API proposed by Ross Bencina | | 15 | + * Based on the Open Source API proposed by Ross Bencina |
16 | + * Copyright (c) 1999-2002 Ross Bencina, Phil Burk | | 16 | + * Copyright (c) 1999-2002 Ross Bencina, Phil Burk |
17 | + * | | 17 | + * |
18 | + * Permission is hereby granted, free of charge, to any person obtaining | | 18 | + * Permission is hereby granted, free of charge, to any person obtaining |
19 | + * a copy of this software and associated documentation files | | 19 | + * a copy of this software and associated documentation files |
20 | + * (the "Software"), to deal in the Software without restriction, | | 20 | + * (the "Software"), to deal in the Software without restriction, |
| @@ -90,31 +90,26 @@ Sun/NetBSD audio support. | | | @@ -90,31 +90,26 @@ Sun/NetBSD audio support. |
90 | + | | 90 | + |
91 | +#ifndef SUN_DEV_PREFIX | | 91 | +#ifndef SUN_DEV_PREFIX |
92 | +# ifdef __sun | | 92 | +# ifdef __sun |
93 | +# define SUN_DEV_PREFIX "/dev/sound/" | | 93 | +# define SUN_DEV_PREFIX "/dev/sound/" |
94 | +# else | | 94 | +# else |
95 | +# define SUN_DEV_PREFIX "/dev/audio" | | 95 | +# define SUN_DEV_PREFIX "/dev/audio" |
96 | +# endif | | 96 | +# endif |
97 | +#endif | | 97 | +#endif |
98 | + | | 98 | + |
99 | +#ifndef SUN_DEV_DEFAULT | | 99 | +#ifndef SUN_DEV_DEFAULT |
100 | +#define SUN_DEV_DEFAULT "/dev/audio" | | 100 | +#define SUN_DEV_DEFAULT "/dev/audio" |
101 | +#endif | | 101 | +#endif |
102 | + | | 102 | + |
103 | +#ifndef AUDIO_FLUSH | | | |
104 | +#include <sys/stropts.h> | | | |
105 | +#define AUDIO_FLUSH I_FLUSH | | | |
106 | +#endif | | | |
107 | + | | | |
108 | +#ifndef AUDIO_ENCODING_SLINEAR | | 103 | +#ifndef AUDIO_ENCODING_SLINEAR |
109 | +#define AUDIO_ENCODING_SLINEAR AUDIO_ENCODING_LINEAR | | 104 | +#define AUDIO_ENCODING_SLINEAR AUDIO_ENCODING_LINEAR |
110 | +#endif | | 105 | +#endif |
111 | + | | 106 | + |
112 | +#if 0 | | 107 | +#if 0 |
113 | +/* testing */ | | 108 | +/* testing */ |
114 | +#undef AUDIO_GETPROPS | | 109 | +#undef AUDIO_GETPROPS |
115 | +#undef AUDIO_GETFORMAT | | 110 | +#undef AUDIO_GETFORMAT |
116 | +#undef AUDIO_GETBUFINFO | | 111 | +#undef AUDIO_GETBUFINFO |
117 | +#endif | | 112 | +#endif |
118 | + | | 113 | + |
119 | +PaError PaSun_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); | | 114 | +PaError PaSun_Initialize( PaUtilHostApiRepresentation **hostApi, PaHostApiIndex index ); |
120 | +static void Terminate( struct PaUtilHostApiRepresentation *hostApi ); | | 115 | +static void Terminate( struct PaUtilHostApiRepresentation *hostApi ); |
| @@ -909,39 +904,27 @@ Sun/NetBSD audio support. | | | @@ -909,39 +904,27 @@ Sun/NetBSD audio support. |
909 | + | | 904 | + |
910 | + if( stream->bufferProcessor.streamCallback ) | | 905 | + if( stream->bufferProcessor.streamCallback ) |
911 | + PA_ENSURE( PaUtil_CancelThreading( &stream->threading, 1, NULL ) ); | | 906 | + PA_ENSURE( PaUtil_CancelThreading( &stream->threading, 1, NULL ) ); |
912 | + | | 907 | + |
913 | + if( stream->play.fd != -1 ) | | 908 | + if( stream->play.fd != -1 ) |
914 | + (void)ioctl(stream->play.fd, AUDIO_DRAIN); | | 909 | + (void)ioctl(stream->play.fd, AUDIO_DRAIN); |
915 | + | | 910 | + |
916 | +error: | | 911 | +error: |
917 | + return result; | | 912 | + return result; |
918 | +} | | 913 | +} |
919 | + | | 914 | + |
920 | +static PaError AbortStream( PaStream *s ) | | 915 | +static PaError AbortStream( PaStream *s ) |
921 | +{ | | 916 | +{ |
922 | + PaError result = paNoError; | | 917 | + StopStream(s); |
923 | + PaSunStream *stream = (PaSunStream*)s; | | | |
924 | + | | | |
925 | + stream->stopped = true; | | | |
926 | + | | | |
927 | + if( stream->bufferProcessor.streamCallback ) | | | |
928 | + PA_ENSURE( PaUtil_CancelThreading( &stream->threading, 0, NULL ) ); | | | |
929 | + | | | |
930 | + if( stream->play.fd != -1 ) | | | |
931 | + (void)ioctl(stream->play.fd, AUDIO_FLUSH); | | | |
932 | + | | | |
933 | +error: | | | |
934 | + return result; | | | |
935 | +} | | 918 | +} |
936 | + | | 919 | + |
937 | +static PaError IsStreamStopped( PaStream *s ) | | 920 | +static PaError IsStreamStopped( PaStream *s ) |
938 | +{ | | 921 | +{ |
939 | + PaSunStream *stream = (PaSunStream*)s; | | 922 | + PaSunStream *stream = (PaSunStream*)s; |
940 | + | | 923 | + |
941 | + return stream->stopped; | | 924 | + return stream->stopped; |
942 | +} | | 925 | +} |
943 | + | | 926 | + |
944 | + | | 927 | + |
945 | +static PaError IsStreamActive( PaStream *s ) | | 928 | +static PaError IsStreamActive( PaStream *s ) |
946 | +{ | | 929 | +{ |
947 | + PaSunStream *stream = (PaSunStream*)s; | | 930 | + PaSunStream *stream = (PaSunStream*)s; |