// wii_orientation_handler -- controls sliders 0 and 1 in range [0, 1] // using wii orientation messages from OSC static int wii_orientation_handler(const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { set_slider(0, min(1.0F, max(0.0F, (argv[0]->f / 180.0F) + 0.5F))); set_slider(1, min(1.0F, max(0.0F, (argv[1]->f / 180.0F) + 0.5F))); return 0; }
static void update_sliders (void * unused, GtkWidget * window) { GtkWidget * preamp = g_object_get_data ((GObject *) window, "preamp"); set_slider (preamp, aud_get_double (NULL, "equalizer_preamp")); double values[AUD_EQUALIZER_NBANDS]; aud_eq_get_bands (values); for (int i = 0; i < AUD_EQUALIZER_NBANDS; i ++) { SPRINTF (slider_id, "slider%d", i); GtkWidget * slider = g_object_get_data ((GObject *) window, slider_id); set_slider (slider, values[i]); } }
void Snes9xPreferences::load_ntsc_settings (void) { set_slider ("ntsc_artifacts", config->ntsc_setup.artifacts); set_slider ("ntsc_bleed", config->ntsc_setup.bleed); set_slider ("ntsc_brightness", config->ntsc_setup.brightness); set_slider ("ntsc_contrast", config->ntsc_setup.contrast); set_slider ("ntsc_fringing", config->ntsc_setup.fringing); set_slider ("ntsc_gamma", config->ntsc_setup.gamma); set_slider ("ntsc_hue", config->ntsc_setup.hue); set_check ("ntsc_merge_fields", config->ntsc_setup.merge_fields); set_slider ("ntsc_resolution", config->ntsc_setup.resolution); set_slider ("ntsc_saturation", config->ntsc_setup.saturation); set_slider ("ntsc_sharpness", config->ntsc_setup.sharpness); return; }
static int slider_handler(const char *path, const char *types, lo_arg **argv, int argc, void *data, void *user_data) { // printf("%s <- %d, %g\n", path, argv[0]->i, argv[1]->f); // fflush(stdout); set_slider(argv[0]->i, argv[1]->f); return 0; }
/* * scrollHelp - refresh the displayed help after a scrolling operation */ static int scrollHelp( SAREA *use, int lastline, bool changecurr ) { int useline; int scroll; int start; int end; scroll = currLine - lastline; vscroll_fields( &helpTab, *use, scroll ); vvscroll( &helpScreen, *use, scroll ); currentAttr = AT( ATTR_NORMAL ); if( abs(scroll) >= use->height ) { start = currLine; end = start + use->height; } else if( scroll < 0 ) { start = currLine; end = start - scroll; } else { start = currLine + use->height - scroll; end = start + scroll; } seek_line( start ); for( ;; ++start ) { save_line( start, HelpTell( helpFileHdl ) ); if( !mygetline() || strncmp( helpInBuf, "::::", 4 ) == 0 ) { maxLine = start; break; } useline = start - currLine; if( useline >= use->height || start >= end ) { break; } /* if it is the first time in, then the old currfield is right */ processLine( helpInBuf, helpOutBuf, useline + use->row, changecurr ); putline( helpOutBuf, useline + use->row ); } end = currLine + use->height; if( maxLine != 0 && end > maxLine ) { end = maxLine; } display_fields(); hotSpots[1].startcol = ( helpScreen.area.width - hotSpots[1].length ) / 2; addSearchButton( helpSearchHdl != NULL ); uiposnhotspots( &helpScreen, hotSpotFields ); uiprinthotspots( &helpScreen, hotSpotFields ); set_slider( currLine ); uirefresh(); return( currLine ); }
static gboolean time_counter_cb (void) { if (slider_is_moving) return TRUE; slider_seek_time = -1; // delayed reset to avoid seeking twice gint time = aud_drct_get_time (); gint length = aud_drct_get_length (); if (length > 0) set_slider (time); set_time_label (time, length); return TRUE; }
static void do_seek (gint time) { gint length = aud_drct_get_length (); time = CLAMP (time, 0, length); set_slider (time); set_time_label (time, length); aud_drct_seek (time); // Trick: Unschedule and then schedule the update function. This gives the // player 1/4 second to perform the seek before we update the display again, // in an attempt to reduce flickering. if (update_song_timeout_source) { g_source_remove (update_song_timeout_source); update_song_timeout_source = g_timeout_add (250, (GSourceFunc) time_counter_cb, NULL); } }
void Snes9xPreferences::move_settings_to_dialog (void) { set_check ("full_screen_on_open", config->full_screen_on_open); set_check ("show_frame_rate", Settings.DisplayFrameRate); set_check ("change_display_resolution", config->change_display_resolution); set_check ("scale_to_fit", config->scale_to_fit); set_check ("overscan", config->overscan); set_check ("multithreading", config->multithreading); set_combo ("hires_effect", config->hires_effect); set_check ("maintain_aspect_ratio", config->maintain_aspect_ratio); set_combo ("aspect_ratio", config->aspect_ratio); if (config->sram_directory[0] == '\0') set_entry_text ("sram_directory", SAME_GAME); else set_entry_text ("sram_directory", config->sram_directory); if (config->savestate_directory[0] == '\0') set_entry_text ("savestate_directory", SAME_GAME); else set_entry_text ("savestate_directory", config->savestate_directory); if (config->patch_directory[0] == '\0') set_entry_text ("patch_directory", SAME_GAME); else set_entry_text ("patch_directory", config->patch_directory); if (config->cheat_directory[0] == '\0') set_entry_text ("cheat_directory", SAME_GAME); else set_entry_text ("cheat_directory", config->cheat_directory); if (config->export_directory[0] == '\0') set_entry_text ("export_directory", SAME_GAME); else set_entry_text ("export_directory", config->export_directory); set_combo ("resolution_combo", config->xrr_index); set_combo ("scale_method_combo", config->scale_method); set_entry_value ("save_sram_after_sec", Settings.AutoSaveDelay); set_check ("block_invalid_vram_access", Settings.BlockInvalidVRAMAccessMaster); set_check ("upanddown", Settings.UpAndDown); set_combo ("default_esc_behavior", config->default_esc_behavior); set_check ("prevent_screensaver", config->prevent_screensaver); set_check ("force_inverted_byte_order", config->force_inverted_byte_order); set_check ("stereo_check", Settings.Stereo); set_combo ("playback_combo", 7 - config->sound_playback_rate); set_combo ("hw_accel", combo_value (config->hw_accel)); set_check ("pause_emulation_on_switch", config->pause_emulation_on_switch); set_spin ("num_threads", config->num_threads); set_check ("mute_sound_check", config->mute_sound); set_check ("mute_sound_turbo_check", config->mute_sound_turbo); set_spin ("sound_buffer_size", config->sound_buffer_size); set_slider ("sound_input_rate", config->sound_input_rate); set_check ("sync_sound", Settings.SoundSync); set_spin ("rewind_buffer_size", config->rewind_buffer_size); set_spin ("rewind_granularity", config->rewind_granularity); int num_sound_drivers = 0; #ifdef USE_PORTAUDIO num_sound_drivers++; #endif #ifdef USE_OSS num_sound_drivers++; #endif #ifdef USE_JOYSTICK num_sound_drivers++; #endif #ifdef USE_ALSA num_sound_drivers++; #endif #ifdef USE_PULSEAUDIO num_sound_drivers++; #endif if (config->sound_driver >= num_sound_drivers) config->sound_driver = 0; set_combo ("sound_driver", config->sound_driver); if (config->scale_method == FILTER_NTSC) { gtk_widget_show (get_widget ("ntsc_frame")); } else { gtk_widget_hide (get_widget ("ntsc_frame")); } if (config->scale_method == FILTER_SCANLINES) { gtk_widget_show (get_widget ("scanline_filter_frame")); } else { gtk_widget_hide (get_widget ("scanline_filter_frame")); } load_ntsc_settings (); set_combo ("ntsc_scanline_intensity", config->ntsc_scanline_intensity); set_combo ("scanline_filter_intensity", config->scanline_filter_intensity); set_combo ("frameskip_combo", Settings.SkipFrames == AUTO_FRAMERATE ? 0 : Settings.SkipFrames + 1); set_check ("bilinear_filter", config->bilinear_filter); #ifdef USE_OPENGL set_check ("sync_to_vblank", config->sync_to_vblank); set_check ("sync_every_frame", config->sync_every_frame); set_check ("use_pbos", config->use_pbos); set_combo ("pixel_format", config->pbo_format); set_check ("npot_textures", config->npot_textures); set_check ("use_shaders", config->use_shaders); set_entry_text ("fragment_shader", config->fragment_shader); #endif #ifdef USE_JOYSTICK set_spin ("joystick_threshold", config->joystick_threshold); #else gtk_widget_set_sensitive (get_widget ("joystick_box"), FALSE); #endif /* Control bindings */ memcpy (pad, config->pad, (sizeof (JoypadBinding)) * NUM_JOYPADS); memcpy (shortcut, config->shortcut, (sizeof (Binding)) * NUM_EMU_LINKS); bindings_to_dialog (0); set_combo ("joypad_to_swap_with", 0); return; }
void input_thread_run(void *args) { int c; /* this gets called, possible later, in io_init() in userio.c, but * that doesn't seem to prevent this thread from being killed by * CTRL-C, so call it here to be safe. */ SetConsoleCtrlHandler(ctrl_c_handler, TRUE); /* printf("input_thread_run\n"); */ while (!buffer_eof) { int head; c = getchar(); if (c == EOF && abort_flag) { // when user types ^C, an EOF is generated for some reason. // Ignore it... if (abort_flag == ABORT_LEVEL) c = ABORT_CHAR; else c = BREAK_CHAR; } else if (c == ABORT_CHAR) { abort_flag = ABORT_LEVEL; } else if (!abort_flag && c == BREAK_CHAR) { // notice that a break will be ignored until XLISP // handles the ABORT_LEVEL abort_flag = BREAK_LEVEL; } else if (c == BREAK_CHAR) { ; // ignore this because abort_flag is set to ABORT_LEVEL } else if (c == '\005' || c == '\006') { // control-e or control-f ; // ignore these. IDE will send control-f to turn off echo, but // under Windows, echo is already turned off. We filter control-f // here to avoid generating an error message. Maybe the IDE should // not send control-f in the first place, but the IDE is cross-platform // and does not know it's running under Windows, whereas this file // is platform dependent. } else if (c == '\016') { // begin hidden message #define MSGBUF_MAX 64 char msgbuf[MSGBUF_MAX]; int msgbufx = 0; char type_char = getchar(); // read message type character printf("begin hidden message: %c\n", type_char); if (type_char == EOF) buffer_eof = TRUE; else { // message is terminated by '\021' while ((c = getchar()) != '\021' && c != EOF && msgbufx < MSGBUF_MAX - 1) { msgbuf[msgbufx++] = c; } msgbuf[msgbufx++] = 0; printf("message: %s\n", msgbuf); if (c == EOF) buffer_eof = TRUE; else if (msgbufx < MSGBUF_MAX) { if (type_char == 'S') { // slider change message // message format is index<space>value int index; float value; if (sscanf(msgbuf, "%d %g", &index, &value) == 2) { set_slider(index, value); printf("set_slider %d %g\n", index, value); } } } } } else if (c == EOF) { buffer_eof = TRUE; } else { // insert character into the FIFO head = (input_buffer_head + 1) & input_buffer_mask; while (head == input_buffer_tail) Sleep(100); input_buffer[input_buffer_head] = c; #ifdef DEBUG_INPUT if (to_input_buffer) putc(c, to_input_buffer); #endif input_buffer_head = head; } if (c == '\n' || abort_flag || buffer_eof) { SetEvent(input_buffer_ready); // wake up Nyquist if it is waiting for input } } // printf("Input thread exiting\n"); }