コード例 #1
0
ファイル: gui_main.c プロジェクト: smbolton/whysynth
int
osc_configure_handler(const char *path, const char *types, lo_arg **argv,
                  int argc, lo_message msg, void *user_data)
{
    char *key, *value;

    if (argc < 2) {
        GDB_MESSAGE(GDB_OSC, " error: too few arguments to osc_configure_handler\n");
        return 1;
    }

    key   = &argv[0]->s;
    value = &argv[1]->s;

    if (!strcmp(key, "load")) {

        update_load(value);

    } else if (!strcmp(key, "polyphony")) {

        update_polyphony(value);

    } else if (!strcmp(key, "monophonic")) {

        update_monophonic(value);

    } else if (!strcmp(key, "glide")) {

        update_glide(value);

    } else if (!strcmp(key, "program_cancel")) {

        update_program_cancel(value);

    } else if (!strcmp(key, DSSI_PROJECT_DIRECTORY_KEY)) {

        update_project_directory(value);

    } else {

        return osc_debug_handler(path, types, argv, argc, msg, user_data);

    }

    return 0;
}
コード例 #2
0
bool 
AirspaceWarningManager::update(const AIRCRAFT_STATE& state,
                               const bool circling)
{
  bool changed = false;

  // save old state
  for (AirspaceWarningList::iterator it = m_warnings.begin();
       it != m_warnings.end(); ++it)
    it->save_state();

  // check from strongest to weakest alerts 
  update_inside(state);
  update_glide(state);
  if (circling)
    update_filter(state);
  update_task(state);

  // action changes
  for (AirspaceWarningList::iterator it = m_warnings.begin();
       it != m_warnings.end(); ) {
    if (it->warning_live(config.AcknowledgementTime)) {
      if (it->changed_state())
        changed = true;

      it++;
    } else {
      if (!it->trivial()) {
        //changed = true; // was downgraded to eliminate
      }
      it = m_warnings.erase(it);
    }
  }

  // sort by importance, most severe top
  m_warnings.sort();

  return changed;
}