audioctl.h

00001 /***************************************************************************
00002  *
00003  *   ::::_audioeditor_::::
00004  *   a simple multitrack audio editor
00005  *
00006  *   audioctl
00007  *   header file
00008  *
00009  *   begin                : Jan 2006
00010  *   copyright            : (C) 2006 by Georg Holzmann
00011  *   email                : grh@mur.at
00012  *
00013  *   This program is free software; you can redistribute it and/or modify
00014  *   it under the terms of the GNU General Public License as published by
00015  *   the Free Software Foundation; either version 2 of the License, or
00016  *   (at your option) any later version.
00017  *
00018  ***************************************************************************/
00019 
00020 #ifndef AUDIOCTL_H__
00021 #define AUDIOCTL_H__
00022 
00023 #include <QObject>
00024 #include <QReadWriteLock>
00025 #include "globaldefines.h"
00026 #include "portaudio.h"
00027 
00028 class MutexPos;
00029 
00050 class AudioCtl : public QObject
00051 {
00052   Q_OBJECT
00053   
00054   public:
00055     AudioCtl();
00056     virtual ~AudioCtl();
00057     
00058   public slots:
00059   
00065     void play(Position cursor=0);
00066     
00071     void pause();
00072     
00074     void stop();
00075     
00084     void registerTrack(PortAudioCallback *callback);
00085     
00094     void registerMasterFX(PortAudioCallback *callback);
00095     
00096   signals:
00097     
00104     void positionChanged(Position new_position);
00105     
00106   protected:
00107     
00114     void openPAStream(int samplerate = DEFAULT_SAMPLERATE,
00115                       int bufsize = DEFAULT_BUFSIZE);
00116     
00118     void closePAStream();
00119     
00120   private:
00121     
00147     static int mainAudioCallback(void *inputBuffer, void *outputBuffer,
00148                       unsigned long framesPerBuffer,
00149                       PaTimestamp outTime, void *userData );
00150     
00152     static MutexPos m_position;
00153     
00155     static PortAudioCallback *m_track_callbacks;
00156     static QReadWriteLock m_track_lock;
00157     
00159     static PortAudioCallback *m_masterFX_callbacks;
00160     static QReadWriteLock m_masterFX_lock;
00161     
00163     static PortAudioStream *m_stream;
00164     
00166     static PaError m_err;
00167     
00169     static bool m_got_hardware;
00170     
00172     static int m_instances;
00173 };
00174 
00175 #endif // AUDIOCTL_H__

Generated on Fri Jul 6 12:38:40 2007 for audioeditor.kdevelop by  doxygen 1.5.2