@@ -22,7 +22,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2222
2323******************************************************************/
2424
25- /* AL module -- interface to Mark Calows' Auido Library (AL). */
25+ /* AL module -- interface to Mark Callows' Audio Library (AL). */
2626
2727#include "audio.h"
2828
@@ -43,6 +43,10 @@ extern typeobject Configtype; /* Forward */
4343
4444#define is_configobject (v ) ((v)->ob_type == &Configtype)
4545
46+ /* Forward */
47+ static int getconfigarg PROTO ((object * , ALconfig * ) );
48+ static int getstrstrconfigarg PROTO ((object * , char * * , char * * , ALconfig * ) );
49+
4650static object *
4751setConfig (self , args , func )
4852 configobject * self ;
@@ -51,7 +55,7 @@ setConfig (self, args, func)
5155{
5256 long par ;
5357
54- if (!getlongarg (args , & par )) return NULL ;
58+ if (!getlongarg (args , & par )) return NULL ;
5559
5660 (* func ) (self -> ob_config , par );
5761
@@ -67,7 +71,7 @@ getConfig (self, args, func)
6771{
6872 long par ;
6973
70- if (!getnoarg (args )) return NULL ;
74+ if (!getnoarg (args )) return NULL ;
7175
7276 par = (* func ) (self -> ob_config );
7377
@@ -192,7 +196,7 @@ al_closeport (self, args)
192196 portobject * self ;
193197 object * args ;
194198{
195- if (!getnoarg (args )) return NULL ;
199+ if (!getnoarg (args )) return NULL ;
196200
197201 if (self -> ob_port != NULL ) {
198202 ALcloseport (self -> ob_port );
@@ -211,7 +215,7 @@ al_getfd (self, args)
211215{
212216 int fd ;
213217
214- if (!getnoarg (args )) return NULL ;
218+ if (!getnoarg (args )) return NULL ;
215219
216220 fd = ALgetfd (self -> ob_port );
217221
@@ -225,7 +229,7 @@ al_getfilled (self, args)
225229{
226230 long count ;
227231
228- if (!getnoarg (args )) return NULL ;
232+ if (!getnoarg (args )) return NULL ;
229233
230234 count = ALgetfilled (self -> ob_port );
231235
@@ -239,7 +243,7 @@ al_getfillable (self, args)
239243{
240244 long count ;
241245
242- if (!getnoarg (args )) return NULL ;
246+ if (!getnoarg (args )) return NULL ;
243247
244248 count = ALgetfillable (self -> ob_port );
245249
@@ -281,17 +285,16 @@ al_writesamps (self, args)
281285 object * args ;
282286{
283287 long count ;
284- object * v ;
288+ char * buf ;
289+ int size , width ;
285290 ALconfig c ;
286- int width ;
287291
288- if (!getstrarg (args , & v )) return NULL ;
292+ if (!getargs (args , "s#" , & buf , & size )) return NULL ;
289293
290294 c = ALgetconfig (self -> ob_port );
291295 width = ALgetwidth (c );
292296 ALfreeconfig (c );
293- ALwritesamps (self -> ob_port , (void * ) getstringvalue (v ),
294- getstringsize (v ) / width );
297+ ALwritesamps (self -> ob_port , (void * ) buf , (long ) size / width );
295298
296299 INCREF (None );
297300 return None ;
@@ -304,7 +307,7 @@ al_getfillpoint (self, args)
304307{
305308 long count ;
306309
307- if (!getnoarg (args )) return NULL ;
310+ if (!getnoarg (args )) return NULL ;
308311
309312 count = ALgetfillpoint (self -> ob_port );
310313
@@ -318,7 +321,7 @@ al_setfillpoint (self, args)
318321{
319322 long count ;
320323
321- if (!getlongarg (args , & count )) return NULL ;
324+ if (!getlongarg (args , & count )) return NULL ;
322325
323326 ALsetfillpoint (self -> ob_port , count );
324327
@@ -333,7 +336,7 @@ al_setconfig (self, args)
333336{
334337 ALconfig config ;
335338
336- if (!getconfigarg (args , & config )) return NULL ;
339+ if (!getconfigarg (args , & config )) return NULL ;
337340
338341 ALsetconfig (self -> ob_port , config );
339342
@@ -348,7 +351,7 @@ al_getconfig (self, args)
348351{
349352 ALconfig config ;
350353
351- if (!getnoarg (args )) return NULL ;
354+ if (!getnoarg (args )) return NULL ;
352355
353356 config = ALgetconfig (self -> ob_port );
354357
@@ -420,13 +423,13 @@ static object *
420423al_openport (self , args )
421424 object * self , * args ;
422425{
423- object * name , * dir ;
426+ char * name , * dir ;
424427 ALport port ;
425428 ALconfig config = NULL ;
426429 int size ;
427430
428431 if (args == NULL || !is_tupleobject (args )) {
429- err_badarg ();
432+ err_badarg ();
430433 return NULL ;
431434 }
432435 size = gettuplesize (args );
@@ -439,11 +442,11 @@ al_openport (self, args)
439442 return NULL ;
440443 }
441444 else {
442- err_badarg ();
445+ err_badarg ();
443446 return NULL ;
444447 }
445448
446- port = ALopenport (getstringvalue ( name ), getstringvalue ( dir ) , config );
449+ port = ALopenport (name , dir , config );
447450
448451 if (port == NULL ) {
449452 err_errno (RuntimeError );
@@ -481,7 +484,7 @@ al_queryparams(self, args)
481484 object * v ;
482485 object * w ;
483486
484- if (!getlongarg (args , & device ))
487+ if (!getlongarg (args , & device ))
485488 return NULL ;
486489 length = ALqueryparams (device , PVdummy , 2L );
487490 PVbuffer = NEW (long , length );
@@ -510,7 +513,7 @@ doParams(args, func, modified)
510513 long length ;
511514 int i ;
512515
513- if (!getlongobjectarg (args , & device , & list ))
516+ if (!getargs (args , "(lO)" , & device , & list ))
514517 return NULL ;
515518 if (!is_listobject (list )) {
516519 err_badarg ();
@@ -572,31 +575,26 @@ inital()
572575 initmodule ("al" , al_methods );
573576}
574577
575- int
576- getconfigarg (o , conf )
577- configobject * o ;
578+ static int
579+ getconfigarg (o , conf )
580+ object * o ;
578581 ALconfig * conf ;
579582{
580583 if (o == NULL || !is_configobject (o ))
581584 return err_badarg ();
582585
583- * conf = o -> ob_config ;
586+ * conf = (( configobject * ) o ) -> ob_config ;
584587
585588 return 1 ;
586589}
587590
588- int
591+ static int
589592getstrstrconfigarg (v , a , b , c )
590593 object * v ;
591- object * * a ;
592- object * * b ;
594+ char * * a ;
595+ char * * b ;
593596 ALconfig * c ;
594597{
595- if (v == NULL || !is_tupleobject (v ) || gettuplesize (v ) != 3 ) {
596- return err_badarg ();
597- }
598-
599- return getstrarg (gettupleitem (v , 0 ), a ) &&
600- getstrarg (gettupleitem (v , 1 ), b ) &&
601- getconfigarg (gettupleitem (v , 2 ), c );
598+ object * o ;
599+ return getargs (v , "(ssO)" , a , b , & o ) && getconfigarg (o , c );
602600}
0 commit comments