예제 #1
0
void ModuleSequencer::check_overload() {
    if (stateflags & SF_OVERLOAD) {
	set_state(kEngineBypass);
	check_module_lists();
	gx_print_error(
	    "watchdog",
	    boost::format(_("Overload (%s)")) % gx_system::atomic_get(overload_reason));
    } else {
	gx_print_error(
	    "watchdog",
	    boost::format(_("Overload ignored (%s)")) % gx_system::atomic_get(overload_reason));
    }
}
예제 #2
0
bool ProcessingChainBase::wait_rt_finished() {
    if (stopped) {
	return true;
    }
    timespec ts;
    clock_gettime(CLOCK_REALTIME, &ts);
    const long ns_in_sec = 1000000000;
    ts.tv_nsec += ns_in_sec / 10;
    if (ts.tv_nsec >= ns_in_sec) {
	ts.tv_nsec -= ns_in_sec;
	ts.tv_sec += 1;
    }
    while (sem_timedwait(&sync_sem, &ts) == -1) {
	if (errno == EINTR) {
	    continue;
	}
	if (errno == ETIMEDOUT) {
	    gx_print_warning("sem_timedwait", "timeout");
	    return false;
	}
	gx_print_error("sem_timedwait", "unknown error");
	break;
    }
    return true;
}
예제 #3
0
    //----- we must make sure that the images for the status icon be there
    int gx_pixmap_check()
    {
      struct stat my_stat;

      string gx_pix   = gx_pixmap_dir + "Jc_Gui.png";
      string warn_pix = gx_pixmap_dir + "Jc_Gui-warn.png";

      if ((stat(gx_pix.c_str(), &my_stat) != 0)   ||
          (stat(warn_pix.c_str(), &my_stat) != 0))

        {
          gx_print_error("Pixmap Check", " cannot find installed pixmaps! giving up ...");

          // giving up
          return 1;
        }

      GtkWidget *ibf =  gtk_image_new_from_file (gx_pix.c_str());
      gx_gui::ib = gtk_image_get_pixbuf (GTK_IMAGE(ibf));

      GtkWidget *stir = gtk_image_new_from_file (warn_pix.c_str());
      gx_gui::ibr = gtk_image_get_pixbuf (GTK_IMAGE(stir));

      return 0;
    }
