More warnings fixed, only 104 left in cpu, slirp and voodoo!
This commit is contained in:
@@ -160,7 +160,7 @@ typedef unsigned char u8;
|
|||||||
typedef unsigned int LZF_HSLOT;
|
typedef unsigned int LZF_HSLOT;
|
||||||
#else
|
#else
|
||||||
# define LZF_HSLOT_BIAS 0
|
# define LZF_HSLOT_BIAS 0
|
||||||
typedef const u8 *LZF_HSLOT;
|
typedef u8 *LZF_HSLOT;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef LZF_HSLOT LZF_STATE[1 << (HLOG)];
|
typedef LZF_HSLOT LZF_STATE[1 << (HLOG)];
|
||||||
|
|||||||
@@ -108,11 +108,11 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||||||
#if !LZF_STATE_ARG
|
#if !LZF_STATE_ARG
|
||||||
LZF_STATE htab;
|
LZF_STATE htab;
|
||||||
#endif
|
#endif
|
||||||
const u8 *ip = (const u8 *)in_data;
|
u8 const *ip = (const u8 *)in_data;
|
||||||
u8 *op = (u8 *)out_data;
|
u8 *op = (u8 *)out_data;
|
||||||
const u8 *in_end = ip + in_len;
|
const u8 *in_end = ip + in_len;
|
||||||
u8 *out_end = op + out_len;
|
u8 *out_end = op + out_len;
|
||||||
const u8 *ref;
|
u8 *ref;
|
||||||
|
|
||||||
/* off requires a type wide enough to hold a general pointer difference.
|
/* off requires a type wide enough to hold a general pointer difference.
|
||||||
* ISO C doesn't have that (size_t might not be enough and ptrdiff_t only
|
* ISO C doesn't have that (size_t might not be enough and ptrdiff_t only
|
||||||
@@ -145,7 +145,8 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||||||
|
|
||||||
hval = NEXT (hval, ip);
|
hval = NEXT (hval, ip);
|
||||||
hslot = htab + IDX (hval);
|
hslot = htab + IDX (hval);
|
||||||
ref = *hslot + LZF_HSLOT_BIAS; *hslot = ip - LZF_HSLOT_BIAS;
|
ref = *hslot + LZF_HSLOT_BIAS;
|
||||||
|
*hslot = *(LZF_HSLOT *)(ip - LZF_HSLOT_BIAS);
|
||||||
|
|
||||||
if (1
|
if (1
|
||||||
#if INIT_HTAB
|
#if INIT_HTAB
|
||||||
@@ -235,7 +236,7 @@ lzf_compress (const void *const in_data, unsigned int in_len,
|
|||||||
hval = FRST (ip);
|
hval = FRST (ip);
|
||||||
|
|
||||||
hval = NEXT (hval, ip);
|
hval = NEXT (hval, ip);
|
||||||
htab[IDX (hval)] = ip - LZF_HSLOT_BIAS;
|
htab[IDX (hval)] = *(LZF_HSLOT *)(ip - LZF_HSLOT_BIAS);
|
||||||
ip++;
|
ip++;
|
||||||
|
|
||||||
# if VERY_FAST && !ULTRA_FAST
|
# if VERY_FAST && !ULTRA_FAST
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the LPT style parallel ports.
|
* Implementation of the LPT style parallel ports.
|
||||||
*
|
*
|
||||||
* Version: @(#)lpt.c 1.0.2 2018/03/15
|
* Version: @(#)lpt.c 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -274,13 +274,13 @@ lpt_devices_init(void)
|
|||||||
else {
|
else {
|
||||||
lpt_device_ts[i] = lpt_devices[c].device;
|
lpt_device_ts[i] = lpt_devices[c].device;
|
||||||
if (lpt_device_ts[i])
|
if (lpt_device_ts[i])
|
||||||
lpt_device_ps[i] = lpt_device_ts[i]->init();
|
lpt_device_ps[i] = lpt_device_ts[i]->init(lpt_devices[c].device);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char *
|
const char *
|
||||||
lpt_device_get_name(int id)
|
lpt_device_get_name(int id)
|
||||||
{
|
{
|
||||||
if (strlen((char *)lpt_devices[id].name) == 0)
|
if (strlen((char *)lpt_devices[id].name) == 0)
|
||||||
|
|||||||
11
src/lpt.h
11
src/lpt.h
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Definitions for the LPT parallel port handlerss.
|
* Definitions for the LPT parallel port handlerss.
|
||||||
*
|
*
|
||||||
* Version: @(#)lpt.h 1.0.1 2018/02/14
|
* Version: @(#)lpt.h 1.0.2 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -40,9 +40,10 @@
|
|||||||
# define EMU_LPT_H
|
# define EMU_LPT_H
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct _lpt_device_ {
|
||||||
char name[80];
|
const char *name;
|
||||||
void *(*init)(void);
|
int type;
|
||||||
|
void *(*init)(const struct _lpt_device_ *);
|
||||||
void (*close)(void *priv);
|
void (*close)(void *priv);
|
||||||
void (*write_data)(uint8_t val, void *priv);
|
void (*write_data)(uint8_t val, void *priv);
|
||||||
void (*write_ctrl)(uint8_t val, void *priv);
|
void (*write_ctrl)(uint8_t val, void *priv);
|
||||||
@@ -65,7 +66,7 @@ extern void lpt3_remove(void);
|
|||||||
extern void lpt_devices_init(void);
|
extern void lpt_devices_init(void);
|
||||||
extern void lpt_devices_close(void);
|
extern void lpt_devices_close(void);
|
||||||
|
|
||||||
extern char *lpt_device_get_name(int id);
|
extern const char *lpt_device_get_name(int id);
|
||||||
extern char *lpt_device_get_internal_name(int id);
|
extern char *lpt_device_get_internal_name(int id);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Handle WinPcap library processing.
|
* Handle WinPcap library processing.
|
||||||
*
|
*
|
||||||
* Version: @(#)net_pcap.c 1.0.4 2018/03/26
|
* Version: @(#)net_pcap.c 1.0.5 2018/03/28
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -68,17 +68,17 @@ static event_t *poll_state;
|
|||||||
|
|
||||||
|
|
||||||
/* Pointers to the real functions. */
|
/* Pointers to the real functions. */
|
||||||
static const char *(*f_pcap_lib_version)(void);
|
static char *const (*f_pcap_lib_version)(void);
|
||||||
static int (*f_pcap_findalldevs)(pcap_if_t **,char *);
|
static int (*f_pcap_findalldevs)(pcap_if_t **,char *);
|
||||||
static void (*f_pcap_freealldevs)(pcap_if_t *);
|
static void (*f_pcap_freealldevs)(pcap_if_t *);
|
||||||
static pcap_t *(*f_pcap_open_live)(const char *,int,int,int,char *);
|
static pcap_t *(*f_pcap_open_live)(const char *,int,int,int,char *);
|
||||||
static int (*f_pcap_compile)(pcap_t *,struct bpf_program *,
|
static int (*f_pcap_compile)(pcap_t *,struct bpf_program *,
|
||||||
const char *,int,bpf_u_int32);
|
const char *,int,bpf_u_int32);
|
||||||
static int (*f_pcap_setfilter)(pcap_t *,struct bpf_program *);
|
static int (*f_pcap_setfilter)(pcap_t *,struct bpf_program *);
|
||||||
static const u_char *(*f_pcap_next)(pcap_t *,struct pcap_pkthdr *);
|
static u_char *const (*f_pcap_next)(pcap_t *,struct pcap_pkthdr *);
|
||||||
static int (*f_pcap_sendpacket)(pcap_t *,const u_char *,int);
|
static int (*f_pcap_sendpacket)(pcap_t *,const u_char *,int);
|
||||||
static void (*f_pcap_close)(pcap_t *);
|
static void (*f_pcap_close)(pcap_t *);
|
||||||
static dllimp_t pcap_imports[] = {
|
static const dllimp_t pcap_imports[] = {
|
||||||
{ "pcap_lib_version", &f_pcap_lib_version },
|
{ "pcap_lib_version", &f_pcap_lib_version },
|
||||||
{ "pcap_findalldevs", &f_pcap_findalldevs },
|
{ "pcap_findalldevs", &f_pcap_findalldevs },
|
||||||
{ "pcap_freealldevs", &f_pcap_freealldevs },
|
{ "pcap_freealldevs", &f_pcap_freealldevs },
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Define the various platform support functions.
|
* Define the various platform support functions.
|
||||||
*
|
*
|
||||||
* Version: @(#)plat.h 1.0.5 2018/03/10
|
* Version: @(#)plat.h 1.0.6 2018/03/28
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -139,7 +139,7 @@ typedef struct {
|
|||||||
} dllimp_t;
|
} dllimp_t;
|
||||||
|
|
||||||
|
|
||||||
extern void *dynld_module(const char *, dllimp_t *);
|
extern void *dynld_module(const char *, const dllimp_t *);
|
||||||
extern void dynld_close(void *);
|
extern void dynld_close(void *);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Emulation of SCSI fixed and removable disks.
|
* Emulation of SCSI fixed and removable disks.
|
||||||
*
|
*
|
||||||
* Version: @(#)scsi_disk.c 1.0.5 2018/03/27
|
* Version: @(#)scsi_disk.c 1.0.6 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -1369,7 +1369,7 @@ atapi_out:
|
|||||||
case GPCMD_READ_CDROM_CAPACITY:
|
case GPCMD_READ_CDROM_CAPACITY:
|
||||||
shdc[id].temp_buffer = (uint8_t *) malloc(8);
|
shdc[id].temp_buffer = (uint8_t *) malloc(8);
|
||||||
|
|
||||||
if (scsi_hd_read_capacity(id, shdc[id].current_cdb, shdc[id].temp_buffer, &len) == 0) {
|
if (scsi_hd_read_capacity(id, shdc[id].current_cdb, shdc[id].temp_buffer, (uint32_t *)&len) == 0) {
|
||||||
scsi_hd_set_phase(id, SCSI_PHASE_STATUS);
|
scsi_hd_set_phase(id, SCSI_PHASE_STATUS);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Interface to the OpenAL sound processing library.
|
* Interface to the OpenAL sound processing library.
|
||||||
*
|
*
|
||||||
* Version: @(#)openal.c 1.0.4 2018/03/10
|
* Version: @(#)openal.c 1.0.5 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -331,7 +331,7 @@ givealbuffer_common(void *buf, uint8_t src, int size, int freq)
|
|||||||
f_alGetSourcei(source[src], AL_BUFFERS_PROCESSED, &processed);
|
f_alGetSourcei(source[src], AL_BUFFERS_PROCESSED, &processed);
|
||||||
if (processed >= 1) {
|
if (processed >= 1) {
|
||||||
gain = pow(10.0, (double)sound_gain / 20.0);
|
gain = pow(10.0, (double)sound_gain / 20.0);
|
||||||
f_alListenerf(AL_GAIN, gain);
|
f_alListenerf(AL_GAIN, (float)gain);
|
||||||
|
|
||||||
f_alSourceUnqueueBuffers(source[src], 1, &buffer);
|
f_alSourceUnqueueBuffers(source[src], 1, &buffer);
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Emulation of the AD1848 (Windows Sound System) CODEC.
|
* Emulation of the AD1848 (Windows Sound System) CODEC.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_ad1848.c 1.0.1 2018/02/14
|
* Version: @(#)snd_ad1848.c 1.0.2 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -96,7 +96,7 @@ void ad1848_write(uint16_t addr, uint8_t val, void *p)
|
|||||||
switch (ad1848->index)
|
switch (ad1848->index)
|
||||||
{
|
{
|
||||||
case 8:
|
case 8:
|
||||||
freq = (val & 1) ? 16934400LL : 24576000LL;
|
freq = (double) ((val & 1) ? 16934400LL : 24576000LL);
|
||||||
switch ((val >> 1) & 7)
|
switch ((val >> 1) & 7)
|
||||||
{
|
{
|
||||||
case 0: freq /= 3072; break;
|
case 0: freq /= 3072; break;
|
||||||
@@ -108,7 +108,7 @@ void ad1848_write(uint16_t addr, uint8_t val, void *p)
|
|||||||
case 6: freq /= 512; break;
|
case 6: freq /= 512; break;
|
||||||
case 7: freq /= 2560; break;
|
case 7: freq /= 2560; break;
|
||||||
}
|
}
|
||||||
ad1848->freq = freq;
|
ad1848->freq = (int64_t)freq;
|
||||||
ad1848->timer_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / (double)ad1848->freq));
|
ad1848->timer_latch = (int64_t)((double)TIMER_USEC * (1000000.0 / (double)ad1848->freq));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* TODO: Stack allocation of big buffers (line 688 et al.)
|
* TODO: Stack allocation of big buffers (line 688 et al.)
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_adlibgold.c 1.0.4 2018/03/15
|
* Version: @(#)snd_adlibgold.c 1.0.5 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -743,7 +743,7 @@ static void adgold_get_buffer(int32_t *buffer, int len, void *p)
|
|||||||
/*Filter left channel, leave right channel unchanged*/
|
/*Filter left channel, leave right channel unchanged*/
|
||||||
/*Filter cutoff is largely a guess*/
|
/*Filter cutoff is largely a guess*/
|
||||||
for (c = 0; c < len * 2; c += 2)
|
for (c = 0; c < len * 2; c += 2)
|
||||||
adgold_buffer[c] += adgold_pseudo_stereo_iir(adgold_buffer[c]);
|
adgold_buffer[c] += (int16_t)adgold_pseudo_stereo_iir(adgold_buffer[c]);
|
||||||
break;
|
break;
|
||||||
case 0x18: /*Spatial stereo*/
|
case 0x18: /*Spatial stereo*/
|
||||||
/*Quite probably wrong, I only have the diagram in the TDA8425 datasheet
|
/*Quite probably wrong, I only have the diagram in the TDA8425 datasheet
|
||||||
@@ -765,8 +765,8 @@ static void adgold_get_buffer(int32_t *buffer, int len, void *p)
|
|||||||
|
|
||||||
/*Output is deliberately halved to avoid clipping*/
|
/*Output is deliberately halved to avoid clipping*/
|
||||||
temp = ((int32_t)adgold_buffer[c] * adgold->vol_l) >> 17;
|
temp = ((int32_t)adgold_buffer[c] * adgold->vol_l) >> 17;
|
||||||
lowpass = adgold_lowpass_iir(0, temp);
|
lowpass = (int32_t)adgold_lowpass_iir(0, (float)temp);
|
||||||
highpass = adgold_highpass_iir(0, temp);
|
highpass = (int32_t)adgold_highpass_iir(0, (float)temp);
|
||||||
if (adgold->bass > 6)
|
if (adgold->bass > 6)
|
||||||
temp += (lowpass * bass_attenuation[adgold->bass]) >> 14;
|
temp += (lowpass * bass_attenuation[adgold->bass]) >> 14;
|
||||||
else if (adgold->bass < 6)
|
else if (adgold->bass < 6)
|
||||||
@@ -782,8 +782,8 @@ static void adgold_get_buffer(int32_t *buffer, int len, void *p)
|
|||||||
buffer[c] += temp;
|
buffer[c] += temp;
|
||||||
|
|
||||||
temp = ((int32_t)adgold_buffer[c+1] * adgold->vol_r) >> 17;
|
temp = ((int32_t)adgold_buffer[c+1] * adgold->vol_r) >> 17;
|
||||||
lowpass = adgold_lowpass_iir(1, temp);
|
lowpass = (int32_t)adgold_lowpass_iir(1, (float)temp);
|
||||||
highpass = adgold_highpass_iir(1, temp);
|
highpass = (int32_t)adgold_highpass_iir(1, (float)temp);
|
||||||
if (adgold->bass > 6)
|
if (adgold->bass > 6)
|
||||||
temp += (lowpass * bass_attenuation[adgold->bass]) >> 14;
|
temp += (lowpass * bass_attenuation[adgold->bass]) >> 14;
|
||||||
else if (adgold->bass < 6)
|
else if (adgold->bass < 6)
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the AudioPCI sound device.
|
* Implementation of the AudioPCI sound device.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_audiopci.c 1.0.7 2018/03/26
|
* Version: @(#)snd_audiopci.c 1.0.8 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -1246,7 +1246,7 @@ static void generate_es1371_filter()
|
|||||||
double h = sinc(2.0 * fC * ((double)n - ((double)(ES1371_NCoef-1) / 2.0)));
|
double h = sinc(2.0 * fC * ((double)n - ((double)(ES1371_NCoef-1) / 2.0)));
|
||||||
|
|
||||||
/*Create windowed-sinc filter*/
|
/*Create windowed-sinc filter*/
|
||||||
low_fir_es1371_coef[n] = w * h;
|
low_fir_es1371_coef[n] = (float)(w * h);
|
||||||
}
|
}
|
||||||
|
|
||||||
low_fir_es1371_coef[(ES1371_NCoef - 1) / 2] = 1.0;
|
low_fir_es1371_coef[(ES1371_NCoef - 1) / 2] = 1.0;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of Emu8000 emulator.
|
* Implementation of Emu8000 emulator.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_emu8k.c 1.0.5 2018/03/26
|
* Version: @(#)snd_emu8k.c 1.0.6 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -396,7 +396,7 @@ static inline int32_t EMU8K_READ_INTERP_CUBIC(emu8k_t *emu8k, uint32_t int_addr,
|
|||||||
const int32_t dat3 = EMU8K_READ(emu8k, int_addr+2);
|
const int32_t dat3 = EMU8K_READ(emu8k, int_addr+2);
|
||||||
const int32_t dat4 = EMU8K_READ(emu8k, int_addr+3);
|
const int32_t dat4 = EMU8K_READ(emu8k, int_addr+3);
|
||||||
/* Note: I've ended using float for the table values to avoid some cases of integer overflow. */
|
/* Note: I've ended using float for the table values to avoid some cases of integer overflow. */
|
||||||
dat2 = dat1*table[0] + dat2*table[1] + dat3*table[2] + dat4*table[3];
|
dat2 = (int32_t) (dat1*table[0] + dat2*table[1] + dat3*table[2] + dat4*table[3]);
|
||||||
return dat2;
|
return dat2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1456,7 +1456,7 @@ void emu8k_outw(uint16_t addr, uint16_t val, void *p)
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
emu8k->voice[emu8k->cur_voice].ip = val;
|
emu8k->voice[emu8k->cur_voice].ip = val;
|
||||||
emu8k->voice[emu8k->cur_voice].ptrx_pit_target = freqtable[val] >> 18;
|
emu8k->voice[emu8k->cur_voice].ptrx_pit_target = (uint16_t) (freqtable[val] >> 18);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
@@ -1583,7 +1583,7 @@ void emu8k_work_chorus(int32_t *inbuf, int32_t *outbuf, emu8k_chorus_eng_t *engi
|
|||||||
/* Work left */
|
/* Work left */
|
||||||
double readdouble = (double)engine->write - (double)engine->delay_samples_central - offset_lfo;
|
double readdouble = (double)engine->write - (double)engine->delay_samples_central - offset_lfo;
|
||||||
int read = (int32_t)floor(readdouble);
|
int read = (int32_t)floor(readdouble);
|
||||||
int fraction_part = (readdouble - (double)read)*65536.0;
|
int fraction_part = (int)((readdouble - (double)read)*65536.0);
|
||||||
int next_value = read + 1;
|
int next_value = read + 1;
|
||||||
if(read < 0)
|
if(read < 0)
|
||||||
{
|
{
|
||||||
@@ -1641,15 +1641,15 @@ int32_t emu8k_reverb_comb_work(emu8k_reverb_combfilter_t* comb, int32_t in)
|
|||||||
/* get echo */
|
/* get echo */
|
||||||
int32_t output = comb->reflection[comb->read_pos];
|
int32_t output = comb->reflection[comb->read_pos];
|
||||||
/* apply lowpass */
|
/* apply lowpass */
|
||||||
comb->filterstore = (output*comb->damp2) + (comb->filterstore*comb->damp1);
|
comb->filterstore = (int32_t) ((output*comb->damp2) + (comb->filterstore*comb->damp1));
|
||||||
/* appply feedback */
|
/* appply feedback */
|
||||||
bufin = in - (comb->filterstore*comb->feedback);
|
bufin = (int32_t) (in - (comb->filterstore*comb->feedback));
|
||||||
/* store new value in delayed buffer */
|
/* store new value in delayed buffer */
|
||||||
comb->reflection[comb->read_pos] = bufin;
|
comb->reflection[comb->read_pos] = bufin;
|
||||||
|
|
||||||
if(++comb->read_pos>=comb->bufsize) comb->read_pos = 0;
|
if(++comb->read_pos>=comb->bufsize) comb->read_pos = 0;
|
||||||
|
|
||||||
return output*comb->output_gain;
|
return (int32_t) (output*comb->output_gain);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t emu8k_reverb_diffuser_work(emu8k_reverb_combfilter_t* comb, int32_t in)
|
int32_t emu8k_reverb_diffuser_work(emu8k_reverb_combfilter_t* comb, int32_t in)
|
||||||
@@ -1657,8 +1657,8 @@ int32_t emu8k_reverb_diffuser_work(emu8k_reverb_combfilter_t* comb, int32_t in)
|
|||||||
|
|
||||||
int32_t bufout = comb->reflection[comb->read_pos];
|
int32_t bufout = comb->reflection[comb->read_pos];
|
||||||
/*diffuse*/
|
/*diffuse*/
|
||||||
int32_t bufin = -in + (bufout*comb->feedback);
|
int32_t bufin = (int32_t) (-in + (bufout*comb->feedback));
|
||||||
int32_t output = bufout - (bufin*comb->feedback);
|
int32_t output = (int32_t) (bufout - (bufin*comb->feedback));
|
||||||
/* store new value in delayed buffer */
|
/* store new value in delayed buffer */
|
||||||
comb->reflection[comb->read_pos] = bufin;
|
comb->reflection[comb->read_pos] = bufin;
|
||||||
|
|
||||||
@@ -1685,7 +1685,7 @@ int32_t emu8k_reverb_tail_work(emu8k_reverb_combfilter_t* comb, emu8k_reverb_com
|
|||||||
int32_t emu8k_reverb_damper_work(emu8k_reverb_combfilter_t* comb, int32_t in)
|
int32_t emu8k_reverb_damper_work(emu8k_reverb_combfilter_t* comb, int32_t in)
|
||||||
{
|
{
|
||||||
/* apply lowpass */
|
/* apply lowpass */
|
||||||
comb->filterstore = (in*comb->damp2) + (comb->filterstore*comb->damp1);
|
comb->filterstore = (int32_t) ((in*comb->damp2) + (comb->filterstore*comb->damp1));
|
||||||
return comb->filterstore;
|
return comb->filterstore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1827,7 +1827,7 @@ void emu8k_update(emu8k_t *emu8k)
|
|||||||
/*move to 24bits*/
|
/*move to 24bits*/
|
||||||
dat <<= 8;
|
dat <<= 8;
|
||||||
|
|
||||||
dat -= (coef2 * emu_voice->filt_buffer[4]) >> 24; /*feedback*/
|
dat -= (int32_t) ((coef2 * emu_voice->filt_buffer[4]) >> 24); /*feedback*/
|
||||||
int64_t t1 = emu_voice->filt_buffer[1];
|
int64_t t1 = emu_voice->filt_buffer[1];
|
||||||
emu_voice->filt_buffer[1] = ((dat + emu_voice->filt_buffer[0]) * coef0 - emu_voice->filt_buffer[1] * coef1) >> 24;
|
emu_voice->filt_buffer[1] = ((dat + emu_voice->filt_buffer[0]) * coef0 - emu_voice->filt_buffer[1] * coef1) >> 24;
|
||||||
emu_voice->filt_buffer[1] = ClipBuffer(emu_voice->filt_buffer[1]);
|
emu_voice->filt_buffer[1] = ClipBuffer(emu_voice->filt_buffer[1]);
|
||||||
@@ -2099,7 +2099,7 @@ void emu8k_update(emu8k_t *emu8k)
|
|||||||
|
|
||||||
emu_voice->vtft_vol_target = env_vol_db_to_vol_target[attenuation >> 5];
|
emu_voice->vtft_vol_target = env_vol_db_to_vol_target[attenuation >> 5];
|
||||||
emu_voice->vtft_filter_target = filtercut >> 5;
|
emu_voice->vtft_filter_target = filtercut >> 5;
|
||||||
emu_voice->ptrx_pit_target = freqtable[currentpitch]>>18;
|
emu_voice->ptrx_pit_target = (int16_t) (freqtable[currentpitch]>>18);
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@@ -2319,9 +2319,9 @@ void emu8k_init(emu8k_t *emu8k, uint16_t emu_addr, int onboard_ram)
|
|||||||
else if (c < 32)
|
else if (c < 32)
|
||||||
millis = 11878.0f/c;
|
millis = 11878.0f/c;
|
||||||
else
|
else
|
||||||
millis = 360*exp((c - 32) / (16.0f/log(1.0f/2.0f)));
|
millis = (float)(360*exp((c - 32) / (16.0f/log(1.0f/2.0f))));
|
||||||
|
|
||||||
env_attack_to_samples[c] = 44.1f*millis;
|
env_attack_to_samples[c] = (int32_t) (44.1f * millis);
|
||||||
/* This is an alternate formula with linear increments, but probably incorrect:
|
/* This is an alternate formula with linear increments, but probably incorrect:
|
||||||
* millis = (256+4096*(0x7F-c)) */
|
* millis = (256+4096*(0x7F-c)) */
|
||||||
}
|
}
|
||||||
@@ -2367,11 +2367,11 @@ void emu8k_init(emu8k_t *emu8k, uint16_t emu_addr, int onboard_ram)
|
|||||||
filt_coeffs[qidx][c][1] = 16777216.0;
|
filt_coeffs[qidx][c][1] = 16777216.0;
|
||||||
filt_coeffs[qidx][c][2] = (int32_t)((1.0f / (0.7071f + q)) * 16777216.0);
|
filt_coeffs[qidx][c][2] = (int32_t)((1.0f / (0.7071f + q)) * 16777216.0);
|
||||||
#elif defined FILTER_MOOG
|
#elif defined FILTER_MOOG
|
||||||
float w0 = sin(2.0*M_PI*out / 44100.0);
|
float w0 = (float) (sin(2.0*M_PI*out / 44100.0));
|
||||||
float q_factor = 1.0f - w0;
|
float q_factor = 1.0f - w0;
|
||||||
float p = w0 + 0.8f * w0 * q_factor;
|
float p = w0 + 0.8f * w0 * q_factor;
|
||||||
float f = p + p - 1.0f;
|
float f = p + p - 1.0f;
|
||||||
float resonance = (1.0-pow(2.0,-qidx*24.0/90.0))*0.8;
|
float resonance = (float) ((1.0-pow(2.0,-qidx*24.0/90.0))*0.8);
|
||||||
float q = resonance * (1.0f + 0.5f * q_factor * (w0 + 5.6f * q_factor * q_factor));
|
float q = resonance * (1.0f + 0.5f * q_factor * (w0 + 5.6f * q_factor * q_factor));
|
||||||
filt_coeffs[qidx][c][0] = (int32_t)(p * 16777216.0);
|
filt_coeffs[qidx][c][0] = (int32_t)(p * 16777216.0);
|
||||||
filt_coeffs[qidx][c][1] = (int32_t)(f * 16777216.0);
|
filt_coeffs[qidx][c][1] = (int32_t)(f * 16777216.0);
|
||||||
@@ -2418,10 +2418,10 @@ void emu8k_init(emu8k_t *emu8k, uint16_t emu_addr, int onboard_ram)
|
|||||||
{
|
{
|
||||||
double x = (double)c * resdouble;
|
double x = (double)c * resdouble;
|
||||||
/* Cubic resolution is made of four table, but I've put them all in one table to optimize memory access. */
|
/* Cubic resolution is made of four table, but I've put them all in one table to optimize memory access. */
|
||||||
cubic_table[c*4] = (-0.5 * x * x * x + x * x - 0.5 * x) ;
|
cubic_table[c*4] = (float) ((-0.5 * x * x * x + x * x - 0.5 * x) );
|
||||||
cubic_table[c*4+1] = ( 1.5 * x * x * x - 2.5 * x * x + 1.0) ;
|
cubic_table[c*4+1] = (float) (( 1.5 * x * x * x - 2.5 * x * x + 1.0));
|
||||||
cubic_table[c*4+2] = (-1.5 * x * x * x + 2.0 * x * x + 0.5 * x) ;
|
cubic_table[c*4+2] = (float) ((-1.5 * x * x * x + 2.0 * x * x + 0.5 * x) );
|
||||||
cubic_table[c*4+3] = ( 0.5 * x * x * x - 0.5 * x * x) ;
|
cubic_table[c*4+3] = (float) (( 0.5 * x * x * x - 0.5 * x * x) );
|
||||||
}
|
}
|
||||||
/* Even when the documentation says that this has to be written by applications to initialize the card,
|
/* Even when the documentation says that this has to be written by applications to initialize the card,
|
||||||
* several applications and drivers ( aweman on windows, linux oss driver..) read it to detect an AWE card. */
|
* several applications and drivers ( aweman on windows, linux oss driver..) read it to detect an AWE card. */
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Gravis UltraSound sound device.
|
* Implementation of the Gravis UltraSound sound device.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_gus.c 1.0.2 2018/03/15
|
* Version: @(#)snd_gus.c 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -735,10 +735,10 @@ uint8_t readgus(uint16_t addr, void *p)
|
|||||||
val = gus->gp2;
|
val = gus->gp2;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
val = gus->gp1_addr;
|
val = (uint8_t)(gus->gp1_addr & 0xff);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
val = gus->gp2_addr;
|
val = (uint8_t)(gus->gp2_addr & 0xff);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -903,8 +903,8 @@ void gus_poll_wave(void *p)
|
|||||||
v = (int16_t)(int8_t)((gus->ram[(gus->cur[d] >> 9) & 0xFFFFF] ^ 0x80) - 0x80);
|
v = (int16_t)(int8_t)((gus->ram[(gus->cur[d] >> 9) & 0xFFFFF] ^ 0x80) - 0x80);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gus->rcur[d] >> 14) > 4095) v = (int16_t)(float)(v) * 24.0 * vol16bit[4095];
|
if ((gus->rcur[d] >> 14) > 4095) v = (int16_t)((float)v * 24.0 * vol16bit[4095]);
|
||||||
else v = (int16_t)(float)(v) * 24.0 * vol16bit[(gus->rcur[d]>>10) & 4095];
|
else v = (int16_t)((float)v * 24.0 * vol16bit[(gus->rcur[d]>>10) & 4095]);
|
||||||
|
|
||||||
gus->out_l += (v * gus->pan_l[d]) / 7;
|
gus->out_l += (v * gus->pan_l[d]) / 7;
|
||||||
gus->out_r += (v * gus->pan_r[d]) / 7;
|
gus->out_r += (v * gus->pan_r[d]) / 7;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implemantation of LPT-based sound devices.
|
* Implemantation of LPT-based sound devices.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_lpt_dac.c 1.0.2 2018/03/15
|
* Version: @(#)snd_lpt_dac.c 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -50,111 +50,125 @@
|
|||||||
#include "filters.h"
|
#include "filters.h"
|
||||||
#include "snd_lpt_dac.h"
|
#include "snd_lpt_dac.h"
|
||||||
|
|
||||||
typedef struct lpt_dac_t
|
|
||||||
{
|
|
||||||
uint8_t dac_val_l, dac_val_r;
|
|
||||||
|
|
||||||
int is_stereo;
|
typedef struct {
|
||||||
int channel;
|
uint8_t dac_val_l,
|
||||||
|
dac_val_r;
|
||||||
|
|
||||||
|
int8_t is_stereo;
|
||||||
|
int8_t channel;
|
||||||
|
|
||||||
int16_t buffer[2][SOUNDBUFLEN];
|
int16_t buffer[2][SOUNDBUFLEN];
|
||||||
int pos;
|
int pos;
|
||||||
} lpt_dac_t;
|
} lpt_dac_t;
|
||||||
|
|
||||||
static void dac_update(lpt_dac_t *lpt_dac)
|
|
||||||
|
static void
|
||||||
|
dac_update(lpt_dac_t *dev)
|
||||||
{
|
{
|
||||||
for (; lpt_dac->pos < sound_pos_global; lpt_dac->pos++)
|
for (; dev->pos < sound_pos_global; dev->pos++) {
|
||||||
{
|
dev->buffer[0][dev->pos] = (int8_t)(dev->dac_val_l ^ 0x80) * 0x40;
|
||||||
lpt_dac->buffer[0][lpt_dac->pos] = (int8_t)(lpt_dac->dac_val_l ^ 0x80) * 0x40;
|
dev->buffer[1][dev->pos] = (int8_t)(dev->dac_val_r ^ 0x80) * 0x40;
|
||||||
lpt_dac->buffer[1][lpt_dac->pos] = (int8_t)(lpt_dac->dac_val_r ^ 0x80) * 0x40;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dac_write_data(uint8_t val, void *p)
|
static void
|
||||||
|
dac_write_data(uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
lpt_dac_t *lpt_dac = (lpt_dac_t *)p;
|
lpt_dac_t *dev = (lpt_dac_t *)priv;
|
||||||
|
|
||||||
timer_clock();
|
timer_clock();
|
||||||
|
|
||||||
if (lpt_dac->is_stereo)
|
if (dev->is_stereo) {
|
||||||
{
|
if (dev->channel)
|
||||||
if (lpt_dac->channel)
|
dev->dac_val_r = val;
|
||||||
lpt_dac->dac_val_r = val;
|
|
||||||
else
|
else
|
||||||
lpt_dac->dac_val_l = val;
|
dev->dac_val_l = val;
|
||||||
|
} else {
|
||||||
|
dev->dac_val_l = dev->dac_val_r = val;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
lpt_dac->dac_val_l = lpt_dac->dac_val_r = val;
|
dac_update(dev);
|
||||||
dac_update(lpt_dac);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dac_write_ctrl(uint8_t val, void *p)
|
|
||||||
|
static void
|
||||||
|
dac_write_ctrl(uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
lpt_dac_t *lpt_dac = (lpt_dac_t *)p;
|
lpt_dac_t *dev = (lpt_dac_t *)priv;
|
||||||
|
|
||||||
if (lpt_dac->is_stereo)
|
if (dev->is_stereo)
|
||||||
lpt_dac->channel = val & 0x01;
|
dev->channel = val & 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t dac_read_status(void *p)
|
|
||||||
|
static uint8_t
|
||||||
|
dac_read_status(void *priv)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dac_get_buffer(int32_t *buffer, int len, void *p)
|
static void
|
||||||
|
dac_get_buffer(int32_t *buffer, int len, void *priv)
|
||||||
{
|
{
|
||||||
lpt_dac_t *lpt_dac = (lpt_dac_t *)p;
|
lpt_dac_t *dev = (lpt_dac_t *)priv;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
dac_update(lpt_dac);
|
dac_update(dev);
|
||||||
|
|
||||||
for (c = 0; c < len; c++)
|
for (c = 0; c < len; c++) {
|
||||||
{
|
buffer[c*2] += (int32_t)dac_iir(0, dev->buffer[0][c]);
|
||||||
buffer[c*2] += dac_iir(0, lpt_dac->buffer[0][c]);
|
buffer[c*2 + 1] += (int32_t)dac_iir(1, dev->buffer[1][c]);
|
||||||
buffer[c*2 + 1] += dac_iir(1, lpt_dac->buffer[1][c]);
|
|
||||||
}
|
}
|
||||||
lpt_dac->pos = 0;
|
|
||||||
|
dev->pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *dac_init(void)
|
|
||||||
|
static void *
|
||||||
|
dac_init(const lpt_device_t *info)
|
||||||
{
|
{
|
||||||
lpt_dac_t *lpt_dac = malloc(sizeof(lpt_dac_t));
|
lpt_dac_t *dev = malloc(sizeof(lpt_dac_t));
|
||||||
memset(lpt_dac, 0, sizeof(lpt_dac_t));
|
|
||||||
|
|
||||||
sound_add_handler(dac_get_buffer, lpt_dac);
|
memset(dev, 0x00, sizeof(lpt_dac_t));
|
||||||
|
|
||||||
return lpt_dac;
|
switch(info->type) {
|
||||||
}
|
case 1:
|
||||||
static void *dac_stereo_init(void)
|
dev->is_stereo = 1;
|
||||||
{
|
break;
|
||||||
lpt_dac_t *lpt_dac = dac_init();
|
}
|
||||||
|
|
||||||
lpt_dac->is_stereo = 1;
|
sound_add_handler(dac_get_buffer, dev);
|
||||||
|
|
||||||
return lpt_dac;
|
return dev;
|
||||||
}
|
|
||||||
static void dac_close(void *p)
|
|
||||||
{
|
|
||||||
lpt_dac_t *lpt_dac = (lpt_dac_t *)p;
|
|
||||||
|
|
||||||
free(lpt_dac);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const lpt_device_t lpt_dac_device =
|
|
||||||
|
static void
|
||||||
|
dac_close(void *priv)
|
||||||
{
|
{
|
||||||
|
lpt_dac_t *dev = (lpt_dac_t *)priv;
|
||||||
|
|
||||||
|
free(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const lpt_device_t lpt_dac_device = {
|
||||||
"LPT DAC / Covox Speech Thing",
|
"LPT DAC / Covox Speech Thing",
|
||||||
|
0,
|
||||||
dac_init,
|
dac_init,
|
||||||
dac_close,
|
dac_close,
|
||||||
dac_write_data,
|
dac_write_data,
|
||||||
dac_write_ctrl,
|
dac_write_ctrl,
|
||||||
dac_read_status
|
dac_read_status
|
||||||
};
|
};
|
||||||
const lpt_device_t lpt_dac_stereo_device =
|
|
||||||
{
|
const lpt_device_t lpt_dac_stereo_device = {
|
||||||
"Stereo LPT DAC",
|
"Stereo LPT DAC",
|
||||||
dac_stereo_init,
|
1,
|
||||||
|
dac_init,
|
||||||
dac_close,
|
dac_close,
|
||||||
dac_write_data,
|
dac_write_data,
|
||||||
dac_write_ctrl,
|
dac_write_ctrl,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the LPT-based DSS sound device.
|
* Implementation of the LPT-based DSS sound device.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_lpt_dss.c 1.0.2 2018/03/15
|
* Version: @(#)snd_lpt_dss.c 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -51,10 +51,10 @@
|
|||||||
#include "snd_lpt_dss.h"
|
#include "snd_lpt_dss.h"
|
||||||
|
|
||||||
|
|
||||||
typedef struct dss_t
|
typedef struct {
|
||||||
{
|
|
||||||
uint8_t fifo[16];
|
uint8_t fifo[16];
|
||||||
int read_idx, write_idx;
|
int8_t read_idx,
|
||||||
|
write_idx;
|
||||||
|
|
||||||
uint8_t dac_val;
|
uint8_t dac_val;
|
||||||
|
|
||||||
@@ -64,93 +64,109 @@ typedef struct dss_t
|
|||||||
int pos;
|
int pos;
|
||||||
} dss_t;
|
} dss_t;
|
||||||
|
|
||||||
static void dss_update(dss_t *dss)
|
|
||||||
|
static void
|
||||||
|
dss_update(dss_t *dev)
|
||||||
{
|
{
|
||||||
for (; dss->pos < sound_pos_global; dss->pos++)
|
for (; dev->pos < sound_pos_global; dev->pos++)
|
||||||
dss->buffer[dss->pos] = (int8_t)(dss->dac_val ^ 0x80) * 0x40;
|
dev->buffer[dev->pos] = (int8_t)(dev->dac_val ^ 0x80) * 0x40;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dss_write_data(uint8_t val, void *p)
|
static void
|
||||||
|
dss_write_data(uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
dss_t *dss = (dss_t *)p;
|
dss_t *dev = (dss_t *)priv;
|
||||||
|
|
||||||
timer_clock();
|
timer_clock();
|
||||||
|
|
||||||
if ((dss->write_idx - dss->read_idx) < 16)
|
if ((dev->write_idx - dev->read_idx) < 16) {
|
||||||
{
|
dev->fifo[dev->write_idx & 15] = val;
|
||||||
dss->fifo[dss->write_idx & 15] = val;
|
dev->write_idx++;
|
||||||
dss->write_idx++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dss_write_ctrl(uint8_t val, void *p)
|
|
||||||
|
static void
|
||||||
|
dss_write_ctrl(uint8_t val, void *priv)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t dss_read_status(void *p)
|
|
||||||
{
|
|
||||||
dss_t *dss = (dss_t *)p;
|
|
||||||
|
|
||||||
if ((dss->write_idx - dss->read_idx) >= 16)
|
static uint8_t
|
||||||
|
dss_read_status(void *priv)
|
||||||
|
{
|
||||||
|
dss_t *dev = (dss_t *)priv;
|
||||||
|
|
||||||
|
if ((dev->write_idx - dev->read_idx) >= 16)
|
||||||
return 0x40;
|
return 0x40;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dss_get_buffer(int32_t *buffer, int len, void *p)
|
static void
|
||||||
|
dss_get_buffer(int32_t *buffer, int len, void *priv)
|
||||||
{
|
{
|
||||||
dss_t *dss = (dss_t *)p;
|
dss_t *dev = (dss_t *)priv;
|
||||||
|
int16_t val;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
dss_update(dss);
|
dss_update(dev);
|
||||||
|
|
||||||
for (c = 0; c < len*2; c += 2)
|
for (c = 0; c < len*2; c += 2) {
|
||||||
{
|
val = (int16_t)dss_iir((float)dev->buffer[c >> 1]);
|
||||||
int16_t val = (int16_t)dss_iir((float)dss->buffer[c >> 1]);
|
|
||||||
|
|
||||||
buffer[c] += val;
|
buffer[c] += val;
|
||||||
buffer[c+1] += val;
|
buffer[c+1] += val;
|
||||||
}
|
}
|
||||||
|
|
||||||
dss->pos = 0;
|
dev->pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dss_callback(void *p)
|
|
||||||
|
static void
|
||||||
|
dss_callback(void *priv)
|
||||||
{
|
{
|
||||||
dss_t *dss = (dss_t *)p;
|
dss_t *dev = (dss_t *)priv;
|
||||||
|
|
||||||
dss_update(dss);
|
dss_update(dev);
|
||||||
|
|
||||||
if ((dss->write_idx - dss->read_idx) > 0)
|
if ((dev->write_idx - dev->read_idx) > 0) {
|
||||||
{
|
dev->dac_val = dev->fifo[dev->read_idx & 15];
|
||||||
dss->dac_val = dss->fifo[dss->read_idx & 15];
|
dev->read_idx++;
|
||||||
dss->read_idx++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dss->time += (int64_t) (TIMER_USEC * (1000000.0 / 7000.0));
|
dev->time += (int64_t) (TIMER_USEC * (1000000.0 / 7000.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *dss_init(void)
|
|
||||||
|
static void *
|
||||||
|
dss_init(const lpt_device_t *info)
|
||||||
{
|
{
|
||||||
dss_t *dss = malloc(sizeof(dss_t));
|
dss_t *dev = malloc(sizeof(dss_t));
|
||||||
memset(dss, 0, sizeof(dss_t));
|
|
||||||
|
|
||||||
sound_add_handler(dss_get_buffer, dss);
|
memset(dev, 0x00, sizeof(dss_t));
|
||||||
timer_add(dss_callback, &dss->time, TIMER_ALWAYS_ENABLED, dss);
|
|
||||||
|
|
||||||
return dss;
|
sound_add_handler(dss_get_buffer, dev);
|
||||||
}
|
|
||||||
static void dss_close(void *p)
|
|
||||||
{
|
|
||||||
dss_t *dss = (dss_t *)p;
|
|
||||||
|
|
||||||
free(dss);
|
timer_add(dss_callback, &dev->time, TIMER_ALWAYS_ENABLED, dev);
|
||||||
|
|
||||||
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
const lpt_device_t dss_device =
|
|
||||||
|
static void
|
||||||
|
dss_close(void *priv)
|
||||||
{
|
{
|
||||||
|
dss_t *dev = (dss_t *)priv;
|
||||||
|
|
||||||
|
free(dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const lpt_device_t dss_device = {
|
||||||
"Disney Sound Source",
|
"Disney Sound Source",
|
||||||
|
0,
|
||||||
dss_init,
|
dss_init,
|
||||||
dss_close,
|
dss_close,
|
||||||
dss_write_data,
|
dss_write_data,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Definitions for the LPT-based DSS driver.
|
* Definitions for the LPT-based DSS driver.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_lpt_dss.h 1.0.2 2018/03/15
|
* Version: @(#)snd_lpt_dss.h 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Roland MPU-401 emulation.
|
* Roland MPU-401 emulation.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_mpu401.c 1.0.2 2018/03/15
|
* Version: @(#)snd_mpu401.c 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -237,7 +237,7 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
|||||||
case 0x8: /* Play */
|
case 0x8: /* Play */
|
||||||
// pclog("MPU-401:Intelligent mode playback started");
|
// pclog("MPU-401:Intelligent mode playback started");
|
||||||
mpu->state.playing = 1;
|
mpu->state.playing = 1;
|
||||||
mpu401_event_callback = (MPU401_TIMECONSTANT / (mpu->clock.tempo*mpu->clock.timebase)) * 1000LL * TIMER_USEC;
|
mpu401_event_callback = (int64_t) ((MPU401_TIMECONSTANT / (mpu->clock.tempo*mpu->clock.timebase)) * 1000LL * TIMER_USEC);
|
||||||
ClrQueue(mpu);
|
ClrQueue(mpu);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -353,7 +353,7 @@ MPU401_WriteCommand(mpu_t *mpu, uint8_t val)
|
|||||||
|
|
||||||
case 0xff: /* Reset MPU-401 */
|
case 0xff: /* Reset MPU-401 */
|
||||||
pclog("MPU-401:Reset %X\n",val);
|
pclog("MPU-401:Reset %X\n",val);
|
||||||
mpu401_reset_callback = MPU401_RESETBUSY * 33LL * TIMER_USEC;
|
mpu401_reset_callback = (int64_t) (MPU401_RESETBUSY * 33LL * TIMER_USEC);
|
||||||
mpu->state.reset=1;
|
mpu->state.reset=1;
|
||||||
MPU401_Reset(mpu);
|
MPU401_Reset(mpu);
|
||||||
#if 0
|
#if 0
|
||||||
@@ -857,7 +857,7 @@ next_event:
|
|||||||
mpu401_event_callback = 0LL;
|
mpu401_event_callback = 0LL;
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
mpu401_event_callback += (MPU401_TIMECONSTANT/new_time) * 1000LL * TIMER_USEC;
|
mpu401_event_callback += (int64_t) ((MPU401_TIMECONSTANT/new_time) * 1000LL * TIMER_USEC);
|
||||||
pclog("Next event after %i us (time constant: %i)\n", (int) ((MPU401_TIMECONSTANT/new_time) * 1000 * TIMER_USEC), (int) MPU401_TIMECONSTANT);
|
pclog("Next event after %i us (time constant: %i)\n", (int) ((MPU401_TIMECONSTANT/new_time) * 1000 * TIMER_USEC), (int) MPU401_TIMECONSTANT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -79,7 +79,7 @@
|
|||||||
* FF88 - board model
|
* FF88 - board model
|
||||||
* 3 = PAS16
|
* 3 = PAS16
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_pas16.c 1.0.2 2018/03/15
|
* Version: @(#)snd_pas16.c 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -443,9 +443,9 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
|||||||
{
|
{
|
||||||
if (!(val & 0x20))
|
if (!(val & 0x20))
|
||||||
{
|
{
|
||||||
if (val & 2) pas16->pit.rl[0] = pas16->pit.c[0] / (PITCONST * (1 << TIMER_SHIFT));
|
if (val & 2) pas16->pit.rl[0] = (int16_t) (pas16->pit.c[0] / (PITCONST * (1 << TIMER_SHIFT)));
|
||||||
if (val & 4) pas16->pit.rl[1] = pas16->pit.c[1];
|
if (val & 4) pas16->pit.rl[1] = (int16_t) (pas16->pit.c[1]);
|
||||||
if (val & 8) pas16->pit.rl[2] = pas16->pit.c[2];
|
if (val & 8) pas16->pit.rl[2] = (int16_t) (pas16->pit.c[2]);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -458,9 +458,9 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
|||||||
}
|
}
|
||||||
if (!(pas16->pit.ctrl & 0x30))
|
if (!(pas16->pit.ctrl & 0x30))
|
||||||
{
|
{
|
||||||
pas16->pit.rl[t] = pas16->pit.c[t];
|
pas16->pit.rl[t] = (int16_t)pas16->pit.c[t];
|
||||||
if (!t)
|
if (!t)
|
||||||
pas16->pit.rl[t] /= (PITCONST * (1 << TIMER_SHIFT));
|
pas16->pit.rl[t] /= (int16_t) ((PITCONST * (1 << TIMER_SHIFT)));
|
||||||
if (pas16->pit.c[t] < 0)
|
if (pas16->pit.c[t] < 0)
|
||||||
pas16->pit.rl[t] = 0;
|
pas16->pit.rl[t] = 0;
|
||||||
pas16->pit.ctrl |= 0x30;
|
pas16->pit.ctrl |= 0x30;
|
||||||
@@ -476,9 +476,9 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
|||||||
if (!pas16->pit.rm[t])
|
if (!pas16->pit.rm[t])
|
||||||
{
|
{
|
||||||
pas16->pit.rm[t] = 3;
|
pas16->pit.rm[t] = 3;
|
||||||
pas16->pit.rl[t] = pit.c[t];
|
pas16->pit.rl[t] = (int16_t)pit.c[t];
|
||||||
if (!t)
|
if (!t)
|
||||||
pas16->pit.rl[t] /= (PITCONST * (1 << TIMER_SHIFT));
|
pas16->pit.rl[t] /= (int16_t) ((PITCONST * (1 << TIMER_SHIFT)));
|
||||||
}
|
}
|
||||||
pas16->pit.rereadlatch[t] = 1;
|
pas16->pit.rereadlatch[t] = 1;
|
||||||
}
|
}
|
||||||
@@ -494,7 +494,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
|||||||
pas16->pit.thit[t] = 0;
|
pas16->pit.thit[t] = 0;
|
||||||
pas16->pit.c[t] = pas16->pit.l[t];
|
pas16->pit.c[t] = pas16->pit.l[t];
|
||||||
if (!t)
|
if (!t)
|
||||||
pas16->pit.c[t] *= PITCONST * (1 << TIMER_SHIFT);
|
pas16->pit.c[t] *= (int64_t) (PITCONST * (1 << TIMER_SHIFT));
|
||||||
pas16->pit.enable[t] = 1;
|
pas16->pit.enable[t] = 1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@@ -502,7 +502,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
|||||||
pas16->pit.thit[t] = 0;
|
pas16->pit.thit[t] = 0;
|
||||||
pas16->pit.c[t] = pas16->pit.l[t];
|
pas16->pit.c[t] = pas16->pit.l[t];
|
||||||
if (!t)
|
if (!t)
|
||||||
pas16->pit.c[t] *= PITCONST * (1 << TIMER_SHIFT);
|
pas16->pit.c[t] *= (int64_t) (PITCONST * (1 << TIMER_SHIFT));
|
||||||
pas16->pit.enable[t] = 1;
|
pas16->pit.enable[t] = 1;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
@@ -510,7 +510,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
|||||||
pas16->pit.l[t] |= (val << 8);
|
pas16->pit.l[t] |= (val << 8);
|
||||||
pas16->pit.c[t] = pas16->pit.l[t];
|
pas16->pit.c[t] = pas16->pit.l[t];
|
||||||
if (!t)
|
if (!t)
|
||||||
pas16->pit.c[t] *= PITCONST * (1 << TIMER_SHIFT);
|
pas16->pit.c[t] *= (int64_t) (PITCONST * (1 << TIMER_SHIFT));
|
||||||
pas16->pit.thit[t] = 0;
|
pas16->pit.thit[t] = 0;
|
||||||
pas16->pit.wm[t] = 3;
|
pas16->pit.wm[t] = 3;
|
||||||
pas16->pit.enable[t] = 1;
|
pas16->pit.enable[t] = 1;
|
||||||
@@ -526,7 +526,7 @@ static void pas16_pit_out(uint16_t port, uint8_t val, void *p)
|
|||||||
pas16->pit.l[t] |= 0x10000;
|
pas16->pit.l[t] |= 0x10000;
|
||||||
pas16->pit.c[t] = pas16->pit.l[t];
|
pas16->pit.c[t] = pas16->pit.l[t];
|
||||||
if (!t)
|
if (!t)
|
||||||
pas16->pit.c[t] *= PITCONST * (1 << TIMER_SHIFT);
|
pas16->pit.c[t] *= (int64_t) (PITCONST * (1 << TIMER_SHIFT));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -545,13 +545,13 @@ static uint8_t pas16_pit_in(uint16_t port, void *p)
|
|||||||
pas16->pit.rereadlatch[t] = 0;
|
pas16->pit.rereadlatch[t] = 0;
|
||||||
if (!t)
|
if (!t)
|
||||||
{
|
{
|
||||||
pas16->pit.rl[t] = pas16->pit.c[t] / (PITCONST * (1 << TIMER_SHIFT));
|
pas16->pit.rl[t] = (uint16_t) (pas16->pit.c[t] / (PITCONST * (1 << TIMER_SHIFT)));
|
||||||
if ((pas16->pit.c[t] / (PITCONST * (1 << TIMER_SHIFT))) > 65536)
|
if ((pas16->pit.c[t] / (PITCONST * (1 << TIMER_SHIFT))) > 65536)
|
||||||
pas16->pit.rl[t] = 0xFFFF;
|
pas16->pit.rl[t] = 0xFFFF;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pas16->pit.rl[t] = pas16->pit.c[t];
|
pas16->pit.rl[t] = (uint16_t)pas16->pit.c[t];
|
||||||
if (pas16->pit.c[t] > 65536)
|
if (pas16->pit.c[t] > 65536)
|
||||||
pas16->pit.rl[t] = 0xFFFF;
|
pas16->pit.rl[t] = 0xFFFF;
|
||||||
}
|
}
|
||||||
@@ -598,9 +598,9 @@ static void pas16_pcm_poll(void *p)
|
|||||||
if (pas16->pit.m[0] & 2)
|
if (pas16->pit.m[0] & 2)
|
||||||
{
|
{
|
||||||
if (pas16->pit.l[0])
|
if (pas16->pit.l[0])
|
||||||
pas16->pit.c[0] += (pas16->pit.l[0] * PITCONST * (1 << TIMER_SHIFT));
|
pas16->pit.c[0] += (int64_t) ((pas16->pit.l[0] * PITCONST * (1 << TIMER_SHIFT)));
|
||||||
else
|
else
|
||||||
pas16->pit.c[0] += (0x10000 * PITCONST * (1 << TIMER_SHIFT));
|
pas16->pit.c[0] += (int64_t) ((0x10000 * PITCONST * (1 << TIMER_SHIFT)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
* 486-50 - 32kHz
|
* 486-50 - 32kHz
|
||||||
* Pentium - 45kHz
|
* Pentium - 45kHz
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_sb_dsp.c 1.0.3 2018/03/26
|
* Version: @(#)snd_sb_dsp.c 1.0.4 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -165,7 +165,7 @@ static inline double sinc(double x)
|
|||||||
static void recalc_sb16_filter(int playback_freq)
|
static void recalc_sb16_filter(int playback_freq)
|
||||||
{
|
{
|
||||||
/*Cutoff frequency = playback / 2*/
|
/*Cutoff frequency = playback / 2*/
|
||||||
float fC = ((float)playback_freq / 2.0) / 48000.0;
|
float fC = (float) (((float)playback_freq / 2.0) / 48000.0);
|
||||||
float gain;
|
float gain;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ static void recalc_sb16_filter(int playback_freq)
|
|||||||
double h = sinc(2.0 * fC * ((double)n - ((double)(SB16_NCoef-1) / 2.0)));
|
double h = sinc(2.0 * fC * ((double)n - ((double)(SB16_NCoef-1) / 2.0)));
|
||||||
|
|
||||||
/*Create windowed-sinc filter*/
|
/*Create windowed-sinc filter*/
|
||||||
low_fir_sb16_coef[n] = w * h;
|
low_fir_sb16_coef[n] = (float)(w * h);
|
||||||
}
|
}
|
||||||
|
|
||||||
low_fir_sb16_coef[(SB16_NCoef - 1) / 2] = 1.0;
|
low_fir_sb16_coef[(SB16_NCoef - 1) / 2] = 1.0;
|
||||||
@@ -1047,7 +1047,7 @@ void pollsb(void *p)
|
|||||||
if (dsp->sb_8_length < 0)
|
if (dsp->sb_8_length < 0)
|
||||||
{
|
{
|
||||||
if (dsp->sb_8_autoinit) dsp->sb_8_length = dsp->sb_8_autolen;
|
if (dsp->sb_8_autoinit) dsp->sb_8_length = dsp->sb_8_autolen;
|
||||||
else dsp->sb_8_enable = dsp->sbenable=0;
|
else dsp->sbenable = dsp->sb_8_enable=0;
|
||||||
sb_irq(dsp, 1);
|
sb_irq(dsp, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1083,7 +1083,7 @@ void pollsb(void *p)
|
|||||||
{
|
{
|
||||||
// pclog("16DMA over %i\n",dsp->sb_16_autoinit);
|
// pclog("16DMA over %i\n",dsp->sb_16_autoinit);
|
||||||
if (dsp->sb_16_autoinit) dsp->sb_16_length = dsp->sb_16_autolen;
|
if (dsp->sb_16_autoinit) dsp->sb_16_length = dsp->sb_16_autolen;
|
||||||
else dsp->sb_16_enable = dsp->sbenable = 0;
|
else dsp->sbenable = dsp->sb_16_enable = 0;
|
||||||
sb_irq(dsp, 0);
|
sb_irq(dsp, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1161,7 +1161,7 @@ void sb_poll_i(void *p)
|
|||||||
{
|
{
|
||||||
// pclog("Input DMA over %i\n",sb_8_autoinit);
|
// pclog("Input DMA over %i\n",sb_8_autoinit);
|
||||||
if (dsp->sb_8_autoinit) dsp->sb_8_length = dsp->sb_8_autolen;
|
if (dsp->sb_8_autoinit) dsp->sb_8_length = dsp->sb_8_autolen;
|
||||||
else dsp->sb_8_enable = dsp->sb_enable_i = 0;
|
else dsp->sb_enable_i = dsp->sb_8_enable = 0;
|
||||||
sb_irq(dsp, 1);
|
sb_irq(dsp, 1);
|
||||||
}
|
}
|
||||||
processed=1;
|
processed=1;
|
||||||
@@ -1228,7 +1228,7 @@ void sb_poll_i(void *p)
|
|||||||
{
|
{
|
||||||
// pclog("16iDMA over %i\n",sb_16_autoinit);
|
// pclog("16iDMA over %i\n",sb_16_autoinit);
|
||||||
if (dsp->sb_16_autoinit) dsp->sb_16_length = dsp->sb_16_autolen;
|
if (dsp->sb_16_autoinit) dsp->sb_16_length = dsp->sb_16_autolen;
|
||||||
else dsp->sb_16_enable = dsp->sb_enable_i = 0;
|
else dsp->sb_enable_i = dsp->sb_16_enable = 0;
|
||||||
sb_irq(dsp, 0);
|
sb_irq(dsp, 0);
|
||||||
}
|
}
|
||||||
processed=1;
|
processed=1;
|
||||||
@@ -1271,9 +1271,9 @@ void sb_dsp_add_status_info(char *s, int max_len, sb_dsp_t *dsp)
|
|||||||
int freq;
|
int freq;
|
||||||
|
|
||||||
if (dsp->sb_timeo < 256LL)
|
if (dsp->sb_timeo < 256LL)
|
||||||
freq = 1000000 / (256LL - dsp->sb_timeo);
|
freq = (int) (1000000 / (256LL - dsp->sb_timeo));
|
||||||
else
|
else
|
||||||
freq = dsp->sb_timeo - 256LL;
|
freq = (int) (dsp->sb_timeo - 256LL);
|
||||||
|
|
||||||
if (dsp->sb_8_enable && dsp->sb_8_output)
|
if (dsp->sb_8_enable && dsp->sb_8_output)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the TI SN74689 PSG sound devices.
|
* Implementation of the TI SN74689 PSG sound devices.
|
||||||
*
|
*
|
||||||
* Version: @(#)snd_sn76489.c 1.0.2 2018/03/15
|
* Version: @(#)snd_sn76489.c 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -72,16 +72,16 @@ void sn76489_update(sn76489_t *sn76489)
|
|||||||
if (sn76489->latch[c] > 256) result += (int16_t) (volslog[sn76489->vol[c]] * sn76489->stat[c]);
|
if (sn76489->latch[c] > 256) result += (int16_t) (volslog[sn76489->vol[c]] * sn76489->stat[c]);
|
||||||
else result += (int16_t) (volslog[sn76489->vol[c]] * 127);
|
else result += (int16_t) (volslog[sn76489->vol[c]] * 127);
|
||||||
|
|
||||||
sn76489->count[c] -= (256 * sn76489->psgconst);
|
sn76489->count[c] -= (int) ((256 * sn76489->psgconst));
|
||||||
while ((int)sn76489->count[c] < 0)
|
while ((int)sn76489->count[c] < 0)
|
||||||
{
|
{
|
||||||
sn76489->count[c] += sn76489->latch[c];
|
sn76489->count[c] += sn76489->latch[c];
|
||||||
sn76489->stat[c] = -sn76489->stat[c];
|
sn76489->stat[c] = -sn76489->stat[c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result += (((sn76489->shift & 1) ^ 1) * 127 * volslog[sn76489->vol[0]] * 2);
|
result += (int16_t) ((((sn76489->shift & 1) ^ 1) * 127 * volslog[sn76489->vol[0]] * 2));
|
||||||
|
|
||||||
sn76489->count[0] -= (512 * sn76489->psgconst);
|
sn76489->count[0] -= (int) ((512 * sn76489->psgconst));
|
||||||
while ((int)sn76489->count[0] < 0 && sn76489->latch[0])
|
while ((int)sn76489->count[0] < 0 && sn76489->latch[0])
|
||||||
{
|
{
|
||||||
sn76489->count[0] += (sn76489->latch[0] * 4);
|
sn76489->count[0] += (sn76489->latch[0] * 4);
|
||||||
@@ -228,7 +228,7 @@ void sn76489_init(sn76489_t *sn76489, uint16_t base, uint16_t size, int type, in
|
|||||||
sn76489->vol[0] = 0;
|
sn76489->vol[0] = 0;
|
||||||
sn76489->vol[1] = sn76489->vol[2] = sn76489->vol[3] = 8;
|
sn76489->vol[1] = sn76489->vol[2] = sn76489->vol[3] = 8;
|
||||||
sn76489->stat[0] = sn76489->stat[1] = sn76489->stat[2] = sn76489->stat[3] = 127;
|
sn76489->stat[0] = sn76489->stat[1] = sn76489->stat[2] = sn76489->stat[3] = 127;
|
||||||
srand(time(NULL));
|
srand((int)time(NULL));
|
||||||
sn76489->count[0] = 0;
|
sn76489->count[0] = 0;
|
||||||
sn76489->count[1] = (rand()&0x3FF)<<6;
|
sn76489->count[1] = (rand()&0x3FF)<<6;
|
||||||
sn76489->count[2] = (rand()&0x3FF)<<6;
|
sn76489->count[2] = (rand()&0x3FF)<<6;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Sound emulation core.
|
* Sound emulation core.
|
||||||
*
|
*
|
||||||
* Version: @(#)sound.c 1.0.2 2018/03/15
|
* Version: @(#)sound.c 1.0.3 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -286,8 +286,8 @@ static void sound_cd_thread(void *param)
|
|||||||
|
|
||||||
if (sound_is_float)
|
if (sound_is_float)
|
||||||
{
|
{
|
||||||
cd_out_buffer[c] += (cd_buffer_temp2[0] / 32768.0);
|
cd_out_buffer[c] += (float)(cd_buffer_temp2[0] / 32768.0);
|
||||||
cd_out_buffer[c+1] += (cd_buffer_temp2[1] / 32768.0);
|
cd_out_buffer[c+1] += (float)(cd_buffer_temp2[1] / 32768.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -300,8 +300,8 @@ static void sound_cd_thread(void *param)
|
|||||||
if (cd_buffer_temp2[1] < -32768)
|
if (cd_buffer_temp2[1] < -32768)
|
||||||
cd_buffer_temp2[1] = -32768;
|
cd_buffer_temp2[1] = -32768;
|
||||||
|
|
||||||
cd_out_buffer_int16[c] += cd_buffer_temp2[0];
|
cd_out_buffer_int16[c] += (int16_t)cd_buffer_temp2[0];
|
||||||
cd_out_buffer_int16[c+1] += cd_buffer_temp2[1];
|
cd_out_buffer_int16[c+1] += (int16_t)cd_buffer_temp2[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,7 +419,7 @@ void sound_poll(void *priv)
|
|||||||
{
|
{
|
||||||
if (sound_is_float)
|
if (sound_is_float)
|
||||||
{
|
{
|
||||||
outbuffer_ex[c] = ((float) outbuffer[c]) / 32768.0;
|
outbuffer_ex[c] = (float)((outbuffer[c]) / 32768.0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Try to load a support DLL.
|
* Try to load a support DLL.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_dynld.c 1.0.3 2018/03/10
|
* Version: @(#)win_dynld.c 1.0.4 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*
|
*
|
||||||
@@ -56,10 +56,10 @@
|
|||||||
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
dynld_module(const char *name, dllimp_t *table)
|
dynld_module(const char *name, const dllimp_t *table)
|
||||||
{
|
{
|
||||||
HMODULE h;
|
HMODULE h;
|
||||||
dllimp_t *imp;
|
const dllimp_t *imp;
|
||||||
void *func;
|
void *func;
|
||||||
|
|
||||||
/* See if we can load the desired module. */
|
/* See if we can load the desired module. */
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Implementation of the Settings dialog.
|
* Implementation of the Settings dialog.
|
||||||
*
|
*
|
||||||
* Version: @(#)win_settings.c 1.0.14 2018/03/27
|
* Version: @(#)win_settings.c 1.0.15 2018/03/28
|
||||||
*
|
*
|
||||||
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Authors: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -1421,7 +1421,7 @@ ports_proc(HWND hdlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
HWND h;
|
HWND h;
|
||||||
int c = 0;
|
int c = 0;
|
||||||
int d = 0;
|
int d = 0;
|
||||||
char *s;
|
const char *s;
|
||||||
LPTSTR lptsTemp;
|
LPTSTR lptsTemp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user