Init engine fields, cleanup.
[jack2.git] / common / JackThreadedDriver.h
blobf7bbf2d06d12fcff35c801fe17c98d8fa1b1fd0a
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004-2008 Grame
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __JackThreadedDriver__
22 #define __JackThreadedDriver__
24 #include "JackDriver.h"
25 #include "JackPlatformPlug.h"
27 namespace Jack
30 /*!
31 \brief The base class for threaded drivers. Threaded drivers are used with blocking devices.
34 class SERVER_EXPORT JackThreadedDriver : public JackDriverClientInterface, public JackRunnableInterface
37 protected:
39 JackThread fThread;
40 JackDriver* fDriver;
42 public:
44 JackThreadedDriver(JackDriver* driver);
45 virtual ~JackThreadedDriver();
47 virtual int Open();
49 virtual int Open (bool capturing,
50 bool playing,
51 int inchannels,
52 int outchannels,
53 bool monitor,
54 const char* capture_driver_name,
55 const char* playback_driver_name,
56 jack_nframes_t capture_latency,
57 jack_nframes_t playback_latency)
59 return -1;
61 virtual int Open(jack_nframes_t buffer_size,
62 jack_nframes_t samplerate,
63 bool capturing,
64 bool playing,
65 int inchannels,
66 int outchannels,
67 bool monitor,
68 const char* capture_driver_name,
69 const char* playback_driver_name,
70 jack_nframes_t capture_latency,
71 jack_nframes_t playback_latency);
72 virtual int Close();
74 virtual int Process();
75 virtual int ProcessNull();
77 virtual int Attach();
78 virtual int Detach();
80 virtual int Read();
81 virtual int Write();
83 virtual int Start();
84 virtual int Stop();
86 virtual bool IsFixedBufferSize();
87 virtual int SetBufferSize(jack_nframes_t buffer_size);
88 virtual int SetSampleRate(jack_nframes_t sample_rate);
90 virtual void SetMaster(bool onoff);
91 virtual bool GetMaster();
92 virtual void AddSlave(JackDriverInterface* slave);
93 virtual void RemoveSlave(JackDriverInterface* slave);
94 virtual std::list<JackDriverInterface*> GetSlaves();
95 virtual int ProcessSlaves();
97 virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2);
98 virtual JackClientControl* GetClientControl() const;
99 virtual bool IsRealTime() const;
101 // JackRunnableInterface interface
102 virtual bool Execute();
103 virtual bool Init();
107 } // end of namespace
110 #endif