Főoldal | Osztályhierarchia | Osztálylista | Fájllista | Osztálytagok | Fájlelemek | Kapcsolódó lapok

wavewidget.hh

Ugrás a fájl dokumentációjához.
00001 /*
00002  * SubTimer header file
00003  *  Copyright (C) 2005 Peter Salvi
00004  *   Last modification: <2005.03.23., 16:21:13>
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00019  */
00020 
00021 #ifndef WAVE_WIDGET_HH
00022 #define WAVE_WIDGET_HH
00023 
00026 #include <alsa/asoundlib.h>
00027 
00028 #include <qdatetime.h>
00029 #include <qwidget.h>
00030 
00043 #define PAINT_FREQ 100
00044 
00045 class WaveFile;
00046 class PlayThread;
00047 class QMutex;
00048 class QTimer;
00049 
00076 class WaveWidget : public QWidget
00077 {
00078   Q_OBJECT
00079 
00080 public:
00091   WaveWidget(QWidget* parent=0, const char *name=0);
00092   ~WaveWidget();
00093 
00120   bool loadFile(QString const fname);
00121 
00136   bool isVisible(QTime const t) const;
00137 
00150   QTime startTime() const; 
00151 
00164   QTime endTime() const;
00165 
00178   void setStartTime(QTime t);
00179 
00192   void setEndTime(QTime t);
00193 
00194 public slots: 
00195 
00226   void playSelected();
00227 
00242   void stopPlayback();
00243 
00262   void setXZoom(int zoom);
00263 
00276   void setYZoom(int zoom);
00277 
00296   void scrollTo(int start);
00297 
00298 signals:
00311   void startTimeChanged(QTime *start);
00312 
00325   void endTimeChanged(QTime *end);
00326 
00345   void lengthChanged(int length);
00346 
00359   void positionChanged(int pos);
00360 
00361 protected:
00374   void customEvent(QCustomEvent *e);
00375 
00398   void mousePressEvent(QMouseEvent *e);
00399 
00416   void paintEvent(QPaintEvent *);
00417 
00418 private:
00419   int timeToPos(QTime t);
00420   
00421   WaveFile *wave_file;
00422   PlayThread *pthread;
00423   snd_pcm_t *playback_handle;
00424   QTime left, right, start_time, end_time;
00425   int xzoom, yzoom;
00426   char *playdata;
00427   size_t playsize;
00428   bool playing;
00429   double play_position;
00430   QTime play_start, play_end;
00431   QMutex *paint_lock;
00432   QTimer *paint_timer;
00433 };
00434   
00435 #endif // WAVE_WIDGET_HH

Projekt: SubTimer Készült: Wed Mar 23 22:06:54 2005 Készítette: doxygen 1.3.6