diff -ru ../ams-1.8.8-rc1/m_midiout.cpp ./m_midiout.cpp --- ../ams-1.8.8-rc1/m_midiout.cpp 2003-10-23 11:24:12.000000000 +0200 +++ ./m_midiout.cpp 2007-04-28 12:33:13.000000000 +0200 @@ -92,7 +92,10 @@ } void M_midiout::generateCycle() { - + + if (!synthdata->seq_handle) + return; + int l1, l2, l3, mididata, velocitydata; snd_seq_event_t ev; diff -ru ../ams-1.8.8-rc1/modularsynth.cpp ./modularsynth.cpp --- ../ams-1.8.8-rc1/modularsynth.cpp 2007-04-20 20:53:28.000000000 +0200 +++ ./modularsynth.cpp 2007-04-28 12:26:58.000000000 +0200 @@ -309,8 +309,10 @@ int ModularSynth::go (bool withJack) { - synthdata->seq_handle = open_seq(); - initSeqNotifier(); + if (synthdata->seq_handle = open_seq()) + initSeqNotifier(); + else + fprintf(stderr, "Could not open ALSA sequencer, MIDI will not work!\n"); if (withJack) { @@ -400,7 +402,7 @@ if (snd_seq_open(&seq_handle, "hw", SND_SEQ_OPEN_DUPLEX, 0) < 0) { fprintf(stderr, "Error opening ALSA sequencer.\n"); - exit(1); + return 0; } snd_seq_set_client_name(seq_handle, "AlsaModularSynth"); clientid = snd_seq_client_id(seq_handle); @@ -408,14 +410,16 @@ SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE, SND_SEQ_PORT_TYPE_APPLICATION)) < 0) { fprintf(stderr, "Error creating sequencer port.\n"); - exit(1); + snd_seq_close(seq_handle); + return 0; } for (l1 = 0; l1 < 2; ++l1) { if ((synthdata->midi_out_port[l1] = snd_seq_create_simple_port(seq_handle, "ams", SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ, SND_SEQ_PORT_TYPE_APPLICATION)) < 0) { fprintf(stderr, "Error creating sequencer port.\n"); - exit(1); + snd_seq_close(seq_handle); + return 0; } } qs.sprintf("AlsaModularSynth " AMS_VERSION " - %d:%d - (%d)", clientid, portid, synthdata->poly);