Jack2: JackALSARawMidiDriver.h Source File

Jack2 1.9.12

JackALSARawMidiDriver.h
1 /*
2 Copyright (C) 2011 Devin Anderson
3
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.
8
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.
13
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.
17
18 */
19
20 #ifndef __JackALSARawMidiDriver__
21 #define __JackALSARawMidiDriver__
22
23 #include <vector>
24
25 #include <alsa/asoundlib.h>
26 #include <poll.h>
27
28 #include "JackALSARawMidiInputPort.h"
29 #include "JackALSARawMidiOutputPort.h"
30 #include "JackMidiDriver.h"
31 #include "JackThread.h"
32
33 namespace Jack {
34
35 class JackALSARawMidiDriver:
36 public JackMidiDriver, public JackRunnableInterface {
37
38 private:
39
40 int fds[2];
41 JackALSARawMidiInputPort **input_ports;
42 JackALSARawMidiOutputPort **output_ports;
43 jack_nframes_t *output_port_timeouts;
44 nfds_t poll_fd_count;
45 struct pollfd *poll_fds;
46 JackThread *thread;
47
48 void
49 FreeDeviceInfo(std::vector<snd_rawmidi_info_t *> *in_info_list,
50 std::vector<snd_rawmidi_info_t *> *out_info_list);
51
52 void
53 GetDeviceInfo(snd_ctl_t *control, snd_rawmidi_info_t *info,
54 std::vector<snd_rawmidi_info_t *> *info_list);
55
56 void
57 HandleALSAError(const char *driver_func, const char *alsa_func,
58 int code);
59
60 public:
61
62 JackALSARawMidiDriver(const char *name, const char *alias,
63 JackLockedEngine *engine, JackSynchro *table);
64 ~JackALSARawMidiDriver();
65
66 int
67 Attach();
68
69 int
70 Close();
71
72 bool
73 Execute();
74
75 bool
76 Init();
77
78 int
79 Open(bool capturing, bool playing, int in_channels, int out_channels,
80 bool monitoring, const char *capture_driver_name,
81 const char *playback_driver_name, jack_nframes_t capture_latency,
82 jack_nframes_t playback_latency);
83
84 int
85 Read();
86
87 int
88 Start();
89
90 int
91 Stop();
92
93 int
94 Write();
95
96 };
97
98 }
99
100 #endif
Jack::JackALSARawMidiInputPort
Definition: JackALSARawMidiInputPort.h:31
Jack::JackMidiDriver
The base class for MIDI drivers: drivers with MIDI ports.
Definition: JackMidiDriver.h:39
Jack::JackALSARawMidiDriver
Definition: JackALSARawMidiDriver.h:35
Jack
Definition: JackAC3Encoder.cpp:30
Jack::JackLockedEngine
Locked Engine, access to methods is serialized using a mutex.
Definition: JackLockedEngine.h:78
Jack::JackRunnableInterface
The base class for runnable objects, that have an Init and Execute method to be called in a threa...
Definition: JackThread.h:34
Jack::JackPosixSemaphore
Inter process synchronization using POSIX semaphore.
Definition: JackPosixSemaphore.h:36
Jack::JackALSARawMidiDriver::Init
bool Init()
Definition: JackALSARawMidiDriver.cpp:337
Jack::JackALSARawMidiOutputPort
Definition: JackALSARawMidiOutputPort.h:31
Jack::JackMachThread
Darwin threads. Real-time threads are actually "time constraint" threads.
Definition: JackMachThread.h:92