rem: throw(new ECA_ERROR("ECA-MIDI", "Unable to open ALSA raw-MIDI device, because ALSA was disabled during compilation."));
add: throw(ECA_ERROR("ECA-MIDI", "Unable to open ALSA raw-MIDI device, because ALSA was disabled during compilation."));
context: void *update_midi_queues(void *) {  struct timeval tv;  int fd;  char buf[MIDI_IN_QUEUE_SIZE];  int temp;    ::pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);  // other threads can cancel this one      ECA_RESOURCES erc;  string midi_dev = erc.resource("midi-device");  bool use_alsa = false;#ifdef COMPILE_ALSA_RAWMIDI  snd_rawmidi_t *midihandle;#endif  if (midi_dev.find("/dev/snd/") != string::npos) {    string cardstr,devicestr;    string::const_iterator p = midi_dev.begin();    while(p != midi_dev.end() && *p != 'C') ++p;    ++p;    while(p != midi_dev.end() && isdigit(*p)) {      cardstr += " ";      cardstr[cardstr.size() - 1] = *p;      ++p;    }    while(p != midi_dev.end() && *p != 'D') ++p;    ++p;    while(p != midi_dev.end() && isdigit(*p)) {      devicestr += " ";      devicestr[devicestr.size() - 1] = *p;      ++p;    }        int card = ::atoi(cardstr.c_str());    int device = ::atoi(devicestr.c_str());        use_alsa = true;#ifdef COMPILE_ALSA_RAWMIDI    if (::snd_rawmidi_open(&midihandle, card, device, SND_RAWMIDI_OPEN_INPUT) < 0) {      throw(new ECA_ERROR("ECA-MIDI", "unable to open ALSA raw-MIDI device " +			erc.resource("midi-device") + "."));    }#ifdef ALSALIB_060    fd = ::snd_rawmidi_poll_descriptor(midihandle);#else    fd = ::snd_rawmidi_file_descriptor(midihandle);#endif#else     throw(new ECA_ERROR("ECA-MIDI", "Unable to open ALSA raw-MIDI device, because ALSA was disabled during compilation."));#endif  }  else {    tv.tv_sec = 0;    tv.tv_usec = 0;    fd = ::open("/dev/midi", O_RDONLY);    if (fd == -1) {      throw(new ECA_ERROR("ECA-MIDI", "unable to open OSS raw-MIDI device " +			  erc.resource("midi-device") + "."));    }  }  ecadebug->control_flow("MIDI-thread ready " + erc.resource("midi-device"));  while(true) {    if (use_alsa) {#ifdef COMPILE_ALSA_RAWMIDI      temp = ::snd_rawmidi_read(midihandle, buf, 1);#endif    }    else {      temp = ::read(fd, buf, 1);    }    ::pthread_mutex_lock(&::midi_in_lock);    while (::midi_in_locked == true) ::pthread_cond_wait(&::midi_in_cond,							 &::midi_in_lock);    ::midi_in_locked = true;    if (temp < 0) {      cerr << "ERROR: Can't read from MIDI-device: " << midi_dev << ".\n";      break;    }    for(int n = 0; n < temp; n++) {      ::midi_in_queue.put(buf[n]);    }    ::midi_in_locked = false;    ::pthread_cond_signal(&::midi_in_cond);    ::pthread_mutex_unlock(&::midi_in_lock);  }  if (use_alsa) {#ifdef COMPILE_ALSA_RAWMIDI    ::snd_rawmidi_close(midihandle);#endif  }  else {    ::close(fd);  }  return(0);}