Jack2  1.9.10
JackThreadedDriver.h
00001 /*
00002  Copyright (C) 2001 Paul Davis
00003  Copyright (C) 2004-2008 Grame
00004 
00005  This program is free software; you can redistribute it and/or modify
00006  it under the terms of the GNU General Public License as published by
00007  the Free Software Foundation; either version 2 of the License, or
00008  (at your option) any later version.
00009 
00010  This program is distributed in the hope that it will be useful,
00011  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  GNU General Public License for more details.
00014 
00015  You should have received a copy of the GNU General Public License
00016  along with this program; if not, write to the Free Software
00017  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019 */
00020 
00021 #ifndef __JackThreadedDriver__
00022 #define __JackThreadedDriver__
00023 
00024 #include "JackDriver.h"
00025 #include "JackPlatformPlug.h"
00026 
00027 namespace Jack
00028 {
00029 
00034 class SERVER_EXPORT JackThreadedDriver : public JackDriverClientInterface, public JackRunnableInterface
00035 {
00036 
00037     protected:
00038 
00039         JackThread fThread;
00040         JackDriver* fDriver;
00041 
00042         void SetRealTime();
00043 
00044     public:
00045 
00046         JackThreadedDriver(JackDriver* driver);
00047         virtual ~JackThreadedDriver();
00048 
00049         virtual int Open();
00050         virtual int Open(jack_nframes_t buffer_size,
00051                          jack_nframes_t samplerate,
00052                          bool capturing,
00053                          bool playing,
00054                          int inchannels,
00055                          int outchannels,
00056                          bool monitor,
00057                          const char* capture_driver_name,
00058                          const char* playback_driver_name,
00059                          jack_nframes_t capture_latency,
00060                          jack_nframes_t playback_latency);
00061         virtual int Close();
00062 
00063         virtual int Process();
00064 
00065         virtual int Attach();
00066         virtual int Detach();
00067 
00068         virtual int Read();
00069         virtual int Write();
00070 
00071         virtual int Start();
00072         virtual int Stop();
00073 
00074         virtual bool IsFixedBufferSize();
00075         virtual int SetBufferSize(jack_nframes_t buffer_size);
00076         virtual int SetSampleRate(jack_nframes_t sample_rate);
00077 
00078         virtual void SetMaster(bool onoff);
00079         virtual bool GetMaster();
00080 
00081         virtual void AddSlave(JackDriverInterface* slave);
00082         virtual void RemoveSlave(JackDriverInterface* slave);
00083 
00084         virtual std::list<JackDriverInterface*> GetSlaves();
00085 
00086         virtual int ProcessReadSlaves();
00087         virtual int ProcessWriteSlaves();
00088 
00089         virtual int ProcessRead();
00090         virtual int ProcessWrite();
00091 
00092         virtual int ProcessReadSync();
00093         virtual int ProcessWriteSync();
00094 
00095         virtual int ProcessReadAsync();
00096         virtual int ProcessWriteAsync();
00097 
00098         virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
00099         virtual JackClientControl* GetClientControl() const;
00100         virtual bool IsRealTime() const;
00101         virtual bool IsRunning() const;
00102 
00103         // JackRunnableInterface interface
00104         virtual bool Execute();
00105         virtual bool Init();
00106 
00107 };
00108 
00109 } // end of namespace
00110 
00111 
00112 #endif