00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __JackALSARawMidiDriver__
00021 #define __JackALSARawMidiDriver__
00022
00023 #include <vector>
00024
00025 #include <alsa/asoundlib.h>
00026 #include <poll.h>
00027
00028 #include "JackALSARawMidiInputPort.h"
00029 #include "JackALSARawMidiOutputPort.h"
00030 #include "JackMidiDriver.h"
00031 #include "JackThread.h"
00032
00033 namespace Jack {
00034
00035 class JackALSARawMidiDriver:
00036 public JackMidiDriver, public JackRunnableInterface {
00037
00038 private:
00039
00040 int fds[2];
00041 JackALSARawMidiInputPort **input_ports;
00042 JackALSARawMidiOutputPort **output_ports;
00043 jack_nframes_t *output_port_timeouts;
00044 nfds_t poll_fd_count;
00045 struct pollfd *poll_fds;
00046 JackThread *thread;
00047
00048 void
00049 FreeDeviceInfo(std::vector<snd_rawmidi_info_t *> *in_info_list,
00050 std::vector<snd_rawmidi_info_t *> *out_info_list);
00051
00052 void
00053 GetDeviceInfo(snd_ctl_t *control, snd_rawmidi_info_t *info,
00054 std::vector<snd_rawmidi_info_t *> *info_list);
00055
00056 void
00057 HandleALSAError(const char *driver_func, const char *alsa_func,
00058 int code);
00059
00060 public:
00061
00062 JackALSARawMidiDriver(const char *name, const char *alias,
00063 JackLockedEngine *engine, JackSynchro *table);
00064 ~JackALSARawMidiDriver();
00065
00066 int
00067 Attach();
00068
00069 int
00070 Close();
00071
00072 bool
00073 Execute();
00074
00075 bool
00076 Init();
00077
00078 int
00079 Open(bool capturing, bool playing, int in_channels, int out_channels,
00080 bool monitoring, const char *capture_driver_name,
00081 const char *playback_driver_name, jack_nframes_t capture_latency,
00082 jack_nframes_t playback_latency);
00083
00084 int
00085 Read();
00086
00087 int
00088 Start();
00089
00090 int
00091 Stop();
00092
00093 int
00094 Write();
00095
00096 };
00097
00098 }
00099
00100 #endif