예제 #4
0
bool State::makeScreen(dc_t* dc_buffer, dc_t* dc_screen, void* pParam)
{
	if ((top == NULL) ||
		(title == NULL) ||
		(button == NULL) ||
		(bottom == NULL) ||
		(button2 == NULL) ||
		(active == NULL) ||
		(dc_buffer == NULL) ||
		(dc_screen == NULL) ||
		(font == NULL) )
		gx_print_error(8, "layout pngs");
	else
	{
		setFont(dc_buffer);
		
		int x = 64 * (state - 1);
		gx_bitblt(dc_buffer, 0, 0, (dc_t *)top, 0, 0, top->width, top->height);
		gx_bitblt(dc_buffer, 98, 8, (dc_t *)title, 0, 0, title->width, title->height);
		gx_bitblt(dc_buffer, 281, 7, (dc_t *)button, 0, 0, button->width, button->height);
		gx_bitblt(dc_buffer, 4, 6, (dc_t *)button2, 0, 0, button->width, button->height);
		gx_bitblt(dc_buffer, 0, 191, (dc_t *)bottom, 0, 0, bottom->width, bottom->height);
		
		if(x >= 0)
			gx_bitblt( dc_buffer, x, 191, ( dc_t *)active, 0, 0, active->width, active->height);
	}
}
예제 #5
0
void SelectJackControlPgm::on_ok_button() {
    machine.set_parameter_value("ui.jack_starter", customstarter->get_text());
    Glib::ustring s;
    startercombo->get_active()->get_value(1, s);
    int n = machine.get_parameter("ui.jack_starter_idx").getInt().idx_from_id(s);
    if (n >= 0) {
	machine.set_parameter_value("ui.jack_starter_idx", n);
    } else {
	gx_print_error("load error", "starter id not found");
    }
    machine.set_parameter_value("ui.ask_for_jack_starter", !dontask->get_active());
    close();
}
예제 #6
0
    // ---- command line options
    void gx_process_cmdline_options(int& argc, char**& argv, string* optvar)
    {
      // store shell variable content
      for (int i = 0; i < NUM_SHELL_VAR; i++)
        gx_assign_shell_var(shell_var_name[i], optvar[i]);



      // ---- parse command line arguments
      try
        {
          gboolean version = FALSE;
          GOptionEntry opt_entries[] =
          {
            { "version", 'v', 0, G_OPTION_ARG_NONE, &version, "Print version string and exit", NULL },
            { NULL }
          };
          GError* error = NULL;
          GOptionContext* opt_context = NULL;

          opt_context = g_option_context_new(NULL);
          g_option_context_set_summary(opt_context,
                                       "All parameters are optional. Examples:\n"
                                       "\tjc_gui\n"
                                       "\tjc_gui -i system:capture_3 -i system:capture_2\n"
                                       "\tjc_gui -o system:playback_1 -o system:playback_2");
          g_option_context_add_main_entries(opt_context, opt_entries, NULL);



          // JACK options: input and output ports
          gchar** jack_input = NULL;
          gchar** jack_outputs = NULL;
          GOptionGroup* optgroup_jack = g_option_group_new("jack",
                                        "\033[1;32mJACK configuration options\033[0m",
                                        "\033[1;32mJACK configuration options\033[0m",
                                        NULL, NULL);
          GOptionEntry opt_entries_jack[] =
          {
            { "jack-input", 'i', 0, G_OPTION_ARG_STRING_ARRAY, &jack_input, "Jc_Gui JACK input", "PORT" },
            {"jack-output", 'o', 0, G_OPTION_ARG_STRING_ARRAY, &jack_outputs, "Jc_Gui JACK outputs", "PORT" },
            { NULL }
          };
          g_option_group_add_entries(optgroup_jack, opt_entries_jack);

          // collecting all option groups

          g_option_context_add_group(opt_context, optgroup_jack);

          // parsing command options
          if (!g_option_context_parse(opt_context, &argc, &argv, &error))
            {
              throw string(error->message);
            }
          g_option_context_free(opt_context);


          // ----------- processing user options -----------

          // *** display version if requested
          if (version)
            {
              cout << "Jc_Gui version \033[1;32m"
              << GX_VERSION << endl
              << "\033[0m   Copyright " << (char)0x40 << " 2009 "
              << "Hermman Meyer - James Warden"
              << endl;
              exit(0);
            }


// *** process jack outputs
          if (jack_input != NULL)
            {
              int idx = JACK_INP1;
              unsigned int i = 0;

              while (jack_input[i] != NULL)
                {
                  if (i >= 2)
                    {
                      gx_print_warning("main",
                                       "Warning --> provided more than 2 input ports, ignoring extra ports");
                      break;
                    }
                  optvar[idx] = string(jack_input[i]);
                  i++;
                  idx++;
                }
              g_strfreev(jack_input);
            }
          else
            {
              if (!gx_shellvar_exists(optvar[JACK_INP1])) optvar[JACK_INP1] = "";
              if (!gx_shellvar_exists(optvar[JACK_INP2])) optvar[JACK_INP2] = "";
            }


          // *** process jack outputs
          if (jack_outputs != NULL)
            {
              int idx = JACK_OUT1;
              unsigned int i = 0;

              while (jack_outputs[i] != NULL)
                {
                  if (i >= 2)
                    {
                      gx_print_warning("main",
                                       "Warning --> provided more than 2 output ports, ignoring extra ports");
                      break;
                    }
                  optvar[idx] = string(jack_outputs[i]);
                  i++;
                  idx++;
                }
              g_strfreev(jack_outputs);
            }
          else
            {
              if (!gx_shellvar_exists(optvar[JACK_OUT1])) optvar[JACK_OUT1] = "";
              if (!gx_shellvar_exists(optvar[JACK_OUT2])) optvar[JACK_OUT2] = "";
            }




        }

      // ---- catch exceptions that occured during user option parsing
      catch (string& e)
        {
          string msg = string("Error in user options! try -?  ") + e;
          gx_print_error("main", msg);
          exit(1);
        }
    }
