Пример #1
0
void ckvdTileGrabber::draw()
{
    ofPushStyle();
    
    if (isFocused())
    {
        ofSetColor(255, 255, 100);
        drawCornerTickBox(x - width/2, y - height/2, width, height, 5);
        ofSetColor(60, 60, 60);
        drawCornerTickBox(x - width/2, y - height/2, width, height, 1);
        ofSetColor(255, 255, 100);
    }
    else
    {
        ofSetColor(255, 255, 255);
        drawCornerTickBox(x - width/2, y - height/2, width, height, 1);
    }

    int r = (width + height) / 5;
    int d = 10;
    float c = cos((270 + _fixture.getRotation()) * pi/180.0);
    float s = sin((270 + _fixture.getRotation()) * pi/180.0);
    ofLine((int)floor(x + r * c), int(floor(y + r * s)), int(floor(x + (r + d) * c)), int(floor(y + (r + d) * s)));
    
    if (theApp()->getGrabberFont())
    {
        ostringstream ss;
        ss << "#" << getParameterInt("SUPPLY") << " " << _fixture.getName();
        ofTrueTypeFont* pFont = theApp()->getGrabberFont();
        pFont->drawString(ss.str(), x - pFont->stringWidth(ss.str())/2, y + pFont->stringHeight(ss.str())/2);
    }
    
    ofPopStyle();
}
bool MzSpectrogramFFTW::initialise(size_t channels, size_t stepsize, 
      size_t blocksize) {

   if (channels < getMinChannelCount() || channels > getMaxChannelCount()) {
      return false;
   }

   // step size and block size should never be zero
   if (stepsize <= 0 || blocksize <= 0) {
      return false;
   }

   setChannelCount(channels);
   setBlockSize(blocksize);
   setStepSize(stepsize);

   mz_minbin = getParameterInt("minbin");
   mz_maxbin = getParameterInt("maxbin");

   if (mz_minbin >= getBlockSize()/2) { mz_minbin = getBlockSize()/2-1; }
   if (mz_maxbin >= getBlockSize()/2) { mz_maxbin = getBlockSize()/2-1; }
   if (mz_maxbin <  0)                { mz_maxbin = getBlockSize()/2-1; }
   if (mz_maxbin <  mz_minbin)        { std::swap(mz_minbin, mz_maxbin); }

   // The signal size/transform size are equivalent for this
   // plugin but the FFTW can handle any size transform.
   // If the size of the transform is a multiple of small
   // prime numbers the FFT will be used, otherwise it will
   // be slow (when block size=1021 for example).

   mz_transformer.setSize(getBlockSize());
   delete [] mz_wind_buff;
   mz_wind_buff = new double[getBlockSize()];
   makeHannWindow(mz_wind_buff, getBlockSize());

   return true;
}