[PD-dev] Re: setting the sample rate from an external (Pontus Nyman)

Kjetil Svalastog Matheussen k.s.matheussen at notam02.no
Tue Aug 3 13:39:37 CEST 2004


Pontus Nyman:
> 
> Hi all.
> 
> I have one short question. Is there a way to set the sample rate of the 
> audio device from an external?
> 

I think so. If you look at the source for k_jack~ on sourceforge,
I close and open audio to be able to change the number of input
and output channels. And the function to open audio includes a parameter
to set the sample rate. This is code from k_jack~:

static void set_pd_channels(int inc_ins,int inc_outs){
  int num_recs=sys_get_inchannels();
  int num_plays=sys_get_outchannels();

  int t1[1]={0};
  int t2[1]={0};
  int t3[1]={num_recs+inc_ins};
  int t4[1]={num_plays+inc_outs};
  sys_close_audio();
  sys_open_audio(1,t1,
 1,t3,
 1,t2,
 1,t4,
 sys_getsr(),sys_schedadvance/1000,1);
}



Note that although the function works now, I don't know how long its
going to last.



-- 




More information about the Pd-dev mailing list