summaryrefslogtreecommitdiff
path: root/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.h
blob: 430462a7f07e32a8943d8d4d778a755436f8e712 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
$NetBSD: patch-netbsd_sun_JackSunAdapter.h,v 1.1 2021/09/08 19:19:20 nia Exp $

Add NetBSD support.

--- netbsd/sun/JackSunAdapter.h.orig	2021-09-08 13:51:19.686313010 +0000
+++ netbsd/sun/JackSunAdapter.h
@@ -0,0 +1,113 @@
+/*
+Copyright (C) 2008 Grame & RTL 2008
+
+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.
+
+*/
+
+#ifndef __JackSunAdapter__
+#define __JackSunAdapter__
+
+#include <math.h>
+#include <limits.h>
+#include <assert.h>
+#include "JackAudioAdapterInterface.h"
+#include "JackPlatformPlug.h"
+#include "JackError.h"
+#include "jack.h"
+#include "jslist.h"
+
+namespace Jack
+{
+
+typedef jack_default_audio_sample_t jack_sample_t;
+
+#define SUN_DRIVER_DEF_DEV	"/dev/audio"
+#define SUN_DRIVER_DEF_FS	48000
+#define SUN_DRIVER_DEF_BLKSIZE	1024
+#define SUN_DRIVER_DEF_BITS	16
+#define SUN_DRIVER_DEF_INS	2
+#define SUN_DRIVER_DEF_OUTS	2
+
+/*!
+\brief The Sun adapter.
+*/
+
+class JackSunAdapter : public JackAudioAdapterInterface, public JackRunnableInterface
+{
+
+    enum { kRead = 1, kWrite = 2, kReadWrite = 3 };
+
+    private:
+
+        JackThread fThread;
+
+        char fCaptureDriverName[JACK_CLIENT_NAME_SIZE+1];
+        char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE+1];
+
+        int fInFD;
+        int fOutFD;
+
+        int fPrecision;
+        int	fRWMode;
+
+        unsigned int fInputBufferSize;
+        unsigned int fOutputBufferSize;
+
+        void* fInputBuffer;
+        void* fOutputBuffer;
+
+        float** fInputSampleBuffer;
+        float** fOutputSampleBuffer;
+
+        int OpenInput();
+        int OpenOutput();
+        void CloseAux();
+        void DisplayDeviceInfo();
+
+    public:
+
+        JackSunAdapter(jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params);
+        ~JackSunAdapter()
+        {}
+
+        int Open();
+        int Close();
+
+        int Read();
+        int Write();
+
+        int SetBufferSize(jack_nframes_t buffer_size);
+
+        bool Execute();
+};
+
+}
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+#include "JackCompilerDeps.h"
+#include "driver_interface.h"
+
+SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif