[PD-cvs] pd/src s_audio_portaudio.c,1.1.2.21.2.5,1.1.2.21.2.6
Mathieu Bouchard
matju at users.sourceforge.net
Tue Jul 10 18:52:24 CEST 2007
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32597
Modified Files:
Tag: desiredata
s_audio_portaudio.c
Log Message:
cleanup
Index: s_audio_portaudio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/s_audio_portaudio.c,v
retrieving revision 1.1.2.21.2.5
retrieving revision 1.1.2.21.2.6
diff -C2 -d -r1.1.2.21.2.5 -r1.1.2.21.2.6
*** s_audio_portaudio.c 9 Jul 2007 19:59:42 -0000 1.1.2.21.2.5
--- s_audio_portaudio.c 10 Jul 2007 16:52:22 -0000 1.1.2.21.2.6
***************
*** 48,61 ****
void pa_initialize() {
! // if (!pa_initialized)
! // {
! pa_status = Pa_Initialize();
! if (pa_status!=paNoError) {
! fprintf(stderr, "Error number %d occured initializing portaudio\n", pa_status);
! fprintf(stderr, "Error message: %s\n", Pa_GetErrorText(pa_status));
! return;
! }
! pa_initialized = 1;
! // }
}
--- 48,59 ----
void pa_initialize() {
! // if (pa_initialized) return;
! pa_status = Pa_Initialize();
! if (pa_status!=paNoError) {
! fprintf(stderr, "Error number %d occured initializing portaudio\n", pa_status);
! fprintf(stderr, "Error message: %s\n", Pa_GetErrorText(pa_status));
! return;
! }
! pa_initialized = 1;
}
***************
*** 91,96 ****
if(pa_indev >= 0) {
pdi = Pa_GetDeviceInfo(pa_indev);
! if(pdi->maxInputChannels < inchans)
! inchans = pdi->maxInputChannels;
}
}
--- 89,93 ----
if(pa_indev >= 0) {
pdi = Pa_GetDeviceInfo(pa_indev);
! if(pdi->maxInputChannels < inchans) inchans = pdi->maxInputChannels;
}
}
***************
*** 100,105 ****
if(pa_outdev >= 0) {
pdo = Pa_GetDeviceInfo(pa_outdev);
! if(pdo->maxOutputChannels < outchans)
! outchans = pdo->maxOutputChannels;
}
}
--- 97,101 ----
if(pa_outdev >= 0) {
pdo = Pa_GetDeviceInfo(pa_outdev);
! if(pdo->maxOutputChannels < outchans) outchans = pdo->maxOutputChannels;
}
}
***************
*** 111,127 ****
if (inchans || outchans) {
int blocksize;
! PaStreamParameters inputParameters, outputParameters;
/* initialize input */
! inputParameters.device = pa_indev;
! inputParameters.channelCount = inchans;
! inputParameters.sampleFormat = paFloat32 | paNonInterleaved;
! inputParameters.suggestedLatency = advance * 0.001;
! inputParameters.hostApiSpecificStreamInfo = NULL;
/* initialize output */
! outputParameters.device = pa_outdev;
! outputParameters.channelCount = outchans;
! outputParameters.sampleFormat = paFloat32 | paNonInterleaved;
! outputParameters.suggestedLatency = advance * 0.001;
! outputParameters.hostApiSpecificStreamInfo = NULL;
/* set block size */
blocksize=64;
--- 107,123 ----
if (inchans || outchans) {
int blocksize;
! PaStreamParameters iparam,oparam;
/* initialize input */
! iparam.device = pa_indev;
! iparam.channelCount = inchans;
! iparam.sampleFormat = paFloat32 | paNonInterleaved;
! iparam.suggestedLatency = advance * 0.001;
! iparam.hostApiSpecificStreamInfo = NULL;
/* initialize output */
! oparam.device = pa_outdev;
! oparam.channelCount = outchans;
! oparam.sampleFormat = paFloat32 | paNonInterleaved;
! oparam.suggestedLatency = advance * 0.001;
! oparam.hostApiSpecificStreamInfo = NULL;
/* set block size */
blocksize=64;
***************
*** 138,149 ****
/* report to portaudio */
err = Pa_OpenStream(&pa_stream,
! ( (pa_indev != -1) ? &inputParameters : 0),
! ( (pa_outdev != -1) ? &outputParameters : 0),
! rate,
! pa_blocksize,
! paClipOff, /* tb: we should be faster ;-) */
! process
! /* patestCallback */, NULL);
!
if (err == paNoError) {
const PaStreamInfo *streaminfo = Pa_GetStreamInfo(pa_stream);
--- 134,140 ----
/* report to portaudio */
err = Pa_OpenStream(&pa_stream,
! (( pa_indev!=-1) ? &iparam : 0),
! ((pa_outdev!=-1) ? &oparam : 0),
! rate, pa_blocksize, paClipOff, /* tb: we should be faster ;-) */ process /* patestCallback */, NULL);
if (err == paNoError) {
const PaStreamInfo *streaminfo = Pa_GetStreamInfo(pa_stream);
***************
*** 210,219 ****
for (int i=0; (unsigned)i < frameCount / sys_dacblocksize; ++i) {
for (int j=0; j < sys_inchannels; j++) {
! t_sample * in = ((t_sample**)input)[j] + i * sys_dacblocksize;
copyvec(sys_soundin + j * sys_dacblocksize, in, sys_dacblocksize);
}
sched_tick(sys_time + sys_time_per_dsp_tick);
for (int j=0; j < sys_outchannels; j++) {
! t_sample * out = ((t_sample**)output)[j] + i * sys_dacblocksize;
copyvec(out, sys_soundout + j * sys_dacblocksize, sys_dacblocksize);
}
--- 201,210 ----
for (int i=0; (unsigned)i < frameCount / sys_dacblocksize; ++i) {
for (int j=0; j < sys_inchannels; j++) {
! t_sample *in = ((t_sample**)input)[j] + i * sys_dacblocksize;
copyvec(sys_soundin + j * sys_dacblocksize, in, sys_dacblocksize);
}
sched_tick(sys_time + sys_time_per_dsp_tick);
for (int j=0; j < sys_outchannels; j++) {
! t_sample *out = ((t_sample**)output)[j] + i * sys_dacblocksize;
copyvec(out, sys_soundout + j * sys_dacblocksize, sys_dacblocksize);
}
***************
*** 288,293 ****
if (pdi->maxInputChannels > 0 && nin < maxndev) {
PaHostApiIndex api = pdi->hostApi;
! const PaHostApiInfo * info = Pa_GetHostApiInfo (api);
! const char * apiName = info->name;
unsigned int apiNameLen = strlen(apiName);
strcpy(indevlist + nin * devdescsize, apiName);
--- 279,284 ----
if (pdi->maxInputChannels > 0 && nin < maxndev) {
PaHostApiIndex api = pdi->hostApi;
! const PaHostApiInfo *info = Pa_GetHostApiInfo(api);
! const char *apiName = info->name;
unsigned int apiNameLen = strlen(apiName);
strcpy(indevlist + nin * devdescsize, apiName);
***************
*** 298,303 ****
if (pdi->maxOutputChannels > 0 && nout < maxndev) {
PaHostApiIndex api = pdi->hostApi;
! const PaHostApiInfo * info = Pa_GetHostApiInfo (api);
! const char * apiName = info->name;
unsigned int apiNameLen = strlen(apiName);
strcpy(outdevlist + nout * devdescsize, apiName);
--- 289,294 ----
if (pdi->maxOutputChannels > 0 && nout < maxndev) {
PaHostApiIndex api = pdi->hostApi;
! const PaHostApiInfo *info = Pa_GetHostApiInfo(api);
! const char *apiName = info->name;
unsigned int apiNameLen = strlen(apiName);
strcpy(outdevlist + nout * devdescsize, apiName);
***************
*** 369,384 ****
if (pa_indev==-1 && pa_outdev==-1) {
int ret;
! PaStreamParameters inputParameters, outputParameters;
! inputParameters.device = indev;
! inputParameters.channelCount = inchans;
! inputParameters.sampleFormat = paFloat32 | paNonInterleaved;
! inputParameters.suggestedLatency = advance * 0.001;
! inputParameters.hostApiSpecificStreamInfo = NULL;
! outputParameters.device = outdev;
! outputParameters.channelCount = outchans;
! outputParameters.sampleFormat = paFloat32 | paNonInterleaved;
! outputParameters.suggestedLatency = advance * 0.001;
! outputParameters.hostApiSpecificStreamInfo = NULL;
! ret = Pa_IsFormatSupported(&inputParameters, &outputParameters, samplerate);
SETFLOAT(argv, ret == paNoError?1:0);
typedmess(pd->s_thing, selector, 1, argv);
--- 360,375 ----
if (pa_indev==-1 && pa_outdev==-1) {
int ret;
! PaStreamParameters iparam, oparam;
! iparam.device = indev;
! iparam.channelCount = inchans;
! iparam.sampleFormat = paFloat32 | paNonInterleaved;
! iparam.suggestedLatency = advance * 0.001;
! iparam.hostApiSpecificStreamInfo = NULL;
! oparam.device = outdev;
! oparam.channelCount = outchans;
! oparam.sampleFormat = paFloat32 | paNonInterleaved;
! oparam.suggestedLatency = advance * 0.001;
! oparam.hostApiSpecificStreamInfo = NULL;
! ret = Pa_IsFormatSupported(&iparam, &oparam, samplerate);
SETFLOAT(argv, ret == paNoError?1:0);
typedmess(pd->s_thing, selector, 1, argv);
More information about the Pd-cvs
mailing list