78 lines · 1023 B · C
RawDownload
#include	<sndio.h> #include	"u.h"#include	"lib.h"#include	"dat.h"#include	"fns.h"#include	"error.h"#include	"devaudio.h" enum{	Channels = 2,	Rate = 44100,	Bits = 16,}; static struct sio_hdl *hdl;static struct sio_par par; voidaudiodevopen(void){	hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);	if(hdl == NULL){		error("sio_open failed");		return;	} 	sio_initpar(&par); 	par.bits = Bits;	par.pchan = Channels;	par.rate = Rate;	par.appbufsz = 288000; 	if(!sio_setpar(hdl, &par) || !sio_start(hdl)){		sio_close(hdl);		error("sio_setpar/sio_start failed");		return;	}} voidaudiodevclose(void){	sio_close(hdl);} voidaudiodevsetvol(int what, int left, int right){	USED(what);	USED(left);	USED(right);	error("not supported");} voidaudiodevgetvol(int what, int *left, int *right){	USED(what);	USED(left);	USED(right);	error("not supported");} intaudiodevwrite(void *v, int n){	return sio_write(hdl, v, n);} intaudiodevread(void *v, int n){	error("no reading");	return -1;}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t