diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2007-01-22 14:14:11 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2007-01-22 14:14:11 +0000 |
commit | d38944becdac0deec9cd4344efbc6b531db4161d (patch) | |
tree | ce960502909099a602e158f8b07829b24f5e6fad /libs/midi++2 | |
parent | 9d4476dbb9ec120fc4a34b4b91117fdfc40bd578 (diff) |
correctly detect missing ALSA MIDI system
git-svn-id: svn://localhost/ardour2/trunk@1369 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/midi++2')
-rw-r--r-- | libs/midi++2/alsa_sequencer_midiport.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libs/midi++2/alsa_sequencer_midiport.cc b/libs/midi++2/alsa_sequencer_midiport.cc index 26cdb7d1fd..a47678bf1b 100644 --- a/libs/midi++2/alsa_sequencer_midiport.cc +++ b/libs/midi++2/alsa_sequencer_midiport.cc @@ -22,6 +22,7 @@ #include <cerrno> #include <pbd/failed_constructor.h> +#include <pbd/error.h> #include <midi++/types.h> #include <midi++/alsa_sequencer.h> @@ -39,6 +40,7 @@ using namespace std; using namespace MIDI; +using namespace PBD; snd_seq_t* ALSA_SequencerMidiPort::seq = 0; @@ -186,12 +188,20 @@ ALSA_SequencerMidiPort::CreatePorts (PortRequest &req) int ALSA_SequencerMidiPort::init_client (std::string name) { - int err; + static bool called = false; + + if (called) { + return -1; + } + + called = true; - if (0 <= (err = snd_seq_open (&seq, "default", SND_SEQ_OPEN_DUPLEX, 0))) { + if (snd_seq_open (&seq, "default", SND_SEQ_OPEN_DUPLEX, 0) >= 0) { snd_seq_set_client_name (seq, name.c_str()); return 0; } else { - return -err; + warning << "The ALSA MIDI system is not available. No ports based on it will be created" + << endmsg; + return -1; } } |