make required changes, and fix per-channel osc

This commit is contained in:
scratchminer 2024-01-22 00:45:54 -05:00
parent 98bb0ea175
commit 606ef1e410
3 changed files with 27 additions and 40 deletions

View file

@ -34,7 +34,7 @@
(a.dir ? 0x02 : 0x00) | \ (a.dir ? 0x02 : 0x00) | \
(b.dir ? 0x01 : 0x00)) (b.dir ? 0x01 : 0x00))
#define volPan(v, p) (((v * (p >> 4) / 15) << 4) | ((v * (p & 0xf) / 15) & 0xf)) #define volPan(v, p) (((v * (p >> 4) / 15) << 4) | ((v * (p & 0xf) / 15) & 0xf))
#define mapAmp(a) (((a) * 65535 / 63 - 32768) * (pn.flags & 0x7) / 7) #define mapAmp(a) ((((a) * 65535 / 63 - 32768) * (pn.flags & 0x7) / 7) >> 1)
#define CHIP_DIVIDER 128 #define CHIP_DIVIDER 128
const char* regCheatSheetPowerNoise[]={ const char* regCheatSheetPowerNoise[]={
@ -81,7 +81,9 @@ void DivPlatformPowerNoise::acquire(short** buf, size_t len) {
int16_t left, right; int16_t left, right;
for (size_t h=0; h<len; h++) { for (size_t h=0; h<len; h++) {
for(int i = 0; i < 32; i++) {
pwrnoise_step(&pn, &left, &right); pwrnoise_step(&pn, &left, &right);
}
oscBuf[0]->data[oscBuf[0]->needle++]=mapAmp(pn.n1.out_latch); oscBuf[0]->data[oscBuf[0]->needle++]=mapAmp(pn.n1.out_latch);
oscBuf[1]->data[oscBuf[1]->needle++]=mapAmp(pn.n2.out_latch); oscBuf[1]->data[oscBuf[1]->needle++]=mapAmp(pn.n2.out_latch);
@ -145,7 +147,7 @@ void DivPlatformPowerNoise::tick(bool sysTick) {
} }
if (chan[i].std.vol.had) { if (chan[i].std.vol.had) {
chan[i].outVol=VOL_SCALE_LINEAR_BROKEN(chan[i].vol&15,MIN(15,chan[i].std.vol.val),15); chan[i].outVol=VOL_SCALE_LINEAR(chan[i].vol&15,MIN(15,chan[i].std.vol.val),15);
if (chan[i].outVol<0) chan[i].outVol=0; if (chan[i].outVol<0) chan[i].outVol=0;
} }
if (NEW_ARP_STRAT) { if (NEW_ARP_STRAT) {
@ -442,18 +444,7 @@ unsigned short DivPlatformPowerNoise::getPan(int ch) {
DivChannelModeHints DivPlatformPowerNoise::getModeHints(int ch) { DivChannelModeHints DivPlatformPowerNoise::getModeHints(int ch) {
DivChannelModeHints ret; DivChannelModeHints ret;
ret.count=0;
ret.count=1;
if (ch==3) {
ret.hint[0]=ICON_FUR_SAW;
ret.type[0]=5;
}
else {
ret.hint[0]=ICON_FUR_NOISE;
ret.type[0]=4;
}
return ret; return ret;
} }
@ -514,10 +505,10 @@ void DivPlatformPowerNoise::notifyInsDeletion(void* ins) {
} }
void DivPlatformPowerNoise::setFlags(const DivConfig& flags) { void DivPlatformPowerNoise::setFlags(const DivConfig& flags) {
chipClock=16777216; chipClock=16000000;
CHECK_CUSTOM_CLOCK; CHECK_CUSTOM_CLOCK;
rate=chipClock; rate=chipClock/32;
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
oscBuf[i]->rate=rate; oscBuf[i]->rate=rate;

View file

@ -21,7 +21,6 @@
#define _POWER_NOISE_H #define _POWER_NOISE_H
#include "../dispatch.h" #include "../dispatch.h"
#include "../../fixedQueue.h"
#include "../../../extern/pwrnoise/pwrnoise.h" #include "../../../extern/pwrnoise/pwrnoise.h"
class DivPlatformPowerNoise: public DivDispatch { class DivPlatformPowerNoise: public DivDispatch {
@ -62,9 +61,6 @@ class DivPlatformPowerNoise: public DivDispatch {
bool isMuted[4]; bool isMuted[4];
unsigned char regPool[32]; unsigned char regPool[32];
FixedQueue<int16_t,64> queueLeft;
FixedQueue<int16_t,64> queueRight;
power_noise_t pn; power_noise_t pn;
friend void putDispatchChip(void*,int); friend void putDispatchChip(void*,int);

View file

@ -1986,7 +1986,7 @@ void DivEngine::registerSystems() {
); );
sysDefs[DIV_SYSTEM_POWER_NOISE]=new DivSysDef( sysDefs[DIV_SYSTEM_POWER_NOISE]=new DivSysDef(
"PowerNoise", NULL, 0xd2, 0, 4, false, false, 0, false, 0, 0, 0, "PowerNoise", NULL, 0xd4, 0, 4, false, false, 0, false, 0, 0, 0,
"a fantasy sound chip designed by jvsTSX and The Beesh-Spweesh!\nused in the Hexheld fantasy console.", "a fantasy sound chip designed by jvsTSX and The Beesh-Spweesh!\nused in the Hexheld fantasy console.",
{"Noise 1", "Noise 2", "Noise 3", "Slope"}, {"Noise 1", "Noise 2", "Noise 3", "Slope"},
{"N1", "N2", "N3", "SL"}, {"N1", "N2", "N3", "SL"},