Esempio n. 1
0
bool ivis_init( ITunesVis* plugin, int width, int height )
{
  if ( plugin == NULL )
    return false;

  /* load imports */
  plugin->imports.main = (iTunesPluginMainMachOPtr) dlsym( plugin->handle, "iTunesPluginMainMachO" );
  if ( ! plugin->imports.main )
    return false;

  /* configure kPluginInitMessage message */
  memset( &plugin->message.u.initMessage, 0, sizeof(plugin->message.u.initMessage) );
  plugin->message.u.initMessage.majorVersion = 7;
  plugin->message.u.initMessage.minorVersion = 4;
  plugin->message.u.initMessage.appCookie    = (void*)plugin;
  plugin->message.u.initMessage.appProc      = XBMCITAppProc;

  /* send the visualizer the kPluginInitMessage */
  plugin->imports.main( kPluginInitMessage, &( plugin->message ), NULL );

  /* keep track of ref */
  plugin->main_ref = plugin->message.u.initMessage.refCon;

  /* ensure we got a visual handler */
  if ( ! plugin->imports.visual_handler )
    return false;

  /* configure kVisualPluginInitMessage message */
  memset( &plugin->visual_message.u.initMessage, 0, sizeof(plugin->visual_message.u.initMessage) );
  plugin->visual_message.u.initMessage.messageMajorVersion = kITPluginMajorMessageVersion;
  plugin->visual_message.u.initMessage.messageMinorVersion = kITPluginMinorMessageVersion;
  plugin->visual_message.u.initMessage.appCookie           = (void*)plugin;
  plugin->visual_message.u.initMessage.appProc             = XBMCITAppProc;
  plugin->visual_message.u.initMessage.appVersion.majorRev       = 7;
  plugin->visual_message.u.initMessage.appVersion.minorAndBugRev = 4;
  plugin->visual_message.u.initMessage.appVersion.stage          = finalStage;
  plugin->visual_message.u.initMessage.appVersion.nonRelRev      = 0;

  /* send the plugin the kVisualPluginInitMessage message */
  plugin->imports.visual_handler( kVisualPluginInitMessage,
                                  &( plugin->visual_message ),
                                  plugin->vis_ref );

  /* update our ref pointer */
  if ( plugin->visual_message.u.initMessage.refCon )
    plugin->vis_ref = plugin->visual_message.u.initMessage.refCon;

  /* set the render rect */
  SetRect( &(plugin->rect), 0, 0, width, height );

  /* create FFT object (use what iTunes uses for doing FFT) */
  plugin->fft_setup = create_fftsetup( 9, FFT_RADIX2 );

  return true;
}
Esempio n. 2
0
void __TFWT2D_TransformerRep::initialize(long nirows, long nicols)
{
  // first release any existing buffers and reset to bare state
  // this accommodates repeated initialization
  discard();
 
  // record user spec'd image sizes for future implanting
  m_nucols = nicols;
  m_nurows = nirows;
  m_nucols2 = nicols/2; // cached value
  
  // adjust user image sizes to next power of two size
  // for internal buffer and FFT sizes
  m_nicols = next_pow2(nicols);
  m_nirows = next_pow2(nirows);
  
  m_nicols2 = m_nicols/2;  // cached value
  
  // compute the useful log2 quantities for FFT
  m_clog2 = ilog2(m_nicols);
  m_rlog2 = ilog2(m_nirows);

  // check size limitations
  if(m_rlog2 < 3 || m_clog2 < 3)
    throw("TFWT2D_Transformer: Image size too small (each axis must be >= 5)");

  if(m_rlog2 > 8)
    throw("TFWT2D_Transformer: Row Size must be 256 or smaller");

  // get the FFT twiddles for the larger dimension
  m_setup = create_fftsetup(max(m_rlog2, m_clog2), RADIX_2);
  if(0 == m_setup)
    throw("TFWT2D_Transformer: unable to construct FFT twiddle table");
  
  // allocate our carefully aligned buffers
  // use fftw_malloc to get favorable alignment
  long tsize  = m_nicols * m_nirows;
  m_tsize2    = tsize/2;
  m_pkrnlmask = (DSPComplex*)must_alloc_floats(tsize);
  m_pinpbuf   = must_alloc_floats(tsize);
  m_poutbuf   = (DSPComplex**)create_output_buffer(tsize);
  
  // zero out the input buffer for kernel implant
  // as long as image size boundaries are respected
  // there will be no further need to pre-zero this buffer
  erase_floats(m_pinpbuf, 0, tsize);
}
Esempio n. 3
0
void *noisiness_new(t_symbol *s, short argc, t_atom *argv) {
    t_int i, j=1, band=0, oldband=0, sizeband=0;
    t_int vs = sys_getblksize(); // get vector size
    double freq=0.0f, oldfreq=0.0f;
    t_noisiness *x = (t_noisiness *)newobject(noisiness_class);
    dsp_setup((t_pxobject *)x,1); // one inlet
    x->x_outnois = floatout((t_noisiness *)x); // one outlet
    x->x_Fs = sys_getsr();
    x->BufWritePos = 0;
    x->x_noisiness = 0.0f;

    switch (argc) { // Read arguments
    case 0:
        x->BufSize = DEFBUFSIZE;
        x->x_overlap = x->BufSize/2;
        x->x_hop = x->BufSize/2;
        x->FFTSize = DEFBUFSIZE;
        x->x_window = DEFWIN;
        x->x_delay = 0;
        break;
    case 1:
        readBufSize(x,argv);
        x->x_overlap = x->BufSize/2;
        x->x_hop = x->BufSize/2;
        x->FFTSize = x->BufSize;
        x->x_window = DEFWIN;
        x->x_delay = 0;
        break;
    case 2:
        readBufSize(x,argv);
        readx_overlap(x,argv);
        x->FFTSize = x->BufSize;
        x->x_window = DEFWIN;
        x->x_delay = 0;
        break;
    case 3:
        readBufSize(x,argv);
        readx_overlap(x,argv);
        readFFTSize(x,argv);
        x->x_window = DEFWIN;
        x->x_delay = 0;
        break;
    case 4:
        readBufSize(x,argv);
        readx_overlap(x,argv);
        readFFTSize(x,argv);
        readx_window(x,argv);
        x->x_delay = 0;
        break;
    default:
        readBufSize(x,argv);
        readx_overlap(x,argv);
        readFFTSize(x,argv);
        readx_window(x,argv);
        readx_delay(x,argv);
    }

    // Just storing the name of the window
    switch(x->x_window) {
    case 0:
        strcpy(x->x_winName,"rectangular");
        break;
    case 1:
        strcpy(x->x_winName,"hanning");
        break;
    case 2:
        strcpy(x->x_winName,"hamming");
        break;
    case 3:
        strcpy(x->x_winName,"blackman62");
        break;
    case 4:
        strcpy(x->x_winName,"blackman70");
        break;
    case 5:
        strcpy(x->x_winName,"blackman74");
        break;
    case 6:
        strcpy(x->x_winName,"blackman92");
        break;
    default:
        strcpy(x->x_winName,"blackman70");
    }

    if (x->BufSize < vs) {
        post("Noisiness~: Buffer size is smaller than the vector size, %d",vs);
        x->BufSize = vs;
    } else if (x->BufSize > 65536) {
        post("Noisiness~: Maximum FFT size is 65536 samples");
        x->BufSize = 65536;
    }

    if (x->FFTSize < x->BufSize) {
        post("Noisiness~: FFT size is at least the buffer size, %d",x->BufSize);
        x->FFTSize = x->BufSize;
    }

    if ((x->FFTSize > vs) && (x->FFTSize < 128))  x->FFTSize = 128;
    else if ((x->FFTSize > 128) && (x->FFTSize < 256)) x->FFTSize = 256;
    else if ((x->FFTSize > 256) && (x->FFTSize < 512)) x->FFTSize = 512;
    else if ((x->FFTSize > 512) && (x->FFTSize < 1024)) x->FFTSize = 1024;
    else if ((x->FFTSize > 1024) && (x->FFTSize < 2048)) x->FFTSize = 2048;
    else if ((x->FFTSize > 2048) && (x->FFTSize < 4096)) x->FFTSize = 4096;
    else if ((x->FFTSize > 8192) && (x->FFTSize < 16384)) x->FFTSize = 16384;
    else if ((x->FFTSize > 16384) && (x->FFTSize < 32768)) x->FFTSize = 32768;
    else if ((x->FFTSize > 32768) && (x->FFTSize < 65536)) x->FFTSize = 65536;
    else if (x->FFTSize > 65536) {
        post("Noisiness~: Maximum FFT size is 65536 samples");
        x->FFTSize = 65536;
    }

    // Overlap case
    if (x->x_overlap > x->BufSize-vs) {
        post("Noisiness~: You can't overlap so much...");
        x->x_overlap = x->BufSize-vs;
    } else if (x->x_overlap < 1)
        x->x_overlap = 0;

    x->x_hop = x->BufSize - x->x_overlap;

    post("--- Noisiness~ ---");
    post("	Buffer size = %d",x->BufSize);
    post("	Hop size = %d",x->x_hop);
    post("	FFT size = %d",x->FFTSize);
    post("	Window type = %s",x->x_winName);
    post("	Initial delay = %d",x->x_delay);

    // Here comes the choice for altivec optimization or not...
    if (sys_optimize()) { // note that we DON'T divide the vector size by four here

#ifdef __ALTIVEC__ // More code and a new ptr so that x->BufFFT is vector aligned.
#pragma altivec_model on
        x->x_clock = clock_new(x,(method)noisiness_tick_G4); // Call altivec-optimized tick function
        post("	Using G4-optimized FFT");
        // Allocate some memory for the altivec FFT
        x->x_FFTSizeOver2 = x->FFTSize/2;
        x->x_A.realp = t_getbytes(x->x_FFTSizeOver2 * sizeof(t_float));
        x->x_A.imagp = t_getbytes(x->x_FFTSizeOver2 * sizeof(t_float));
        x->x_log2n = log2max(x->FFTSize);
        x->x_setup = create_fftsetup (x->x_log2n, 0);
#pragma altivec_model off
#else
        error("  No G4 optimization available");
#endif

    } else { // Normal tick function
        x->x_clock = clock_new(x,(method)noisiness_tick);
        x->memFFT = (t_float*) NewPtr(CMAX * x->FFTSize * sizeof(t_float)); // memory allocated for normal fft twiddle
    }
    post("");

    // Allocate memory
    x->Buf1 = (t_int*) NewPtr(x->BufSize * sizeof(t_float)); // Careful these are pointers to integers but the content is floats
    x->Buf2 = (t_int*) NewPtr(x->BufSize * sizeof(t_float));
    x->BufFFT = (t_float*) NewPtr(x->FFTSize * sizeof(t_float));
    x->WindFFT = (t_float*) NewPtr(x->BufSize * sizeof(t_float));

    if (x->x_Fs != DEFAULT_FS) {
        error("Noisiness~: WARNING !!! object set for 44.1 KHz only");
        return;
    } else {
        x->BufBark = (t_float*) NewPtr(2*NUMBAND * sizeof(t_float));
        x->BufSizeBark = (t_int*) NewPtr(NUMBAND * sizeof(t_int));
    }

    // Compute and store Windows
    if (x->x_window != Recta) {

        switch (x->x_window) {

        case Hann:
            for (i=0; i<x->BufSize; ++i)
                x->WindFFT[i] = HANNING_W(i,x->BufSize);
            break;
        case Hamm:
            for (i=0; i<x->BufSize; ++i)
                x->WindFFT[i] = HAMMING_W(i,x->BufSize);
            break;
        case Blackman62:
            for (i=0; i<x->BufSize; ++i)
                x->WindFFT[i] = BLACKMAN62_W(i,x->BufSize);
            break;
        case Blackman70:
            for (i=0; i<x->BufSize; ++i)
                x->WindFFT[i] = BLACKMAN70_W(i,x->BufSize);
            break;
        case Blackman74:
            for (i=0; i<x->BufSize; ++i)
                x->WindFFT[i] = BLACKMAN74_W(i,x->BufSize);
            break;
        case Blackman92:
            for (i=0; i<x->BufSize; ++i)
                x->WindFFT[i] = BLACKMAN92_W(i,x->BufSize);
            break;
        }
    } else {
        for (i=0; i<x->BufSize; ++i) { // Just in case
            x->WindFFT[i] = 1.0f;
        }
    }

    x->BufBark[0] = 0.0f;

    // Compute and store Bark scale
    for (i=0; i<x->FFTSize/2; i++) {
        freq = (i*x->x_Fs)/x->FFTSize;
        band = floor(13*atan(0.76*freq/1000) + 3.5*atan((freq/7500)*(freq/7500)));
        if (oldband != band) {
            x->BufBark[j] = oldfreq;
            x->BufBark[j+1] = freq;
            x->BufSizeBark[j/2] = sizeband;
            j+=2;
            sizeband = 0;
        }
        oldband = band;
        oldfreq = freq;
        sizeband++;
    }

    x->BufBark[2*NUMBAND-1] = freq;
    x->BufSizeBark[NUMBAND-1] = sizeband;

    return (x);
}
Esempio n. 4
0
void *pitch_new(t_symbol *s, short argc, t_atom *argv) {
	t_int i, j;
	t_int vs = sys_getblksize(); // get vector size
    t_pitch *x = (t_pitch *)object_alloc(pitch_class);
	if(!x){
		return NULL;
	}

    dsp_setup((t_pxobject *)x,1); // one signal inlet	
	x->x_Fs = sys_getsr();
	x->BufWritePos = 0;
	
	// From fiddle~
    x->x_histphase = 0;
    x->x_dbage = 0;
    x->x_peaked = 0;
    x->x_amplo = DEFAMPLO;
    x->x_amphi = DEFAMPHI;
    x->x_attacktime = DEFATTACKTIME;
    x->x_attackbins = 1; // real value calculated afterward
    x->x_attackthresh = DEFATTACKTHRESH;
    x->x_vibtime = DEFVIBTIME;
    x->x_vibbins = 1;	 // real value calculated afterward
    x->x_vibdepth = DEFVIBDEPTH;
    x->x_npartial = DEFNPARTIAL;
    x->x_attackvalue = 0;

	// More initializations from Fiddle~
    for (i=0; i<MAXNPITCH; i++) {
		x->x_hist[i].h_pitch = x->x_hist[i].h_noted = 0.0f;
		x->x_hist[i].h_age = 0;
		x->x_hist[i].h_wherefrom = NULL;
		
		for (j=0; j<HISTORY; j++)
	    	x->x_hist[i].h_amps[j] = x->x_hist[i].h_pitches[j] = 0.0f;
    }
        
    for (i=0; i<HISTORY; i++) 
    	x->x_dbs[i] = 0.0f;
		
	switch (argc) { // Read arguments
		case 0: 
			x->BufSize = DEFBUFSIZE;
			x->x_overlap = x->BufSize/2;
			x->x_hop = x->BufSize/2;
			x->FFTSize = DEFBUFSIZE;
			x->x_window = DEFWIN;
			x->x_delay = DEFDELAY;
			x->x_npitch = DEFNPITCH;
			x->x_npeakanal = DEFNPEAKANAL;
			x->x_npeakout = DEFNPEAKOUT;
			break;
		case 1:
			readBufSize(x,argv);
			x->x_overlap = x->BufSize/2;
			x->x_hop = x->BufSize/2;
			x->FFTSize = x->BufSize;
			x->x_window = DEFWIN;
			x->x_delay = DEFDELAY;
			x->x_npitch = DEFNPITCH;
			x->x_npeakanal = DEFNPEAKANAL;
			x->x_npeakout = DEFNPEAKOUT;
			break;
		case 2:
			readBufSize(x,argv);
			readx_overlap(x,argv);		
			x->FFTSize = x->BufSize;
			x->x_window = DEFWIN;
			x->x_delay = DEFDELAY;
			x->x_npitch = DEFNPITCH;
			x->x_npeakanal = DEFNPEAKANAL;
			x->x_npeakout = DEFNPEAKOUT;
			break;
		case 3:
			readBufSize(x,argv);
			readx_overlap(x,argv);		
			readFFTSize(x,argv);
			x->x_window = DEFWIN;
			x->x_delay = DEFDELAY;
			x->x_npitch = DEFNPITCH;
			x->x_npeakanal = DEFNPEAKANAL;
			x->x_npeakout = DEFNPEAKOUT;
			break;
		case 4:
			readBufSize(x,argv);
			readx_overlap(x,argv);		
			readFFTSize(x,argv);
			readx_window(x,argv);
			x->x_delay = DEFDELAY;
			x->x_npitch = DEFNPITCH;
			x->x_npeakanal = DEFNPEAKANAL;
			x->x_npeakout = DEFNPEAKOUT;
			break;
		case 5:
			readBufSize(x,argv);
			readx_overlap(x,argv);			
			readFFTSize(x,argv);
			readx_window(x,argv);
			readx_delay(x,argv);
			x->x_npitch = DEFNPITCH;
			x->x_npeakanal = DEFNPEAKANAL;
			x->x_npeakout = DEFNPEAKOUT;
			break;
		case 6:
			readBufSize(x,argv);
			readx_overlap(x,argv);			
			readFFTSize(x,argv);
			readx_window(x,argv);
			readx_delay(x,argv);
			readx_npitch(x,argv);
			x->x_npeakanal = DEFNPEAKANAL;
			x->x_npeakout = DEFNPEAKOUT;
			break;
		case 7:
			readBufSize(x,argv);
			readx_overlap(x,argv);			
			readFFTSize(x,argv);
			readx_window(x,argv);
			readx_delay(x,argv);
			readx_npitch(x,argv);
			readx_npeakanal(x,argv);
			x->x_npeakout = DEFNPEAKOUT;
			break;
		default:
			readBufSize(x,argv);
			readx_overlap(x,argv);			
			readFFTSize(x,argv);
			readx_window(x,argv);
			readx_delay(x,argv);
			readx_npitch(x,argv);
			readx_npeakanal(x,argv);
			readx_npeakout(x,argv);
	}		
	
	if (x->x_npeakout > x->x_npeakanal) {
		object_post((t_object *)x, "Pitch~: You can't output more peaks than you pick...");
		x->x_npeakout = x->x_npeakanal;
	}
	
	// Make an outlet for peaks out
	if (x->x_npeakout)
    	x->x_peakout = listout((t_object *)x); // one list out

	// Make an outlet for Amplitude in dB
	x->x_envout = floatout((t_object *)x);

 	// One outlet for fundamental & amplitude raw values
	if (x->x_npitch)
		x->x_pitchout = listout((t_object *)x);

 	// One outlet for MIDI & frequency cooked pitch
	x->x_noteout = listout((t_object *)x);

	// Make bang outlet for onset detection
	x->x_attackout = bangout((t_object *)x);

	// Just storing the name of the window
	switch(x->x_window) {
		case 0:
			strcpy(x->x_winName,"rectangular");
			break;
		case 1:
			strcpy(x->x_winName,"hanning");
			break;		
		case 2:
			strcpy(x->x_winName,"hamming");
			break;		
		case 3:
			strcpy(x->x_winName,"blackman62");
			break;		
		case 4:
			strcpy(x->x_winName,"blackman70");
			break;		
		case 5:
			strcpy(x->x_winName,"blackman74");
			break;		
		case 6:
			strcpy(x->x_winName,"blackman92");
			break;		
		default:
			strcpy(x->x_winName,"blackman62");
	}
	
	if (x->BufSize < vs) { 
		object_post((t_object *)x, "Pitch~: Buffer size is smaller than the vector size, %d",vs);
		x->BufSize = vs;
	} else if (x->BufSize > 65536) {
		object_post((t_object *)x, "Pitch~: Maximum FFT size is 65536 samples");
		x->BufSize = 65536;
	}
		
	if (x->FFTSize < x->BufSize) {
		object_post((t_object *)x, "Pitch~: FFT size is at least the buffer size, %d",x->BufSize);
		x->FFTSize = x->BufSize;
	}

	if ((x->FFTSize > vs) && (x->FFTSize < 128))  x->FFTSize = 128;
	else if ((x->FFTSize > 128) && (x->FFTSize < 256)) x->FFTSize = 256;
	else if ((x->FFTSize > 256) && (x->FFTSize < 512)) x->FFTSize = 512;
	else if ((x->FFTSize > 512) && (x->FFTSize < 1024)) x->FFTSize = 1024;
	else if ((x->FFTSize > 1024) && (x->FFTSize < 2048)) x->FFTSize = 2048;
	else if ((x->FFTSize > 2048) && (x->FFTSize < 4096)) x->FFTSize = 4096;
	else if ((x->FFTSize > 8192) && (x->FFTSize < 16384)) x->FFTSize = 16384;
	else if ((x->FFTSize > 16384) && (x->FFTSize < 32768)) x->FFTSize = 32768;
	else if ((x->FFTSize > 32768) && (x->FFTSize < 65536)) x->FFTSize = 65536;
	else if (x->FFTSize > 65536) {
		object_post((t_object *)x, "Pitch~: Maximum FFT size is 65536 samples");
		x->FFTSize = 65536;
	}
	
	// Overlap case
	if (x->x_overlap > x->BufSize-vs) {
		object_post((t_object *)x, "Pitch~: You can't overlap so much...");
		x->x_overlap = x->BufSize-vs;
	} else if (x->x_overlap < 1)
		x->x_overlap = 0; 

	x->x_hop = x->BufSize - x->x_overlap;
	x->x_FFTSizeOver2 = x->FFTSize/2;		

	object_post((t_object *)x, "--- Pitch~ ---");	
	object_post((t_object *)x, "	Buffer size = %d",x->BufSize);
	object_post((t_object *)x, "	Hop size = %d",x->x_hop);
	object_post((t_object *)x, "	FFT size = %d",x->FFTSize);
	object_post((t_object *)x, "	Window type = %s",x->x_winName);
	object_post((t_object *)x, "	Initial delay = %d",x->x_delay);
	object_post((t_object *)x, "	Number of pitches = %d",x->x_npitch);
	object_post((t_object *)x, "	Number of peaks to search = %d",x->x_npeakanal);
	object_post((t_object *)x, "	Number of peaks to output = %d",x->x_npeakout);

	// Here comes the choice for altivec optimization or not...
	if (sys_optimize()) { // note that we DON'T divide the vector size by four here

#ifdef __ALTIVEC__ // More code and a new ptr so that x->BufFFT is vector aligned.
#pragma altivec_model on 
		x->x_clock = clock_new(x,(method)pitch_tick_G4); // Call altivec-optimized tick function
		object_post((t_object *)x, "	Using G4-optimized FFT");	
		// Allocate some memory for the altivec FFT
		x->x_A.realp = t_getbytes(x->x_FFTSizeOver2 * sizeof(t_float));
		x->x_A.imagp = t_getbytes(x->x_FFTSizeOver2 * sizeof(t_float));
		x->x_log2n = log2max(x->FFTSize);
      	x->x_setup = create_fftsetup (x->x_log2n, 0);
    	x->x_scaleFactor = (t_float)1.0/(2.0*x->FFTSize);
#pragma altivec_model off
#else
		object_error((t_object *)x, "  No G4 optimization available");
#endif

	} else { // Normal tick function
		x->x_clock = clock_new(x,(method)pitch_tick);
		x->memFFT = (t_float*) sysmem_newptr(CMAX * x->FFTSize * sizeof(t_float)); // memory allocated for normal fft twiddle
	}
	object_post((t_object *)x, "");

	// Allocate memory
	x->Buf1 = (t_int*) sysmem_newptr(x->BufSize * sizeof(t_float)); // Careful these are pointers to integers but the content is floats
	x->Buf2 = (t_int*) sysmem_newptr(x->BufSize * sizeof(t_float));
	x->BufFFT = (t_float*) sysmem_newptr(x->FFTSize * sizeof(t_float));
	x->BufPower = (t_float*) sysmem_newptr((x->FFTSize/2) * sizeof(t_float));
	x->WindFFT = (t_float*) sysmem_newptr(x->BufSize * sizeof(t_float));
	x->peakBuf = (t_peakout*) sysmem_newptr(x->x_npeakout * sizeof(t_peakout)); // from Fiddle~
	x->histBuf = (t_float*) sysmem_newptr((x->FFTSize + BINGUARD) * sizeof(t_float)); // for Fiddle~
		
	// Compute and store Windows
	if (x->x_window != Recta) {
		
		switch (x->x_window) {

			case Hann: 	for (i=0; i<x->BufSize; ++i)
							x->WindFFT[i] = HANNING_W(i,x->BufSize);
 						break;
			case Hamm:	for (i=0; i<x->BufSize; ++i)
							x->WindFFT[i] = HAMMING_W(i,x->BufSize);
						break;
			case Blackman62: for (i=0; i<x->BufSize; ++i)
							x->WindFFT[i] = BLACKMAN62_W(i,x->BufSize);
						break;
			case Blackman70: for (i=0; i<x->BufSize; ++i)
							x->WindFFT[i] = BLACKMAN70_W(i,x->BufSize);
						break;
			case Blackman74: for (i=0; i<x->BufSize; ++i)
							x->WindFFT[i] = BLACKMAN74_W(i,x->BufSize);
						break;
			case Blackman92: for (i=0; i<x->BufSize; ++i)
							x->WindFFT[i] = BLACKMAN92_W(i,x->BufSize);
						break;
		}
	} else {
		for (i=0; i<x->BufSize; ++i) { // Just in case
			x->WindFFT[i] = 1.0f;
		}
	}
	
	// More initializations from Fiddle~
	for (i=0; i<x->x_npeakout; i++)
		x->peakBuf[i].po_freq = x->peakBuf[i].po_amp = 0.0f;
		
    return (x);
}