annotate widgets/Fader.h @ 1:ab83c415a6cd

* Backed out partially complete changes to make the spectrogram only store results up to the requested max frequency. The speed improvement was minimal at the expense of annoyance when changing frequency limit, and although it did save memory, it wasn't yet reliable and fixing it is not a high enough priority.
author Chris Cannam
date Tue, 10 Jan 2006 17:04:02 +0000
parents 2a4f26e85b4c
children 37b110168acf
rev   line source
Chris@0 1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */
Chris@0 2
Chris@0 3 /*
Chris@0 4 A waveform viewer and audio annotation editor.
Chris@0 5 Chris Cannam, Queen Mary University of London, 2005
Chris@0 6
Chris@0 7 This is experimental software. Not for distribution.
Chris@0 8 */
Chris@0 9
Chris@0 10 #ifndef FADER_H
Chris@0 11 #define FADER_H
Chris@0 12
Chris@0 13 /**
Chris@0 14 * Horizontal audio fader and meter widget.
Chris@0 15 * Based on the vertical fader and meter widget from:
Chris@0 16 *
Chris@0 17 * Hydrogen
Chris@0 18 * Copyright(c) 2002-2005 by Alex >Comix< Cominu [comix@users.sourceforge.net]
Chris@0 19 *
Chris@0 20 * http://www.hydrogen-music.org
Chris@0 21 *
Chris@0 22 * This program is free software; you can redistribute it and/or modify
Chris@0 23 * it under the terms of the GNU General Public License as published by
Chris@0 24 * the Free Software Foundation; either version 2 of the License, or
Chris@0 25 * (at your option) any later version.
Chris@0 26 *
Chris@0 27 * This program is distributed in the hope that it will be useful,
Chris@0 28 * but WITHOUT ANY WARRANTY, without even the implied warranty of
Chris@0 29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
Chris@0 30 * GNU General Public License for more details.
Chris@0 31 *
Chris@0 32 * You should have received a copy of the GNU General Public License
Chris@0 33 * along with this program; if not, write to the Free Software
Chris@0 34 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Chris@0 35 *
Chris@0 36 * $Id: Fader.h,v 1.14 2005/08/10 08:03:30 comix Exp $
Chris@0 37 */
Chris@0 38
Chris@0 39
Chris@0 40 #include <string>
Chris@0 41 #include <iostream>
Chris@0 42
Chris@0 43 #include <QWidget>
Chris@0 44 #include <QPixmap>
Chris@0 45 #include <QMouseEvent>
Chris@0 46 #include <QWheelEvent>
Chris@0 47 #include <QPaintEvent>
Chris@0 48
Chris@0 49 class Fader : public QWidget
Chris@0 50 {
Chris@0 51 Q_OBJECT
Chris@0 52
Chris@0 53 public:
Chris@0 54 Fader(QWidget *parent, bool withoutKnob = false);
Chris@0 55 ~Fader();
Chris@0 56
Chris@0 57 void setValue(float newValue);
Chris@0 58 float getValue();
Chris@0 59
Chris@0 60 void setPeakLeft(float);
Chris@0 61 float getPeakLeft() { return m_peakLeft; }
Chris@0 62
Chris@0 63 void setPeakRight(float);
Chris@0 64 float getPeakRight() { return m_peakRight; }
Chris@0 65
Chris@0 66 virtual void mousePressEvent(QMouseEvent *ev);
Chris@0 67 virtual void mouseDoubleClickEvent(QMouseEvent *ev);
Chris@0 68 virtual void mouseMoveEvent(QMouseEvent *ev);
Chris@0 69 virtual void wheelEvent( QWheelEvent *ev );
Chris@0 70 virtual void paintEvent(QPaintEvent *ev);
Chris@0 71
Chris@0 72 signals:
Chris@0 73 void valueChanged(float); // 0.0 -> 1.0
Chris@0 74
Chris@0 75 private:
Chris@0 76 bool m_withoutKnob;
Chris@0 77 float m_value;
Chris@0 78 float m_peakLeft;
Chris@0 79 float m_peakRight;
Chris@0 80
Chris@0 81 QPixmap m_back;
Chris@0 82 QPixmap m_leds;
Chris@0 83 QPixmap m_knob;
Chris@0 84 QPixmap m_clip;
Chris@0 85 };
Chris@0 86
Chris@0 87 #endif