From ceac394c2133d44e81db2eb633ff54a9ad6ce7c5 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 10 Nov 2005 05:52:11 +0000 Subject: This commit was generated by cvs2svn to compensate for changes in r3865, which included commits to RCS files with non-trunk default branches. svn path=/trunk/extensions/gripd/; revision=3866 --- src/midiio/include/Sequencer_alsa.h | 139 ++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 src/midiio/include/Sequencer_alsa.h (limited to 'src/midiio/include/Sequencer_alsa.h') diff --git a/src/midiio/include/Sequencer_alsa.h b/src/midiio/include/Sequencer_alsa.h new file mode 100644 index 0000000..3227f5e --- /dev/null +++ b/src/midiio/include/Sequencer_alsa.h @@ -0,0 +1,139 @@ +// +// Programmer: Craig Stuart Sapp +// Creation Date: Thu May 11 21:06:21 PDT 2000 +// Last Modified: Sat Oct 13 14:50:04 PDT 2001 (updated for ALSA 0.9 interface) +// Filename: ...sig/maint/code/control/MidiOutPort/Sequencer_alsa.h +// Web Address: http://sig.sapp.org/include/sig/Sequencer_alsa.h +// Syntax: C++ +// +// Description: Basic MIDI input/output functionality for the +// Linux ALSA midi device /dev/snd/midiXX. This class +// is inherited by the classes MidiInPort_alsa and +// MidiOutPort_alsa. +// +// to get information of status a alsa hardware & software +// cat /proc/asound/version +// cat /proc/asound/devices +// cat /proc/asound/card0/midi0 +// + +#ifndef _SEQUENCER_ALSA_H_INCLUDED +#define _SEQUENCER_ALSA_H_INCLUDED + +#include + +#ifdef ALSA + +#include +#include "Collection.h" + +#define MIDI_EXTERNAL (1) +#define MIDI_INTERNAL (2) + +typedef unsigned char uchar; + + +class Sequencer_alsa { + public: + Sequencer_alsa (int autoOpen = 1); + ~Sequencer_alsa (); + + void close (void); + void closeInput (int index); + void closeOutput (int index); + void displayInputs (std::ostream& out = std::cout, + char* initial = "\t"); + void displayOutputs (std::ostream& out = std::cout, + char* initial = "\t"); + static const char* getInputName (int aDevice); + static const char* getOutputName (int aDevice); + static int getNumInputs (void); + static int getNumOutputs (void); + int is_open (int mode, int index); + int is_open_in (int index); + int is_open_out (int index); + int open (int direction, int index); + int openInput (int index); + int openOutput (int index); + void read (int dev, uchar* buf, int count); + void rebuildInfoDatabase (void); + int write (int aDevice, int aByte); + int write (int aDevice, uchar* bytes, int count); + int write (int aDevice, char* bytes, int count); + int write (int aDevice, int* bytes, int count); + + int getInCardValue (int aDevice) const; + int getOutCardValue (int aDevice) const; + protected: + static int class_count; // number of existing classes using + static int indevcount; // number of MIDI input devices + static int outdevcount; // number of MIDI output devices + static int initialized; // for starting buileinfodatabase + + static Collection Sequencer_alsa::rawmidi_in; + static Collection Sequencer_alsa::rawmidi_out; + static Collection Sequencer_alsa::midiincard; + static Collection Sequencer_alsa::midioutcard; + static Collection Sequencer_alsa::midiindevice; + static Collection Sequencer_alsa::midioutdevice; + static Collection Sequencer_alsa::midiinname; + static Collection Sequencer_alsa::midioutname; + + private: + static void buildInfoDatabase (void); + static void getPossibleMidiStreams(Collection& cards, + Collection& devices); + int getInDeviceValue (int aDevice) const; + int getInputType (int aDevice) const; + int getOutDeviceValue (int aDevice) const; + int getOutputType (int aDevice) const; + void removeInfoDatabase (void); + + + friend void *interpretMidiInputStreamPrivateALSA(void * x); + +}; + +#else /* ALSA is not defined */ + +typedef unsigned char uchar; + +class Sequencer_alsa { + public: + Sequencer_alsa (int autoOpen = 1) { } + ~Sequencer_alsa () { } + + void close (void) { }; + void displayInputs (std::ostream& out = std::cout, + char* initial = "\t") + { out << initial << "NONE\n"; } + void displayOutputs (std::ostream& out = std::cout, + char* initial = "\t") + { out << initial << "NONE\n"; } + static const char* getInputName (int aDevice) { return ""; } + static const char* getOutputName (int aDevice) { return ""; } + static int getNumInputs (void) { return 0; } + static int getNumOutputs (void) { return 0; } + int is_open (int mode, int index) { return 0; } + int is_open_in (int index) { return 0; } + int is_open_out (int index) { return 0; } + int open (void) { return 0; } + void read (int dev, uchar* buf, int count) { } + void rebuildInfoDatabase (void) { } + int write (int aDevice, int aByte) { return 0; } + int write (int aDevice, uchar* bytes, int count) { return 0; } + int write (int aDevice, char* bytes, int count) { return 0; } + int write (int aDevice, int* bytes, int count) { return 0; } + int getInCardValue (int aDevice) const { return 0; } + int getOutCardValue (int aDevice) const { return 0; } + +}; + + +#endif /* ALSA */ + + +#endif /* _SEQUENCER_ALSA_H_INCLUDED */ + + +// md5sum: 6147020b0646fca8245f653505308949 - Sequencer_alsa.h =css= 20030102 -- cgit v1.2.1