Merge branch 'master' into develop
[jack2.git] / common / JackNetAdapter.h
blob05de4632111ff32c18f885ce186609e330021824
1 /*
2 Copyright (C) 2008-2011 Romain Moret at Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #ifndef __JackNetAdapter__
21 #define __JackNetAdapter__
23 #include "JackAudioAdapterInterface.h"
24 #include "JackNetInterface.h"
26 namespace Jack
29 /*!
30 \brief Net adapter.
33 class JackNetAdapter : public JackAudioAdapterInterface,
34 public JackNetSlaveInterface,
35 public JackRunnableInterface
38 private:
40 //jack data
41 jack_client_t* fClient;
43 //transport data
44 int fLastTransportState;
45 int fLastTimebaseMaster;
47 //sample buffers
48 sample_t** fSoftCaptureBuffer;
49 sample_t** fSoftPlaybackBuffer;
51 //adapter thread
52 JackThread fThread;
54 //transport
55 void EncodeTransportData();
56 void DecodeTransportData();
58 public:
60 JackNetAdapter(jack_client_t* jack_client, jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params);
61 ~JackNetAdapter();
63 int Open();
64 int Close();
66 int SetBufferSize(jack_nframes_t buffer_size);
68 bool Init();
69 bool Execute();
71 int Read();
72 int Write();
74 int Process();
78 #endif