JackNetAdapter.h 1.64 KB
Newer Older
sletz's avatar
sletz committed
1
/*
moret's avatar
moret committed
2
Copyright (C) 2008 Romain Moret at Grame
sletz's avatar
sletz committed
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

*/

moret's avatar
moret committed
20
21
#ifndef __JackNetAdapter__
#define __JackNetAdapter__
sletz's avatar
sletz committed
22
23
24
25

#include <assert.h>
#include "JackAudioAdapterInterface.h"
#include "JackPlatformThread.h"
26
#include "JackNetInterface.h"
sletz's avatar
sletz committed
27
28
29
30

namespace Jack
{

moret's avatar
moret committed
31
32
33
    /*!
    \brief Net adapter.
    */
sletz's avatar
sletz committed
34

35
    class JackNetAdapter : public JackAudioAdapterInterface, public JackNetSlaveInterface, public JackRunnableInterface
moret's avatar
moret committed
36
    {
37
    private:
moret's avatar
moret committed
38
        //jack data
39
        net_transport_data_t fTransportData;
moret's avatar
moret committed
40

41
42
43
        //sample buffers
        sample_t** fSoftCaptureBuffer;
        sample_t** fSoftPlaybackBuffer;
moret's avatar
moret committed
44

moret's avatar
moret committed
45
        //adapter thread
46
        JackThread fThread;
moret's avatar
moret committed
47

48
    public:
sletz's avatar
sletz committed
49

50
51
        JackNetAdapter ( jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params );
        ~JackNetAdapter();
sletz's avatar
sletz committed
52

moret's avatar
moret committed
53
54
        int Open();
        int Close();
sletz's avatar
sletz committed
55

moret's avatar
moret committed
56
        int SetBufferSize ( jack_nframes_t buffer_size );
sletz's avatar
sletz committed
57

moret's avatar
moret committed
58
59
        bool Init();
        bool Execute();
moret's avatar
moret committed
60

moret's avatar
moret committed
61
62
63
        int Read();
        int Write();

moret's avatar
moret committed
64
        int Process();
65
    };
sletz's avatar
sletz committed
66
67
68
}

#endif