view base/FFTFileCache.h @ 89:6a1803d578e0

added ogg, fishsound, rdf libraries to deploy script
author Martin Gasser
date Wed, 03 May 2006 11:15:46 +0000
parents 024d4a71f5bf
children c4e163f911dd
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */

/*
    Sonic Visualiser
    An audio file viewer and annotation editor.
    Centre for Digital Music, Queen Mary, University of London.
    This file copyright 2006 Chris Cannam.
    
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
    published by the Free Software Foundation; either version 2 of the
    License, or (at your option) any later version.  See the file
    COPYING included with this distribution for more information.
*/

#ifndef _FFT_FILE_CACHE_H_
#define _FFT_FILE_CACHE_H_

#include "FFTCache.h"

class MatrixFileCache;

class FFTFileCache : public FFTCacheBase
{
public:
    //!!!
    // Initially, make this take a string for the filename,
    // and make the spectrogram layer have two, one for the main
    // thread and one for the fill thread, one RO and one RW, both
    // using the same string based off spectrogram layer address
    // or export ID.
    // Subsequently factor out into reader and writer classes?
    // Make take arguments to ctor describing FFT parameters and
    // calculate its own string and eventually do its own FFT as
    // well.  Intention is to make it able ultimately to write
    // its own cache so it can do it in the background while e.g.
    // plugins read from it -- need the reader thread to be able
    // to block waiting for the writer thread as appropriate.

    FFTFileCache();
    virtual ~FFTFileCache();

    virtual size_t getWidth() const;
    virtual size_t getHeight() const;
	
    virtual void resize(size_t width, size_t height);
    virtual void reset(); // zero-fill or 1-fill as appropriate without changing size
	
    virtual float getMagnitudeAt(size_t x, size_t y) const;
    virtual float getNormalizedMagnitudeAt(size_t x, size_t y) const;
    virtual float getPhaseAt(size_t x, size_t y) const;

    virtual bool isLocalPeak(size_t x, size_t y) const;
    virtual bool isOverThreshold(size_t x, size_t y, float threshold) const;

    virtual void setNormalizationFactor(size_t x, float factor);
    virtual void setMagnitudeAt(size_t x, size_t y, float mag);
    virtual void setNormalizedMagnitudeAt(size_t x, size_t y, float norm);
    virtual void setPhaseAt(size_t x, size_t y, float phase);

    virtual QColor getColour(unsigned char index) const;
    virtual void setColour(unsigned char index, QColor colour);

protected:
    size_t m_height;
    MatrixFileCache *m_mfc;
};

#endif