Improved Chipset Vsync to audio
This commit is contained in:
parent
1547d5673d
commit
3ee52daf1f
11 changed files with 6191 additions and 6110 deletions
|
@ -88,10 +88,10 @@ int sound_available = 0;
|
||||||
void(*sample_handler)(void);
|
void(*sample_handler)(void);
|
||||||
static void(*sample_prehandler)(unsigned long best_evtime);
|
static void(*sample_prehandler)(unsigned long best_evtime);
|
||||||
|
|
||||||
unsigned long scaled_sample_evtime;
|
float scaled_sample_evtime;
|
||||||
|
|
||||||
static unsigned long last_cycles;
|
static unsigned long last_cycles;
|
||||||
static unsigned long next_sample_evtime;
|
static float next_sample_evtime;
|
||||||
|
|
||||||
typedef uae_s8 sample8_t;
|
typedef uae_s8 sample8_t;
|
||||||
#define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].vol; } while (0)
|
#define DO_CHANNEL_1(v, c) do { (v) *= audio_channel[c].vol; } while (0)
|
||||||
|
|
|
@ -2344,7 +2344,7 @@ static int cfgfile_parse_hardware(struct uae_prefs *p, const TCHAR *option, TCHA
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (cfgfile_intval(option, value, _T("cachesize"), &p->cachesize, 1)
|
if (cfgfile_intval(option, value, _T("cachesize"), &p->cachesize, 1)
|
||||||
|| cfgfile_intval(option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate, 1)
|
|| cfgfile_doubleval (option, value, _T("chipset_refreshrate"), &p->chipset_refreshrate)
|
||||||
|| cfgfile_intval(option, value, _T("fastmem_size"), &p->fastmem_size, 0x100000)
|
|| cfgfile_intval(option, value, _T("fastmem_size"), &p->fastmem_size, 0x100000)
|
||||||
|| cfgfile_intval(option, value, _T("z3mem_size"), &p->z3fastmem_size, 0x100000)
|
|| cfgfile_intval(option, value, _T("z3mem_size"), &p->z3fastmem_size, 0x100000)
|
||||||
|| cfgfile_intval(option, value, _T("z3mem_start"), &p->z3fastmem_start, 1)
|
|| cfgfile_intval(option, value, _T("z3mem_start"), &p->z3fastmem_start, 1)
|
||||||
|
|
12205
src/custom.cpp
12205
src/custom.cpp
File diff suppressed because it is too large
Load diff
|
@ -2210,3 +2210,25 @@ void drawing_init(void)
|
||||||
|
|
||||||
reset_drawing();
|
reset_drawing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int isvsync_chipset(void)
|
||||||
|
{
|
||||||
|
if (picasso_on)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isvsync_rtg(void)
|
||||||
|
{
|
||||||
|
if (!picasso_on)
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int isvsync(void)
|
||||||
|
{
|
||||||
|
if (picasso_on)
|
||||||
|
return isvsync_rtg();
|
||||||
|
else
|
||||||
|
return isvsync_chipset();
|
||||||
|
}
|
|
@ -13,11 +13,31 @@
|
||||||
#include "rtgmodes.h"
|
#include "rtgmodes.h"
|
||||||
#include "xwin.h"
|
#include "xwin.h"
|
||||||
|
|
||||||
#define RED 0
|
double getvsyncrate(double hz, int *mult)
|
||||||
|
{
|
||||||
|
// struct apmode *ap = picasso_on ? &currprefs.gfx_apmode[1] : &currprefs.gfx_apmode[0];
|
||||||
|
|
||||||
|
if (hz < 0)
|
||||||
|
return 0;
|
||||||
|
if (hz > 85) {
|
||||||
|
*mult = -1;
|
||||||
|
return hz / 2;
|
||||||
|
}
|
||||||
|
if (hz < 35 && hz > 0) {
|
||||||
|
// if (ap->gfx_interlaced)
|
||||||
|
// *mult = 0;
|
||||||
|
// else
|
||||||
|
*mult = 1;
|
||||||
|
return hz * 2;
|
||||||
|
}
|
||||||
|
*mult = 0;
|
||||||
|
return hz;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define RED 0
|
||||||
#define GRN 1
|
#define GRN 1
|
||||||
#define BLU 2
|
#define BLU 2
|
||||||
|
|
||||||
|
|
||||||
unsigned int doMask (int p, int bits, int shift)
|
unsigned int doMask (int p, int bits, int shift)
|
||||||
{
|
{
|
||||||
/* p is a value from 0 to 15 (Amiga color value)
|
/* p is a value from 0 to 15 (Amiga color value)
|
||||||
|
|
|
@ -30,7 +30,7 @@ extern void update_audio (void);
|
||||||
extern void audio_evhandler (void);
|
extern void audio_evhandler (void);
|
||||||
extern void audio_hsync (void);
|
extern void audio_hsync (void);
|
||||||
extern void audio_update_adkmasks (void);
|
extern void audio_update_adkmasks (void);
|
||||||
extern void update_sound (float clk);
|
extern void update_sound (double clk);
|
||||||
extern void led_filter_audio (void);
|
extern void led_filter_audio (void);
|
||||||
extern void set_audio(void);
|
extern void set_audio(void);
|
||||||
extern int audio_activate(void);
|
extern int audio_activate(void);
|
||||||
|
|
|
@ -115,10 +115,13 @@ STATIC_INLINE uae_u16 INTREQR (void)
|
||||||
#define EQU_ENDLINE_PAL 8
|
#define EQU_ENDLINE_PAL 8
|
||||||
#define EQU_ENDLINE_NTSC 10
|
#define EQU_ENDLINE_NTSC 10
|
||||||
|
|
||||||
extern int maxhpos;
|
extern int maxhpos, maxhpos_short;
|
||||||
extern int maxvpos, maxvpos_nom, maxvpos_display;
|
extern int maxvpos, maxvpos_nom, maxvpos_display;
|
||||||
extern int minfirstline;
|
extern int hsyncstartpos, hsyncendpos;
|
||||||
extern int vblank_hz;
|
extern int minfirstline, vblank_endline, numscrlines;
|
||||||
|
extern double vblank_hz, fake_vblank_hz;
|
||||||
|
extern int vblank_skip, doublescan;
|
||||||
|
extern bool programmedmode;
|
||||||
|
|
||||||
#define DMA_AUD0 0x0001
|
#define DMA_AUD0 0x0001
|
||||||
#define DMA_AUD1 0x0002
|
#define DMA_AUD1 0x0002
|
||||||
|
|
|
@ -12,7 +12,7 @@ extern int sound_available;
|
||||||
extern void (*sample_handler) (void);
|
extern void (*sample_handler) (void);
|
||||||
/* sample_evtime is in normal Amiga cycles; scaled_sample_evtime is in our
|
/* sample_evtime is in normal Amiga cycles; scaled_sample_evtime is in our
|
||||||
event cycles. */
|
event cycles. */
|
||||||
extern unsigned long scaled_sample_evtime;
|
extern float scaled_sample_evtime;
|
||||||
|
|
||||||
/* Determine if we can produce any sound at all. This can be only a guess;
|
/* Determine if we can produce any sound at all. This can be only a guess;
|
||||||
* if unsure, say yes. Any call to init_sound may change the value. */
|
* if unsure, say yes. Any call to init_sound may change the value. */
|
||||||
|
|
|
@ -185,7 +185,7 @@ struct uae_prefs {
|
||||||
int waiting_blits;
|
int waiting_blits;
|
||||||
unsigned int chipset_mask;
|
unsigned int chipset_mask;
|
||||||
bool ntscmode;
|
bool ntscmode;
|
||||||
int chipset_refreshrate;
|
double chipset_refreshrate;
|
||||||
int collision_level;
|
int collision_level;
|
||||||
int leds_on_screen;
|
int leds_on_screen;
|
||||||
int fast_copper;
|
int fast_copper;
|
||||||
|
|
|
@ -10,9 +10,12 @@
|
||||||
|
|
||||||
typedef uae_u32 xcolnr;
|
typedef uae_u32 xcolnr;
|
||||||
|
|
||||||
typedef int (*allocfunc_type)(int, int, int, xcolnr *);
|
typedef int(*allocfunc_type)(int, int, int, xcolnr *);
|
||||||
|
|
||||||
extern xcolnr xcolors[4096];
|
extern xcolnr xcolors[4096];
|
||||||
|
extern xcolnr xcolors_16[4096];
|
||||||
|
extern xcolnr xcolors_32[4096];
|
||||||
|
extern uae_u32 p96_rgbx16[65536];
|
||||||
|
|
||||||
extern int graphics_setup (void);
|
extern int graphics_setup (void);
|
||||||
extern int graphics_init (bool);
|
extern int graphics_init (bool);
|
||||||
|
@ -21,21 +24,10 @@ extern void graphics_leave (void);
|
||||||
extern int handle_msgpump (void);
|
extern int handle_msgpump (void);
|
||||||
extern void setup_brkhandler (void);
|
extern void setup_brkhandler (void);
|
||||||
extern bool vsync_switchmode (int);
|
extern bool vsync_switchmode (int);
|
||||||
STATIC_INLINE int isvsync_chipset (void)
|
|
||||||
{
|
|
||||||
if (picasso_on)
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
STATIC_INLINE int isvsync_rtg (void)
|
|
||||||
{
|
|
||||||
if (!picasso_on)
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern void flush_screen (void);
|
extern void flush_screen (void);
|
||||||
|
extern int isvsync_chipset(void);
|
||||||
|
extern int isvsync_rtg(void);
|
||||||
|
extern int isvsync(void);
|
||||||
|
|
||||||
extern int lockscr (void);
|
extern int lockscr (void);
|
||||||
extern void unlockscr (void);
|
extern void unlockscr (void);
|
||||||
|
@ -49,6 +41,7 @@ extern unsigned int doMask (int p, int bits, int shift);
|
||||||
extern unsigned int doMask256 (int p, int bits, int shift);
|
extern unsigned int doMask256 (int p, int bits, int shift);
|
||||||
extern void alloc_colors64k (int, int, int, int, int, int, int);
|
extern void alloc_colors64k (int, int, int, int, int, int, int);
|
||||||
extern void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt);
|
extern void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt);
|
||||||
|
extern double getvsyncrate(double hz, int *mult);
|
||||||
|
|
||||||
extern int max_uae_width, max_uae_height;
|
extern int max_uae_width, max_uae_height;
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ void pause_sound(void) {}
|
||||||
|
|
||||||
void resume_sound(void) {}
|
void resume_sound(void) {}
|
||||||
|
|
||||||
void update_sound(float) {}
|
void update_sound(double) {}
|
||||||
|
|
||||||
void reset_sound(void) {}
|
void reset_sound(void) {}
|
||||||
|
|
||||||
|
@ -91,12 +91,12 @@ void restart_sound_buffer(void) {}
|
||||||
static int have_sound = 0;
|
static int have_sound = 0;
|
||||||
static int lastfreq;
|
static int lastfreq;
|
||||||
|
|
||||||
void update_sound(float clk)
|
void update_sound(double clk)
|
||||||
{
|
{
|
||||||
float evtime;
|
float evtime;
|
||||||
|
|
||||||
evtime = clk * CYCLE_UNIT / (float)currprefs.sound_freq;
|
evtime = clk * CYCLE_UNIT / (float)currprefs.sound_freq;
|
||||||
scaled_sample_evtime = (int)evtime;
|
scaled_sample_evtime = evtime;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;
|
static int s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue