PV-1000: more accurate emulation

This commit is contained in:
tildearrow 2023-03-18 17:15:13 -05:00
parent 09a30570de
commit 293d2b8775
5 changed files with 35 additions and 5 deletions

View file

@ -459,7 +459,7 @@ src/engine/platform/sound/ga20/iremga20.cpp
src/engine/platform/sound/sm8521.c src/engine/platform/sound/sm8521.c
src/engine/platform/sound/d65010g031.c src/engine/platform/sound/d65modified.c
src/engine/platform/oplAInterface.cpp src/engine/platform/oplAInterface.cpp
src/engine/platform/ym2608Interface.cpp src/engine/platform/ym2608Interface.cpp

View file

@ -40,7 +40,7 @@ void DivPlatformPV1000::acquire(short** buf, size_t len) {
for (size_t h=0; h<len; h++) { for (size_t h=0; h<len; h++) {
short samp; short samp;
samp=d65010g031_sound_tick(&d65010g031,1); samp=d65010g031_sound_tick(&d65010g031,1);
buf[0][h]=samp<<12; buf[0][h]=samp;
for (int i=0; i<3; i++) { for (int i=0; i<3; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=(d65010g031.square[i].out<<12); oscBuf[i]->data[oscBuf[i]->needle++]=(d65010g031.square[i].out<<12);
} }

View file

@ -21,7 +21,7 @@
#define _PV1000_H #define _PV1000_H
#include "../dispatch.h" #include "../dispatch.h"
#include "sound/d65010g031.h" #include "sound/d65modified.h"
#include <queue> #include <queue>
class DivPlatformPV1000: public DivDispatch { class DivPlatformPV1000: public DivDispatch {

View file

@ -34,9 +34,31 @@ freely, subject to the following restrictions:
TODO: TODO:
- needs hardware test - needs hardware test
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
ALTERED VERSION!!!
THIS IS **NOT** NOT NOT NOT!!!! THE ORIGINAL SOFTWARE
IT ISN'T
THE MODIFICATIONS THAT WERE MADE ARE:
1. FIX VOLUMES - APPARENTLY THE SQUARES HAVE DIFFERENT VOLUMES (thanks forple)
*/ */
#include "d65010g031.h" #include "d65modified.h"
#include <stdlib.h> #include <stdlib.h>
static int d65010g031_max(int a, int b) { return (a > b) ? a : b; } static int d65010g031_max(int a, int b) { return (a > b) ? a : b; }
@ -57,12 +79,20 @@ int d65010g031_square_tick(struct d65010g031_square_t *square, const int cycle)
return 0; return 0;
} }
// this is the bit I altered
// THIS IS **NOT** THE ORIGINAL SOFTWARE! I am plainly marking it as such!
const int d65Volumes[3]={
3840,
5120,
8192
};
int d65010g031_sound_tick(struct d65010g031_t *d65010g031, const int cycle) int d65010g031_sound_tick(struct d65010g031_t *d65010g031, const int cycle)
{ {
int out = 0; int out = 0;
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
out += d65010g031_square_tick(&d65010g031->square[i], cycle); out += d65010g031_square_tick(&d65010g031->square[i], cycle)?d65Volumes[i]:-d65Volumes[i];
} }
return out; return out;
} }