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

playthread.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:16:55>
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 PLAYTHREAD_HH
00022 #define PLAYTHREAD_HH
00023 
00026 #include <alsa/asoundlib.h>
00027 
00028 #include <qevent.h>
00029 #include <qobject.h>
00030 #include <qthread.h>
00031 
00032 #include "common.hh"
00033 
00046 #define PCM_CHUNK_SIZE 4096
00047 
00060 class PlayThread : public QThread, public QObject
00061 {
00062 public:
00075   enum ThreadEvents { 
00085     Stop = 2000, 
00086 
00096     Finished
00097   };
00098 
00129   void run();
00130 
00151   void initThread(QWidget *obj, snd_pcm_t *handle, 
00152                   QMutex *mutex, double *playpos);
00153 
00170   void loadData(char *ptr, size_t size, WaveFormat f);
00171 
00172 protected:
00191   void customEvent(QCustomEvent *e);
00192 
00193 private:
00194   QWidget *parent;
00195   snd_pcm_t *pcm_handle;
00196   QMutex *pos_lock;
00197   double *play_position;
00198   char *data;
00199   size_t datasize;
00200   WaveFormat format;
00201   bool stop_now;
00202 };
00203 
00204 #endif // PLAYTHREAD_HH

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