Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22533/src
Modified Files:
Tag: devel_0_39
m_glob.c m_sched.c s_audio.c s_audio_portaudio.c
Log Message:
cleaned up message-based access to portaudio backend
Index: s_audio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v
retrieving revision 1.5.4.16.2.17
retrieving revision 1.5.4.16.2.18
diff -C2 -d -r1.5.4.16.2.17 -r1.5.4.16.2.18
*** s_audio.c 21 Apr 2006 14:03:17 -0000 1.5.4.16.2.17
--- s_audio.c 25 Jun 2006 17:37:42 -0000 1.5.4.16.2.18
***************
*** 212,217 ****
MAXNDEV, DEVDESCSIZE);
-
-
/* jsarlo { (*/
if (sys_externalschedlib)
--- 212,215 ----
***************
*** 416,419 ****
--- 414,429 ----
sys_update_sleepgrain();
+
+ if (enable)
+ {
+ t_atom argv[1];
+
+ t_symbol * selector = gensym("audio_started");
+ t_symbol * pd = gensym("pd");
+
+ SETFLOAT(argv, 1.);
+ typedmess(pd->s_thing, selector, 1, argv);
+ }
+
}
***************
*** 1350,1353 ****
--- 1360,1364 ----
extern void pa_getaudiooutdevinfo(t_float f);
extern void pa_test_setting (int ac, t_atom *av);
+ extern void pa_get_asio_latencies(t_float f);
void glob_audio_getaudioindevinfo(t_pd * dummy, t_float f)
***************
*** 1391,1394 ****
--- 1402,1417 ----
}
+ void glob_audio_asio_latencies(t_pd * dummy, t_float f)
+ {
+ #ifdef USEAPI_PORTAUDIO
+ #ifndef PABLIO
+ if (sys_audioapi == API_PORTAUDIO)
+ pa_get_asio_latencies(f);
+ #endif
+ #endif
+
+ }
+
+
/* tb } */
Index: m_sched.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v
retrieving revision 1.5.4.35.2.12
retrieving revision 1.5.4.35.2.13
diff -C2 -d -r1.5.4.35.2.12 -r1.5.4.35.2.13
*** m_sched.c 13 Jun 2006 13:05:45 -0000 1.5.4.35.2.12
--- m_sched.c 25 Jun 2006 17:37:42 -0000 1.5.4.35.2.13
***************
*** 378,381 ****
--- 378,382 ----
t_clock *c = clock_setlist;
clock_unset(c); /* the compiler should easily inline this */
+ sys_time = c->c_settime;
outlet_setstacklim();
(*c->c_fn)(c->c_owner);
***************
*** 389,397 ****
void sched_tick(double next_sys_time)
{
sys_time = next_sys_time;
sched_diddsp++; /* rethink: how to get rid of this stupid histogram??? */
dsp_tick();
- run_clock_callbacks(next_sys_time);
/* rethink: should we really do all this midi messaging in the realtime thread ? */
--- 390,398 ----
void sched_tick(double next_sys_time)
{
+ run_clock_callbacks(next_sys_time);
sys_time = next_sys_time;
sched_diddsp++; /* rethink: how to get rid of this stupid histogram??? */
dsp_tick();
/* rethink: should we really do all this midi messaging in the realtime thread ? */
Index: s_audio_portaudio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/s_audio_portaudio.c,v
retrieving revision 1.1.2.10
retrieving revision 1.1.2.11
diff -C2 -d -r1.1.2.10 -r1.1.2.11
*** s_audio_portaudio.c 13 Jun 2006 12:48:01 -0000 1.1.2.10
--- s_audio_portaudio.c 25 Jun 2006 17:37:42 -0000 1.1.2.11
***************
*** 23,26 ****
--- 23,27 ----
#ifdef MSW
# include <malloc.h>
+ # include <pa_asio.h>
#else
# include <alloca.h>
***************
*** 48,53 ****
void pa_initialize()
{
! if (!pa_initialized)
! {
pa_status = Pa_Initialize();
if ( pa_status!= paNoError )
--- 49,54 ----
void pa_initialize()
{
! // if (!pa_initialized)
! // {
pa_status = Pa_Initialize();
if ( pa_status!= paNoError )
***************
*** 60,64 ****
}
pa_initialized = 1;
! }
}
--- 61,65 ----
}
pa_initialized = 1;
! // }
}
***************
*** 177,193 ****
/* set block size */
! blocksize = sys_advance_samples;
!
! if (blocksize > 8192)
! blocksize = 8192;
! else if (blocksize < sys_dacblocksize)
! blocksize = sys_dacblocksize;
! if (blocksize != (1 << ilog2(blocksize)))
! {
! blocksize = (1 << ilog2(blocksize));
! }
! post("using blocksize %d", blocksize);
pa_blocksize = blocksize;
--- 178,195 ----
/* set block size */
! // blocksize = sys_advance_samples;
! // if (blocksize > 8192)
! // blocksize = 8192;
! // else if (blocksize < sys_dacblocksize)
! // blocksize = sys_dacblocksize;
! // if (blocksize != (1 << ilog2(blocksize)))
! // {
! // blocksize = (1 << ilog2(blocksize));
! // }
! blocksize=64;
!
! // post("using blocksize %d", blocksize);
pa_blocksize = blocksize;
***************
*** 252,257 ****
pa_inchans = inchans;
pa_outchans = outchans;
- pa_indev = indeviceno;
- pa_outdev = outdeviceno;
/* we might have adapted the channel count */
--- 254,257 ----
***************
*** 310,320 ****
void run_all_idle_callbacks(void);
- void sys_xrun_notification(void);
-
int process (const void *input, void *output, unsigned long frameCount,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags, void *userData)
{
! static int started = 0;
--- 310,318 ----
void run_all_idle_callbacks(void);
int process (const void *input, void *output, unsigned long frameCount,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags, void *userData)
{
! static started = 0;
***************
*** 323,332 ****
if (statusFlags)
! sys_xrun_notification();
if (sys_timedlock(timeout) == ETIMEDOUT)
/* we're late */
{
! sys_xrun_notification();
return 0;
}
--- 321,331 ----
if (statusFlags)
! post("statusFlags %p", statusFlags);
if (sys_timedlock(timeout) == ETIMEDOUT)
/* we're late */
{
! post("timeout %d", timeout);
! sys_log_error(ERR_SYSLOCK);
return 0;
}
***************
*** 546,552 ****
t_symbol * selector = gensym("testaudiosettingresult");
t_atom argv[1];
- int ret;
- PaStreamParameters inputParameters, outputParameters;
indev = pdindev2paindev(indev);
outdev = pdoutdev2paoutdev(outdev);
--- 545,551 ----
t_symbol * selector = gensym("testaudiosettingresult");
t_atom argv[1];
+ pa_initialize();
+
indev = pdindev2paindev(indev);
outdev = pdoutdev2paoutdev(outdev);
***************
*** 554,559 ****
if ((pa_indev == -1) && (pa_outdev == -1))
{
! pa_initialize();
!
inputParameters.device = indev;
inputParameters.channelCount = inchans;
--- 553,559 ----
if ((pa_indev == -1) && (pa_outdev == -1))
{
! int ret;
! PaStreamParameters inputParameters, outputParameters;
!
inputParameters.device = indev;
inputParameters.channelCount = inchans;
***************
*** 579,582 ****
--- 579,584 ----
int j;
int devno;
+ pa_initialize();
+
for (j = 0, devno = 0; j < Pa_GetDeviceCount(); j++)
{
***************
*** 587,591 ****
if (devno == pdindev)
{
! return devno;
}
devno++;
--- 589,593 ----
if (devno == pdindev)
{
! return j;
}
devno++;
***************
*** 600,603 ****
--- 602,607 ----
int j;
int devno;
+ pa_initialize();
+
for (j = 0, devno = 0; j < Pa_GetDeviceCount(); j++)
{
***************
*** 608,612 ****
if (devno == pdoutdev)
{
! return devno;
}
devno++;
--- 612,616 ----
if (devno == pdoutdev)
{
! return j;
}
devno++;
***************
*** 617,618 ****
--- 621,652 ----
}
+ void pa_get_asio_latencies(t_float f)
+ {
+ int index = (int)f;
+ const PaDeviceInfo *pdi = Pa_GetDeviceInfo(index);
+ if (pdi->hostApi != paASIO)
+ {
+ post("device not an asio device");
+ return;
+ }
+ #ifdef WIN32
+ else
+ {
+ long minlat, maxlat, preflat, gran;
+ t_atom argv[4];
+
+ t_symbol * selector = gensym("asiolatency");
+ t_symbol * pd = gensym("pd");
+
+ PaAsio_GetAvailableLatencyValues(index, &minlat, &maxlat, &preflat, &gran);
+
+ SETFLOAT(argv, (float) minlat);
+ SETFLOAT(argv + 1, (float) maxlat);
+ SETFLOAT(argv + 2, (float) preflat);
+ SETFLOAT(argv + 3, (float) gran);
+
+ typedmess(pd->s_thing, selector, 4, argv);
+ }
+ #endif
+
+ }
Index: m_glob.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_glob.c,v
retrieving revision 1.4.4.2.2.8
retrieving revision 1.4.4.2.2.9
diff -C2 -d -r1.4.4.2.2.8 -r1.4.4.2.2.9
*** m_glob.c 13 Jun 2006 12:48:01 -0000 1.4.4.2.2.8
--- m_glob.c 25 Jun 2006 17:37:42 -0000 1.4.4.2.2.9
***************
*** 39,50 ****
void glob_audio_getaudioindevinfo(t_pd * dummy, t_float f);
void glob_audio_getaudiooutdevinfo(t_pd * dummy, t_float f);
! void glob_audio_samplerate(t_pd * dummy, t_float f);
! void glob_audio_delay(t_pd * dummy, t_float f);
! void glob_audio_dacblocksize(t_pd * dummy, t_float f);
! void glob_audio_scheduler(t_pd * dummy, t_float f);
void glob_audio_device(t_pd * dummy, t_symbol *s, int argc, t_atom *argv);
! void glob_audio_device_in(t_pd * dummy, t_symbol *s, int argc, t_atom *argv);
! void glob_audio_device_out(t_pd * dummy, t_symbol *s, int argc, t_atom *argv);
void glob_audio_getcurrent_devices(void);
/* tb } */
--- 39,51 ----
void glob_audio_getaudioindevinfo(t_pd * dummy, t_float f);
void glob_audio_getaudiooutdevinfo(t_pd * dummy, t_float f);
! //void glob_audio_samplerate(t_pd * dummy, t_float f);
! //void glob_audio_delay(t_pd * dummy, t_float f);
! //void glob_audio_dacblocksize(t_pd * dummy, t_float f);
! //void glob_audio_scheduler(t_pd * dummy, t_float f);
void glob_audio_device(t_pd * dummy, t_symbol *s, int argc, t_atom *argv);
! //void glob_audio_device_in(t_pd * dummy, t_symbol *s, int argc, t_atom *argv);
! //void glob_audio_device_out(t_pd * dummy, t_symbol *s, int argc, t_atom *argv);
void glob_audio_getcurrent_devices(void);
+ void glob_audio_asio_latencies(t_pd * dummy, t_float f);
/* tb } */
***************
*** 84,87 ****
--- 85,90 ----
if (s == gensym("xrun"))
return;
+ if (s == gensym("audio_started"))
+ return;
startpost("%s: unknown message %s ", class_getname(pd_class(x)),
***************
*** 177,194 ****
gensym("tooltips"), A_DEFFLOAT, 0);
/* tb: message-based audio configuration { */
! class_addmethod(glob_pdobject, (t_method)glob_audio_samplerate,
! gensym("audio-samplerate"), A_DEFFLOAT, 0);
! class_addmethod(glob_pdobject, (t_method)glob_audio_delay,
! gensym("audio-delay"), A_DEFFLOAT, 0);
! class_addmethod(glob_pdobject, (t_method)glob_audio_dacblocksize,
! gensym("audio-dacblocksize"), A_DEFFLOAT, 0);
! class_addmethod(glob_pdobject, (t_method)glob_audio_scheduler,
! gensym("audio-scheduler"), A_DEFFLOAT, 0);
class_addmethod(glob_pdobject, (t_method)glob_audio_device,
gensym("audio-device"), A_GIMME, 0);
! class_addmethod(glob_pdobject, (t_method)glob_audio_device_in,
! gensym("audio-device-in"), A_GIMME, 0);
! class_addmethod(glob_pdobject, (t_method)glob_audio_device_out,
! gensym("audio-device-out"), A_GIMME, 0);
class_addmethod(glob_pdobject, (t_method)glob_audio_getaudioindevices,
gensym("getaudioindev"), A_GIMME, 0);
--- 180,197 ----
gensym("tooltips"), A_DEFFLOAT, 0);
/* tb: message-based audio configuration { */
! // class_addmethod(glob_pdobject, (t_method)glob_audio_samplerate,
! // gensym("audio-samplerate"), A_DEFFLOAT, 0);
! // class_addmethod(glob_pdobject, (t_method)glob_audio_delay,
! // gensym("audio-delay"), A_DEFFLOAT, 0);
! // class_addmethod(glob_pdobject, (t_method)glob_audio_dacblocksize,
! // gensym("audio-dacblocksize"), A_DEFFLOAT, 0);
! // class_addmethod(glob_pdobject, (t_method)glob_audio_scheduler,
! // gensym("audio-scheduler"), A_DEFFLOAT, 0);
class_addmethod(glob_pdobject, (t_method)glob_audio_device,
gensym("audio-device"), A_GIMME, 0);
! // class_addmethod(glob_pdobject, (t_method)glob_audio_device_in,
! // gensym("audio-device-in"), A_GIMME, 0);
! // class_addmethod(glob_pdobject, (t_method)glob_audio_device_out,
! // gensym("audio-device-out"), A_GIMME, 0);
class_addmethod(glob_pdobject, (t_method)glob_audio_getaudioindevices,
gensym("getaudioindev"), A_GIMME, 0);
***************
*** 203,206 ****
--- 206,211 ----
class_addmethod(glob_pdobject, (t_method)glob_audio_getcurrent_devices,
gensym("getaudiodevice"), 0);
+ class_addmethod(glob_pdobject, (t_method)glob_audio_asio_latencies,
+ gensym("getasiolatencies"), A_DEFFLOAT, 0);
/* tb } */
#ifdef DESIRE