예제 #7
0
Liveplay::Liveplay(
    const gx_system::CmdlineOptions& options, gx_engine::GxMachineBase& machine_,
    const std::string& fname, const GxActions& actions_)
    : bld(),
      machine(machine_),
      actions(actions_),
      use_composite(),
      brightness_adj(),
      background_adj(),
      keyswitch(machine_, sigc::mem_fun(this, &Liveplay::display)),
      midi_conn(),
      window(),
      mouse_hide_conn() {
    const char *id_list[] = {"LivePlay", 0};
    bld = gx_gui::GxBuilder::create_from_file(fname, &machine, id_list);
    bld->get_toplevel("LivePlay", window);

    bld->find_widget("liveplay_bank", liveplay_bank);
    bld->find_widget("liveplay_preset", liveplay_preset);
    bld->find_widget("liveplay_bypass_image", bypass_image);
    bld->find_widget("liveplay_mute_image", mute_image);
    bld->find_widget("liveplay_canvas", liveplay_canvas);
    bld->find_widget("brightness_slider", brightness_slider);
    bld->find_widget("brightness_box", brightness_box);
    bld->find_widget("background_slider", background_slider);
    bld->find_widget("liveplay_exit:barbutton", liveplay_exit);
    bld->find_widget("liveplay_tuner", tuner);
    bld->find_widget("liveplay_midictrl_table", midictrl_table);
    brightness_adj = brightness_slider->get_adjustment();
    background_adj = background_slider->get_adjustment();
    MyPaintBox *liveplay_paintbox;
    bld->find_widget_derived(
        "liveplay_paintbox", liveplay_paintbox,
        sigc::bind(
            sigc::ptr_fun(MyPaintBox::create_from_builder),
            background_adj));
    Glib::RefPtr<Gdk::Pixbuf> pb;
    try {
        pb = Gdk::Pixbuf::create_from_file(
                 options.get_style_filepath("bypass.svg"), 300, 150);
        bypass_image->set(pb);
    } catch (const Glib::FileError& ex) {
        gx_print_error("liveplay", ex.what());
    } catch (const Gdk::PixbufError& ex) {
        gx_print_error("liveplay", ex.what());
    } catch(...) {
        gx_print_error("liveplay", "failed to load pixmap bypass.svg");
    }
    try {
        pb = Gdk::Pixbuf::create_from_file(
                 options.get_style_filepath("mute.svg"), 300, 150);
        mute_image->set(pb);
    } catch (const Glib::FileError& ex) {
        gx_print_error("liveplay", ex.what());
    } catch (const Gdk::PixbufError& ex) {
        gx_print_error("liveplay", ex.what());
    } catch(...) {
        gx_print_error("liveplay", "failed to load pixmap mute.svg");
    }
    use_composite = window->get_display()->supports_composite();
    if (use_composite) {
        brightness_adj->signal_value_changed().connect(sigc::mem_fun(this, &Liveplay::on_brightness_changed));
        liveplay_canvas->signal_realize().connect(sigc::mem_fun(this, &Liveplay::on_realize));
        window->signal_expose_event().connect(
            sigc::mem_fun(this, &Liveplay::window_expose_event), true);
    } else {
        brightness_box->hide();
    }
    background_adj->signal_value_changed().connect(
        sigc::mem_fun(this, &Liveplay::on_background_changed));
    Glib::RefPtr<Gdk::Screen> screen = liveplay_canvas->get_screen();
    Glib::RefPtr<Gdk::Colormap> rgba = screen->get_rgba_colormap();
    liveplay_canvas->set_colormap(rgba);
    liveplay_canvas->set_app_paintable(true);
    window->signal_delete_event().connect(
        sigc::mem_fun(this, &Liveplay::on_delete));
    window->add_events(Gdk::POINTER_MOTION_HINT_MASK|Gdk::POINTER_MOTION_MASK);
    window->signal_motion_notify_event().connect(
        sigc::mem_fun(*this, &Liveplay::pointer_motion));

    gtk_activatable_set_related_action(
        GTK_ACTIVATABLE(liveplay_exit->gobj()), GTK_ACTION(actions.live_play->gobj()));
    Glib::RefPtr<Gtk::AccelGroup> ag = Gtk::AccelGroup::create();
    GClosure *cl = g_cclosure_new(G_CALLBACK(do_action), (gpointer)(actions.live_play->gobj()), 0);
    gtk_accel_group_connect_by_path(ag->gobj(), actions.live_play->get_accel_path().c_str(), cl);
    cl = g_cclosure_new(G_CALLBACK(do_action), (gpointer)(actions.live_play->gobj()), 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_Escape, (GdkModifierType)0, (GtkAccelFlags)0, cl);

    cl = g_cclosure_new(G_CALLBACK(do_action), (gpointer)(actions.livetuner->gobj()), 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_Return, (GdkModifierType)0, (GtkAccelFlags)0, cl);

    cl = g_cclosure_new(G_CALLBACK(do_action), (gpointer)(actions.quit->gobj()), 0);
    gtk_accel_group_connect_by_path(ag->gobj(), actions.quit->get_accel_path().c_str(), cl);

    cl = g_cclosure_new(G_CALLBACK(on_keyboard_toggle_mute), (gpointer)this, 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_M, GDK_CONTROL_MASK, (GtkAccelFlags)0, cl);

    cl = g_cclosure_new(G_CALLBACK(on_keyboard_toggle_bypass), (gpointer)this, 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_B, GDK_CONTROL_MASK, (GtkAccelFlags)0, cl);

    cl = g_cclosure_new(G_CALLBACK(on_keyboard_arrows), (gpointer)this, 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_Left, GDK_CONTROL_MASK, (GtkAccelFlags)0, cl);
    cl = g_cclosure_new(G_CALLBACK(on_keyboard_arrows), (gpointer)this, 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_Right, GDK_CONTROL_MASK, (GtkAccelFlags)0, cl);
    cl = g_cclosure_new(G_CALLBACK(on_keyboard_arrows), (gpointer)this, 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_Up, GDK_CONTROL_MASK, (GtkAccelFlags)0, cl);
    cl = g_cclosure_new(G_CALLBACK(on_keyboard_arrows), (gpointer)this, 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_Down, GDK_CONTROL_MASK, (GtkAccelFlags)0, cl);

    for (int n = GDK_KEY_0; n <= GDK_KEY_9; ++n) {
        cl = g_cclosure_new(G_CALLBACK(on_keyboard_preset_select), (gpointer)this, 0);
        gtk_accel_group_connect(ag->gobj(), n, (GdkModifierType)0, (GtkAccelFlags)0, cl);
    }
    for (int n = GDK_KEY_KP_0; n <= GDK_KEY_KP_9; ++n) {
        cl = g_cclosure_new(G_CALLBACK(on_keyboard_preset_select), (gpointer)this, 0);
        gtk_accel_group_connect(ag->gobj(), n, (GdkModifierType)0, (GtkAccelFlags)0, cl);
    }
    for (int n = GDK_KEY_A; n <= GDK_KEY_Z; ++n) {
        cl = g_cclosure_new(G_CALLBACK(on_keyboard_preset_select), (gpointer)this, 0);
        gtk_accel_group_connect(ag->gobj(), n, (GdkModifierType)0, (GtkAccelFlags)0, cl);
    }

    cl = g_cclosure_new(G_CALLBACK(on_keyboard_mode_switch), (gpointer)this, 0);
    gtk_accel_group_connect(ag->gobj(), GDK_KEY_space, (GdkModifierType)0, (GtkAccelFlags)0, cl);
    machine.tuner_switcher_signal_display().connect(
        sigc::mem_fun(this, &Liveplay::display));
    machine.tuner_switcher_signal_set_state().connect(
        sigc::mem_fun(this, &Liveplay::set_display_state));
    machine.tuner_switcher_signal_selection_done().connect(
        sigc::mem_fun(this, &Liveplay::on_selection_done));

    window->add_accel_group(ag);

    machine.signal_state_change().connect(
        sigc::mem_fun(this, &Liveplay::on_engine_state_change));
    machine.signal_selection_changed().connect(
        sigc::mem_fun(this, &Liveplay::on_selection_changed));

    on_engine_state_change(machine.get_state());
    on_selection_changed();
}