Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30669
Modified Files:
Tag: desiredata
s_audio_jack.c s_audio.c s_stuff.h
Log Message:
cleanup
Index: s_audio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v
retrieving revision 1.5.4.16.2.20.2.21
retrieving revision 1.5.4.16.2.20.2.22
diff -C2 -d -r1.5.4.16.2.20.2.21 -r1.5.4.16.2.20.2.22
*** s_audio.c 10 Jul 2007 21:50:05 -0000 1.5.4.16.2.20.2.21
--- s_audio.c 10 Jul 2007 22:24:36 -0000 1.5.4.16.2.20.2.22
***************
*** 157,163 ****
post("warning: adjusting dac~blocksize to power of 2: %d", dacblocksize);
}
! sys_dacblocksize = dacblocksize;
sys_schedblocksize = dacblocksize;
! sys_inchannels = chin;
sys_outchannels = chout;
sys_dacsr = double(sr);
--- 157,163 ----
post("warning: adjusting dac~blocksize to power of 2: %d", dacblocksize);
}
! sys_dacblocksize = dacblocksize;
sys_schedblocksize = dacblocksize;
! sys_inchannels = chin;
sys_outchannels = chout;
sys_dacsr = double(sr);
***************
*** 190,200 ****
int indevs = 0, outdevs = 0, canmulti = 0;
audio_getdevs(indevlist, &indevs, outdevlist, &outdevs, &canmulti, MAXNDEV, DEVDESCSIZE);
-
- /* jsarlo { (*/
if (sys_externalschedlib) return;
- /* if we're already open close it */
if (sys_inchannels || sys_outchannels) sys_close_audio();
- /* } jsarlo */
-
if (rate < 1) rate = DEFAULTSRATE;
if (dacblocksize < 1) dacblocksize = DEFDACBLKSIZE;
--- 190,195 ----
***************
*** 281,292 ****
jack_open_audio((nindev > 0 ? realinchans[0] : 0),
(noutdev > 0 ? realoutchans[0] : 0), rate, schedmode);
! else
#endif
if (sys_audioapi == API_OSS || sys_audioapi == API_ALSA || sys_audioapi == API_MMIO)
sys_audio()->open_audio(nindev, indev, nchindev, realinchans, noutdev, outdev, nchoutdev, realoutchans, rate, -42);
else if (sys_audioapi == API_SGI)
! sys_audio()->open_audio(nindev, indev, nchindev, chindev, noutdev, outdev, nchoutdev, choutdev, rate, -42);
else if (sys_audioapi == API_ASIO)
! sys_audio()->open_audio(nindev, indev, nchindev, chindev, noutdev, outdev, nchoutdev, choutdev, rate, schedmode);
else post("unknown audio API specified");
}
--- 276,287 ----
jack_open_audio((nindev > 0 ? realinchans[0] : 0),
(noutdev > 0 ? realoutchans[0] : 0), rate, schedmode);
! else
#endif
if (sys_audioapi == API_OSS || sys_audioapi == API_ALSA || sys_audioapi == API_MMIO)
sys_audio()->open_audio(nindev, indev, nchindev, realinchans, noutdev, outdev, nchoutdev, realoutchans, rate, -42);
else if (sys_audioapi == API_SGI)
! sys_audio()->open_audio(nindev, indev, nchindev, chindev, noutdev, outdev, nchoutdev, choutdev, rate, -42);
else if (sys_audioapi == API_ASIO)
! sys_audio()->open_audio(nindev, indev, nchindev, chindev, noutdev, outdev, nchoutdev, choutdev, rate, schedmode);
else post("unknown audio API specified");
}
***************
*** 294,298 ****
if (sys_inchannels == 0 && sys_outchannels == 0) enable = 0;
audio_state = enable;
! sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0));
sched_set_using_dacs(enable);
sys_update_sleepgrain();
--- 289,293 ----
if (sys_inchannels == 0 && sys_outchannels == 0) enable = 0;
audio_state = enable;
! sys_vgui("set pd_whichapi %d\n", audio_isopen() ? sys_audioapi : 0);
sched_set_using_dacs(enable);
sys_update_sleepgrain();
***************
*** 362,367 ****
}
- void sys_reportidle() {}
-
static void audio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) {
audio_init();
--- 357,360 ----
***************
*** 372,376 ****
static void sys_listaudiodevs() {
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
! int nindevs = 0, noutdevs = 0, i, canmulti = 0;
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE);
/* To agree with command line flags, normally start at 1; but microsoft "MMIO" device list starts at 0 (the "mapper"). */
--- 365,369 ----
static void sys_listaudiodevs() {
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE];
! int nindevs = 0, noutdevs = 0, canmulti = 0;
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, MAXNDEV, DEVDESCSIZE);
/* To agree with command line flags, normally start at 1; but microsoft "MMIO" device list starts at 0 (the "mapper"). */
***************
*** 379,388 ****
else {
post("audio input devices:");
! for (i = 0; i < nindevs; i++) post("%d. %s", i + (sys_audioapi != API_MMIO), indevlist + i * DEVDESCSIZE);
}
if (!noutdevs) post("no audio output devices found");
else {
post("audio output devices:");
! for (i = 0; i < noutdevs; i++) post("%d. %s", i + (sys_audioapi != API_MMIO), outdevlist + i * DEVDESCSIZE);
}
post("API number %d\n", sys_audioapi);
--- 372,381 ----
else {
post("audio input devices:");
! for (int i=0; i<nindevs; i++) post("%d. %s", i + (sys_audioapi != API_MMIO), indevlist + i * DEVDESCSIZE);
}
if (!noutdevs) post("no audio output devices found");
else {
post("audio output devices:");
! for (int i=0; i<noutdevs; i++) post("%d. %s", i + (sys_audioapi != API_MMIO), outdevlist + i * DEVDESCSIZE);
}
post("API number %d\n", sys_audioapi);
***************
*** 684,688 ****
sys_get_audio_params(&in,&out, &rate, &dacblocksize, &advance, &scheduler);
if (f < 0) {
- int i;
for (int i=0; i<noutdevs; i++) SETSYMBOL(argv+i, gensym(outdevlist+i*DEVDESCSIZE));
typedmess(pd->s_thing, selector, noutdevs, argv);
--- 677,680 ----
Index: s_audio_jack.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio_jack.c,v
retrieving revision 1.5.4.8.2.7.2.9
retrieving revision 1.5.4.8.2.7.2.10
diff -C2 -d -r1.5.4.8.2.7.2.9 -r1.5.4.8.2.7.2.10
*** s_audio_jack.c 10 Jul 2007 21:49:16 -0000 1.5.4.8.2.7.2.9
--- s_audio_jack.c 10 Jul 2007 22:24:36 -0000 1.5.4.8.2.7.2.10
***************
*** 292,311 ****
void jack_close_audio() {
! if (jack_client) {
! jack_deactivate(jack_client);
! jack_started = 0;
! jack_client_close(jack_client);
! jack_client = 0;
! for (int i = 0; i <NUM_JACK_PORTS; i++) {
! input_port[i] = 0;
! output_port[i] = 0;
! }
}
}
int jack_send_dacs() {
! float *fp;
! int rtnval = SENDDACS_YES;
! int timenow;
int timeref = int(sys_getrealtime());
if (!jack_client) return SENDDACS_NO;
--- 292,308 ----
void jack_close_audio() {
! if (!jack_client) return;
! jack_deactivate(jack_client);
! jack_started = 0;
! jack_client_close(jack_client);
! jack_client = 0;
! for (int i=0; i<NUM_JACK_PORTS; i++) {
! input_port[i] = 0;
! output_port[i] = 0;
}
}
int jack_send_dacs() {
! int rtnval = SENDDACS_YES;
int timeref = int(sys_getrealtime());
if (!jack_client) return SENDDACS_NO;
***************
*** 315,336 ****
jack_dio_error = 0;
}
! if (jack_filled >= jack_out_max)
! return SENDDACS_NO;
/* tb: wait in the scheduler */
/* pthread_cond_wait(&jack_sem,&jack_mutex); */
jack_started = 1;
! fp = sys_soundout;
for (int j=0; j<sys_outchannels; j++) {
! memcpy(jack_outbuf + (j * BUF_JACK) + jack_filled,fp, sys_dacblocksize*sizeof(float));
fp += sys_dacblocksize;
}
fp = sys_soundin;
for (int j=0; j<sys_inchannels; j++) {
! memcpy(fp, jack_inbuf + (j * BUF_JACK) + jack_filled, sys_dacblocksize*sizeof(float));
fp += sys_dacblocksize;
}
! if ((timenow = int(sys_getrealtime()) - timeref > sys_sleepgrain * 1e-6)) {
! rtnval = SENDDACS_SLEPT;
! }
memset(sys_soundout,0,sys_dacblocksize*sizeof(float)*sys_outchannels);
jack_filled += sys_dacblocksize;
--- 312,331 ----
jack_dio_error = 0;
}
! if (jack_filled >= jack_out_max) return SENDDACS_NO;
/* tb: wait in the scheduler */
/* pthread_cond_wait(&jack_sem,&jack_mutex); */
jack_started = 1;
! float *fp = sys_soundout;
for (int j=0; j<sys_outchannels; j++) {
! memcpy(jack_outbuf + j*BUF_JACK + jack_filled, fp, sys_dacblocksize*sizeof(float));
fp += sys_dacblocksize;
}
fp = sys_soundin;
for (int j=0; j<sys_inchannels; j++) {
! memcpy(fp, jack_inbuf + j*BUF_JACK + jack_filled, sys_dacblocksize*sizeof(float));
fp += sys_dacblocksize;
}
! int timenow = int(sys_getrealtime());
! if (timenow-timeref > sys_sleepgrain*1e-6) rtnval = SENDDACS_SLEPT;
memset(sys_soundout,0,sys_dacblocksize*sizeof(float)*sys_outchannels);
jack_filled += sys_dacblocksize;
***************
*** 339,347 ****
void jack_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) {
! int i, ndev;
! *canmulti = 0; /* supports multiple devices */
! ndev = 1;
! for (i = 0; i < ndev; i++) {
! sprintf(indevlist + i * devdescsize, "JACK");
sprintf(outdevlist + i * devdescsize, "JACK");
}
--- 334,341 ----
void jack_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize) {
! *canmulti = 0; /* supports multiple devices */
! int ndev = 1;
! for (int i=0; i<ndev; i++) {
! sprintf( indevlist + i * devdescsize, "JACK");
sprintf(outdevlist + i * devdescsize, "JACK");
}
***************
*** 351,363 ****
void jack_listdevs () {post("device listing not implemented for jack yet\n");}
! /* ports connected to the inputs */
! static const char ** jack_in_connections[NUM_JACK_PORTS];
! /* ports connected to the outputs */
! static const char ** jack_out_connections[NUM_JACK_PORTS];
/* tb: save the current state of pd's jack connections */
t_int jack_save_connection_state(t_int* dummy) {
if (jack_ignore_graph_callback) return 0;
! for (int i = 0; i != NUM_JACK_PORTS; ++i) {
/* saving the inputs connections */
if (jack_in_connections[i]) free(jack_in_connections[i]);
--- 345,355 ----
void jack_listdevs () {post("device listing not implemented for jack yet\n");}
! static const char ** jack_in_connections[NUM_JACK_PORTS]; /* ports connected to the inputs */
! static const char **jack_out_connections[NUM_JACK_PORTS]; /* ports connected to the outputs */
/* tb: save the current state of pd's jack connections */
t_int jack_save_connection_state(t_int* dummy) {
if (jack_ignore_graph_callback) return 0;
! for (int i=0; i<NUM_JACK_PORTS; i++) {
/* saving the inputs connections */
if (jack_in_connections[i]) free(jack_in_connections[i]);
***************
*** 374,400 ****
/* todo: don't try to connect twice if we're both input and output host */
static void jack_restore_connection_state() {
- int status;
post("restoring connections");
! for (int i = 0; i != NUM_JACK_PORTS; ++i) {
/* restoring the inputs connections */
if (jack_in_connections[i]) {
! int j = 0;
! while (1) {
! const char* src_port = jack_in_connections[i][j];
if (!src_port) break; /* we've connected all incoming ports */
! status = jack_connect(jack_client, src_port, jack_port_name(input_port[i]));
if (status) post("cannot connect input ports %s -> %s", src_port, jack_port_name (input_port[i]));
- ++j;
}
}
/* restoring the output connections */
if (jack_out_connections[i]) {
! int j = 0;
! while (1) {
! const char* dst_port = jack_out_connections[i][j];
if (!dst_port) break; /* we've connected all outgoing ports */
! status = jack_connect(jack_client, jack_port_name(output_port[i]), dst_port);
if (status) post("cannot connect output ports %s -> %s", jack_port_name(output_port[i]), dst_port);
- ++j;
}
}
--- 366,387 ----
/* todo: don't try to connect twice if we're both input and output host */
static void jack_restore_connection_state() {
post("restoring connections");
! for (int i=0; i<NUM_JACK_PORTS; i++) {
/* restoring the inputs connections */
if (jack_in_connections[i]) {
! for (int j=0;;j++) {
! const char *src_port = jack_in_connections[i][j];
if (!src_port) break; /* we've connected all incoming ports */
! int status = jack_connect(jack_client, src_port, jack_port_name(input_port[i]));
if (status) post("cannot connect input ports %s -> %s", src_port, jack_port_name (input_port[i]));
}
}
/* restoring the output connections */
if (jack_out_connections[i]) {
! for (int j=0;;j++) {
! const char *dst_port = jack_out_connections[i][j];
if (!dst_port) break; /* we've connected all outgoing ports */
! int status = jack_connect(jack_client, jack_port_name(output_port[i]), dst_port);
if (status) post("cannot connect output ports %s -> %s", jack_port_name(output_port[i]), dst_port);
}
}
Index: s_stuff.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_stuff.h,v
retrieving revision 1.5.4.10.2.8.2.13
retrieving revision 1.5.4.10.2.8.2.14
diff -C2 -d -r1.5.4.10.2.8.2.13 -r1.5.4.10.2.8.2.14
*** s_stuff.h 10 Jul 2007 16:36:03 -0000 1.5.4.10.2.8.2.13
--- s_stuff.h 10 Jul 2007 22:24:36 -0000 1.5.4.10.2.8.2.14
***************
*** 93,97 ****
int sys_send_dacs(void);
- void sys_reportidle(void);
void sys_set_priority(int higher);
void sys_audiobuf(int nbufs);
--- 93,96 ----
***************
*** 263,269 ****
} t_audioapi;
! int pa_open_audio(int inchans, int outchans, int rate, int advance,
! int indeviceno, int outdeviceno, int schedmode);
! void sys_reportidle(void);
/* tb { */
--- 262,266 ----
} t_audioapi;
! int pa_open_audio(int inchans, int outchans, int rate, int advance, int indeviceno, int outdeviceno, int schedmode);
/* tb { */
***************
*** 274,300 ****
/* } tb */
! int oss_open_audio(int naudioindev, int *audioindev, int nchindev,
! int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
! int *choutdev, int rate); /* IOhannes */
! void oss_reportidle(void);
! void oss_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
! int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
! int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev,
! int *choutdev, int rate);
! void alsa_reportidle(void);
void alsa_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
- int jack_open_audio(int wantinchans, int wantoutchans, int srate, int scheduler);
- void jack_reportidle(void);
void jack_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
- void jack_listdevs(void);
- void mmio_open_audio(int naudioindev, int *audioindev,
- int nchindev, int *chindev, int naudiooutdev, int *audiooutdev,
- int nchoutdev, int *choutdev, int rate);
- void mmio_reportidle(void);
void mmio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
- void asio_open_audio(int naudioindev, int *audioindev, int nchindev,
- int *chindev, int naudiooutdev, int *audiooutdev,
- int nchoutdev, int *choutdev, int srate, int scheduler);
void asio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
void sys_listmididevs(void);
void sys_set_midi_api(int whichapi);
--- 271,287 ----
/* } tb */
! int jack_open_audio(int wantinchans, int wantoutchans, int rate, int scheduler);
! int oss_open_audio(int nindev, int *indev, int nchindev, int *chindev, int noutdev, int *outdev, int nchoutdev, int *choutdev, int rate);
! int alsa_open_audio(int nindev, int *indev, int nchindev, int *chindev, int noutdev, int *outdev, int nchoutdev, int *choutdev, int rate);
! void mmio_open_audio(int nindev, int *indev, int nchindev, int *chindev, int noutdev, int *outdev, int nchoutdev, int *choutdev, int rate);
! void asio_open_audio(int nindev, int *indev, int nchindev, int *chindev, int noutdev, int *outdev, int nchoutdev, int *choutdev, int rate,
! int scheduler);
!
! void oss_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
void alsa_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
void jack_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
void mmio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
void asio_getdevs(char *indevlist, int *nindevs, char *outdevlist, int *noutdevs, int *canmulti, int maxndev, int devdescsize);
+ void jack_listdevs(void);
void sys_listmididevs(void);
void sys_set_midi_api(int whichapi);
***************
*** 308,313 ****
void linux_alsa_devname(char *devname);
! void sys_get_audio_params(t_audiodevs *in, t_audiodevs *out, int *prate, int *dacblocksize, int *padvance, int *pscheduler);
! void sys_save_audio_params(t_audiodevs *in, t_audiodevs *out, int rate, int dacblocksize, int advance, int scheduler);
/* s_file.c */
--- 295,300 ----
void linux_alsa_devname(char *devname);
! void sys_get_audio_params(t_audiodevs *in, t_audiodevs *out, int *prate, int *dacblocksize, int *padvance, int *pscheduler);
! void sys_save_audio_params(t_audiodevs *in, t_audiodevs *out, int rate, int dacblocksize, int advance, int scheduler);
/* s_file.c */