Merge branch 'tildearrow:master' into master
This commit is contained in:
commit
16aed41e89
103 changed files with 1358 additions and 268 deletions
|
|
@ -61,9 +61,11 @@ void DivEngine::initConfDir() {
|
|||
return;
|
||||
}
|
||||
#else
|
||||
// TODO this should check XDG_CONFIG_HOME first
|
||||
char* xdgConfigHome=getenv("XDG_CONFIG_HOME");
|
||||
char* home=getenv("HOME");
|
||||
if (home==NULL) {
|
||||
if (xdgConfigHome) {
|
||||
configPath=xdgConfigHome;
|
||||
} else if (home==NULL) {
|
||||
int uid=getuid();
|
||||
struct passwd* entry=getpwuid(uid);
|
||||
if (entry==NULL) {
|
||||
|
|
@ -79,8 +81,9 @@ void DivEngine::initConfDir() {
|
|||
#ifdef __APPLE__
|
||||
configPath+="/Library/Application Support";
|
||||
#else
|
||||
// FIXME this doesn't honour XDG_CONFIG_HOME *at all*
|
||||
configPath+="/.config";
|
||||
if (xdgConfigHome==NULL) {
|
||||
configPath+="/.config";
|
||||
}
|
||||
#endif // __APPLE__
|
||||
#endif // __HAIKU__
|
||||
#ifdef __APPLE__
|
||||
|
|
|
|||
|
|
@ -2166,6 +2166,13 @@ int DivEngine::getRow() {
|
|||
return prevRow;
|
||||
}
|
||||
|
||||
void DivEngine::getPlayPos(int& order, int& row) {
|
||||
playPosLock.lock();
|
||||
order=prevOrder;
|
||||
row=prevRow;
|
||||
playPosLock.unlock();
|
||||
}
|
||||
|
||||
int DivEngine::getElapsedBars() {
|
||||
return elapsedBars;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include <mutex>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <deque>
|
||||
#include "../fixedQueue.h"
|
||||
|
||||
class DivWorkPool;
|
||||
|
||||
|
|
@ -58,8 +58,8 @@ class DivWorkPool;
|
|||
|
||||
#define DIV_UNSTABLE
|
||||
|
||||
#define DIV_VERSION "0.6pre14"
|
||||
#define DIV_ENGINE_VERSION 175
|
||||
#define DIV_VERSION "0.6pre16"
|
||||
#define DIV_ENGINE_VERSION 178
|
||||
// for imports
|
||||
#define DIV_VERSION_MOD 0xff01
|
||||
#define DIV_VERSION_FC 0xff02
|
||||
|
|
@ -176,14 +176,28 @@ struct DivChannelState {
|
|||
};
|
||||
|
||||
struct DivNoteEvent {
|
||||
int channel, ins, note, volume;
|
||||
bool on;
|
||||
signed char channel;
|
||||
unsigned char ins;
|
||||
signed char note, volume;
|
||||
bool on, nop, pad1, pad2;
|
||||
DivNoteEvent(int c, int i, int n, int v, bool o):
|
||||
channel(c),
|
||||
ins(i),
|
||||
note(n),
|
||||
volume(v),
|
||||
on(o) {}
|
||||
on(o),
|
||||
nop(false),
|
||||
pad1(false),
|
||||
pad2(false) {}
|
||||
DivNoteEvent():
|
||||
channel(-1),
|
||||
ins(0),
|
||||
note(0),
|
||||
volume(0),
|
||||
on(false),
|
||||
nop(true),
|
||||
pad1(false),
|
||||
pad2(false) {}
|
||||
};
|
||||
|
||||
struct DivDispatchContainer {
|
||||
|
|
@ -428,11 +442,11 @@ class DivEngine {
|
|||
DivAudioExportModes exportMode;
|
||||
double exportFadeOut;
|
||||
DivConfig conf;
|
||||
std::deque<DivNoteEvent> pendingNotes;
|
||||
FixedQueue<DivNoteEvent,8192> pendingNotes;
|
||||
// bitfield
|
||||
unsigned char walked[8192];
|
||||
bool isMuted[DIV_MAX_CHANS];
|
||||
std::mutex isBusy, saveLock;
|
||||
std::mutex isBusy, saveLock, playPosLock;
|
||||
String configPath;
|
||||
String configFile;
|
||||
String lastError;
|
||||
|
|
@ -834,6 +848,9 @@ class DivEngine {
|
|||
// get current row
|
||||
int getRow();
|
||||
|
||||
// synchronous get order/row
|
||||
void getPlayPos(int& order, int& row);
|
||||
|
||||
// get beat/bar
|
||||
int getElapsedBars();
|
||||
int getElapsedBeats();
|
||||
|
|
@ -886,7 +903,7 @@ class DivEngine {
|
|||
|
||||
// get instrument from file
|
||||
// if the returned vector is empty then there was an error.
|
||||
std::vector<DivInstrument*> instrumentFromFile(const char* path, bool loadAssets=true);
|
||||
std::vector<DivInstrument*> instrumentFromFile(const char* path, bool loadAssets=true, bool readInsName=true);
|
||||
|
||||
// load temporary instrument
|
||||
void loadTempIns(DivInstrument* which);
|
||||
|
|
|
|||
|
|
@ -1058,6 +1058,11 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
|||
ds.systemFlags[0].set("keyPriority",false);
|
||||
}
|
||||
|
||||
// OPM broken pitch
|
||||
if (ds.system[0]==DIV_SYSTEM_YM2151) {
|
||||
ds.systemFlags[0].set("brokenPitch",true);
|
||||
}
|
||||
|
||||
ds.systemName=getSongSystemLegacyName(ds,!getConfInt("noMultiSystem",0));
|
||||
|
||||
if (active) quitDispatch();
|
||||
|
|
@ -2976,6 +2981,16 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
// OPM/OPZ slide compat
|
||||
if (ds.version<176) {
|
||||
for (int i=0; i<ds.systemLen; i++) {
|
||||
if (ds.system[i]==DIV_SYSTEM_YM2151 ||
|
||||
ds.system[i]==DIV_SYSTEM_OPZ) {
|
||||
ds.systemFlags[i].set("brokenPitch",true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (active) quitDispatch();
|
||||
BUSY_BEGIN_SOFT;
|
||||
saveLock.lock();
|
||||
|
|
|
|||
|
|
@ -1816,7 +1816,7 @@ void DivEngine::loadWOPN(SafeReader& reader, std::vector<DivInstrument*>& ret, S
|
|||
}
|
||||
}
|
||||
|
||||
std::vector<DivInstrument*> DivEngine::instrumentFromFile(const char* path, bool loadAssets) {
|
||||
std::vector<DivInstrument*> DivEngine::instrumentFromFile(const char* path, bool loadAssets, bool readInsName) {
|
||||
std::vector<DivInstrument*> ret;
|
||||
warnings="";
|
||||
|
||||
|
|
@ -1921,12 +1921,17 @@ std::vector<DivInstrument*> DivEngine::instrumentFromFile(const char* path, bool
|
|||
reader.seek(dataPtr,SEEK_SET);
|
||||
}
|
||||
|
||||
ins->name=stripPath;
|
||||
|
||||
if (ins->readInsData(reader,version,loadAssets?(&song):NULL)!=DIV_DATA_SUCCESS) {
|
||||
lastError="invalid instrument header/data!";
|
||||
delete ins;
|
||||
delete[] buf;
|
||||
return ret;
|
||||
} else {
|
||||
if (!readInsName) {
|
||||
ins->name=stripPath;
|
||||
}
|
||||
ret.push_back(ins);
|
||||
}
|
||||
} catch (EndOfFileException& e) {
|
||||
|
|
|
|||
|
|
@ -1,140 +0,0 @@
|
|||
/**
|
||||
* Furnace Tracker - multi-system chiptune tracker
|
||||
* Copyright (C) 2021-2023 tildearrow and contributors
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef _FIXED_QUEUE_H
|
||||
#define _FIXED_QUEUE_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "../ta-log.h"
|
||||
|
||||
template<typename T, size_t items> struct FixedQueue {
|
||||
size_t readPos, writePos;
|
||||
T data[items];
|
||||
|
||||
T& front();
|
||||
T& back();
|
||||
bool pop();
|
||||
bool push(const T& item);
|
||||
|
||||
bool pop_front();
|
||||
bool pop_back();
|
||||
bool push_front(const T& item);
|
||||
bool push_back(const T& item);
|
||||
void clear();
|
||||
bool empty();
|
||||
size_t size();
|
||||
FixedQueue():
|
||||
readPos(0),
|
||||
writePos(0) {}
|
||||
};
|
||||
|
||||
template <typename T, size_t items> T& FixedQueue<T,items>::front() {
|
||||
return data[readPos];
|
||||
}
|
||||
|
||||
template <typename T, size_t items> T& FixedQueue<T,items>::back() {
|
||||
if (writePos==0) return data[items-1];
|
||||
return data[writePos-1];
|
||||
}
|
||||
|
||||
template <typename T, size_t items> bool FixedQueue<T,items>::pop() {
|
||||
if (readPos==writePos) return false;
|
||||
if (++readPos>=items) readPos=0;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, size_t items> bool FixedQueue<T,items>::push(const T& item) {
|
||||
if (writePos==(readPos-1)) {
|
||||
logW("queue overflow!");
|
||||
return false;
|
||||
}
|
||||
if (writePos==items-1 && readPos==0) {
|
||||
logW("queue overflow!");
|
||||
return false;
|
||||
}
|
||||
data[writePos]=item;
|
||||
if (++writePos>=items) writePos=0;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, size_t items> bool FixedQueue<T,items>::pop_front() {
|
||||
if (readPos==writePos) return false;
|
||||
if (++readPos>=items) readPos=0;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, size_t items> bool FixedQueue<T,items>::push_back(const T& item) {
|
||||
if (writePos==(readPos-1)) {
|
||||
logW("queue overflow!");
|
||||
return false;
|
||||
}
|
||||
if (writePos==items-1 && readPos==0) {
|
||||
logW("queue overflow!");
|
||||
return false;
|
||||
}
|
||||
data[writePos]=item;
|
||||
if (++writePos>=items) writePos=0;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, size_t items> bool FixedQueue<T,items>::pop_back() {
|
||||
if (readPos==writePos) return false;
|
||||
if (writePos>0) {
|
||||
writePos--;
|
||||
} else {
|
||||
writePos=items-1;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, size_t items> bool FixedQueue<T,items>::push_front(const T& item) {
|
||||
if (readPos==(writePos+1)) {
|
||||
logW("stack overflow!");
|
||||
return false;
|
||||
}
|
||||
if (readPos==0 && writePos==items-1) {
|
||||
logW("stack overflow!");
|
||||
return false;
|
||||
}
|
||||
if (readPos>0) {
|
||||
readPos--;
|
||||
} else {
|
||||
readPos=items-1;
|
||||
}
|
||||
data[readPos]=item;
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, size_t items> void FixedQueue<T,items>::clear() {
|
||||
readPos=0;
|
||||
writePos=0;
|
||||
}
|
||||
|
||||
template <typename T, size_t items> bool FixedQueue<T,items>::empty() {
|
||||
return (readPos==writePos);
|
||||
}
|
||||
|
||||
template <typename T, size_t items> size_t FixedQueue<T,items>::size() {
|
||||
if (readPos>writePos) {
|
||||
return items+writePos-readPos;
|
||||
}
|
||||
return writePos-readPos;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -719,7 +719,7 @@ void DivInstrument::writeFeatureX1(SafeWriter* w) {
|
|||
FEATURE_END;
|
||||
}
|
||||
|
||||
void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song) {
|
||||
void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song, bool insName) {
|
||||
size_t blockStartSeek=0;
|
||||
size_t blockEndSeek=0;
|
||||
size_t slSeek=0;
|
||||
|
|
@ -1021,7 +1021,7 @@ void DivInstrument::putInsData2(SafeWriter* w, bool fui, const DivSong* song) {
|
|||
}
|
||||
|
||||
// check ins name
|
||||
if (!name.empty()) {
|
||||
if (!name.empty() && insName) {
|
||||
featureNA=true;
|
||||
}
|
||||
|
||||
|
|
@ -3380,7 +3380,7 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version, DivS
|
|||
return readInsDataOld(reader,version);
|
||||
}
|
||||
|
||||
bool DivInstrument::save(const char* path, bool oldFormat, DivSong* song) {
|
||||
bool DivInstrument::save(const char* path, bool oldFormat, DivSong* song, bool writeInsName) {
|
||||
SafeWriter* w=new SafeWriter();
|
||||
w->init();
|
||||
|
||||
|
|
@ -3397,14 +3397,14 @@ bool DivInstrument::save(const char* path, bool oldFormat, DivSong* song) {
|
|||
// pointer to data
|
||||
w->writeI(32);
|
||||
|
||||
// currently reserved (TODO; wavetable and sample here)
|
||||
// reserved
|
||||
w->writeS(0);
|
||||
w->writeS(0);
|
||||
w->writeI(0);
|
||||
|
||||
putInsData(w);
|
||||
} else {
|
||||
putInsData2(w,true,song);
|
||||
putInsData2(w,true,song,writeInsName);
|
||||
}
|
||||
|
||||
FILE* outFile=ps_fopen(path,"wb");
|
||||
|
|
|
|||
|
|
@ -720,7 +720,7 @@ struct DivInstrument {
|
|||
* save the instrument to a SafeWriter using new format.
|
||||
* @param w the SafeWriter in question.
|
||||
*/
|
||||
void putInsData2(SafeWriter* w, bool fui=false, const DivSong* song=NULL);
|
||||
void putInsData2(SafeWriter* w, bool fui=false, const DivSong* song=NULL, bool insName=true);
|
||||
|
||||
/**
|
||||
* read instrument data in .fui format.
|
||||
|
|
@ -735,9 +735,10 @@ struct DivInstrument {
|
|||
* @param path file path.
|
||||
* @param oldFormat whether to save in legacy Furnace ins format.
|
||||
* @param song if new format, a DivSong to read wavetables and samples.
|
||||
* @param writeInsName whether to write the instrument name or not. ignored if old format.
|
||||
* @return whether it was successful.
|
||||
*/
|
||||
bool save(const char* path, bool oldFormat=false, DivSong* song=NULL);
|
||||
bool save(const char* path, bool oldFormat=false, DivSong* song=NULL, bool writeInsName=true);
|
||||
|
||||
/**
|
||||
* save this instrument to a file in .dmp format.
|
||||
|
|
|
|||
|
|
@ -197,10 +197,10 @@ void DivPlatformArcade::tick(bool sysTick) {
|
|||
|
||||
if (chan[i].std.pitch.had) {
|
||||
if (chan[i].std.pitch.mode) {
|
||||
chan[i].pitch2+=chan[i].std.pitch.val;
|
||||
chan[i].pitch2+=chan[i].std.pitch.val*(brokenPitch?2:1);
|
||||
CLAMP_VAR(chan[i].pitch2,-32768,32767);
|
||||
} else {
|
||||
chan[i].pitch2=chan[i].std.pitch.val;
|
||||
chan[i].pitch2=chan[i].std.pitch.val*(brokenPitch?2:1);
|
||||
}
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -354,18 +354,18 @@ void DivPlatformArcade::tick(bool sysTick) {
|
|||
|
||||
for (int i=0; i<8; i++) {
|
||||
if (chan[i].freqChanged) {
|
||||
chan[i].freq=chan[i].baseFreq+(chan[i].pitch>>1)-64+chan[i].pitch2;
|
||||
chan[i].freq=chan[i].baseFreq+chan[i].pitch-128+chan[i].pitch2;
|
||||
if (!parent->song.oldArpStrategy) {
|
||||
if (chan[i].fixedArp) {
|
||||
chan[i].freq=(chan[i].baseNoteOverride<<6)+(chan[i].pitch>>1)-64+chan[i].pitch2;
|
||||
chan[i].freq=(chan[i].baseNoteOverride<<7)+chan[i].pitch-128+chan[i].pitch2;
|
||||
} else {
|
||||
chan[i].freq+=chan[i].arpOff<<6;
|
||||
chan[i].freq+=chan[i].arpOff<<7;
|
||||
}
|
||||
}
|
||||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>=(95<<6)) chan[i].freq=(95<<6)-1;
|
||||
immWrite(i+0x28,hScale(chan[i].freq>>6));
|
||||
immWrite(i+0x30,chan[i].freq<<2);
|
||||
if (chan[i].freq>=(95<<7)) chan[i].freq=(95<<7)-1;
|
||||
immWrite(i+0x28,hScale(chan[i].freq>>7));
|
||||
immWrite(i+0x30,((chan[i].freq<<1)&0xfc));
|
||||
hardResetElapsed+=2;
|
||||
chan[i].freqChanged=false;
|
||||
}
|
||||
|
|
@ -534,13 +534,13 @@ int DivPlatformArcade::dispatch(DivCommand c) {
|
|||
int newFreq;
|
||||
bool return2=false;
|
||||
if (destFreq>chan[c.chan].baseFreq) {
|
||||
newFreq=chan[c.chan].baseFreq+c.value;
|
||||
newFreq=chan[c.chan].baseFreq+c.value*(brokenPitch?2:1);
|
||||
if (newFreq>=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
} else {
|
||||
newFreq=chan[c.chan].baseFreq-c.value;
|
||||
newFreq=chan[c.chan].baseFreq-c.value*(brokenPitch?2:1);
|
||||
if (newFreq<=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
|
|
@ -932,7 +932,9 @@ void DivPlatformArcade::setFlags(const DivConfig& flags) {
|
|||
}
|
||||
CHECK_CUSTOM_CLOCK;
|
||||
|
||||
baseFreqOff=round(768.0*(log((COLOR_NTSC/(double)chipClock))/log(2.0)));
|
||||
baseFreqOff=round(1536.0*(log((COLOR_NTSC/(double)chipClock))/log(2.0)));
|
||||
|
||||
brokenPitch=flags.getBool("brokenPitch",false);
|
||||
|
||||
rate=chipClock/64;
|
||||
for (int i=0; i<8; i++) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef _AY_H
|
||||
#define _AY_H
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
class DivPlatformAY8910: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef _AY8930_H
|
||||
#define _AY8930_H
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/ay8910.h"
|
||||
|
||||
class DivPlatformAY8930: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../dispatch.h"
|
||||
#include "sound/c140_c219.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
|
||||
class DivPlatformC140: public DivDispatch {
|
||||
struct Channel: public SharedChannel<int> {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _C64_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/c64/sid.h"
|
||||
#include "sound/c64_fp/SID.h"
|
||||
#include "sound/c64_d/dsid.h"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../dispatch.h"
|
||||
#include "../engine.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../macroInt.h"
|
||||
#include "../sample.h"
|
||||
#include "vgsound_emu/src/es550x/es5506.hpp"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "fmsharedbase.h"
|
||||
|
||||
#define NOTE_LINEAR(x) (((x)<<6)+baseFreqOff+log2(parent->song.tuning/440.0)*12.0*64.0)
|
||||
#define NOTE_LINEAR(x) (((x)<<7)+baseFreqOff+log2(parent->song.tuning/440.0)*12.0*128.0)
|
||||
|
||||
class DivPlatformOPM: public DivPlatformFMBase {
|
||||
protected:
|
||||
|
|
@ -42,13 +42,15 @@ class DivPlatformOPM: public DivPlatformFMBase {
|
|||
};
|
||||
|
||||
unsigned char lfoValue, lfoValue2, lfoShape, lfoShape2;
|
||||
bool brokenPitch;
|
||||
|
||||
DivPlatformOPM():
|
||||
DivPlatformFMBase(),
|
||||
lfoValue(0),
|
||||
lfoValue2(0),
|
||||
lfoShape(0),
|
||||
lfoShape2(0) {}
|
||||
lfoShape2(0),
|
||||
brokenPitch(false) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../dispatch.h"
|
||||
#include "../instrument.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
|
||||
#define KVS(x,y) ((chan[x].state.op[y].kvs==2 && isOutput[chan[x].state.alg][y]) || chan[x].state.op[y].kvs==1)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _GA20_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../macroInt.h"
|
||||
#include "sound/ga20/iremga20.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "../dispatch.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "sound/gb/gb.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
|
||||
class DivPlatformGB: public DivDispatch {
|
||||
struct Channel: public SharedChannel<signed char> {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _K007232_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../macroInt.h"
|
||||
#include "vgsound_emu/src/k007232/k007232.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _MSM5232_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/oki/msm5232.h"
|
||||
|
||||
class DivPlatformMSM5232: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _MSM6258_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/oki/okim6258.h"
|
||||
|
||||
class DivPlatformMSM6258: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _MSM6295_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "vgsound_emu/src/msm6295/msm6295.hpp"
|
||||
|
||||
class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _N163_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "vgsound_emu/src/n163/n163.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _NAMCOWSG_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "sound/namco.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -722,6 +722,10 @@ void DivPlatformOPL::muteChannel(int ch, bool mute) {
|
|||
}
|
||||
}
|
||||
|
||||
if (properDrums && ch>melodicChans) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isMuted[ch]) {
|
||||
rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1));
|
||||
if (ops==4) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _OPL_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../../../extern/opl/opl3.h"
|
||||
#include "sound/ymfm/ymfm_adpcm.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _OPLL_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
|
||||
extern "C" {
|
||||
#include "../../../extern/Nuked-OPLL/opll.h"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _PCE_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "sound/pce_psg.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _PCSPKR_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _POKEY_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
|
||||
extern "C" {
|
||||
#include "sound/pokey/mzpokeysnd.h"
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _SAA_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../../../extern/SAASound/src/SAASound.h"
|
||||
|
||||
class DivPlatformSAA1099: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "../dispatch.h"
|
||||
#include "../instrument.h"
|
||||
#include "sound/segapcm.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
|
||||
class DivPlatformSegaPCM: public DivDispatch {
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _SM8521_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "sound/sm8521.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
extern "C" {
|
||||
#include "../../../extern/Nuked-PSG/ympsg.h"
|
||||
}
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
|
||||
class DivPlatformSMS: public DivDispatch {
|
||||
struct Channel: public SharedChannel<signed char> {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include "../dispatch.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/snes/SPC_DSP.h"
|
||||
|
||||
class DivPlatformSNES: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _SU_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/su.h"
|
||||
|
||||
class DivPlatformSoundUnit: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
#include "../dispatch.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "sound/swan.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
|
||||
class DivPlatformSwan: public DivDispatch {
|
||||
struct Channel: public SharedChannel<int> {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _T6W28_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/t6w28/T6W28_Apu.h"
|
||||
|
||||
class DivPlatformT6W28: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _TED_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/ted-sound.h"
|
||||
|
||||
class DivPlatformTED: public DivDispatch {
|
||||
|
|
|
|||
|
|
@ -147,10 +147,10 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
|||
|
||||
if (chan[i].std.pitch.had) {
|
||||
if (chan[i].std.pitch.mode) {
|
||||
chan[i].pitch2+=chan[i].std.pitch.val;
|
||||
chan[i].pitch2+=chan[i].std.pitch.val*(brokenPitch?2:1);
|
||||
CLAMP_VAR(chan[i].pitch2,-32768,32767);
|
||||
} else {
|
||||
chan[i].pitch2=chan[i].std.pitch.val;
|
||||
chan[i].pitch2=chan[i].std.pitch.val*(brokenPitch?2:1);
|
||||
}
|
||||
chan[i].freqChanged=true;
|
||||
}
|
||||
|
|
@ -337,18 +337,18 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
|||
|
||||
for (int i=0; i<8; i++) {
|
||||
if (chan[i].freqChanged) {
|
||||
chan[i].freq=chan[i].baseFreq+(chan[i].pitch>>1)-64+chan[i].pitch2;
|
||||
chan[i].freq=chan[i].baseFreq+chan[i].pitch-128+chan[i].pitch2;
|
||||
if (!parent->song.oldArpStrategy) {
|
||||
if (chan[i].fixedArp) {
|
||||
chan[i].freq=(chan[i].baseNoteOverride<<6)+(chan[i].pitch>>1)-64+chan[i].pitch2;
|
||||
chan[i].freq=(chan[i].baseNoteOverride<<7)+chan[i].pitch-128+chan[i].pitch2;
|
||||
} else {
|
||||
chan[i].freq+=chan[i].arpOff<<6;
|
||||
chan[i].freq+=chan[i].arpOff<<7;
|
||||
}
|
||||
}
|
||||
if (chan[i].freq<0) chan[i].freq=0;
|
||||
if (chan[i].freq>=(95<<6)) chan[i].freq=(95<<6)-1;
|
||||
immWrite(i+0x28,hScale(chan[i].freq>>6));
|
||||
immWrite(i+0x30,(chan[i].freq<<2)|(chan[i].chVolL==chan[i].chVolR));
|
||||
if (chan[i].freq>=(95<<7)) chan[i].freq=(95<<7)-1;
|
||||
immWrite(i+0x28,hScale(chan[i].freq>>7));
|
||||
immWrite(i+0x30,((chan[i].freq<<1)&0xfc)|(chan[i].chVolL==chan[i].chVolR));
|
||||
hardResetElapsed+=2;
|
||||
chan[i].freqChanged=false;
|
||||
}
|
||||
|
|
@ -523,13 +523,13 @@ int DivPlatformTX81Z::dispatch(DivCommand c) {
|
|||
int newFreq;
|
||||
bool return2=false;
|
||||
if (destFreq>chan[c.chan].baseFreq) {
|
||||
newFreq=chan[c.chan].baseFreq+c.value;
|
||||
newFreq=chan[c.chan].baseFreq+c.value*(brokenPitch?2:1);
|
||||
if (newFreq>=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
}
|
||||
} else {
|
||||
newFreq=chan[c.chan].baseFreq-c.value;
|
||||
newFreq=chan[c.chan].baseFreq-c.value*(brokenPitch?2:1);
|
||||
if (newFreq<=destFreq) {
|
||||
newFreq=destFreq;
|
||||
return2=true;
|
||||
|
|
@ -1043,7 +1043,9 @@ void DivPlatformTX81Z::setFlags(const DivConfig& flags) {
|
|||
}
|
||||
CHECK_CUSTOM_CLOCK;
|
||||
|
||||
baseFreqOff=round(768.0*(log((COLOR_NTSC/(double)chipClock))/log(2.0)));
|
||||
baseFreqOff=round(1536.0*(log((COLOR_NTSC/(double)chipClock))/log(2.0)));
|
||||
|
||||
brokenPitch=flags.getBool("brokenPitch",false);
|
||||
|
||||
rate=chipClock/64;
|
||||
for (int i=0; i<8; i++) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _TX81Z_H
|
||||
|
||||
#include "fmshared_OPM.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "sound/ymfm/ymfm_opz.h"
|
||||
|
||||
class DivTXInterface: public ymfm::ymfm_interface {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _PLATFORM_VB_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "sound/vsu.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
#ifndef _VRC6_H
|
||||
#define _VRC6_H
|
||||
|
||||
#include "../fixedQueue.h"
|
||||
#include "../../fixedQueue.h"
|
||||
#include "../dispatch.h"
|
||||
#include "vgsound_emu/src/vrcvi/vrcvi.hpp"
|
||||
|
||||
|
|
|
|||
|
|
@ -1167,8 +1167,10 @@ void DivEngine::nextRow() {
|
|||
}
|
||||
|
||||
if (!stepPlay) {
|
||||
playPosLock.lock();
|
||||
prevOrder=curOrder;
|
||||
prevRow=curRow;
|
||||
playPosLock.unlock();
|
||||
}
|
||||
|
||||
for (int i=0; i<chans; i++) {
|
||||
|
|
@ -1349,8 +1351,8 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
|
|||
isOn[pendingNotes[i].channel]=true;
|
||||
} else {
|
||||
if (isOn[pendingNotes[i].channel]) {
|
||||
logV("erasing off -> on sequence in %d",pendingNotes[i].channel);
|
||||
pendingNotes.erase(pendingNotes.begin()+i);
|
||||
//logV("erasing off -> on sequence in %d",pendingNotes[i].channel);
|
||||
pendingNotes[i].nop=true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1358,12 +1360,13 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
|
|||
|
||||
while (!pendingNotes.empty()) {
|
||||
DivNoteEvent& note=pendingNotes.front();
|
||||
if (note.channel<0 || note.channel>=chans) {
|
||||
if (note.nop || note.channel<0 || note.channel>=chans) {
|
||||
pendingNotes.pop_front();
|
||||
continue;
|
||||
}
|
||||
if (note.on) {
|
||||
dispatchCmd(DivCommand(DIV_CMD_INSTRUMENT,note.channel,note.ins,1));
|
||||
//dispatchCmd(DivCommand(DIV_CMD_VOLUME,note.channel,(note.volume*(chan[note.channel].volMax>>8))/127));
|
||||
dispatchCmd(DivCommand(DIV_CMD_NOTE_ON,note.channel,note.note));
|
||||
keyHit[note.channel]=true;
|
||||
chan[note.channel].noteOnInhibit=true;
|
||||
|
|
@ -1405,8 +1408,10 @@ bool DivEngine::nextTick(bool noAccum, bool inhibitLowLat) {
|
|||
endOfSong=false;
|
||||
if (stepPlay==2) {
|
||||
stepPlay=1;
|
||||
playPosLock.lock();
|
||||
prevOrder=curOrder;
|
||||
prevRow=curRow;
|
||||
playPosLock.unlock();
|
||||
}
|
||||
nextRow();
|
||||
break;
|
||||
|
|
@ -1850,7 +1855,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
|||
}
|
||||
}
|
||||
}
|
||||
logD("%.2x",msg.type);
|
||||
//logD("%.2x",msg.type);
|
||||
output->midiIn->queue.pop();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "defines.h"
|
||||
#include "safeWriter.h"
|
||||
#include "dataErrors.h"
|
||||
#include <deque>
|
||||
#include "../fixedQueue.h"
|
||||
|
||||
enum DivSampleLoopMode: unsigned char {
|
||||
DIV_SAMPLE_LOOP_FORWARD=0,
|
||||
|
|
@ -144,8 +144,8 @@ struct DivSample {
|
|||
|
||||
unsigned int samples;
|
||||
|
||||
std::deque<DivSampleHistory*> undoHist;
|
||||
std::deque<DivSampleHistory*> redoHist;
|
||||
FixedQueue<DivSampleHistory*,128> undoHist;
|
||||
FixedQueue<DivSampleHistory*,128> redoHist;
|
||||
|
||||
/**
|
||||
* put sample data.
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
#include <functional>
|
||||
#include <future>
|
||||
|
||||
#include "fixedQueue.h"
|
||||
#include "../fixedQueue.h"
|
||||
|
||||
class DivWorkPool;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue