Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt

This commit is contained in:
cam900 2023-01-13 14:24:43 +09:00
commit ab46b8e080
11 changed files with 29 additions and 17 deletions

View File

@ -20,13 +20,13 @@ jobs:
config:
- { name: 'Windows MSVC x86', os: windows-latest, compiler: msvc, arch: x86 }
- { name: 'Windows MSVC x86_64', os: windows-latest, compiler: msvc, arch: x86_64 }
- { name: 'Windows MinGW x86', os: ubuntu-20.04, compiler: mingw, arch: x86 }
- { name: 'Windows MinGW x86_64', os: ubuntu-20.04, compiler: mingw, arch: x86_64 }
##- { name: 'Windows MinGW x86', os: ubuntu-20.04, compiler: mingw, arch: x86 }
##- { name: 'Windows MinGW x86_64', os: ubuntu-20.04, compiler: mingw, arch: x86_64 }
- { name: 'macOS x86_64', os: macos-latest, arch: x86_64 }
- { name: 'macOS ARM', os: macos-latest, arch: arm64 }
- { name: 'Linux x86_64', os: ubuntu-18.04, arch: x86_64 }
##- { name: 'Linux x86_64', os: ubuntu-18.04, arch: x86_64 }
#- { name: 'Linux ARM', os: ubuntu-18.04, arch: armhf }
fail-fast: true
fail-fast: false
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}

View File

@ -19,6 +19,7 @@
#include "arcade.h"
#include "../engine.h"
#include "../../ta-log.h"
#include <string.h>
#include <math.h>
@ -868,17 +869,18 @@ void DivPlatformArcade::setFlags(const DivConfig& flags) {
switch (flags.getInt("clockSel",0)) {
case 1:
chipClock=COLOR_PAL*4.0/5.0;
baseFreqOff=12;
break;
case 2:
chipClock=4000000.0;
baseFreqOff=-122;
break;
default:
chipClock=COLOR_NTSC;
baseFreqOff=0;
break;
}
CHECK_CUSTOM_CLOCK;
baseFreqOff=round(768.0*(log((COLOR_NTSC/(double)chipClock))/log(2.0)));
rate=chipClock/64;
for (int i=0; i<8; i++) {
oscBuf[i]->rate=rate;

View File

@ -809,6 +809,12 @@ void DivPlatformAY8930::setFlags(const DivConfig& flags) {
case 12:
chipClock=3600000;
break;
case 13:
chipClock=20000000/16;
break;
case 14:
chipClock=1536000;
break;
default:
chipClock=COLOR_NTSC/2.0;
break;

View File

@ -68,7 +68,7 @@ void DivPlatformBubSysWSG::acquire(short** buf, size_t len) {
if (out>32767) out=32767;
//printf("out: %d\n",out);
buf[0][h]=buf[1][h]=out;
buf[0][h]=out;
}
}

View File

@ -114,7 +114,7 @@ void DivPlatformN163::acquire(short** buf, size_t len) {
int out=(n163.out()<<6)*2; // scale to 16 bit
if (out>32767) out=32767;
if (out<-32768) out=-32768;
buf[0][i]=buf[1][i]=out;
buf[0][i]=out;
if (n163.voice_cycle()==0x78) for (int i=0; i<8; i++) {
oscBuf[i]->data[oscBuf[i]->needle++]=n163.voice_out(i)<<7;

View File

@ -343,7 +343,7 @@ void DivPlatformOPL::tick(bool sysTick) {
if (chan[i].std.pitch.had) {
if (chan[i].std.pitch.mode) {
chan[i].pitch2+=chan[i].std.pitch.val;
CLAMP_VAR(chan[i].pitch2,-32768,32767);
CLAMP_VAR(chan[i].pitch2,-131071,131071);
} else {
chan[i].pitch2=chan[i].std.pitch.val;
}

View File

@ -124,7 +124,7 @@ void DivPlatformOPLL::tick(bool sysTick) {
if (chan[i].std.pitch.had) {
if (chan[i].std.pitch.mode) {
chan[i].pitch2+=chan[i].std.pitch.val;
CLAMP_VAR(chan[i].pitch2,-32768,32767);
CLAMP_VAR(chan[i].pitch2,-65535,65535);
} else {
chan[i].pitch2=chan[i].std.pitch.val;
}

View File

@ -289,6 +289,7 @@ void DivPlatformT6W28::forceIns() {
chan[i].insChanged=true;
chan[i].freqChanged=true;
}
rWrite(1,0xe0+chan[3].duty);
}
void* DivPlatformT6W28::getChanState(int ch) {

View File

@ -941,14 +941,15 @@ void DivPlatformTX81Z::setFlags(const DivConfig& flags) {
int clockSel=flags.getInt("clockSel",0);
if (clockSel==2) {
chipClock=4000000.0;
baseFreqOff=-122;
} else if (clockSel==1) {
chipClock=COLOR_PAL*4.0/5.0;
baseFreqOff=12;
} else {
chipClock=COLOR_NTSC;
baseFreqOff=0;
}
CHECK_CUSTOM_CLOCK;
baseFreqOff=round(768.0*(log((COLOR_NTSC/(double)chipClock))/log(2.0)));
rate=chipClock/64;
for (int i=0; i<8; i++) {
oscBuf[i]->rate=rate;

View File

@ -81,7 +81,7 @@ void DivPlatformVRC6::acquire(short** buf, size_t len) {
int sample=vrc6.out()<<9; // scale to 16 bit
if (sample>32767) sample=32767;
if (sample<-32768) sample=-32768;
buf[0][i]=buf[1][i]=sample;
buf[0][i]=sample;
// Oscilloscope buffer part
if (++writeOscBuf>=32) {

View File

@ -29,13 +29,14 @@ int logLevel=LOGLEVEL_INFO;
FILE* logFile;
char* logFileBuf;
char* logFileWriteBuf;
unsigned int logFilePosI;
unsigned int logFilePosO;
std::thread* logFileThread;
std::mutex logFileLock;
std::mutex logFileLockI;
std::condition_variable logFileNotify;
bool logFileAvail=false;
std::atomic<bool> logFileAvail(false);
std::atomic<unsigned short> logPosition;
@ -157,8 +158,8 @@ void _logFileThread() {
}
} else {
// wait
if (!logFileAvail) break;
fflush(logFile);
if (!logFileAvail) break;
logFileNotify.wait(lock);
}
}
@ -177,6 +178,7 @@ bool startLogFile(const char* path) {
}
logFileBuf=new char[TA_LOGFILE_BUF_SIZE];
logFileWriteBuf=new char[TA_LOGFILE_BUF_SIZE];
logFilePosI=0;
logFilePosO=0;
logFileAvail=true;