view src/Analyser.h @ 128:06f9caf5928d

Initial hack for switching visibility & audibility of layers on and off. This doesn't work well.
author Chris Cannam
date Thu, 09 Jan 2014 14:05:20 +0000
parents 4db051a704b2
children 2abff42be385
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */

/*
    Tony
    An intonation analysis and annotation tool
    Centre for Digital Music, Queen Mary, University of London.
    This file copyright 2006-2012 Chris Cannam and QMUL.
    
    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 ANALYSER_H
#define ANALYSER_H

#include <QObject>

#include <map>

class WaveFileModel;
class Pane;
class PaneStack;
class Document;
class Layer;
class TimeValueLayer;
class Layer;

class Analyser : public QObject
{
    Q_OBJECT

public:
    Analyser();
    virtual ~Analyser();

    void newFileLoaded(Document *newDocument, WaveFileModel *model,
		       PaneStack *paneStack, Pane *pane);
		       
    void setIntelligentActions(bool);

    enum Component {
        Audio,
        PitchTrack,
        Notes,
    };

    bool isVisible(Component c) const;
    void setVisible(Component c, bool v);

    bool isAudible(Component c) const;
    void setAudible(Component c, bool v);

    void cycleStatus(Component c) {
        if (isVisible(c)) {
            if (isAudible(c)) {
                setVisible(c, false);
                setAudible(c, false);
            } else {
                setAudible(c, true);
            }
        } else {
            setVisible(c, true);
            setAudible(c, false);
        }
    }

signals:
    void layersChanged();

protected:
    Document *m_document;
    WaveFileModel *m_fileModel;
    Pane *m_pane;
    mutable std::map<Component, Layer *> m_layers;
};

#endif