comparison blastem.c @ 1002:8d032a368dd5

Made low pass filter frequency configurable
author Michael Pavone <pavone@retrodev.com>
date Sun, 01 May 2016 13:36:14 -0700
parents 560da2e455c2
children 51885857c019
comparison
equal deleted inserted replaced
1001:1dc749c9c0d9 1002:8d032a368dd5
30 uint32_t MCLKS_PER_68K; 30 uint32_t MCLKS_PER_68K;
31 #define MCLKS_PER_YM 7 31 #define MCLKS_PER_YM 7
32 #define MCLKS_PER_Z80 15 32 #define MCLKS_PER_Z80 15
33 #define MCLKS_PER_PSG (MCLKS_PER_Z80*16) 33 #define MCLKS_PER_PSG (MCLKS_PER_Z80*16)
34 #define DEFAULT_SYNC_INTERVAL MCLKS_LINE 34 #define DEFAULT_SYNC_INTERVAL MCLKS_LINE
35 #define DEFAULT_LOWPASS_CUTOFF 3390
35 36
36 //TODO: Figure out the exact value for this 37 //TODO: Figure out the exact value for this
37 #define LINES_NTSC 262 38 #define LINES_NTSC 262
38 #define LINES_PAL 312 39 #define LINES_PAL 312
39 40
896 init_vdp_context(gen->vdp, version_reg & 0x40); 897 init_vdp_context(gen->vdp, version_reg & 0x40);
897 gen->frame_end = vdp_cycles_to_frame_end(gen->vdp); 898 gen->frame_end = vdp_cycles_to_frame_end(gen->vdp);
898 char * config_cycles = tern_find_path(config, "clocks\0max_cycles\0").ptrval; 899 char * config_cycles = tern_find_path(config, "clocks\0max_cycles\0").ptrval;
899 gen->max_cycles = config_cycles ? atoi(config_cycles) : DEFAULT_SYNC_INTERVAL; 900 gen->max_cycles = config_cycles ? atoi(config_cycles) : DEFAULT_SYNC_INTERVAL;
900 901
902 char * lowpass_cutoff_str = tern_find_path(config, "audio\0lowpass_cutoff\0").ptrval;
903 uint32_t lowpass_cutoff = lowpass_cutoff_str ? atoi(lowpass_cutoff_str) : DEFAULT_LOWPASS_CUTOFF;
904
901 gen->ym = malloc(sizeof(ym2612_context)); 905 gen->ym = malloc(sizeof(ym2612_context));
902 ym_init(gen->ym, render_sample_rate(), gen->master_clock, MCLKS_PER_YM, render_audio_buffer(), ym_opts); 906 ym_init(gen->ym, render_sample_rate(), gen->master_clock, MCLKS_PER_YM, render_audio_buffer(), ym_opts, lowpass_cutoff);
903 907
904 gen->psg = malloc(sizeof(psg_context)); 908 gen->psg = malloc(sizeof(psg_context));
905 psg_init(gen->psg, render_sample_rate(), gen->master_clock, MCLKS_PER_PSG, render_audio_buffer()); 909 psg_init(gen->psg, render_sample_rate(), gen->master_clock, MCLKS_PER_PSG, render_audio_buffer(), lowpass_cutoff);
906 910
907 gen->z80 = calloc(1, sizeof(z80_context)); 911 gen->z80 = calloc(1, sizeof(z80_context));
908 #ifndef NO_Z80 912 #ifndef NO_Z80
909 z80_options *z_opts = malloc(sizeof(z80_options)); 913 z80_options *z_opts = malloc(sizeof(z80_options));
910 init_z80_opts(z_opts, z80_map, 5, NULL, 0, MCLKS_PER_Z80); 914 init_z80_opts(z_opts, z80_map, 5, NULL, 0, MCLKS_PER_Z80);