Jack2: JackAlsaDriver.h Source File

Jack2 1.9.12

JackAlsaDriver.h
1 /*
2 Copyright (C) 2001 Paul Davis
3 Copyright (C) 2004 Grame
4
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.
9
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.
14
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.
18
19 */
20
21 #ifndef __JackAlsaDriver__
22 #define __JackAlsaDriver__
23
24 #include "JackAudioDriver.h"
25 #include "JackThreadedDriver.h"
26 #include "JackTime.h"
27 #include "alsa_driver.h"
28
29 namespace Jack
30 {
31
36 class JackAlsaDriver : public JackAudioDriver
37 {
38
39 private:
40
41 jack_driver_t* fDriver;
42
43 void UpdateLatencies();
44
45 public:
46
47 JackAlsaDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
48 : JackAudioDriver(name, alias, engine, table),fDriver(NULL)
49 {}
50 virtual ~JackAlsaDriver()
51 {}
52
53 int Open(jack_nframes_t buffer_size,
54 jack_nframes_t user_nperiods,
55 jack_nframes_t samplerate,
56 bool hw_monitoring,
57 bool hw_metering,
58 bool capturing,
59 bool playing,
60 DitherAlgorithm dither,
61 bool soft_mode,
62 bool monitor,
63 int inchannels,
64 int outchannels,
65 bool shorts_first,
66 const char* capture_driver_name,
67 const char* playback_driver_name,
68 jack_nframes_t capture_latency,
69 jack_nframes_t playback_latency,
70 const char* midi_driver_name);
71
72 int Close();
73 int Attach();
74 int Detach();
75
76 int Start();
77 int Stop();
78
79 int Read();
80 int Write();
81
82 // BufferSize can be changed
83 bool IsFixedBufferSize()
84 {
85 return false;
86 }
87
88 int SetBufferSize(jack_nframes_t buffer_size);
89
90 void ReadInputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nread);
91 void MonitorInputAux();
92 void ClearOutputAux();
93 void WriteOutputAux(jack_nframes_t orig_nframes, snd_pcm_sframes_t contiguous, snd_pcm_sframes_t nwritten);
94 void SetTimetAux(jack_time_t time);
95
96 // JACK API emulation for the midi driver
97 int is_realtime() const;
98 int create_thread(pthread_t *thread, int prio, int rt, void *(*start_func)(void*), void *arg);
99
100 jack_port_id_t port_register(const char *port_name, const char *port_type, unsigned long flags, unsigned long buffer_size);
101 int port_unregister(jack_port_id_t port_index);
102 void* port_get_buffer(int port, jack_nframes_t nframes);
103 int port_set_alias(int port, const char* name);
104
105 jack_nframes_t get_sample_rate() const;
106 jack_nframes_t frame_time() const;
107 jack_nframes_t last_frame_time() const;
108 };
109
110 } // end of namespace
111
112 #endif
Jack::JackPosixSemaphore
Inter process synchronization using POSIX semaphore.
Definition: JackPosixSemaphore.h:36
_jack_driver
Definition: driver.h:87
Jack::JackAudioDriver
The base class for audio drivers: drivers with audio ports.
Definition: JackAudioDriver.h:42
Jack::JackAlsaDriver
The ALSA driver.
Definition: JackAlsaDriver.h:36
Jack::JackLockedEngine
Locked Engine, access to methods is serialized using a mutex.
Definition: JackLockedEngine.h:78