Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1:/tmp/cvs-serv26968
Modified Files:
Tag: devel_0_37
g_all_guis.c g_canvas.c g_template.c m_sched.c s_audio.c
s_audio_alsa.c s_audio_oss.c s_audio_pa.c s_midi_mmio.c
Log Message:
merged in millers 0.37-1test3
Index: g_all_guis.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_all_guis.c,v
retrieving revision 1.1.1.4.2.3
retrieving revision 1.1.1.4.2.4
diff -C2 -d -r1.1.1.4.2.3 -r1.1.1.4.2.4
*** g_all_guis.c 18 Nov 2003 10:34:10 -0000 1.1.1.4.2.3
--- g_all_guis.c 14 Jan 2004 15:50:28 -0000 1.1.1.4.2.4
***************
*** 209,213 ****
iemgui->x_lab_unexpanded = 0;
iemgui->x_binbufindex = indx;
! iemgui->x_labelbindex = indx + 2;
}
--- 209,213 ----
iemgui->x_lab_unexpanded = 0;
iemgui->x_binbufindex = indx;
! iemgui->x_labelbindex = indx + 3;
}
***************
*** 225,240 ****
/* initialize a single symbol in unexpanded form. We reach into the
! binbuf to grab them; if there's nothing there, set it to "empty". */
static void iemgui_init_sym2dollararg(t_iemgui *iemgui, t_symbol **symp,
! int indx)
{
if (!*symp)
{
t_binbuf *b = iemgui->x_obj.ob_binbuf;
! char buf[80];
! if (binbuf_getnatom(b) <= indx)
! strcpy(buf, "empty");
! else atom_string(binbuf_getvec(b) + indx, buf, 80);
! *symp = gensym(buf);
}
}
--- 225,245 ----
/* initialize a single symbol in unexpanded form. We reach into the
! binbuf to grab them; if there's nothing there, set it to the
! fallback; if still nothing, set to "empty". */
static void iemgui_init_sym2dollararg(t_iemgui *iemgui, t_symbol **symp,
! int indx, t_symbol *fallback)
{
if (!*symp)
{
t_binbuf *b = iemgui->x_obj.ob_binbuf;
! if (binbuf_getnatom(b) > indx)
! {
! char buf[80];
! atom_string(binbuf_getvec(b) + indx, buf, 80);
! *symp = gensym(buf);
! }
! else if (fallback)
! *symp = fallback;
! else *symp = gensym("empty");
}
}
***************
*** 245,253 ****
{
iemgui_init_sym2dollararg(iemgui, &iemgui->x_snd_unexpanded,
! iemgui->x_binbufindex+1);
iemgui_init_sym2dollararg(iemgui, &iemgui->x_rcv_unexpanded,
! iemgui->x_binbufindex+2);
iemgui_init_sym2dollararg(iemgui, &iemgui->x_lab_unexpanded,
! iemgui->x_labelbindex);
srlsym[0] = iemgui->x_snd_unexpanded;
srlsym[1] = iemgui->x_rcv_unexpanded;
--- 250,258 ----
{
iemgui_init_sym2dollararg(iemgui, &iemgui->x_snd_unexpanded,
! iemgui->x_binbufindex+1, iemgui->x_snd);
iemgui_init_sym2dollararg(iemgui, &iemgui->x_rcv_unexpanded,
! iemgui->x_binbufindex+2, iemgui->x_rcv);
iemgui_init_sym2dollararg(iemgui, &iemgui->x_lab_unexpanded,
! iemgui->x_labelbindex, iemgui->x_lab);
srlsym[0] = iemgui->x_snd_unexpanded;
srlsym[1] = iemgui->x_rcv_unexpanded;
***************
*** 401,404 ****
--- 406,410 ----
iemgui->x_lab_unexpanded = lab;
iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab);
+
if(glist_isvisible(iemgui->x_glist))
sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n",
Index: g_canvas.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_canvas.c,v
retrieving revision 1.1.1.4.2.6
retrieving revision 1.1.1.4.2.7
diff -C2 -d -r1.1.1.4.2.6 -r1.1.1.4.2.7
*** g_canvas.c 29 Oct 2003 12:57:42 -0000 1.1.1.4.2.6
--- g_canvas.c 14 Jan 2004 15:50:28 -0000 1.1.1.4.2.7
***************
*** 1029,1037 ****
/* When you ask a canvas its size the result is 2 pixels more than what
you gave it to open it; perhaps there's a 1-pixel border all around it
! or something. Anyway, we just add the 2 pixels back here: */
#ifdef MSW
! #define HORIZBORDER 2
! #define VERTBORDER 2
#else
#define HORIZBORDER 2
--- 1029,1038 ----
/* When you ask a canvas its size the result is 2 pixels more than what
you gave it to open it; perhaps there's a 1-pixel border all around it
! or something. Anyway, we just add the 2 pixels back here; seems we
! have to do this for linux but not MSW; not sure about MacOS. */
#ifdef MSW
! #define HORIZBORDER 0
! #define VERTBORDER 0
#else
#define HORIZBORDER 2
Index: g_template.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/g_template.c,v
retrieving revision 1.1.1.3.2.1
retrieving revision 1.1.1.3.2.2
diff -C2 -d -r1.1.1.3.2.1 -r1.1.1.3.2.2
*** g_template.c 8 Jul 2003 09:48:57 -0000 1.1.1.3.2.1
--- g_template.c 14 Jan 2004 15:50:28 -0000 1.1.1.3.2.2
***************
*** 609,616 ****
if (!warned)
{
! post("warning -- 'template' is obsolete; replace with 'struct'");
warned = 1;
}
- post("name: %s", sym->s_name);
return (gtemplate_donew(sym, argc, argv));
}
--- 609,616 ----
if (!warned)
{
! post("warning -- 'template' (%s) is obsolete; replace with 'struct'",
! sym->s_name);
warned = 1;
}
return (gtemplate_donew(sym, argc, argv));
}
Index: m_sched.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v
retrieving revision 1.1.1.2.2.6
retrieving revision 1.1.1.2.2.7
diff -C2 -d -r1.1.1.2.2.6 -r1.1.1.2.2.7
*** m_sched.c 12 Sep 2003 21:19:04 -0000 1.1.1.2.2.6
--- m_sched.c 14 Jan 2004 15:50:28 -0000 1.1.1.2.2.7
***************
*** 361,364 ****
--- 361,366 ----
sys_pollgui();
}
+ if (sys_quit)
+ return;
}
sys_time = next_sys_time;
***************
*** 400,404 ****
sys_sleepgrain = 5000;
sys_initmidiqueue();
! while (1)
{
int didsomething = 0;
--- 402,406 ----
sys_sleepgrain = 5000;
sys_initmidiqueue();
! while (!sys_quit)
{
int didsomething = 0;
Index: s_audio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v
retrieving revision 1.1.1.1.2.6
retrieving revision 1.1.1.1.2.7
diff -C2 -d -r1.1.1.1.2.6 -r1.1.1.1.2.7
*** s_audio.c 18 Nov 2003 10:34:10 -0000 1.1.1.1.2.6
--- s_audio.c 14 Jan 2004 15:50:28 -0000 1.1.1.1.2.7
***************
*** 28,31 ****
--- 28,33 ----
#define SYS_XFERSIZE (SYS_SAMPLEWIDTH * SYS_XFERSAMPS)
+ /* these are set in this file when opening audio, but then may be reduced,
+ even to zero, in the system dependent open_audio routines. */
int sys_inchannels;
int sys_outchannels;
***************
*** 327,330 ****
--- 329,334 ----
sys_save_audio_params(naudioindev, audioindev, chindev,
naudiooutdev, audiooutdev, choutdev, sys_dacsr, advance);
+ if (sys_inchannels == 0 && sys_outchannels == 0)
+ enable = 0;
audio_state = enable;
sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0));
Index: s_audio_alsa.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio_alsa.c,v
retrieving revision 1.1.1.1.2.4
retrieving revision 1.1.1.1.2.5
diff -C2 -d -r1.1.1.1.2.4 -r1.1.1.1.2.5
*** s_audio_alsa.c 18 Nov 2003 10:34:10 -0000 1.1.1.1.2.4
--- s_audio_alsa.c 14 Jan 2004 15:50:28 -0000 1.1.1.1.2.5
***************
*** 39,42 ****
--- 39,46 ----
#endif
+ #if (SND_LIB_MAJOR < 1)
+ #define ALSAAPI9
+ #endif
+
typedef struct _alsa_dev
{
***************
*** 64,67 ****
--- 68,72 ----
static void alsa_checkiosync( void);
+ static void alsa_numbertoname(int devno, char *devname, int nchar);
/* don't assume we can turn all 31 bits when doing float-to-fix;
***************
*** 93,96 ****
--- 98,102 ----
short* tmp_buf;
unsigned int tmp_uint;
+ snd_pcm_uframes_t tmp_snd_pcm_uframes;
int wantinchans, wantoutchans, devno;
***************
*** 109,116 ****
(naudiooutdev > 0 ? audiooutdev[0] : 0));
! /* device names are hw:0, plughw:0, hw:1, and so on. */
! if (devno & 1)
! sprintf(devname, "plughw:%d", devno/2);
! else sprintf(devname, "hw:%d", devno/2);
if (sys_verbose)
--- 115,119 ----
(naudiooutdev > 0 ? audiooutdev[0] : 0));
! alsa_numbertoname(devno, devname, 512);
if (sys_verbose)
***************
*** 228,245 ****
--- 231,266 ----
snd_pcm_hw_params_get_period_size_max(hw_params, 0));
#endif
+ #ifdef ALSAAPI9
err = snd_pcm_hw_params_set_period_size_near(alsa_device.inhandle,
hw_params,
(snd_pcm_uframes_t)
frag_size, 0);
+ #else
+ tmp_snd_pcm_uframes = frag_size;
+ err = snd_pcm_hw_params_set_period_size_near(alsa_device.inhandle,
+ hw_params, &tmp_snd_pcm_uframes, 0);
+ #endif
check_error(err, "snd_pcm_hw_params_set_period_size_near (input)");
// post("fragsize b %d", frag_size);
// set the number of periods - ie numfrags
// post("nfrags a %d", nfrags);
+ #ifdef ALSAAPI9
err = snd_pcm_hw_params_set_periods_near(alsa_device.inhandle,
hw_params, nfrags, 0);
+ #else
+ tmp_uint = nfrags;
+ err = snd_pcm_hw_params_set_periods_near(alsa_device.inhandle,
+ hw_params, &tmp_uint, 0);
+ #endif
check_error(err, "snd_pcm_hw_params_set_periods_near (input)");
// set the buffer size
+ #ifdef ALSAAPI9
err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.inhandle,
hw_params, nfrags * frag_size);
+ #else
+ tmp_snd_pcm_uframes = nfrags * frag_size;
+ err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.inhandle,
+ hw_params, &tmp_snd_pcm_uframes);
+ #endif
check_error(err, "snd_pcm_hw_params_set_buffer_size_near (input)");
***************
*** 354,371 ****
#endif
// post("fragsize c %d", frag_size);
err = snd_pcm_hw_params_set_period_size_near(alsa_device.outhandle,
hw_params,
(snd_pcm_uframes_t)
frag_size, 0);
// post("fragsize d %d", frag_size);
check_error(err, "snd_pcm_hw_params_set_period_size_near (output)");
// set the number of periods - ie numfrags
err = snd_pcm_hw_params_set_periods_near(alsa_device.outhandle,
hw_params, nfrags, 0);
check_error(err, "snd_pcm_hw_params_set_periods_near (output)");
// set the buffer size
err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.outhandle,
hw_params, nfrags * frag_size);
!
check_error(err, "snd_pcm_hw_params_set_buffer_size_near (output)");
--- 375,409 ----
#endif
// post("fragsize c %d", frag_size);
+ #ifdef ALSAAPI9
err = snd_pcm_hw_params_set_period_size_near(alsa_device.outhandle,
hw_params,
(snd_pcm_uframes_t)
frag_size, 0);
+ #else
+ tmp_snd_pcm_uframes = frag_size;
+ err = snd_pcm_hw_params_set_period_size_near(alsa_device.outhandle,
+ hw_params, &tmp_snd_pcm_uframes, 0);
+ #endif
// post("fragsize d %d", frag_size);
check_error(err, "snd_pcm_hw_params_set_period_size_near (output)");
// set the number of periods - ie numfrags
+ #ifdef ALSAAPI9
err = snd_pcm_hw_params_set_periods_near(alsa_device.outhandle,
hw_params, nfrags, 0);
+ #else
+ tmp_uint = nfrags;
+ err = snd_pcm_hw_params_set_periods_near(alsa_device.outhandle,
+ hw_params, &tmp_uint, 0);
+ #endif
check_error(err, "snd_pcm_hw_params_set_periods_near (output)");
// set the buffer size
+ #ifdef ALSAAPI9
err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.outhandle,
hw_params, nfrags * frag_size);
! #else
! tmp_snd_pcm_uframes = nfrags * frag_size;
! err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.outhandle,
! hw_params, &tmp_snd_pcm_uframes);
! #endif
check_error(err, "snd_pcm_hw_params_set_buffer_size_near (output)");
***************
*** 449,459 ****
check_error(err, "output start failed\n"); */
}
! else if (snd_pcm_start(alsa_device.inhandle) < 0)
check_error(err, "input start failed\n");
!
alsa_outchannels = outchans;
alsa_inchannels = inchans;
! return 0;
}
--- 487,499 ----
check_error(err, "output start failed\n"); */
}
! else if (inchans)
! {
! if (snd_pcm_start(alsa_device.inhandle) < 0)
check_error(err, "input start failed\n");
! }
alsa_outchannels = outchans;
alsa_inchannels = inchans;
! return (!(inchans || outchans));
}
***************
*** 461,470 ****
{
int err;
! if (sys_inchannels)
{
err = snd_pcm_close(alsa_device.inhandle);
check_error(err, "snd_pcm_close (input)");
}
! if (sys_outchannels)
{
err = snd_pcm_close(alsa_device.outhandle);
--- 501,510 ----
{
int err;
! if (alsa_inchannels)
{
err = snd_pcm_close(alsa_device.inhandle);
check_error(err, "snd_pcm_close (input)");
}
! if (alsa_outchannels)
{
err = snd_pcm_close(alsa_device.outhandle);
***************
*** 826,829 ****
--- 866,899 ----
}
+ static int alsa_nnames = 0;
+ static char **alsa_names = 0;
+
+ void alsa_adddev(char *name)
+ {
+ if (alsa_nnames)
+ alsa_names = (char **)t_resizebytes(alsa_names,
+ alsa_nnames * sizeof(char *),
+ (alsa_nnames+1) * sizeof(char *));
+ else alsa_names = (char **)t_getbytes(sizeof(char *));
+ alsa_names[alsa_nnames] = gensym(name)->s_name;
+ alsa_nnames++;
+ }
+
+ static void alsa_numbertoname(int devno, char *devname, int nchar)
+ {
+ int ndev = 0, cardno = -1;
+ while (!snd_card_next(&cardno) && cardno >= 0)
+ ndev++;
+ if (devno < 2*ndev)
+ {
+ if (devno & 1)
+ snprintf(devname, nchar, "plughw:%d", devno/2);
+ else snprintf(devname, nchar, "hw:%d", devno/2);
+ }
+ else if (devno <2*ndev + alsa_nnames)
+ snprintf(devname, nchar, "%s", alsa_names[devno - 2*ndev]);
+ else snprintf(devname, nchar, "???");
+ }
+
/* For each hardware card found, we list two devices, the "hard" and
"plug" one. The card scan is derived from portaudio code. */
***************
*** 832,836 ****
int maxndev, int devdescsize)
{
! int ndev = 0, cardno = -1;
*canmulti = 0; /* only one device; must be the same for input&output */
while (!snd_card_next(&cardno) && cardno >= 0)
--- 902,906 ----
int maxndev, int devdescsize)
{
! int ndev = 0, cardno = -1, i, j;
*canmulti = 0; /* only one device; must be the same for input&output */
while (!snd_card_next(&cardno) && cardno >= 0)
***************
*** 866,869 ****
ndev++;
}
! *nindevs = *noutdevs = 2 * ndev;
}
--- 936,946 ----
ndev++;
}
! for (i = 0, j = 2*ndev; i < alsa_nnames; i++, j++)
! {
! if (j >= maxndev)
! break;
! snprintf(indevlist + j * devdescsize, devdescsize, "%s",
! alsa_names[i]);
! }
! *nindevs = *noutdevs = j;
}
Index: s_audio_oss.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio_oss.c,v
retrieving revision 1.1.1.1.2.4
retrieving revision 1.1.1.1.2.5
diff -C2 -d -r1.1.1.1.2.4 -r1.1.1.1.2.5
*** s_audio_oss.c 18 Nov 2003 10:34:10 -0000 1.1.1.1.2.4
--- s_audio_oss.c 14 Jan 2004 15:50:28 -0000 1.1.1.1.2.5
***************
*** 407,412 ****
if (linux_dacs[n].d_fd >= 0)
{
! fd = linux_dacs[n].d_fd;
alreadyopened = 1;
}
else
--- 407,413 ----
if (linux_dacs[n].d_fd >= 0)
{
! fd = linux_adcs[n].d_fd;
alreadyopened = 1;
+ post("already");
}
else
***************
*** 484,487 ****
--- 485,491 ----
}
sys_setalarm(0);
+ sys_inchannels = inchannels;
+ sys_outchannels = outchannels;
+ post("in %d, out %d", inchannels, outchannels);
return (0);
}
***************
*** 795,799 ****
sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels)
{
! for (j=0;j<sys_inchannels;j++)
fp1[j*DEFDACBLKSIZE] = (float)sp[j]*(float)3.051850e-05;
}
--- 799,803 ----
sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels)
{
! for (j=0;j<nchannels;j++)
fp1[j*DEFDACBLKSIZE] = (float)sp[j]*(float)3.051850e-05;
}
***************
*** 801,806 ****
thischan += nchannels;
}
- if (thischan != sys_inchannels)
- bug("inchannels");
return (rtnval);
}
--- 805,808 ----
Index: s_audio_pa.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio_pa.c,v
retrieving revision 1.1.1.1.2.5
retrieving revision 1.1.1.1.2.6
diff -C2 -d -r1.1.1.1.2.5 -r1.1.1.1.2.6
*** s_audio_pa.c 23 Sep 2003 00:51:50 -0000 1.1.1.1.2.5
--- s_audio_pa.c 14 Jan 2004 15:50:28 -0000 1.1.1.1.2.6
***************
*** 128,131 ****
--- 128,132 ----
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
Pa_Terminate();
+ sys_inchannels = sys_outchannels = 0;
return (1);
}
Index: s_midi_mmio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_midi_mmio.c,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** s_midi_mmio.c 13 Sep 2003 08:30:52 -0000 1.1.2.1
--- s_midi_mmio.c 14 Jan 2004 15:50:28 -0000 1.1.2.2
***************
*** 80,85 ****
{
MIDIOUTCAPS mocap;
! int devno = (midioutvec[i] == DEFMIDIDEV ?
! MIDI_MAPPER : midioutvec[i]-1);
result = midiOutOpen(&hMidiOut[dev], devno, 0, 0,
CALLBACK_NULL);
--- 80,84 ----
{
MIDIOUTCAPS mocap;
! int devno = midioutvec[i];
result = midiOutOpen(&hMidiOut[dev], devno, 0, 0,
CALLBACK_NULL);
***************
*** 535,539 ****
wRtn = midiInOpen((LPHMIDIIN)&hMidiIn[ndev],
! midiinvec[i] - 1,
(DWORD)midiInputHandler,
(DWORD)lpCallbackInstanceData[ndev],
--- 534,538 ----
wRtn = midiInOpen((LPHMIDIIN)&hMidiIn[ndev],
! midiinvec[i],
(DWORD)midiInputHandler,
(DWORD)lpCallbackInstanceData[ndev],
***************
*** 662,666 ****
}
! void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
{
if (nmidiout)
--- 661,666 ----
}
! void sys_do_open_midi(int nmidiin, int *midiinvec,
! int nmidiout, int *midioutvec)
{
if (nmidiout)
***************
*** 681,685 ****
}
!
/* list the audio and MIDI device names */
void sys_listmididevs(void)
--- 681,685 ----
}
! #if 0
/* list the audio and MIDI device names */
void sys_listmididevs(void)
***************
*** 714,715 ****
--- 714,745 ----
}
+ #endif
+
+ void midi_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int maxndev, int devdescsize)
+ {
+ int i, nin = midiInGetNumDevs(), nout = midiOutGetNumDevs();
+ UINT wRtn;
+ if (nin > maxndev)
+ nin = maxndev;
+ for (i = 0; i < nin; i++)
+ {
+ MIDIINCAPS micap;
+ wRtn = midiInGetDevCaps(i, (LPMIDIINCAPS) &micap, sizeof(micap));
+ strncpy(indevlist + i * devdescsize,
+ (wRtn ? "???" : micap.szPname), devdescsize);
+ indevlist[(i+1) * devdescsize - 1] = 0;
+ }
+ if (nout > maxndev)
+ nout = maxndev;
+ for (i = 0; i < nout; i++)
+ {
+ MIDIOUTCAPS mocap;
+ wRtn = midiOutGetDevCaps(i, (LPMIDIOUTCAPS) &mocap, sizeof(mocap));
+ strncpy(outdevlist + i * devdescsize,
+ (wRtn ? "???" : mocap.szPname), devdescsize);
+ outdevlist[(i+1) * devdescsize - 1] = 0;
+ }
+ *nindevs = nin;
+ *noutdevs = nout;
+ }