Commit 3cc22456 authored by ericlyon's avatar ericlyon

commit EL

parent 5e2f35e0
1. change all t_doubles and doubles to t_float
/* Pd 32-bit FFTease 3.0 */
1. change t_pxobject to t_object
t_object x_obj;
t_float x_f;
4. add prototypes for XXX_dsp() & XXX_perform()
void bthresher_dsp(t_bthresher *x, t_signal **sp);
t_int *bthresher_perform(t_int *w);
5. write XXX-tilde_setup
void bthresher_tilde_setup(void)
{
t_class *c;
c = class_new(gensym("bthresher~"), (t_newmethod)bthresher_new,
(t_method)bthresher_free,sizeof(t_bthresher), 0,A_GIMME,0);
CLASS_MAINSIGNALIN(c, t_bthresher, x_f);
class_addmethod(c,(t_method)bthresher_dsp,gensym("dsp"),0);
class_addmethod(c,(t_method)bthresher_mute,gensym("mute"),A_FLOAT,0);
class_addmethod(c,(t_method)bthresher_fftinfo,gensym("fftinfo"),0);
class_addmethod(c,(t_method)bthresher_oscbank,gensym("oscbank"),A_FLOAT,0);
class_addmethod(c,(t_method)bthresher_transpose,gensym("transpose"),A_FLOAT,0);
class_addmethod(c,(t_method)bthresher_synthresh,gensym("synthresh"),A_FLOAT,0);
bthresher_class = c;
fftease_announce(OBJECT_NAME);
}
6. comment out main() function
7. modify new() function:
pd_new() for object_alloc()
inlet_new(&x->x_obj, &x->x_obj.ob_pd,gensym("signal"), gensym("signal"));
outlet_new(&x->x_obj, gensym("signal"));
Make note of z_no_inplace issues
add non-signal outlets *after* signal outlets
add optional arguments
x->mybang = outlet_new(&x->x_obj, gensym("bang"));
x->m_clock = clock_new(x,(void *)sigseq_tick);
if(argc > 0){ fft->N = (int) atom_getfloatarg(0, argc, argv); }
if(argc > 1){ fft->overlap = (int) atom_getfloatarg(1, argc, argv); }
8. modify init()
kill use of obj.z_disabled
9. modify perform() function
t_int *bthresher_perform(t_int *w)
t_bthresher *x = (t_bthresher *) (w[1]);
t_float *MSPInputVector = (t_float *)(w[2]);
if( fft->bufferStatus == EQUAL_TO_MSP_VECTOR ){
memcpy(input, input + D, (Nw - D) * sizeof(t_float));
memcpy(input + (Nw - D), MSPInputVector, D * sizeof(t_float));
do_bthresher(x);
for ( j = 0; j < D; j++ ){ *MSPOutputVector++ = output[j] * mult; }
memcpy(output, output + D, (Nw-D) * sizeof(t_float));
for(j = (Nw-D); j < Nw; j++){ output[j] = 0.0; }
}
else if( fft->bufferStatus == SMALLER_THAN_MSP_VECTOR ) {
for( i = 0; i < operationRepeat; i++ ){
memcpy(input, input + D, (Nw - D) * sizeof(t_float));
memcpy(input + (Nw-D), MSPInputVector + (D*i), D * sizeof(t_float));
do_bthresher(x);
for ( j = 0; j < D; j++ ){ *MSPOutputVector++ = output[j] * mult; }
memcpy(output, output + D, (Nw-D) * sizeof(t_float));
for(j = (Nw-D); j < Nw; j++){ output[j] = 0.0; }
}
}
else if( fft->bufferStatus == BIGGER_THAN_MSP_VECTOR ) {
memcpy(internalInputVector + (operationCount * MSPVectorSize), MSPInputVector,MSPVectorSize * sizeof(t_float));
memcpy(MSPOutputVector, internalOutputVector + (operationCount * MSPVectorSize),MSPVectorSize * sizeof(t_float));
operationCount = (operationCount + 1) % operationRepeat;
if( operationCount == 0 ) {
memcpy(input, input + D, (Nw - D) * sizeof(t_float));
memcpy(input + (Nw - D), internalInputVector, D * sizeof(t_float));
do_bthresher(x);
for ( j = 0; j < D; j++ ){ internalOutputVector[j] = output[j] * mult; }
memcpy(output, output + D, (Nw - D) * sizeof(t_float));
for(j = (Nw-D); j < Nw; j++){ output[j] = 0.0; }
}
fft->operationCount = operationCount;
}
10. modify DSP method
void bthresher_dsp(t_bthresher *x, t_signal **sp)
{
int reset_required = 0;
int maxvectorsize = sys_getblksize();
int samplerate = sys_getsr();
if(!samplerate)
return;
t_fftease *fft = x->fft;
if(fft->R != samplerate || fft->MSPVectorSize != maxvectorsize || fft->initialized == 0){
reset_required = 1;
}
if(fft->MSPVectorSize != maxvectorsize){
fft->MSPVectorSize = maxvectorsize;
fftease_set_fft_buffers(fft);
}
if(fft->R != samplerate){
fft->R = samplerate;
}
if(reset_required){
bthresher_init(x);
}
if(fftease_msp_sanity_check(fft,OBJECT_NAME)) {
dsp_add(bthresher_perform, 5, x, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec);
}
}
11. Remove dsp_free from free function
12. add back any messages from attributes
13. clean up vestigial code
#N canvas 1339 110 450 300 10;
#X obj 152 234 *~ 0.05;
#X obj 152 265 dac~;
#X obj 194 194 hsl 128 15 0 1 0 0 empty empty Gain -2 -8 0 10 -262144
-1 -1 0 1;
#X floatatom 191 214 5 0 0 0 - - -, f 5;
#X obj 41 219 readsf~;
#X obj 41 163 openpanel;
#X msg 41 188 open \$1;
#X msg 41 136 bang;
#N canvas 404 737 450 300 showsync 0;
#X obj 205 102 inlet~;
#X obj 205 159 snapshot~;
#X obj 325 121 metro 50;
#X obj 325 89 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X obj 325 22 loadbang;
#X msg 325 57 1;
#X obj 205 225 outlet;
#X connect 0 0 1 0;
#X connect 1 0 6 0;
#X connect 2 0 1 0;
#X connect 3 0 2 0;
#X connect 4 0 5 0;
#X connect 5 0 3 0;
#X restore 42 81 pd showsync;
#X obj 342 125 vu 15 120 empty empty -1 -8 0 10 -66577 -1 1 0;
#N canvas 0 22 450 300 meter 0;
#X obj 110 164 snapshot~;
#X obj 126 114 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X floatatom 110 187 5 0 0 0 - - -, f 5;
#X obj 110 91 env~ 1024;
#X obj 126 140 metro 100;
#X obj 109 211 - 100;
#X obj 231 46 loadbang;
#X msg 231 71 1;
#X obj 109 246 outlet;
#X obj 110 51 inlet~;
#X connect 0 0 2 0;
#X connect 1 0 4 0;
#X connect 2 0 5 0;
#X connect 3 0 0 0;
#X connect 4 0 0 0;
#X connect 5 0 8 0;
#X connect 6 0 7 0;
#X connect 7 0 1 0;
#X connect 9 0 3 0;
#X restore 341 82 pd meter;
#X floatatom 42 106 5 0 0 0 - - -, f 5;
#X obj 198 67 phasor~ 261;
#X obj 198 94 -~ 0.5;
#X msg 109 188 1;
#X text 77 140 load sf;
#X connect 0 0 1 0;
#X connect 0 0 1 1;
#X connect 2 0 3 0;
#X connect 3 0 0 1;
#X connect 5 0 6 0;
#X connect 6 0 4 0;
#X connect 7 0 5 0;
#X connect 8 0 11 0;
#X connect 10 0 9 0;
#X connect 12 0 13 0;
#X connect 14 0 4 0;
#N canvas 862 639 490 378 10;
#X obj 144 173 pvgrain~;
#X obj 53 121 readsf~;
#X obj 53 65 openpanel;
#X msg 53 90 open \$1;
#X msg 53 38 bang;
#X msg 121 90 1;
#X text 89 42 load sf;
#X obj 53 213 *~;
#X floatatom 68 180 5 0 0 0 - - -, f 5;
#X obj 51 305 *~ 0.05;
#X obj 51 336 dac~;
#X obj 93 265 hsl 128 15 0 1 0 0 empty empty Gain -2 -8 0 10 -262144
-1 -1 0 1;
#X floatatom 90 285 5 0 0 0 - - -, f 5;
#N canvas 0 22 450 278 (subpatch) 0;
#X array pf 100 float 3;
#A 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0;
#X coords 0 1 99 -1 200 140 1;
#X restore 255 28 graph;
#X obj 275 273 soundfiler;
#X msg 275 242 read ./sound/Piano.aif pf;
#X msg 260 200 read sound/Piano.aif pf;
#X connect 1 0 0 0;
#X connect 1 0 7 0;
#X connect 2 0 3 0;
#X connect 3 0 1 0;
#X connect 4 0 2 0;
#X connect 5 0 1 0;
#X connect 7 0 9 0;
#X connect 8 0 7 1;
#X connect 9 0 10 0;
#X connect 9 0 10 1;
#X connect 11 0 12 0;
#X connect 12 0 9 1;
#X connect 15 0 14 0;
#X connect 16 0 14 0;
361000 * 0.03
(
post("set ");
30.do({|i| post("$" ++ (i+1) + " ")});
"";
)
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment