Ejemplo n.º 1
0
void CMyPreferences::apply() {
	char temp[16];
	int t = GetDlgItemInt( IDC_SAMPLERATE, NULL, FALSE );
	if ( t < 6000 ) t = 6000;
	else if ( t > 96000 ) t = 96000;
	SetDlgItemInt( IDC_SAMPLERATE, t, FALSE );
	itoa( t, temp, 10 );
	cfg_history_rate.add_item(temp);
	cfg_sample_rate = t;
	cfg_vgm_loop_count = SendDlgItemMessage( IDC_VGMLOOPCOUNT, CB_GETCURSEL );
	cfg_spc_interpolation = SendDlgItemMessage( IDC_INTERPOLATION, CB_GETCURSEL ) - 2;
	t = parse_time_crap( string_utf8_from_window( GetDlgItem( IDC_DLENGTH ) ) );
	if ( t != BORK_TIME ) cfg_default_length = t;
	else
	{
		print_time_crap( cfg_default_length, (char *)&temp );
		uSetDlgItemText( m_hWnd, IDC_DLENGTH, (char *)&temp );
	}
	t = parse_time_crap( string_utf8_from_window( GetDlgItem( IDC_DFADE ) ) );
	if ( t != BORK_TIME ) cfg_default_fade = t;
	else
	{
		print_time_crap( cfg_default_fade, (char *)&temp );
		uSetDlgItemText( m_hWnd, IDC_DFADE, (char *)&temp );
	}
	cfg_indefinite = SendDlgItemMessage( IDC_INDEFINITE, BM_GETCHECK );
	cfg_write = SendDlgItemMessage( IDC_WRITE, BM_GETCHECK );
	cfg_write_nsfe = SendDlgItemMessage( IDC_WNSFE, BM_GETCHECK );
	cfg_nsfe_ignore_playlists = SendDlgItemMessage( IDC_NSFEPL, BM_GETCHECK );
	cfg_nsf_ignore_w4011 = SendDlgItemMessage( IDC_NSF4011, BM_GETCHECK );
	cfg_spc_anti_surround = SendDlgItemMessage( IDC_ANTISURROUND, BM_GETCHECK );
	cfg_vgm_gd3_prefers_japanese = SendDlgItemMessage( IDC_GD3JAPANESE, BM_GETCHECK );
	cfg_effects_enable = SendDlgItemMessage( IDC_EFFECTS, BM_GETCHECK );
	cfg_format_enable = ~0;
	for (unsigned wp = IDC_FORMAT_NSF; wp <= IDC_FORMAT_SFM; wp++)
	{
		unsigned bit = 1 << ( wp - IDC_FORMAT_NSF );
		unsigned mask = ~0 ^ bit;
		cfg_format_enable = ( cfg_format_enable & mask ) | ( bit * SendDlgItemMessage( wp, BM_GETCHECK ) );
	}
	cfg_effects_bass = SendDlgItemMessage( IDC_SLIDER_BASS, TBM_GETPOS );
	cfg_effects_treble = SendDlgItemMessage( IDC_SLIDER_TREBLE, TBM_GETPOS );
	cfg_effects_echo_depth = SendDlgItemMessage( IDC_SLIDER_ECHO_DEPTH, TBM_GETPOS );
	
	OnChanged(); //our dialog content has not changed but the flags have - our currently shown values now match the settings so the apply button can be disabled
}
Ejemplo n.º 2
0
static int usf_info(void * context, const char * name, const char * value)
{
    if (!strcasecmp(name, "length") || !strcasecmp(name, "fade"))
        length_ms += parse_time_crap(value);
    else if (!strcasecmp(name, "_enablecompare") && *value)
        enable_compare = 1;
    else if (!strcasecmp(name, "_enablefifofull") && *value)
        enable_fifo_full = 1;
    
    return 0;
}
Ejemplo n.º 3
0
bool CMyPreferences::HasChanged() {
	//returns whether our dialog content is different from the current configuration (whether the apply button should be enabled or not)
	bool changed = false;
	if ( !changed && GetDlgItemInt( IDC_SAMPLERATE, NULL, FALSE ) != cfg_sample_rate ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_INTERPOLATION, CB_GETCURSEL ) != cfg_spc_interpolation + 2 ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_VGMLOOPCOUNT, CB_GETCURSEL ) != cfg_vgm_loop_count ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_INDEFINITE, BM_GETCHECK ) != cfg_indefinite ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_WRITE, BM_GETCHECK ) != cfg_write ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_WNSFE, BM_GETCHECK ) != cfg_write_nsfe ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_NSFEPL, BM_GETCHECK ) != cfg_nsfe_ignore_playlists ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_NSF4011, BM_GETCHECK ) != cfg_nsf_ignore_w4011 ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_ANTISURROUND, BM_GETCHECK ) != cfg_spc_anti_surround ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_GD3JAPANESE, BM_GETCHECK ) != cfg_vgm_gd3_prefers_japanese ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_EFFECTS, BM_GETCHECK ) != cfg_effects_enable ) changed = true;
	if ( !changed )
	{
		unsigned format_enable = ~0;
		for (unsigned wp = IDC_FORMAT_NSF; wp <= IDC_FORMAT_SFM; wp++)
		{
			unsigned bit = 1 << ( wp - IDC_FORMAT_NSF );
			unsigned mask = ~0 ^ bit;
			format_enable = ( format_enable & mask ) | ( bit * SendDlgItemMessage( wp, BM_GETCHECK ) );
		}
		if ( format_enable != cfg_format_enable ) changed = true;
	}
	if ( !changed && SendDlgItemMessage( IDC_SLIDER_BASS, TBM_GETPOS ) != cfg_effects_bass ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_SLIDER_TREBLE, TBM_GETPOS ) != cfg_effects_treble ) changed = true;
	if ( !changed && SendDlgItemMessage( IDC_SLIDER_ECHO_DEPTH, TBM_GETPOS ) != cfg_effects_echo_depth ) changed = true;
	if ( !changed )
	{
		int t = parse_time_crap( string_utf8_from_window( GetDlgItem( IDC_DLENGTH ) ) );
		if ( t != BORK_TIME && t != cfg_default_length ) changed = true;
	}
	if ( !changed )
	{
		int t = parse_time_crap( string_utf8_from_window( GetDlgItem( IDC_DFADE ) ) );
		if ( t != BORK_TIME && t != cfg_default_fade ) changed = true;
	}
	return changed;
}
Ejemplo n.º 4
0
static int psf_info_meta(void* context,
                         const char* name, const char* value)
{
  USFContext* usf = (USFContext*)context;
  if (!strcasecmp(name, "length"))
    usf->len = parse_time_crap(value);
  if (!strcasecmp(name, "title"))
    usf->title = value;
  if (!strcasecmp(name, "artist"))
    usf->artist = value;

  return 0;
}
Ejemplo n.º 5
0
static int psf_info_meta(void * context, const char * name, const char * value)
{
//fprintf(stderr, "dump k: %s v: %s\n", name, value);	
    struct psf_load_state * state = ( struct psf_load_state * ) context;

    if ( !strcasecmp( name, "length" ) )
    {
        unsigned long n = parse_time_crap( value );
        if ( n != BORK_TIME ) state->tag_song_ms = n;
    }
    else if ( !strcasecmp( name, "fade" ) )
    {
        unsigned long n = parse_time_crap( value );
        if ( n != BORK_TIME ) state->tag_fade_ms = n;
    }
    else if ( !strcasecmp( name, "_refresh" ) )
    {
        char * end;
        state->refresh = strtoul( value, &end, 10 );
    }
	psf_info_meta2(context, name, value);
	return 0;
}
Ejemplo n.º 6
0
static int psf_info_dump(void * context, const char * name, const char * value)
{
    struct psf_load_state * state = ( struct psf_load_state * ) context;

//fprintf(stderr, "dump k: %s v: %s\n", name, value);	
	
    if ( !strcasecmp( name, "length" ) )
    {
        unsigned long n = parse_time_crap( value );
        if ( n != BORK_TIME ) state->tag_song_ms = n;
    }
    else if ( !strcasecmp( name, "fade" ) )
    {
        unsigned long n = parse_time_crap( value );
        if ( n != BORK_TIME ) state->tag_fade_ms = n;
    }
    else if ( !strcasecmp( name, "_refresh" ) )
    {
        char * end;
        state->refresh = strtoul( value, &end, 10 );
    }
    else if ( !strcasecmp( name, "utf8" ) )
    {
        state->utf8 = 1;
    }
    else if ( *name != '_' )
    {
        if ( !strcasecmp( name, "game" ) ) name = "album";
        else if ( !strcasecmp( name, "year" ) ) name = "date";
        else if ( !strcasecmp( name, "tracknumber" ) ) name = "track";
        else if ( !strcasecmp( name, "discnumber" ) ) name = "disc";

        state->tags = add_tag( state->tags, name, value );
    }

    return 0;
}
Ejemplo n.º 7
0
static int psf_info_meta(void * context, const char * name, const char * value)
{
  NCSFContext* ncsf = (NCSFContext*)context;

  if (!strcasecmp(name, "game"))
    ncsf->album = value;
  else if (!strcasecmp(name, "year"))
    ncsf->year = atoi(value);
  else if (!strcasecmp(name, "length"))
  {
    int temp = parse_time_crap(value);
    if (temp != BORK_TIME)
      ncsf->length = temp;
  }

  return 0;
}