mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-16 09:45:06 +00:00
Merge branch 'master' into ZSMv1
This commit is contained in:
commit
ca4fb5b7d4
131 changed files with 2913 additions and 3348 deletions
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
|
@ -130,7 +130,7 @@ jobs:
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
libjack-jackd2-dev \
|
libjack-jackd2-dev \
|
||||||
appstream
|
appstream
|
||||||
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
|
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" || wget "https://tildearrow.org/storage/furnace/ci/appimagetool-x86_64.AppImage"
|
||||||
chmod +x appimagetool-x86_64.AppImage
|
chmod +x appimagetool-x86_64.AppImage
|
||||||
|
|
||||||
- name: Install Dependencies [Linux armhf]
|
- name: Install Dependencies [Linux armhf]
|
||||||
|
@ -151,8 +151,8 @@ jobs:
|
||||||
libsndfile1-dev:armhf \
|
libsndfile1-dev:armhf \
|
||||||
zlib1g-dev:armhf \
|
zlib1g-dev:armhf \
|
||||||
libjack-jackd2-dev:armhf
|
libjack-jackd2-dev:armhf
|
||||||
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
|
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" || wget "https://tildearrow.org/storage/furnace/ci/appimagetool-x86_64.AppImage"
|
||||||
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-armhf"
|
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-armhf" || wget "https://tildearrow.org/storage/furnace/ci/runtime-armhf"
|
||||||
chmod +x appimagetool-x86_64.AppImage
|
chmod +x appimagetool-x86_64.AppImage
|
||||||
ls /usr/arm-linux-gnueabihf/lib
|
ls /usr/arm-linux-gnueabihf/lib
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@ set(USE_SNDFILE_DEFAULT ON)
|
||||||
set(SYSTEM_SDL2_DEFAULT OFF)
|
set(SYSTEM_SDL2_DEFAULT OFF)
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include(CheckIncludeFile)
|
||||||
|
include(TestBigEndian)
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
set(USE_RTMIDI_DEFAULT OFF)
|
set(USE_RTMIDI_DEFAULT OFF)
|
||||||
|
@ -72,9 +73,15 @@ option(WITH_INSTRUMENTS "Install instruments" ON)
|
||||||
set(DEPENDENCIES_INCLUDE_DIRS "")
|
set(DEPENDENCIES_INCLUDE_DIRS "")
|
||||||
|
|
||||||
if (ANDROID AND NOT TERMUX)
|
if (ANDROID AND NOT TERMUX)
|
||||||
set(DEPENDENCIES_DEFINES "IS_MOBILE")
|
set(DEPENDENCIES_DEFINES "IS_MOBILE")
|
||||||
else()
|
else()
|
||||||
set(DEPENDENCIES_DEFINES "")
|
set(DEPENDENCIES_DEFINES "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
TEST_BIG_ENDIAN(IS_BIG_ENDIAN)
|
||||||
|
|
||||||
|
if (IS_BIG_ENDIAN)
|
||||||
|
list(APPEND DEPENDENCIES_DEFINES "TA_BIG_ENDIAN")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(DEPENDENCIES_COMPILE_OPTIONS "")
|
set(DEPENDENCIES_COMPILE_OPTIONS "")
|
||||||
|
@ -547,6 +554,8 @@ src/gui/stats.cpp
|
||||||
src/gui/subSongs.cpp
|
src/gui/subSongs.cpp
|
||||||
src/gui/sysConf.cpp
|
src/gui/sysConf.cpp
|
||||||
src/gui/sysEx.cpp
|
src/gui/sysEx.cpp
|
||||||
|
src/gui/sysManager.cpp
|
||||||
|
src/gui/sysPicker.cpp
|
||||||
src/gui/util.cpp
|
src/gui/util.cpp
|
||||||
src/gui/waveEdit.cpp
|
src/gui/waveEdit.cpp
|
||||||
src/gui/volMeter.cpp
|
src/gui/volMeter.cpp
|
||||||
|
|
|
@ -33,6 +33,7 @@ the coding style is described here:
|
||||||
- indent switch cases
|
- indent switch cases
|
||||||
- preprocessor directives not intended
|
- preprocessor directives not intended
|
||||||
- if macro comprises more than one line, indent
|
- if macro comprises more than one line, indent
|
||||||
|
- no new line after `template<>`
|
||||||
- prefer built-in types:
|
- prefer built-in types:
|
||||||
- `bool`
|
- `bool`
|
||||||
- `signed char` or `unsigned char` are 8-bit
|
- `signed char` or `unsigned char` are 8-bit
|
||||||
|
@ -81,6 +82,7 @@ just put your demo song in `demos/`! be noted there are some guidelines:
|
||||||
|
|
||||||
- avoid Nintendo song covers.
|
- avoid Nintendo song covers.
|
||||||
- avoid big label song covers.
|
- avoid big label song covers.
|
||||||
|
- avoid poor quality songs.
|
||||||
|
|
||||||
# Finishing
|
# Finishing
|
||||||
|
|
||||||
|
|
2
TODO.md
2
TODO.md
|
@ -1,5 +1,5 @@
|
||||||
# to-do for 0.6pre1.5-0.6pre2
|
# to-do for 0.6pre1.5-0.6pre2
|
||||||
|
|
||||||
- volume commands should work on Game Boy
|
- volume commands should work on Game Boy
|
||||||
- ability to customize `OFF`, `===` and `REL`
|
|
||||||
- stereo separation control for AY
|
- stereo separation control for AY
|
||||||
|
- "paste with instrument"
|
BIN
demos/BONUS. Sonic 2 Boss.fur
Normal file
BIN
demos/BONUS. Sonic 2 Boss.fur
Normal file
Binary file not shown.
BIN
demos/Silver Surfer - Stage Music 1.fur
Normal file
BIN
demos/Silver Surfer - Stage Music 1.fur
Normal file
Binary file not shown.
Binary file not shown.
BIN
demos/Waterworld_-_Map.fur
Normal file
BIN
demos/Waterworld_-_Map.fur
Normal file
Binary file not shown.
BIN
demos/government funding breakcore-ish remix.fur
Normal file
BIN
demos/government funding breakcore-ish remix.fur
Normal file
Binary file not shown.
BIN
demos/rule2.fur
Normal file
BIN
demos/rule2.fur
Normal file
Binary file not shown.
136
papers/format.md
136
papers/format.md
|
@ -32,6 +32,12 @@ these fields are 0 in format versions prior to 100 (0.6pre1).
|
||||||
|
|
||||||
the format versions are:
|
the format versions are:
|
||||||
|
|
||||||
|
- 112: Furnace dev112
|
||||||
|
- 111: Furnace dev111
|
||||||
|
- 110: Furnace dev110
|
||||||
|
- 109: Furnace dev109
|
||||||
|
- 108: Furnace dev108
|
||||||
|
- 107: Furnace dev107
|
||||||
- 106: Furnace dev106
|
- 106: Furnace dev106
|
||||||
- 105: Furnace dev105
|
- 105: Furnace dev105
|
||||||
- 104: Furnace dev104
|
- 104: Furnace dev104
|
||||||
|
@ -330,7 +336,9 @@ size | description
|
||||||
1 | broken outVol (>=99) or reserved
|
1 | broken outVol (>=99) or reserved
|
||||||
1 | E1xy and E2xy stop on same note (>=100) or reserved
|
1 | E1xy and E2xy stop on same note (>=100) or reserved
|
||||||
1 | broken initial position of porta after arp (>=101) or reserved
|
1 | broken initial position of porta after arp (>=101) or reserved
|
||||||
7 | reserved
|
1 | SN periods under 8 are treated as 1 (>=108) or reserved
|
||||||
|
1 | cut/delay effect policy (>=110) or reserved
|
||||||
|
5 | reserved
|
||||||
--- | **virtual tempo data**
|
--- | **virtual tempo data**
|
||||||
2 | virtual tempo numerator of first song (>=96) or reserved
|
2 | virtual tempo numerator of first song (>=96) or reserved
|
||||||
2 | virtual tempo denominator of first song (>=96) or reserved
|
2 | virtual tempo denominator of first song (>=96) or reserved
|
||||||
|
@ -447,6 +455,7 @@ size | description
|
||||||
| - 29: SNES
|
| - 29: SNES
|
||||||
| - 30: Sound Unit
|
| - 30: Sound Unit
|
||||||
| - 31: Namco WSG
|
| - 31: Namco WSG
|
||||||
|
| - 32: OPL (drums)
|
||||||
1 | reserved
|
1 | reserved
|
||||||
STR | instrument name
|
STR | instrument name
|
||||||
--- | **FM instrument data**
|
--- | **FM instrument data**
|
||||||
|
@ -538,7 +547,18 @@ size | description
|
||||||
4 | extra 1 macro loop (>=17)
|
4 | extra 1 macro loop (>=17)
|
||||||
4 | extra 2 macro loop (>=17)
|
4 | extra 2 macro loop (>=17)
|
||||||
4 | extra 3 macro loop (>=17)
|
4 | extra 3 macro loop (>=17)
|
||||||
1 | arp macro mode
|
1 | arp macro mode (<112) or reserved
|
||||||
|
| - treat this value in a special way.
|
||||||
|
| - before version 112, this byte indicates whether the arp macro mode is fixed or not.
|
||||||
|
| - from that version onwards, the fixed mode is part of the macro values.
|
||||||
|
| - to convert a <112 macro mode to a modern one, do the following:
|
||||||
|
| - is the macro mode set to fixed?
|
||||||
|
| - if yes, then:
|
||||||
|
| - set bit 30 of all arp macro values (this is the fixed mode bit)
|
||||||
|
| - does the macro loop?
|
||||||
|
| - if yes, then do nothing else
|
||||||
|
| - if no, then add one to the macro length, and set the last macro value to 0
|
||||||
|
| - if no, then do nothing
|
||||||
1 | reserved (>=17) or volume macro height (>=15) or reserved
|
1 | reserved (>=17) or volume macro height (>=15) or reserved
|
||||||
1 | reserved (>=17) or duty macro height (>=15) or reserved
|
1 | reserved (>=17) or duty macro height (>=15) or reserved
|
||||||
1 | reserved (>=17) or wave macro height (>=15) or reserved
|
1 | reserved (>=17) or wave macro height (>=15) or reserved
|
||||||
|
@ -546,6 +566,7 @@ size | description
|
||||||
| - before version 87, if this is the C64 relative cutoff macro, its values were stored offset by 18.
|
| - before version 87, if this is the C64 relative cutoff macro, its values were stored offset by 18.
|
||||||
4?? | arp macro
|
4?? | arp macro
|
||||||
| - before version 31, this macro's values were stored offset by 12.
|
| - before version 31, this macro's values were stored offset by 12.
|
||||||
|
| - from version 112 onward, bit 30 of a value indicates fixed mode.
|
||||||
4?? | duty macro
|
4?? | duty macro
|
||||||
| - before version 87, if this is the C64 relative duty macro, its values were stored offset by 12.
|
| - before version 87, if this is the C64 relative duty macro, its values were stored offset by 12.
|
||||||
4?? | wave macro
|
4?? | wave macro
|
||||||
|
@ -850,6 +871,111 @@ size | description
|
||||||
--- | **Game Boy extra flags** (>=106)
|
--- | **Game Boy extra flags** (>=106)
|
||||||
1 | use software envelope
|
1 | use software envelope
|
||||||
1 | always init hard env on new note
|
1 | always init hard env on new note
|
||||||
|
--- | **ES5506 data** (>=107)
|
||||||
|
1 | filter mode
|
||||||
|
| - 0: HPK2_HPK2
|
||||||
|
| - 1: HPK2_LPK1
|
||||||
|
| - 2: LPK2_LPK2
|
||||||
|
| - 3: LPK2_LPK1
|
||||||
|
2 | K1
|
||||||
|
2 | K2
|
||||||
|
2 | envelope count
|
||||||
|
1 | left volume ramp
|
||||||
|
1 | right volume ramp
|
||||||
|
1 | K1 ramp
|
||||||
|
1 | K2 ramp
|
||||||
|
1 | K1 slow
|
||||||
|
1 | K2 slow
|
||||||
|
--- | **SNES data** (>=109)
|
||||||
|
1 | use envelope
|
||||||
|
1 | gain mode
|
||||||
|
1 | gain
|
||||||
|
1 | attack
|
||||||
|
1 | decay
|
||||||
|
1 | sustain
|
||||||
|
1 | release
|
||||||
|
--- | **macro speeds/delays** (>=111)
|
||||||
|
1 | volume macro speed
|
||||||
|
1 | arp macro speed
|
||||||
|
1 | duty macro speed
|
||||||
|
1 | wave macro speed
|
||||||
|
1 | pitch macro speed
|
||||||
|
1 | extra 1 macro speed
|
||||||
|
1 | extra 2 macro speed
|
||||||
|
1 | extra 3 macro speed
|
||||||
|
1 | alg macro speed
|
||||||
|
1 | fb macro speed
|
||||||
|
1 | fms macro speed
|
||||||
|
1 | ams macro speed
|
||||||
|
1 | left panning macro speed
|
||||||
|
1 | right panning macro speed
|
||||||
|
1 | phase reset macro speed
|
||||||
|
1 | extra 4 macro speed
|
||||||
|
1 | extra 5 macro speed
|
||||||
|
1 | extra 6 macro speed
|
||||||
|
1 | extra 7 macro speed
|
||||||
|
1 | extra 8 macro speed
|
||||||
|
1 | volume macro delay
|
||||||
|
1 | arp macro delay
|
||||||
|
1 | duty macro delay
|
||||||
|
1 | wave macro delay
|
||||||
|
1 | pitch macro delay
|
||||||
|
1 | extra 1 macro delay
|
||||||
|
1 | extra 2 macro delay
|
||||||
|
1 | extra 3 macro delay
|
||||||
|
1 | alg macro delay
|
||||||
|
1 | fb macro delay
|
||||||
|
1 | fms macro delay
|
||||||
|
1 | ams macro delay
|
||||||
|
1 | left panning macro delay
|
||||||
|
1 | right panning macro delay
|
||||||
|
1 | phase reset macro delay
|
||||||
|
1 | extra 4 macro delay
|
||||||
|
1 | extra 5 macro delay
|
||||||
|
1 | extra 6 macro delay
|
||||||
|
1 | extra 7 macro delay
|
||||||
|
1 | extra 8 macro delay
|
||||||
|
--- | **operator macro speeds/delay** × 4 (>=111)
|
||||||
|
1 | AM macro speed
|
||||||
|
1 | AR macro speed
|
||||||
|
1 | DR macro speed
|
||||||
|
1 | MULT macro speed
|
||||||
|
1 | RR macro speed
|
||||||
|
1 | SL macro speed
|
||||||
|
1 | TL macro speed
|
||||||
|
1 | DT2 macro speed
|
||||||
|
1 | RS macro speed
|
||||||
|
1 | DT macro speed
|
||||||
|
1 | D2R macro speed
|
||||||
|
1 | SSG-EG macro speed
|
||||||
|
1 | DAM macro speed
|
||||||
|
1 | DVB macro speed
|
||||||
|
1 | EGT macro speed
|
||||||
|
1 | KSL macro speed
|
||||||
|
1 | SUS macro speed
|
||||||
|
1 | VIB macro speed
|
||||||
|
1 | WS macro speed
|
||||||
|
1 | KSR macro speed
|
||||||
|
1 | AM macro delay
|
||||||
|
1 | AR macro delay
|
||||||
|
1 | DR macro delay
|
||||||
|
1 | MULT macro delay
|
||||||
|
1 | RR macro delay
|
||||||
|
1 | SL macro delay
|
||||||
|
1 | TL macro delay
|
||||||
|
1 | DT2 macro delay
|
||||||
|
1 | RS macro delay
|
||||||
|
1 | DT macro delay
|
||||||
|
1 | D2R macro delay
|
||||||
|
1 | SSG-EG macro delay
|
||||||
|
1 | DAM macro delay
|
||||||
|
1 | DVB macro delay
|
||||||
|
1 | EGT macro delay
|
||||||
|
1 | KSL macro delay
|
||||||
|
1 | SUS macro delay
|
||||||
|
1 | VIB macro delay
|
||||||
|
1 | WS macro delay
|
||||||
|
1 | KSR macro delay
|
||||||
```
|
```
|
||||||
|
|
||||||
# wavetable
|
# wavetable
|
||||||
|
@ -860,9 +986,9 @@ size | description
|
||||||
4 | "WAVE" block ID
|
4 | "WAVE" block ID
|
||||||
4 | size of this block
|
4 | size of this block
|
||||||
STR | wavetable name
|
STR | wavetable name
|
||||||
4 | wavetable size
|
4 | wavetable width
|
||||||
4 | wavetable min
|
4 | reserved
|
||||||
4 | wavetable max
|
4 | wavetable height
|
||||||
4?? | wavetable data
|
4?? | wavetable data
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,11 @@ bool TAAudioSDL::init(TAAudioDesc& request, TAAudioDesc& response) {
|
||||||
desc.outFormat=TA_AUDIO_FORMAT_F32;
|
desc.outFormat=TA_AUDIO_FORMAT_F32;
|
||||||
|
|
||||||
ac.freq=desc.rate;
|
ac.freq=desc.rate;
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
ac.format=AUDIO_F32MSB;
|
||||||
|
#else
|
||||||
ac.format=AUDIO_F32;
|
ac.format=AUDIO_F32;
|
||||||
|
#endif
|
||||||
ac.channels=desc.outChans;
|
ac.channels=desc.outChans;
|
||||||
ac.samples=desc.bufsize;
|
ac.samples=desc.bufsize;
|
||||||
ac.callback=taSDLProcess;
|
ac.callback=taSDLProcess;
|
||||||
|
|
|
@ -417,13 +417,6 @@ class DivDispatch {
|
||||||
*/
|
*/
|
||||||
virtual bool getWantPreNote();
|
virtual bool getWantPreNote();
|
||||||
|
|
||||||
/**
|
|
||||||
* get a description of a dispatch-specific effect.
|
|
||||||
* @param effect the effect.
|
|
||||||
* @return the description, or NULL if effect is invalid.
|
|
||||||
*/
|
|
||||||
virtual const char* getEffectName(unsigned char effect);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the chip flags.
|
* set the chip flags.
|
||||||
* @param flags the flags. see song.h for possible values.
|
* @param flags the flags. see song.h for possible values.
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "dispatch.h"
|
#include "dispatch.h"
|
||||||
|
#include "song.h"
|
||||||
#define _USE_MATH_DEFINES
|
#define _USE_MATH_DEFINES
|
||||||
#include "engine.h"
|
#include "engine.h"
|
||||||
#include "instrument.h"
|
#include "instrument.h"
|
||||||
|
@ -124,8 +125,15 @@ const char* DivEngine::getEffectDesc(unsigned char effect, int chan, bool notNul
|
||||||
if ((effect&0xf0)==0x90) {
|
if ((effect&0xf0)==0x90) {
|
||||||
return "9xxx: Set sample offset*256";
|
return "9xxx: Set sample offset*256";
|
||||||
} else if (chan>=0 && chan<chans) {
|
} else if (chan>=0 && chan<chans) {
|
||||||
const char* ret=disCont[dispatchOfChan[chan]].dispatch->getEffectName(effect);
|
DivSysDef* sysDef=sysDefs[sysOfChan[chan]];
|
||||||
if (ret!=NULL) return ret;
|
auto iter=sysDef->effectHandlers.find(effect);
|
||||||
|
if (iter!=sysDef->effectHandlers.end()) {
|
||||||
|
return iter->second.description;
|
||||||
|
}
|
||||||
|
iter=sysDef->postEffectHandlers.find(effect);
|
||||||
|
if (iter!=sysDef->postEffectHandlers.end()) {
|
||||||
|
return iter->second.description;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1379,6 +1387,115 @@ bool DivEngine::removeSystem(int index, bool preserveOrder) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DivEngine::swapSystem(int src, int dest, bool preserveOrder) {
|
||||||
|
if (src==dest) {
|
||||||
|
lastError="source and destination are equal";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (src<0 || src>=song.systemLen) {
|
||||||
|
lastError="invalid source index";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (dest<0 || dest>=song.systemLen) {
|
||||||
|
lastError="invalid destination index";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//int chanCount=chans;
|
||||||
|
quitDispatch();
|
||||||
|
BUSY_BEGIN;
|
||||||
|
saveLock.lock();
|
||||||
|
|
||||||
|
if (!preserveOrder) {
|
||||||
|
// move channels
|
||||||
|
unsigned char unswappedChannels[DIV_MAX_CHANS];
|
||||||
|
unsigned char swappedChannels[DIV_MAX_CHANS];
|
||||||
|
std::vector<std::vector<int>> swapList;
|
||||||
|
std::vector<int> chanList;
|
||||||
|
|
||||||
|
int tchans=0;
|
||||||
|
|
||||||
|
for (int i=0; i<song.systemLen; i++) {
|
||||||
|
tchans+=getChannelCount(song.system[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(unswappedChannels,0,DIV_MAX_CHANS);
|
||||||
|
memset(swappedChannels,0,DIV_MAX_CHANS);
|
||||||
|
|
||||||
|
for (int i=0; i<tchans; i++) {
|
||||||
|
unswappedChannels[i]=i;
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepare swap list
|
||||||
|
int index=0;
|
||||||
|
for (int i=0; i<song.systemLen; i++) {
|
||||||
|
chanList.clear();
|
||||||
|
for (int j=0; j<getChannelCount(song.system[i]); j++) {
|
||||||
|
chanList.push_back(index);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
swapList.push_back(chanList);
|
||||||
|
}
|
||||||
|
swapList[src].swap(swapList[dest]);
|
||||||
|
|
||||||
|
// unfold it
|
||||||
|
index=0;
|
||||||
|
for (std::vector<int>& i: swapList) {
|
||||||
|
for (int& j: i) {
|
||||||
|
swappedChannels[index++]=j;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logV("swap list:");
|
||||||
|
for (int i=0; i<tchans; i++) {
|
||||||
|
logV("- %d -> %d",unswappedChannels[i],swappedChannels[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// swap channels
|
||||||
|
bool allComplete=false;
|
||||||
|
while (!allComplete) {
|
||||||
|
logD("doing swap...");
|
||||||
|
allComplete=true;
|
||||||
|
for (int i=0; i<tchans; i++) {
|
||||||
|
if (unswappedChannels[i]!=swappedChannels[i]) {
|
||||||
|
swapChannels(i,swappedChannels[i]);
|
||||||
|
allComplete=false;
|
||||||
|
logD("> %d -> %d",unswappedChannels[i],unswappedChannels[swappedChannels[i]]);
|
||||||
|
unswappedChannels[i]^=unswappedChannels[swappedChannels[i]];
|
||||||
|
unswappedChannels[swappedChannels[i]]^=unswappedChannels[i];
|
||||||
|
unswappedChannels[i]^=unswappedChannels[swappedChannels[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DivSystem srcSystem=song.system[src];
|
||||||
|
|
||||||
|
song.system[src]=song.system[dest];
|
||||||
|
song.system[dest]=srcSystem;
|
||||||
|
|
||||||
|
song.systemVol[src]^=song.systemVol[dest];
|
||||||
|
song.systemVol[dest]^=song.systemVol[src];
|
||||||
|
song.systemVol[src]^=song.systemVol[dest];
|
||||||
|
|
||||||
|
song.systemPan[src]^=song.systemPan[dest];
|
||||||
|
song.systemPan[dest]^=song.systemPan[src];
|
||||||
|
song.systemPan[src]^=song.systemPan[dest];
|
||||||
|
|
||||||
|
song.systemFlags[src]^=song.systemFlags[dest];
|
||||||
|
song.systemFlags[dest]^=song.systemFlags[src];
|
||||||
|
song.systemFlags[src]^=song.systemFlags[dest];
|
||||||
|
|
||||||
|
recalcChans();
|
||||||
|
saveLock.unlock();
|
||||||
|
BUSY_END;
|
||||||
|
initDispatch();
|
||||||
|
BUSY_BEGIN;
|
||||||
|
renderSamples();
|
||||||
|
reset();
|
||||||
|
BUSY_END;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DivEngine::poke(int sys, unsigned int addr, unsigned short val) {
|
void DivEngine::poke(int sys, unsigned int addr, unsigned short val) {
|
||||||
if (sys<0 || sys>=song.systemLen) return;
|
if (sys<0 || sys>=song.systemLen) return;
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
|
@ -1654,6 +1771,15 @@ int DivEngine::calcFreq(int base, int pitch, bool period, int octave, int pitch2
|
||||||
base+((pitch*octave)>>1)+pitch2;
|
base+((pitch*octave)>>1)+pitch2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DivEngine::calcArp(int note, int arp, int offset) {
|
||||||
|
if (arp<0) {
|
||||||
|
if (!(arp&0x40000000)) return (arp|0x40000000)+offset;
|
||||||
|
} else {
|
||||||
|
if (arp&0x40000000) return (arp&(~0x40000000))+offset;
|
||||||
|
}
|
||||||
|
return note+arp;
|
||||||
|
}
|
||||||
|
|
||||||
int DivEngine::convertPanSplitToLinear(unsigned int val, unsigned char bits, int range) {
|
int DivEngine::convertPanSplitToLinear(unsigned int val, unsigned char bits, int range) {
|
||||||
int panL=val>>bits;
|
int panL=val>>bits;
|
||||||
int panR=val&((1<<bits)-1);
|
int panR=val&((1<<bits)-1);
|
||||||
|
@ -3084,7 +3210,7 @@ bool DivEngine::moveSampleDown(int which) {
|
||||||
void DivEngine::noteOn(int chan, int ins, int note, int vol) {
|
void DivEngine::noteOn(int chan, int ins, int note, int vol) {
|
||||||
if (chan<0 || chan>=chans) return;
|
if (chan<0 || chan>=chans) return;
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
pendingNotes.push(DivNoteEvent(chan,ins,note,vol,true));
|
pendingNotes.push_back(DivNoteEvent(chan,ins,note,vol,true));
|
||||||
if (!playing) {
|
if (!playing) {
|
||||||
reset();
|
reset();
|
||||||
freelance=true;
|
freelance=true;
|
||||||
|
@ -3096,7 +3222,7 @@ void DivEngine::noteOn(int chan, int ins, int note, int vol) {
|
||||||
void DivEngine::noteOff(int chan) {
|
void DivEngine::noteOff(int chan) {
|
||||||
if (chan<0 || chan>=chans) return;
|
if (chan<0 || chan>=chans) return;
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
pendingNotes.push(DivNoteEvent(chan,-1,-1,-1,false));
|
pendingNotes.push_back(DivNoteEvent(chan,-1,-1,-1,false));
|
||||||
if (!playing) {
|
if (!playing) {
|
||||||
reset();
|
reset();
|
||||||
freelance=true;
|
freelance=true;
|
||||||
|
@ -3148,7 +3274,7 @@ void DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
|
||||||
if ((!midiPoly) || (isViable[finalChan] && chan[finalChan].midiNote==-1 && (insInst->type==DIV_INS_OPL || getChannelType(finalChan)==finalChanType || notInViableChannel))) {
|
if ((!midiPoly) || (isViable[finalChan] && chan[finalChan].midiNote==-1 && (insInst->type==DIV_INS_OPL || getChannelType(finalChan)==finalChanType || notInViableChannel))) {
|
||||||
chan[finalChan].midiNote=note;
|
chan[finalChan].midiNote=note;
|
||||||
chan[finalChan].midiAge=midiAgeCounter++;
|
chan[finalChan].midiAge=midiAgeCounter++;
|
||||||
pendingNotes.push(DivNoteEvent(finalChan,ins,note,vol,true));
|
pendingNotes.push_back(DivNoteEvent(finalChan,ins,note,vol,true));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (++finalChan>=chans) {
|
if (++finalChan>=chans) {
|
||||||
|
@ -3169,7 +3295,7 @@ void DivEngine::autoNoteOn(int ch, int ins, int note, int vol) {
|
||||||
|
|
||||||
chan[candidate].midiNote=note;
|
chan[candidate].midiNote=note;
|
||||||
chan[candidate].midiAge=midiAgeCounter++;
|
chan[candidate].midiAge=midiAgeCounter++;
|
||||||
pendingNotes.push(DivNoteEvent(candidate,ins,note,vol,true));
|
pendingNotes.push_back(DivNoteEvent(candidate,ins,note,vol,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivEngine::autoNoteOff(int ch, int note, int vol) {
|
void DivEngine::autoNoteOff(int ch, int note, int vol) {
|
||||||
|
@ -3181,7 +3307,7 @@ void DivEngine::autoNoteOff(int ch, int note, int vol) {
|
||||||
//if (ch<0 || ch>=chans) return;
|
//if (ch<0 || ch>=chans) return;
|
||||||
for (int i=0; i<chans; i++) {
|
for (int i=0; i<chans; i++) {
|
||||||
if (chan[i].midiNote==note) {
|
if (chan[i].midiNote==note) {
|
||||||
pendingNotes.push(DivNoteEvent(i,-1,-1,-1,false));
|
pendingNotes.push_back(DivNoteEvent(i,-1,-1,-1,false));
|
||||||
chan[i].midiNote=-1;
|
chan[i].midiNote=-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3195,7 +3321,7 @@ void DivEngine::autoNoteOffAll() {
|
||||||
}
|
}
|
||||||
for (int i=0; i<chans; i++) {
|
for (int i=0; i<chans; i++) {
|
||||||
if (chan[i].midiNote!=-1) {
|
if (chan[i].midiNote!=-1) {
|
||||||
pendingNotes.push(DivNoteEvent(i,-1,-1,-1,false));
|
pendingNotes.push_back(DivNoteEvent(i,-1,-1,-1,false));
|
||||||
chan[i].midiNote=-1;
|
chan[i].midiNote=-1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <queue>
|
#include <unordered_map>
|
||||||
|
#include <deque>
|
||||||
|
|
||||||
#define addWarning(x) \
|
#define addWarning(x) \
|
||||||
if (warnings.empty()) { \
|
if (warnings.empty()) { \
|
||||||
|
@ -45,8 +46,8 @@
|
||||||
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
|
#define BUSY_BEGIN_SOFT softLocked=true; isBusy.lock();
|
||||||
#define BUSY_END isBusy.unlock(); softLocked=false;
|
#define BUSY_END isBusy.unlock(); softLocked=false;
|
||||||
|
|
||||||
#define DIV_VERSION "dev106"
|
#define DIV_VERSION "dev112"
|
||||||
#define DIV_ENGINE_VERSION 106
|
#define DIV_ENGINE_VERSION 112
|
||||||
|
|
||||||
// for imports
|
// for imports
|
||||||
#define DIV_VERSION_MOD 0xff01
|
#define DIV_VERSION_MOD 0xff01
|
||||||
|
@ -194,7 +195,29 @@ struct DivDispatchContainer {
|
||||||
dcOffCompensation(false) {}
|
dcOffCompensation(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::function<bool(int,unsigned char,unsigned char)> EffectProcess;
|
typedef int EffectValConversion(unsigned char,unsigned char);
|
||||||
|
|
||||||
|
struct EffectHandler {
|
||||||
|
DivDispatchCmds dispatchCmd;
|
||||||
|
const char* description;
|
||||||
|
EffectValConversion* val;
|
||||||
|
EffectValConversion* val2;
|
||||||
|
EffectHandler(
|
||||||
|
DivDispatchCmds dispatchCmd_,
|
||||||
|
const char* description_,
|
||||||
|
EffectValConversion val_=NULL,
|
||||||
|
EffectValConversion val2_=NULL
|
||||||
|
):
|
||||||
|
dispatchCmd(dispatchCmd_),
|
||||||
|
description(description_),
|
||||||
|
val(val_),
|
||||||
|
val2(val2_) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DivDoNotHandleEffect {
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::unordered_map<unsigned char,const EffectHandler> EffectHandlerMap;
|
||||||
|
|
||||||
struct DivSysDef {
|
struct DivSysDef {
|
||||||
const char* name;
|
const char* name;
|
||||||
|
@ -211,8 +234,8 @@ struct DivSysDef {
|
||||||
// 0: primary
|
// 0: primary
|
||||||
// 1: alternate (usually PCM)
|
// 1: alternate (usually PCM)
|
||||||
DivInstrumentType chanInsType[DIV_MAX_CHANS][2];
|
DivInstrumentType chanInsType[DIV_MAX_CHANS][2];
|
||||||
EffectProcess effectFunc;
|
const EffectHandlerMap effectHandlers;
|
||||||
EffectProcess postEffectFunc;
|
const EffectHandlerMap postEffectHandlers;
|
||||||
DivSysDef(
|
DivSysDef(
|
||||||
const char* sysName, const char* sysNameJ, unsigned char fileID, unsigned char fileID_DMF, int chans,
|
const char* sysName, const char* sysNameJ, unsigned char fileID, unsigned char fileID_DMF, int chans,
|
||||||
bool isFMChip, bool isSTDChip, unsigned int vgmVer, bool compound, const char* desc,
|
bool isFMChip, bool isSTDChip, unsigned int vgmVer, bool compound, const char* desc,
|
||||||
|
@ -221,8 +244,8 @@ struct DivSysDef {
|
||||||
std::initializer_list<int> chTypes,
|
std::initializer_list<int> chTypes,
|
||||||
std::initializer_list<DivInstrumentType> chInsType1,
|
std::initializer_list<DivInstrumentType> chInsType1,
|
||||||
std::initializer_list<DivInstrumentType> chInsType2={},
|
std::initializer_list<DivInstrumentType> chInsType2={},
|
||||||
EffectProcess fxHandler=[](int,unsigned char,unsigned char) -> bool {return false;},
|
const EffectHandlerMap fxHandlers_={},
|
||||||
EffectProcess postFxHandler=[](int,unsigned char,unsigned char) -> bool {return false;}):
|
const EffectHandlerMap postFxHandlers_={}):
|
||||||
name(sysName),
|
name(sysName),
|
||||||
nameJ(sysNameJ),
|
nameJ(sysNameJ),
|
||||||
description(desc),
|
description(desc),
|
||||||
|
@ -233,8 +256,8 @@ struct DivSysDef {
|
||||||
isSTD(isSTDChip),
|
isSTD(isSTDChip),
|
||||||
isCompound(compound),
|
isCompound(compound),
|
||||||
vgmVersion(vgmVer),
|
vgmVersion(vgmVer),
|
||||||
effectFunc(fxHandler),
|
effectHandlers(fxHandlers_),
|
||||||
postEffectFunc(postFxHandler) {
|
postEffectHandlers(postFxHandlers_) {
|
||||||
memset(chanNames,0,DIV_MAX_CHANS*sizeof(void*));
|
memset(chanNames,0,DIV_MAX_CHANS*sizeof(void*));
|
||||||
memset(chanShortNames,0,DIV_MAX_CHANS*sizeof(void*));
|
memset(chanShortNames,0,DIV_MAX_CHANS*sizeof(void*));
|
||||||
memset(chanTypes,0,DIV_MAX_CHANS*sizeof(int));
|
memset(chanTypes,0,DIV_MAX_CHANS*sizeof(int));
|
||||||
|
@ -334,7 +357,7 @@ class DivEngine {
|
||||||
DivAudioExportModes exportMode;
|
DivAudioExportModes exportMode;
|
||||||
double exportFadeOut;
|
double exportFadeOut;
|
||||||
std::map<String,String> conf;
|
std::map<String,String> conf;
|
||||||
std::queue<DivNoteEvent> pendingNotes;
|
std::deque<DivNoteEvent> pendingNotes;
|
||||||
bool isMuted[DIV_MAX_CHANS];
|
bool isMuted[DIV_MAX_CHANS];
|
||||||
std::mutex isBusy, saveLock;
|
std::mutex isBusy, saveLock;
|
||||||
String configPath;
|
String configPath;
|
||||||
|
@ -533,6 +556,9 @@ class DivEngine {
|
||||||
// calculate frequency/period
|
// calculate frequency/period
|
||||||
int calcFreq(int base, int pitch, bool period=false, int octave=0, int pitch2=0, double clock=1.0, double divider=1.0, int blockBits=0);
|
int calcFreq(int base, int pitch, bool period=false, int octave=0, int pitch2=0, double clock=1.0, double divider=1.0, int blockBits=0);
|
||||||
|
|
||||||
|
// calculate arpeggio
|
||||||
|
int calcArp(int note, int arp, int offset=0);
|
||||||
|
|
||||||
// convert panning formats
|
// convert panning formats
|
||||||
int convertPanSplitToLinear(unsigned int val, unsigned char bits, int range);
|
int convertPanSplitToLinear(unsigned int val, unsigned char bits, int range);
|
||||||
int convertPanSplitToLinearLR(unsigned char left, unsigned char right, int range);
|
int convertPanSplitToLinearLR(unsigned char left, unsigned char right, int range);
|
||||||
|
@ -603,6 +629,9 @@ class DivEngine {
|
||||||
// get japanese system name
|
// get japanese system name
|
||||||
const char* getSystemNameJ(DivSystem sys);
|
const char* getSystemNameJ(DivSystem sys);
|
||||||
|
|
||||||
|
// get sys definition
|
||||||
|
const DivSysDef* getSystemDef(DivSystem sys);
|
||||||
|
|
||||||
// convert sample rate format
|
// convert sample rate format
|
||||||
int fileToDivRate(int frate);
|
int fileToDivRate(int frate);
|
||||||
int divToFileRate(int drate);
|
int divToFileRate(int drate);
|
||||||
|
@ -885,6 +914,9 @@ class DivEngine {
|
||||||
// remove system
|
// remove system
|
||||||
bool removeSystem(int index, bool preserveOrder=true);
|
bool removeSystem(int index, bool preserveOrder=true);
|
||||||
|
|
||||||
|
// move system
|
||||||
|
bool swapSystem(int src, int dest, bool preserveOrder=true);
|
||||||
|
|
||||||
// write to register on system
|
// write to register on system
|
||||||
void poke(int sys, unsigned int addr, unsigned short val);
|
void poke(int sys, unsigned int addr, unsigned short val);
|
||||||
|
|
||||||
|
|
|
@ -145,7 +145,9 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
||||||
ds.loopModality=0;
|
ds.loopModality=0;
|
||||||
ds.properNoiseLayout=false;
|
ds.properNoiseLayout=false;
|
||||||
ds.waveDutyIsVol=false;
|
ds.waveDutyIsVol=false;
|
||||||
ds.resetMacroOnPorta=true;
|
// TODO: WHAT?! geodude.dmf fails when this is true
|
||||||
|
// but isn't that how Defle behaves???
|
||||||
|
ds.resetMacroOnPorta=false;
|
||||||
ds.legacyVolumeSlides=true;
|
ds.legacyVolumeSlides=true;
|
||||||
ds.compatibleArpeggio=true;
|
ds.compatibleArpeggio=true;
|
||||||
ds.noteOffResetsSlides=true;
|
ds.noteOffResetsSlides=true;
|
||||||
|
@ -175,6 +177,8 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
||||||
ds.brokenOutVol=true; // ???
|
ds.brokenOutVol=true; // ???
|
||||||
ds.e1e2StopOnSameNote=true;
|
ds.e1e2StopOnSameNote=true;
|
||||||
ds.brokenPortaArp=false;
|
ds.brokenPortaArp=false;
|
||||||
|
ds.snNoLowPeriods=true;
|
||||||
|
ds.delayBehavior=0;
|
||||||
|
|
||||||
// 1.1 compat flags
|
// 1.1 compat flags
|
||||||
if (ds.version>24) {
|
if (ds.version>24) {
|
||||||
|
@ -505,6 +509,14 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
||||||
for (int j=0; j<ins->std.arpMacro.len; j++) {
|
for (int j=0; j<ins->std.arpMacro.len; j++) {
|
||||||
ins->std.arpMacro.val[j]-=12;
|
ins->std.arpMacro.val[j]-=12;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
ins->std.arpMacro.mode=0;
|
||||||
|
for (int j=0; j<ins->std.arpMacro.len; j++) {
|
||||||
|
ins->std.arpMacro.val[j]^=0x40000000;
|
||||||
|
}
|
||||||
|
if (ins->std.arpMacro.loop==255 && ins->std.arpMacro.len<255) {
|
||||||
|
ins->std.arpMacro.val[ins->std.arpMacro.len++]=0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ins->std.dutyMacro.len=reader.readC();
|
ins->std.dutyMacro.len=reader.readC();
|
||||||
|
@ -826,6 +838,13 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
||||||
reader.read(data,length*2);
|
reader.read(data,length*2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
// convert to big-endian
|
||||||
|
for (int pos=0; pos<length; pos++) {
|
||||||
|
data[pos]=(short)((((unsigned short)data[pos])<<8)|(((unsigned short)data[pos])>>8));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pitch!=5) {
|
if (pitch!=5) {
|
||||||
logD("%d: scaling from %d...",i,pitch);
|
logD("%d: scaling from %d...",i,pitch);
|
||||||
}
|
}
|
||||||
|
@ -1056,6 +1075,12 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
if (ds.version<101) {
|
if (ds.version<101) {
|
||||||
ds.brokenPortaArp=true;
|
ds.brokenPortaArp=true;
|
||||||
}
|
}
|
||||||
|
if (ds.version<108) {
|
||||||
|
ds.snNoLowPeriods=true;
|
||||||
|
}
|
||||||
|
if (ds.version<110) {
|
||||||
|
ds.delayBehavior=1;
|
||||||
|
}
|
||||||
ds.isDMF=false;
|
ds.isDMF=false;
|
||||||
|
|
||||||
reader.readS(); // reserved
|
reader.readS(); // reserved
|
||||||
|
@ -1323,9 +1348,15 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// pointers
|
// pointers
|
||||||
reader.read(insPtr,ds.insLen*4);
|
for (int i=0; i<ds.insLen; i++) {
|
||||||
reader.read(wavePtr,ds.waveLen*4);
|
insPtr[i]=reader.readI();
|
||||||
reader.read(samplePtr,ds.sampleLen*4);
|
}
|
||||||
|
for (int i=0; i<ds.waveLen; i++) {
|
||||||
|
wavePtr[i]=reader.readI();
|
||||||
|
}
|
||||||
|
for (int i=0; i<ds.sampleLen; i++) {
|
||||||
|
samplePtr[i]=reader.readI();
|
||||||
|
}
|
||||||
for (int i=0; i<numberOfPats; i++) patPtr.push_back(reader.readI());
|
for (int i=0; i<numberOfPats; i++) patPtr.push_back(reader.readI());
|
||||||
|
|
||||||
logD("reading orders (%d)...",subSong->ordersLen);
|
logD("reading orders (%d)...",subSong->ordersLen);
|
||||||
|
@ -1462,7 +1493,17 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
} else {
|
} else {
|
||||||
reader.readC();
|
reader.readC();
|
||||||
}
|
}
|
||||||
for (int i=0; i<7; i++) {
|
if (ds.version>=108) {
|
||||||
|
ds.snNoLowPeriods=reader.readC();
|
||||||
|
} else {
|
||||||
|
reader.readC();
|
||||||
|
}
|
||||||
|
if (ds.version>=110) {
|
||||||
|
ds.delayBehavior=reader.readC();
|
||||||
|
} else {
|
||||||
|
reader.readC();
|
||||||
|
}
|
||||||
|
for (int i=0; i<5; i++) {
|
||||||
reader.readC();
|
reader.readC();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1703,11 +1744,36 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
if (ds.version>=58) { // modern sample
|
if (ds.version>=58) { // modern sample
|
||||||
sample->init(sample->samples);
|
sample->init(sample->samples);
|
||||||
reader.read(sample->getCurBuf(),sample->getCurBufLen());
|
reader.read(sample->getCurBuf(),sample->getCurBufLen());
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
// convert 16-bit samples to big-endian
|
||||||
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
|
unsigned char* sampleBuf=(unsigned char*)sample->getCurBuf();
|
||||||
|
size_t sampleBufLen=sample->getCurBufLen();
|
||||||
|
for (size_t pos=0; pos<sampleBufLen; pos+=2) {
|
||||||
|
sampleBuf[pos]^=sampleBuf[pos+1];
|
||||||
|
sampleBuf[pos+1]^=sampleBuf[pos];
|
||||||
|
sampleBuf[pos]^=sampleBuf[pos+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else { // legacy sample
|
} else { // legacy sample
|
||||||
int length=sample->samples;
|
int length=sample->samples;
|
||||||
short* data=new short[length];
|
short* data=new short[length];
|
||||||
reader.read(data,2*length);
|
reader.read(data,2*length);
|
||||||
|
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
// convert 16-bit samples to big-endian
|
||||||
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
|
unsigned char* sampleBuf=(unsigned char*)sample->getCurBuf();
|
||||||
|
size_t sampleBufLen=sample->getCurBufLen();
|
||||||
|
for (size_t pos=0; pos<sampleBufLen; pos+=2) {
|
||||||
|
sampleBuf[pos]^=sampleBuf[pos+1];
|
||||||
|
sampleBuf[pos+1]^=sampleBuf[pos];
|
||||||
|
sampleBuf[pos]^=sampleBuf[pos+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pitch!=5) {
|
if (pitch!=5) {
|
||||||
logD("%d: scaling from %d...",i,pitch);
|
logD("%d: scaling from %d...",i,pitch);
|
||||||
}
|
}
|
||||||
|
@ -1870,6 +1936,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
|
||||||
ds.noSlidesOnFirstTick=true;
|
ds.noSlidesOnFirstTick=true;
|
||||||
ds.rowResetsArpPos=true;
|
ds.rowResetsArpPos=true;
|
||||||
ds.ignoreJumpAtEnd=false;
|
ds.ignoreJumpAtEnd=false;
|
||||||
|
ds.delayBehavior=0;
|
||||||
|
|
||||||
int insCount=31;
|
int insCount=31;
|
||||||
bool bypassLimits=false;
|
bool bypassLimits=false;
|
||||||
|
@ -2786,9 +2853,9 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
// TODO: <= or <?
|
// TODO: <= or <?
|
||||||
for (int k=0; k<=susTime; k++) {
|
for (int k=0; k<=susTime; k++) {
|
||||||
ins->std.volMacro.val[ins->std.volMacro.len]=lastVal;
|
ins->std.volMacro.val[ins->std.volMacro.len]=lastVal;
|
||||||
if (++ins->std.volMacro.len>=128) break;
|
if (++ins->std.volMacro.len>=255) break;
|
||||||
}
|
}
|
||||||
if (ins->std.volMacro.len>=128) break;
|
if (ins->std.volMacro.len>=255) break;
|
||||||
} else if (m.val[j]==0xe9 || m.val[j]==0xea) { // volume slide
|
} else if (m.val[j]==0xe9 || m.val[j]==0xea) { // volume slide
|
||||||
if (++j>=64) break;
|
if (++j>=64) break;
|
||||||
signed char slideStep=m.val[j];
|
signed char slideStep=m.val[j];
|
||||||
|
@ -2807,16 +2874,16 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ins->std.volMacro.val[ins->std.volMacro.len]=lastVal;
|
ins->std.volMacro.val[ins->std.volMacro.len]=lastVal;
|
||||||
if (++ins->std.volMacro.len>=128) break;
|
if (++ins->std.volMacro.len>=255) break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: replace with upcoming macro speed
|
// TODO: replace with upcoming macro speed
|
||||||
for (int k=0; k<MAX(1,seqSpeed); k++) {
|
for (int k=0; k<MAX(1,seqSpeed); k++) {
|
||||||
ins->std.volMacro.val[ins->std.volMacro.len]=m.val[j];
|
ins->std.volMacro.val[ins->std.volMacro.len]=m.val[j];
|
||||||
lastVal=m.val[j];
|
lastVal=m.val[j];
|
||||||
if (++ins->std.volMacro.len>=128) break;
|
if (++ins->std.volMacro.len>=255) break;
|
||||||
}
|
}
|
||||||
if (ins->std.volMacro.len>=128) break;
|
if (ins->std.volMacro.len>=255) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2829,9 +2896,6 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
loopMapFreq[j]=ins->std.arpMacro.len;
|
loopMapFreq[j]=ins->std.arpMacro.len;
|
||||||
loopMapWave[j]=ins->std.waveMacro.len;
|
loopMapWave[j]=ins->std.waveMacro.len;
|
||||||
if (fm.val[j]==0xe1) {
|
if (fm.val[j]==0xe1) {
|
||||||
if (ins->std.arpMacro.mode) {
|
|
||||||
ins->std.arpMacro.loop=(signed int)ins->std.arpMacro.len-1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
} else if (fm.val[j]==0xe2 || fm.val[j]==0xe4) {
|
} else if (fm.val[j]==0xe2 || fm.val[j]==0xe4) {
|
||||||
if (++j>=64) break;
|
if (++j>=64) break;
|
||||||
|
@ -2845,7 +2909,7 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
ins->std.waveMacro.val[ins->std.waveMacro.len]=wave-10;
|
ins->std.waveMacro.val[ins->std.waveMacro.len]=wave-10;
|
||||||
ins->std.waveMacro.open=true;
|
ins->std.waveMacro.open=true;
|
||||||
lastVal=wave;
|
lastVal=wave;
|
||||||
//if (++ins->std.arpMacro.len>=128) break;
|
//if (++ins->std.arpMacro.len>=255) break;
|
||||||
}
|
}
|
||||||
} else if (fm.val[j]==0xe0) {
|
} else if (fm.val[j]==0xe0) {
|
||||||
if (++j>=64) break;
|
if (++j>=64) break;
|
||||||
|
@ -2866,8 +2930,7 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
logV("unhandled pitch!");
|
logV("unhandled pitch!");
|
||||||
} else {
|
} else {
|
||||||
if (fm.val[j]>0x80) {
|
if (fm.val[j]>0x80) {
|
||||||
ins->std.arpMacro.val[ins->std.arpMacro.len]=fm.val[j]-0x80+24;
|
ins->std.arpMacro.val[ins->std.arpMacro.len]=(fm.val[j]-0x80+24)^0x40000000;
|
||||||
ins->std.arpMacro.mode=1; // TODO: variable fixed/relative mode
|
|
||||||
} else {
|
} else {
|
||||||
ins->std.arpMacro.val[ins->std.arpMacro.len]=fm.val[j];
|
ins->std.arpMacro.val[ins->std.arpMacro.len]=fm.val[j];
|
||||||
}
|
}
|
||||||
|
@ -2875,8 +2938,8 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
ins->std.waveMacro.val[ins->std.waveMacro.len]=lastVal-10;
|
ins->std.waveMacro.val[ins->std.waveMacro.len]=lastVal-10;
|
||||||
}
|
}
|
||||||
ins->std.arpMacro.open=true;
|
ins->std.arpMacro.open=true;
|
||||||
if (++ins->std.arpMacro.len>=128) break;
|
if (++ins->std.arpMacro.len>=255) break;
|
||||||
if (++ins->std.waveMacro.len>=128) break;
|
if (++ins->std.waveMacro.len>=255) break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2889,7 +2952,7 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
// vibrato
|
// vibrato
|
||||||
for (int j=0; j<=vibDelay; j++) {
|
for (int j=0; j<=vibDelay; j++) {
|
||||||
ins->std.pitchMacro.val[ins->std.pitchMacro.len]=0;
|
ins->std.pitchMacro.val[ins->std.pitchMacro.len]=0;
|
||||||
if (++ins->std.pitchMacro.len>=128) break;
|
if (++ins->std.pitchMacro.len>=255) break;
|
||||||
}
|
}
|
||||||
int vibPos=0;
|
int vibPos=0;
|
||||||
ins->std.pitchMacro.loop=ins->std.pitchMacro.len;
|
ins->std.pitchMacro.loop=ins->std.pitchMacro.len;
|
||||||
|
@ -2897,19 +2960,19 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
vibPos+=vibSpeed;
|
vibPos+=vibSpeed;
|
||||||
if (vibPos>vibDepth) vibPos=vibDepth;
|
if (vibPos>vibDepth) vibPos=vibDepth;
|
||||||
ins->std.pitchMacro.val[ins->std.pitchMacro.len]=vibPos*32;
|
ins->std.pitchMacro.val[ins->std.pitchMacro.len]=vibPos*32;
|
||||||
if (++ins->std.pitchMacro.len>=128) break;
|
if (++ins->std.pitchMacro.len>=255) break;
|
||||||
} while (vibPos<vibDepth);
|
} while (vibPos<vibDepth);
|
||||||
do {
|
do {
|
||||||
vibPos-=vibSpeed;
|
vibPos-=vibSpeed;
|
||||||
if (vibPos<-vibDepth) vibPos=-vibDepth;
|
if (vibPos<-vibDepth) vibPos=-vibDepth;
|
||||||
ins->std.pitchMacro.val[ins->std.pitchMacro.len]=vibPos*32;
|
ins->std.pitchMacro.val[ins->std.pitchMacro.len]=vibPos*32;
|
||||||
if (++ins->std.pitchMacro.len>=128) break;
|
if (++ins->std.pitchMacro.len>=255) break;
|
||||||
} while (vibPos>-vibDepth);
|
} while (vibPos>-vibDepth);
|
||||||
do {
|
do {
|
||||||
vibPos+=vibSpeed;
|
vibPos+=vibSpeed;
|
||||||
if (vibPos>0) vibPos=0;
|
if (vibPos>0) vibPos=0;
|
||||||
ins->std.pitchMacro.val[ins->std.pitchMacro.len]=vibPos*32;
|
ins->std.pitchMacro.val[ins->std.pitchMacro.len]=vibPos*32;
|
||||||
if (++ins->std.pitchMacro.len>=128) break;
|
if (++ins->std.pitchMacro.len>=255) break;
|
||||||
} while (vibPos<0);
|
} while (vibPos<0);
|
||||||
|
|
||||||
ds.ins.push_back(ins);
|
ds.ins.push_back(ins);
|
||||||
|
@ -3236,6 +3299,7 @@ bool DivEngine::loadFTM(unsigned char* file, size_t len) {
|
||||||
ins->std.arpMacro.len=reader.readC();
|
ins->std.arpMacro.len=reader.readC();
|
||||||
ins->std.arpMacro.loop=reader.readI();
|
ins->std.arpMacro.loop=reader.readI();
|
||||||
ins->std.arpMacro.rel=reader.readI();
|
ins->std.arpMacro.rel=reader.readI();
|
||||||
|
// TODO: get rid
|
||||||
ins->std.arpMacro.mode=reader.readI();
|
ins->std.arpMacro.mode=reader.readI();
|
||||||
for (int j=0; j<ins->std.arpMacro.len; j++) {
|
for (int j=0; j<ins->std.arpMacro.len; j++) {
|
||||||
ins->std.arpMacro.val[j]=reader.readC();
|
ins->std.arpMacro.val[j]=reader.readC();
|
||||||
|
@ -3681,7 +3745,9 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
||||||
w->writeC(song.brokenOutVol);
|
w->writeC(song.brokenOutVol);
|
||||||
w->writeC(song.e1e2StopOnSameNote);
|
w->writeC(song.e1e2StopOnSameNote);
|
||||||
w->writeC(song.brokenPortaArp);
|
w->writeC(song.brokenPortaArp);
|
||||||
for (int i=0; i<7; i++) {
|
w->writeC(song.snNoLowPeriods);
|
||||||
|
w->writeC(song.delayBehavior);
|
||||||
|
for (int i=0; i<5; i++) {
|
||||||
w->writeC(0);
|
w->writeC(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3807,7 +3873,21 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
||||||
w->writeI(0xffffffff);
|
w->writeI(0xffffffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
// store 16-bit samples as little-endian
|
||||||
|
if (sample->depth==DIV_SAMPLE_DEPTH_16BIT) {
|
||||||
|
unsigned char* sampleBuf=(unsigned char*)sample->getCurBuf();
|
||||||
|
size_t bufLen=sample->getCurBufLen();
|
||||||
|
for (size_t i=0; i<bufLen; i+=2) {
|
||||||
|
w->writeC(sampleBuf[i+1]);
|
||||||
|
w->writeC(sampleBuf[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
w->write(sample->getCurBuf(),sample->getCurBufLen());
|
||||||
|
}
|
||||||
|
#else
|
||||||
w->write(sample->getCurBuf(),sample->getCurBufLen());
|
w->write(sample->getCurBuf(),sample->getCurBufLen());
|
||||||
|
#endif
|
||||||
|
|
||||||
blockEndSeek=w->tell();
|
blockEndSeek=w->tell();
|
||||||
w->seek(blockStartSeek,SEEK_SET);
|
w->seek(blockStartSeek,SEEK_SET);
|
||||||
|
@ -3834,7 +3914,13 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
||||||
w->writeS(pat->data[j][1]); // octave
|
w->writeS(pat->data[j][1]); // octave
|
||||||
w->writeS(pat->data[j][2]); // instrument
|
w->writeS(pat->data[j][2]); // instrument
|
||||||
w->writeS(pat->data[j][3]); // volume
|
w->writeS(pat->data[j][3]); // volume
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
for (int k=0; k<song.subsong[i.subsong]->pat[i.chan].effectCols*2; k++) {
|
||||||
|
w->writeS(pat->data[j][4+k]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
w->write(&pat->data[j][4],2*song.subsong[i.subsong]->pat[i.chan].effectCols*2); // effects
|
w->write(&pat->data[j][4],2*song.subsong[i.subsong]->pat[i.chan].effectCols*2); // effects
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
w->writeString(pat->name,false);
|
w->writeString(pat->name,false);
|
||||||
|
@ -4069,7 +4155,25 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
|
||||||
|
|
||||||
// safety check
|
// safety check
|
||||||
if (!isFMSystem(sys) && i->type!=DIV_INS_STD && i->type!=DIV_INS_FDS) {
|
if (!isFMSystem(sys) && i->type!=DIV_INS_STD && i->type!=DIV_INS_FDS) {
|
||||||
i->type=DIV_INS_STD;
|
switch (song.system[0]) {
|
||||||
|
case DIV_SYSTEM_GB:
|
||||||
|
i->type=DIV_INS_GB;
|
||||||
|
break;
|
||||||
|
case DIV_SYSTEM_C64_6581:
|
||||||
|
case DIV_SYSTEM_C64_8580:
|
||||||
|
i->type=DIV_INS_C64;
|
||||||
|
break;
|
||||||
|
case DIV_SYSTEM_PCE:
|
||||||
|
i->type=DIV_INS_PCE;
|
||||||
|
break;
|
||||||
|
case DIV_SYSTEM_YM2610:
|
||||||
|
case DIV_SYSTEM_YM2610_EXT:
|
||||||
|
i->type=DIV_INS_AY;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
i->type=DIV_INS_STD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!isSTDSystem(sys) && i->type!=DIV_INS_FM) {
|
if (!isSTDSystem(sys) && i->type!=DIV_INS_FM) {
|
||||||
i->type=DIV_INS_FM;
|
i->type=DIV_INS_FM;
|
||||||
|
@ -4110,47 +4214,79 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
|
||||||
}
|
}
|
||||||
} else { // STD
|
} else { // STD
|
||||||
if (sys!=DIV_SYSTEM_GB) {
|
if (sys!=DIV_SYSTEM_GB) {
|
||||||
w->writeC(i->std.volMacro.len);
|
int realVolMacroLen=i->std.volMacro.len;
|
||||||
|
if (realVolMacroLen>127) realVolMacroLen=127;
|
||||||
|
w->writeC(realVolMacroLen);
|
||||||
if ((sys==DIV_SYSTEM_C64_6581 || sys==DIV_SYSTEM_C64_8580) && i->c64.volIsCutoff) {
|
if ((sys==DIV_SYSTEM_C64_6581 || sys==DIV_SYSTEM_C64_8580) && i->c64.volIsCutoff) {
|
||||||
for (int j=0; j<i->std.volMacro.len; j++) {
|
for (int j=0; j<realVolMacroLen; j++) {
|
||||||
w->writeI(i->std.volMacro.val[j]+18);
|
w->writeI(i->std.volMacro.val[j]+18);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
w->write(i->std.volMacro.val,4*i->std.volMacro.len);
|
for (int j=0; j<realVolMacroLen; j++) {
|
||||||
|
w->writeI(i->std.volMacro.val[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (i->std.volMacro.len>0) {
|
if (realVolMacroLen>0) {
|
||||||
w->writeC(i->std.volMacro.loop);
|
w->writeC(i->std.volMacro.loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: take care of new arp macro format
|
||||||
w->writeC(i->std.arpMacro.len);
|
w->writeC(i->std.arpMacro.len);
|
||||||
if (i->std.arpMacro.mode) {
|
bool arpMacroMode=false;
|
||||||
w->write(i->std.arpMacro.val,4*i->std.arpMacro.len);
|
int arpMacroHowManyFixed=0;
|
||||||
|
int realArpMacroLen=i->std.arpMacro.len;
|
||||||
|
for (int j=0; j<i->std.arpMacro.len; j++) {
|
||||||
|
if ((i->std.arpMacro.val[j]&0xc0000000)==0x40000000 || (i->std.arpMacro.val[j]&0xc0000000)==0x80000000) {
|
||||||
|
arpMacroHowManyFixed++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (arpMacroHowManyFixed>=i->std.arpMacro.len-1) {
|
||||||
|
arpMacroMode=true;
|
||||||
|
}
|
||||||
|
if (i->std.arpMacro.len>0) {
|
||||||
|
if (arpMacroMode && i->std.arpMacro.val[i->std.arpMacro.len-1]==0 && i->std.arpMacro.loop>=i->std.arpMacro.len) {
|
||||||
|
realArpMacroLen--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (arpMacroMode) {
|
||||||
|
for (int j=0; j<realArpMacroLen; j++) {
|
||||||
|
w->writeI(i->std.arpMacro.val[j]);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int j=0; j<i->std.arpMacro.len; j++) {
|
for (int j=0; j<realArpMacroLen; j++) {
|
||||||
w->writeI(i->std.arpMacro.val[j]+12);
|
w->writeI(i->std.arpMacro.val[j]+12);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i->std.arpMacro.len>0) {
|
if (realArpMacroLen>0) {
|
||||||
w->writeC(i->std.arpMacro.loop);
|
w->writeC(i->std.arpMacro.loop);
|
||||||
}
|
}
|
||||||
w->writeC(i->std.arpMacro.mode);
|
w->writeC(arpMacroMode);
|
||||||
|
|
||||||
w->writeC(i->std.dutyMacro.len);
|
int realDutyMacroLen=i->std.dutyMacro.len;
|
||||||
|
if (realDutyMacroLen>127) realDutyMacroLen=127;
|
||||||
|
w->writeC(realDutyMacroLen);
|
||||||
if (sys==DIV_SYSTEM_C64_6581 || sys==DIV_SYSTEM_C64_8580) {
|
if (sys==DIV_SYSTEM_C64_6581 || sys==DIV_SYSTEM_C64_8580) {
|
||||||
for (int j=0; j<i->std.dutyMacro.len; j++) {
|
for (int j=0; j<realDutyMacroLen; j++) {
|
||||||
w->writeI(i->std.dutyMacro.val[j]+12);
|
w->writeI(i->std.dutyMacro.val[j]+12);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
w->write(i->std.dutyMacro.val,4*i->std.dutyMacro.len);
|
for (int j=0; j<realDutyMacroLen; j++) {
|
||||||
|
w->writeI(i->std.dutyMacro.val[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (i->std.dutyMacro.len>0) {
|
if (realDutyMacroLen>0) {
|
||||||
w->writeC(i->std.dutyMacro.loop);
|
w->writeC(i->std.dutyMacro.loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
w->writeC(i->std.waveMacro.len);
|
int realWaveMacroLen=i->std.waveMacro.len;
|
||||||
w->write(i->std.waveMacro.val,4*i->std.waveMacro.len);
|
if (realWaveMacroLen>127) realWaveMacroLen=127;
|
||||||
if (i->std.waveMacro.len>0) {
|
w->writeC(realWaveMacroLen);
|
||||||
|
for (int j=0; j<realWaveMacroLen; j++) {
|
||||||
|
w->writeI(i->std.waveMacro.val[j]);
|
||||||
|
}
|
||||||
|
if (realWaveMacroLen>0) {
|
||||||
w->writeC(i->std.waveMacro.loop);
|
w->writeC(i->std.waveMacro.loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4200,7 +4336,9 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
|
||||||
w->writeI(i->data[j]>>2);
|
w->writeI(i->data[j]>>2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
w->write(i->data,4*i->len);
|
for (int j=0; j<i->len; j++) {
|
||||||
|
w->writeI(i->data[j]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4213,7 +4351,13 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
|
||||||
w->writeS(pat->data[k][0]); // note
|
w->writeS(pat->data[k][0]); // note
|
||||||
w->writeS(pat->data[k][1]); // octave
|
w->writeS(pat->data[k][1]); // octave
|
||||||
w->writeS(pat->data[k][3]); // volume
|
w->writeS(pat->data[k][3]); // volume
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
for (int l=0; l<curPat[i].effectCols*2; l++) {
|
||||||
|
w->writeS(pat->data[k][4+l]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
w->write(&pat->data[k][4],2*curPat[i].effectCols*2); // effects
|
w->write(&pat->data[k][4],2*curPat[i].effectCols*2); // effects
|
||||||
|
#endif
|
||||||
w->writeS(pat->data[k][2]); // instrument
|
w->writeS(pat->data[k][2]); // instrument
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4232,7 +4376,15 @@ SafeWriter* DivEngine::saveDMF(unsigned char version) {
|
||||||
w->writeC(50);
|
w->writeC(50);
|
||||||
// i'm too lazy to deal with .dmf's weird way of storing 8-bit samples
|
// i'm too lazy to deal with .dmf's weird way of storing 8-bit samples
|
||||||
w->writeC(16);
|
w->writeC(16);
|
||||||
|
// well I can't be lazy if it's on a big-endian system
|
||||||
|
#ifdef TA_BIG_ENDIAN
|
||||||
|
for (unsigned int j=0; j<i->length16; j++) {
|
||||||
|
w->writeC(((unsigned short)i->data16[j])&0xff);
|
||||||
|
w->writeC(((unsigned short)i->data16[j])>>8);
|
||||||
|
}
|
||||||
|
#else
|
||||||
w->write(i->data16,i->length16);
|
w->write(i->data16,i->length16);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
saveLock.unlock();
|
saveLock.unlock();
|
||||||
|
|
|
@ -132,7 +132,7 @@ void DivInstrument::putInsData(SafeWriter* w) {
|
||||||
w->writeI(std.ex1Macro.loop);
|
w->writeI(std.ex1Macro.loop);
|
||||||
w->writeI(std.ex2Macro.loop);
|
w->writeI(std.ex2Macro.loop);
|
||||||
w->writeI(std.ex3Macro.loop);
|
w->writeI(std.ex3Macro.loop);
|
||||||
w->writeC(std.arpMacro.mode);
|
w->writeC(0); // this was arp macro mode
|
||||||
w->writeC(0); // reserved
|
w->writeC(0); // reserved
|
||||||
w->writeC(0);
|
w->writeC(0);
|
||||||
w->writeC(0);
|
w->writeC(0);
|
||||||
|
@ -543,12 +543,126 @@ void DivInstrument::putInsData(SafeWriter* w) {
|
||||||
w->writeC(gb.softEnv);
|
w->writeC(gb.softEnv);
|
||||||
w->writeC(gb.alwaysInit);
|
w->writeC(gb.alwaysInit);
|
||||||
|
|
||||||
|
// ES5506
|
||||||
|
w->writeC(es5506.filter.mode);
|
||||||
|
w->writeS(es5506.filter.k1);
|
||||||
|
w->writeS(es5506.filter.k2);
|
||||||
|
w->writeS(es5506.envelope.ecount);
|
||||||
|
w->writeC(es5506.envelope.lVRamp);
|
||||||
|
w->writeC(es5506.envelope.rVRamp);
|
||||||
|
w->writeC(es5506.envelope.k1Ramp);
|
||||||
|
w->writeC(es5506.envelope.k2Ramp);
|
||||||
|
w->writeC(es5506.envelope.k1Slow);
|
||||||
|
w->writeC(es5506.envelope.k2Slow);
|
||||||
|
|
||||||
|
// SNES
|
||||||
|
w->writeC(snes.useEnv);
|
||||||
|
w->writeC(snes.gainMode);
|
||||||
|
w->writeC(snes.gain);
|
||||||
|
w->writeC(snes.a);
|
||||||
|
w->writeC(snes.d);
|
||||||
|
w->writeC(snes.s);
|
||||||
|
w->writeC(snes.r);
|
||||||
|
|
||||||
|
// macro speed/delay
|
||||||
|
w->writeC(std.volMacro.speed);
|
||||||
|
w->writeC(std.arpMacro.speed);
|
||||||
|
w->writeC(std.dutyMacro.speed);
|
||||||
|
w->writeC(std.waveMacro.speed);
|
||||||
|
w->writeC(std.pitchMacro.speed);
|
||||||
|
w->writeC(std.ex1Macro.speed);
|
||||||
|
w->writeC(std.ex2Macro.speed);
|
||||||
|
w->writeC(std.ex3Macro.speed);
|
||||||
|
w->writeC(std.algMacro.speed);
|
||||||
|
w->writeC(std.fbMacro.speed);
|
||||||
|
w->writeC(std.fmsMacro.speed);
|
||||||
|
w->writeC(std.amsMacro.speed);
|
||||||
|
w->writeC(std.panLMacro.speed);
|
||||||
|
w->writeC(std.panRMacro.speed);
|
||||||
|
w->writeC(std.phaseResetMacro.speed);
|
||||||
|
w->writeC(std.ex4Macro.speed);
|
||||||
|
w->writeC(std.ex5Macro.speed);
|
||||||
|
w->writeC(std.ex6Macro.speed);
|
||||||
|
w->writeC(std.ex7Macro.speed);
|
||||||
|
w->writeC(std.ex8Macro.speed);
|
||||||
|
|
||||||
|
w->writeC(std.volMacro.delay);
|
||||||
|
w->writeC(std.arpMacro.delay);
|
||||||
|
w->writeC(std.dutyMacro.delay);
|
||||||
|
w->writeC(std.waveMacro.delay);
|
||||||
|
w->writeC(std.pitchMacro.delay);
|
||||||
|
w->writeC(std.ex1Macro.delay);
|
||||||
|
w->writeC(std.ex2Macro.delay);
|
||||||
|
w->writeC(std.ex3Macro.delay);
|
||||||
|
w->writeC(std.algMacro.delay);
|
||||||
|
w->writeC(std.fbMacro.delay);
|
||||||
|
w->writeC(std.fmsMacro.delay);
|
||||||
|
w->writeC(std.amsMacro.delay);
|
||||||
|
w->writeC(std.panLMacro.delay);
|
||||||
|
w->writeC(std.panRMacro.delay);
|
||||||
|
w->writeC(std.phaseResetMacro.delay);
|
||||||
|
w->writeC(std.ex4Macro.delay);
|
||||||
|
w->writeC(std.ex5Macro.delay);
|
||||||
|
w->writeC(std.ex6Macro.delay);
|
||||||
|
w->writeC(std.ex7Macro.delay);
|
||||||
|
w->writeC(std.ex8Macro.delay);
|
||||||
|
|
||||||
|
// op macro speed/delay
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
DivInstrumentSTD::OpMacro& op=std.opMacros[i];
|
||||||
|
|
||||||
|
w->writeC(op.amMacro.speed);
|
||||||
|
w->writeC(op.arMacro.speed);
|
||||||
|
w->writeC(op.drMacro.speed);
|
||||||
|
w->writeC(op.multMacro.speed);
|
||||||
|
w->writeC(op.rrMacro.speed);
|
||||||
|
w->writeC(op.slMacro.speed);
|
||||||
|
w->writeC(op.tlMacro.speed);
|
||||||
|
w->writeC(op.dt2Macro.speed);
|
||||||
|
w->writeC(op.rsMacro.speed);
|
||||||
|
w->writeC(op.dtMacro.speed);
|
||||||
|
w->writeC(op.d2rMacro.speed);
|
||||||
|
w->writeC(op.ssgMacro.speed);
|
||||||
|
w->writeC(op.damMacro.speed);
|
||||||
|
w->writeC(op.dvbMacro.speed);
|
||||||
|
w->writeC(op.egtMacro.speed);
|
||||||
|
w->writeC(op.kslMacro.speed);
|
||||||
|
w->writeC(op.susMacro.speed);
|
||||||
|
w->writeC(op.vibMacro.speed);
|
||||||
|
w->writeC(op.wsMacro.speed);
|
||||||
|
w->writeC(op.ksrMacro.speed);
|
||||||
|
|
||||||
|
w->writeC(op.amMacro.delay);
|
||||||
|
w->writeC(op.arMacro.delay);
|
||||||
|
w->writeC(op.drMacro.delay);
|
||||||
|
w->writeC(op.multMacro.delay);
|
||||||
|
w->writeC(op.rrMacro.delay);
|
||||||
|
w->writeC(op.slMacro.delay);
|
||||||
|
w->writeC(op.tlMacro.delay);
|
||||||
|
w->writeC(op.dt2Macro.delay);
|
||||||
|
w->writeC(op.rsMacro.delay);
|
||||||
|
w->writeC(op.dtMacro.delay);
|
||||||
|
w->writeC(op.d2rMacro.delay);
|
||||||
|
w->writeC(op.ssgMacro.delay);
|
||||||
|
w->writeC(op.damMacro.delay);
|
||||||
|
w->writeC(op.dvbMacro.delay);
|
||||||
|
w->writeC(op.egtMacro.delay);
|
||||||
|
w->writeC(op.kslMacro.delay);
|
||||||
|
w->writeC(op.susMacro.delay);
|
||||||
|
w->writeC(op.vibMacro.delay);
|
||||||
|
w->writeC(op.wsMacro.delay);
|
||||||
|
w->writeC(op.ksrMacro.delay);
|
||||||
|
}
|
||||||
|
|
||||||
blockEndSeek=w->tell();
|
blockEndSeek=w->tell();
|
||||||
w->seek(blockStartSeek,SEEK_SET);
|
w->seek(blockStartSeek,SEEK_SET);
|
||||||
w->writeI(blockEndSeek-blockStartSeek-4);
|
w->writeI(blockEndSeek-blockStartSeek-4);
|
||||||
w->seek(0,SEEK_END);
|
w->seek(0,SEEK_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define READ_MACRO_VALS(x,y) \
|
||||||
|
for (int macroValPos=0; macroValPos<y; macroValPos++) x[macroValPos]=reader.readI();
|
||||||
|
|
||||||
DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
|
DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
|
||||||
char magic[4];
|
char magic[4];
|
||||||
reader.read(magic,4);
|
reader.read(magic,4);
|
||||||
|
@ -674,10 +788,10 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
|
||||||
int oldVolHeight=reader.readC();
|
int oldVolHeight=reader.readC();
|
||||||
int oldDutyHeight=reader.readC();
|
int oldDutyHeight=reader.readC();
|
||||||
reader.readC(); // oldWaveHeight
|
reader.readC(); // oldWaveHeight
|
||||||
reader.read(std.volMacro.val,4*std.volMacro.len);
|
READ_MACRO_VALS(std.volMacro.val,std.volMacro.len);
|
||||||
reader.read(std.arpMacro.val,4*std.arpMacro.len);
|
READ_MACRO_VALS(std.arpMacro.val,std.arpMacro.len);
|
||||||
reader.read(std.dutyMacro.val,4*std.dutyMacro.len);
|
READ_MACRO_VALS(std.dutyMacro.val,std.dutyMacro.len);
|
||||||
reader.read(std.waveMacro.val,4*std.waveMacro.len);
|
READ_MACRO_VALS(std.waveMacro.val,std.waveMacro.len);
|
||||||
if (version<31) {
|
if (version<31) {
|
||||||
if (!std.arpMacro.mode) for (int j=0; j<std.arpMacro.len; j++) {
|
if (!std.arpMacro.mode) for (int j=0; j<std.arpMacro.len; j++) {
|
||||||
std.arpMacro.val[j]-=12;
|
std.arpMacro.val[j]-=12;
|
||||||
|
@ -692,10 +806,10 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (version>=17) {
|
if (version>=17) {
|
||||||
reader.read(std.pitchMacro.val,4*std.pitchMacro.len);
|
READ_MACRO_VALS(std.pitchMacro.val,std.pitchMacro.len);
|
||||||
reader.read(std.ex1Macro.val,4*std.ex1Macro.len);
|
READ_MACRO_VALS(std.ex1Macro.val,std.ex1Macro.len);
|
||||||
reader.read(std.ex2Macro.val,4*std.ex2Macro.len);
|
READ_MACRO_VALS(std.ex2Macro.val,std.ex2Macro.len);
|
||||||
reader.read(std.ex3Macro.val,4*std.ex3Macro.len);
|
READ_MACRO_VALS(std.ex3Macro.val,std.ex3Macro.len);
|
||||||
} else {
|
} else {
|
||||||
if (type==DIV_INS_STD) {
|
if (type==DIV_INS_STD) {
|
||||||
if (oldVolHeight==31) {
|
if (oldVolHeight==31) {
|
||||||
|
@ -730,10 +844,10 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
|
||||||
std.fmsMacro.open=reader.readC();
|
std.fmsMacro.open=reader.readC();
|
||||||
std.amsMacro.open=reader.readC();
|
std.amsMacro.open=reader.readC();
|
||||||
|
|
||||||
reader.read(std.algMacro.val,4*std.algMacro.len);
|
READ_MACRO_VALS(std.algMacro.val,std.algMacro.len);
|
||||||
reader.read(std.fbMacro.val,4*std.fbMacro.len);
|
READ_MACRO_VALS(std.fbMacro.val,std.fbMacro.len);
|
||||||
reader.read(std.fmsMacro.val,4*std.fmsMacro.len);
|
READ_MACRO_VALS(std.fmsMacro.val,std.fmsMacro.len);
|
||||||
reader.read(std.amsMacro.val,4*std.amsMacro.len);
|
READ_MACRO_VALS(std.amsMacro.val,std.amsMacro.len);
|
||||||
|
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
DivInstrumentSTD::OpMacro& op=std.opMacros[i];
|
DivInstrumentSTD::OpMacro& op=std.opMacros[i];
|
||||||
|
@ -936,15 +1050,15 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
|
||||||
// clear noise macro if PCE instrument and version<63
|
// clear noise macro if PCE instrument and version<63
|
||||||
if (version<63 && type==DIV_INS_PCE) {
|
if (version<63 && type==DIV_INS_PCE) {
|
||||||
std.dutyMacro.len=0;
|
std.dutyMacro.len=0;
|
||||||
std.dutyMacro.loop=-1;
|
std.dutyMacro.loop=255;
|
||||||
std.dutyMacro.rel=-1;
|
std.dutyMacro.rel=255;
|
||||||
}
|
}
|
||||||
|
|
||||||
// clear wave macro if OPLL instrument and version<70
|
// clear wave macro if OPLL instrument and version<70
|
||||||
if (version<70 && type==DIV_INS_OPLL) {
|
if (version<70 && type==DIV_INS_OPLL) {
|
||||||
std.waveMacro.len=0;
|
std.waveMacro.len=0;
|
||||||
std.waveMacro.loop=-1;
|
std.waveMacro.loop=255;
|
||||||
std.waveMacro.rel=-1;
|
std.waveMacro.rel=255;
|
||||||
}
|
}
|
||||||
|
|
||||||
// sample map
|
// sample map
|
||||||
|
@ -1007,14 +1121,14 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
|
||||||
std.ex7Macro.open=reader.readC();
|
std.ex7Macro.open=reader.readC();
|
||||||
std.ex8Macro.open=reader.readC();
|
std.ex8Macro.open=reader.readC();
|
||||||
|
|
||||||
reader.read(std.panLMacro.val,4*std.panLMacro.len);
|
READ_MACRO_VALS(std.panLMacro.val,std.panLMacro.len);
|
||||||
reader.read(std.panRMacro.val,4*std.panRMacro.len);
|
READ_MACRO_VALS(std.panRMacro.val,std.panRMacro.len);
|
||||||
reader.read(std.phaseResetMacro.val,4*std.phaseResetMacro.len);
|
READ_MACRO_VALS(std.phaseResetMacro.val,std.phaseResetMacro.len);
|
||||||
reader.read(std.ex4Macro.val,4*std.ex4Macro.len);
|
READ_MACRO_VALS(std.ex4Macro.val,std.ex4Macro.len);
|
||||||
reader.read(std.ex5Macro.val,4*std.ex5Macro.len);
|
READ_MACRO_VALS(std.ex5Macro.val,std.ex5Macro.len);
|
||||||
reader.read(std.ex6Macro.val,4*std.ex6Macro.len);
|
READ_MACRO_VALS(std.ex6Macro.val,std.ex6Macro.len);
|
||||||
reader.read(std.ex7Macro.val,4*std.ex7Macro.len);
|
READ_MACRO_VALS(std.ex7Macro.val,std.ex7Macro.len);
|
||||||
reader.read(std.ex8Macro.val,4*std.ex8Macro.len);
|
READ_MACRO_VALS(std.ex8Macro.val,std.ex8Macro.len);
|
||||||
|
|
||||||
// FDS
|
// FDS
|
||||||
fds.modSpeed=reader.readI();
|
fds.modSpeed=reader.readI();
|
||||||
|
@ -1111,6 +1225,136 @@ DivDataErrors DivInstrument::readInsData(SafeReader& reader, short version) {
|
||||||
gb.alwaysInit=reader.readC();
|
gb.alwaysInit=reader.readC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ES5506
|
||||||
|
if (version>=107) {
|
||||||
|
es5506.filter.mode=(DivInstrumentES5506::Filter::FilterMode)reader.readC();
|
||||||
|
es5506.filter.k1=reader.readS();
|
||||||
|
es5506.filter.k2=reader.readS();
|
||||||
|
es5506.envelope.ecount=reader.readS();
|
||||||
|
es5506.envelope.lVRamp=reader.readC();
|
||||||
|
es5506.envelope.rVRamp=reader.readC();
|
||||||
|
es5506.envelope.k1Ramp=reader.readC();
|
||||||
|
es5506.envelope.k2Ramp=reader.readC();
|
||||||
|
es5506.envelope.k1Slow=reader.readC();
|
||||||
|
es5506.envelope.k2Slow=reader.readC();
|
||||||
|
}
|
||||||
|
|
||||||
|
// SNES
|
||||||
|
if (version>=109) {
|
||||||
|
snes.useEnv=reader.readC();
|
||||||
|
snes.gainMode=(DivInstrumentSNES::GainMode)reader.readC();
|
||||||
|
snes.gain=reader.readC();
|
||||||
|
snes.a=reader.readC();
|
||||||
|
snes.d=reader.readC();
|
||||||
|
snes.s=reader.readC();
|
||||||
|
snes.r=reader.readC();
|
||||||
|
}
|
||||||
|
|
||||||
|
// macro speed/delay
|
||||||
|
if (version>=111) {
|
||||||
|
std.volMacro.speed=reader.readC();
|
||||||
|
std.arpMacro.speed=reader.readC();
|
||||||
|
std.dutyMacro.speed=reader.readC();
|
||||||
|
std.waveMacro.speed=reader.readC();
|
||||||
|
std.pitchMacro.speed=reader.readC();
|
||||||
|
std.ex1Macro.speed=reader.readC();
|
||||||
|
std.ex2Macro.speed=reader.readC();
|
||||||
|
std.ex3Macro.speed=reader.readC();
|
||||||
|
std.algMacro.speed=reader.readC();
|
||||||
|
std.fbMacro.speed=reader.readC();
|
||||||
|
std.fmsMacro.speed=reader.readC();
|
||||||
|
std.amsMacro.speed=reader.readC();
|
||||||
|
std.panLMacro.speed=reader.readC();
|
||||||
|
std.panRMacro.speed=reader.readC();
|
||||||
|
std.phaseResetMacro.speed=reader.readC();
|
||||||
|
std.ex4Macro.speed=reader.readC();
|
||||||
|
std.ex5Macro.speed=reader.readC();
|
||||||
|
std.ex6Macro.speed=reader.readC();
|
||||||
|
std.ex7Macro.speed=reader.readC();
|
||||||
|
std.ex8Macro.speed=reader.readC();
|
||||||
|
|
||||||
|
std.volMacro.delay=reader.readC();
|
||||||
|
std.arpMacro.delay=reader.readC();
|
||||||
|
std.dutyMacro.delay=reader.readC();
|
||||||
|
std.waveMacro.delay=reader.readC();
|
||||||
|
std.pitchMacro.delay=reader.readC();
|
||||||
|
std.ex1Macro.delay=reader.readC();
|
||||||
|
std.ex2Macro.delay=reader.readC();
|
||||||
|
std.ex3Macro.delay=reader.readC();
|
||||||
|
std.algMacro.delay=reader.readC();
|
||||||
|
std.fbMacro.delay=reader.readC();
|
||||||
|
std.fmsMacro.delay=reader.readC();
|
||||||
|
std.amsMacro.delay=reader.readC();
|
||||||
|
std.panLMacro.delay=reader.readC();
|
||||||
|
std.panRMacro.delay=reader.readC();
|
||||||
|
std.phaseResetMacro.delay=reader.readC();
|
||||||
|
std.ex4Macro.delay=reader.readC();
|
||||||
|
std.ex5Macro.delay=reader.readC();
|
||||||
|
std.ex6Macro.delay=reader.readC();
|
||||||
|
std.ex7Macro.delay=reader.readC();
|
||||||
|
std.ex8Macro.delay=reader.readC();
|
||||||
|
|
||||||
|
// op macro speed/delay
|
||||||
|
for (int i=0; i<4; i++) {
|
||||||
|
DivInstrumentSTD::OpMacro& op=std.opMacros[i];
|
||||||
|
|
||||||
|
op.amMacro.speed=reader.readC();
|
||||||
|
op.arMacro.speed=reader.readC();
|
||||||
|
op.drMacro.speed=reader.readC();
|
||||||
|
op.multMacro.speed=reader.readC();
|
||||||
|
op.rrMacro.speed=reader.readC();
|
||||||
|
op.slMacro.speed=reader.readC();
|
||||||
|
op.tlMacro.speed=reader.readC();
|
||||||
|
op.dt2Macro.speed=reader.readC();
|
||||||
|
op.rsMacro.speed=reader.readC();
|
||||||
|
op.dtMacro.speed=reader.readC();
|
||||||
|
op.d2rMacro.speed=reader.readC();
|
||||||
|
op.ssgMacro.speed=reader.readC();
|
||||||
|
op.damMacro.speed=reader.readC();
|
||||||
|
op.dvbMacro.speed=reader.readC();
|
||||||
|
op.egtMacro.speed=reader.readC();
|
||||||
|
op.kslMacro.speed=reader.readC();
|
||||||
|
op.susMacro.speed=reader.readC();
|
||||||
|
op.vibMacro.speed=reader.readC();
|
||||||
|
op.wsMacro.speed=reader.readC();
|
||||||
|
op.ksrMacro.speed=reader.readC();
|
||||||
|
|
||||||
|
op.amMacro.delay=reader.readC();
|
||||||
|
op.arMacro.delay=reader.readC();
|
||||||
|
op.drMacro.delay=reader.readC();
|
||||||
|
op.multMacro.delay=reader.readC();
|
||||||
|
op.rrMacro.delay=reader.readC();
|
||||||
|
op.slMacro.delay=reader.readC();
|
||||||
|
op.tlMacro.delay=reader.readC();
|
||||||
|
op.dt2Macro.delay=reader.readC();
|
||||||
|
op.rsMacro.delay=reader.readC();
|
||||||
|
op.dtMacro.delay=reader.readC();
|
||||||
|
op.d2rMacro.delay=reader.readC();
|
||||||
|
op.ssgMacro.delay=reader.readC();
|
||||||
|
op.damMacro.delay=reader.readC();
|
||||||
|
op.dvbMacro.delay=reader.readC();
|
||||||
|
op.egtMacro.delay=reader.readC();
|
||||||
|
op.kslMacro.delay=reader.readC();
|
||||||
|
op.susMacro.delay=reader.readC();
|
||||||
|
op.vibMacro.delay=reader.readC();
|
||||||
|
op.wsMacro.delay=reader.readC();
|
||||||
|
op.ksrMacro.delay=reader.readC();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// old arp macro format
|
||||||
|
if (version<112) {
|
||||||
|
if (std.arpMacro.mode) {
|
||||||
|
std.arpMacro.mode=0;
|
||||||
|
for (int i=0; i<std.arpMacro.len; i++) {
|
||||||
|
std.arpMacro.val[i]^=0x40000000;
|
||||||
|
}
|
||||||
|
if ((std.arpMacro.loop>=std.arpMacro.len || (std.arpMacro.rel>std.arpMacro.loop && std.arpMacro.rel<std.arpMacro.len)) && std.arpMacro.len<255) {
|
||||||
|
std.arpMacro.val[std.arpMacro.len++]=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return DIV_DATA_SUCCESS;
|
return DIV_DATA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,21 +165,20 @@ struct DivInstrumentMacro {
|
||||||
int val[256];
|
int val[256];
|
||||||
unsigned int mode;
|
unsigned int mode;
|
||||||
bool open;
|
bool open;
|
||||||
unsigned char len;
|
unsigned char len, delay, speed, loop, rel;
|
||||||
signed char loop;
|
|
||||||
signed char rel;
|
|
||||||
|
|
||||||
// the following variables are used by the GUI and not saved in the file
|
// the following variables are used by the GUI and not saved in the file
|
||||||
int vScroll, vZoom;
|
int vScroll, vZoom;
|
||||||
|
|
||||||
|
|
||||||
explicit DivInstrumentMacro(const String& n, bool initOpen=false):
|
explicit DivInstrumentMacro(const String& n, bool initOpen=false):
|
||||||
name(n),
|
name(n),
|
||||||
mode(0),
|
mode(0),
|
||||||
open(initOpen),
|
open(initOpen),
|
||||||
len(0),
|
len(0),
|
||||||
loop(-1),
|
delay(0),
|
||||||
rel(-1),
|
speed(1),
|
||||||
|
loop(255),
|
||||||
|
rel(255),
|
||||||
vScroll(0),
|
vScroll(0),
|
||||||
vZoom(-1) {
|
vZoom(-1) {
|
||||||
memset(val,0,256*sizeof(int));
|
memset(val,0,256*sizeof(int));
|
||||||
|
@ -465,6 +464,64 @@ struct DivInstrumentSoundUnit {
|
||||||
switchRoles(false) {}
|
switchRoles(false) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct DivInstrumentES5506 {
|
||||||
|
struct Filter {
|
||||||
|
enum FilterMode: unsigned char { // filter mode for pole 4,3
|
||||||
|
FILTER_MODE_HPK2_HPK2=0,
|
||||||
|
FILTER_MODE_HPK2_LPK1,
|
||||||
|
FILTER_MODE_LPK2_LPK2,
|
||||||
|
FILTER_MODE_LPK2_LPK1,
|
||||||
|
};
|
||||||
|
FilterMode mode;
|
||||||
|
unsigned short k1, k2;
|
||||||
|
Filter():
|
||||||
|
mode(FILTER_MODE_LPK2_LPK1),
|
||||||
|
k1(0xffff),
|
||||||
|
k2(0xffff) {}
|
||||||
|
};
|
||||||
|
struct Envelope {
|
||||||
|
unsigned short ecount;
|
||||||
|
signed char lVRamp, rVRamp;
|
||||||
|
signed char k1Ramp, k2Ramp;
|
||||||
|
bool k1Slow, k2Slow;
|
||||||
|
Envelope():
|
||||||
|
ecount(0),
|
||||||
|
lVRamp(0),
|
||||||
|
rVRamp(0),
|
||||||
|
k1Ramp(0),
|
||||||
|
k2Ramp(0),
|
||||||
|
k1Slow(false),
|
||||||
|
k2Slow(false) {}
|
||||||
|
};
|
||||||
|
Filter filter;
|
||||||
|
Envelope envelope;
|
||||||
|
DivInstrumentES5506():
|
||||||
|
filter(Filter()),
|
||||||
|
envelope(Envelope()) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct DivInstrumentSNES {
|
||||||
|
enum GainMode: unsigned char {
|
||||||
|
GAIN_MODE_DIRECT=0,
|
||||||
|
GAIN_MODE_DEC_LINEAR=4,
|
||||||
|
GAIN_MODE_DEC_LOG=5,
|
||||||
|
GAIN_MODE_INC_LINEAR=6,
|
||||||
|
GAIN_MODE_INC_INVLOG=7
|
||||||
|
};
|
||||||
|
bool useEnv;
|
||||||
|
GainMode gainMode;
|
||||||
|
unsigned char gain;
|
||||||
|
unsigned char a, d, s, r;
|
||||||
|
DivInstrumentSNES():
|
||||||
|
useEnv(true),
|
||||||
|
gainMode(GAIN_MODE_DIRECT),
|
||||||
|
gain(127),
|
||||||
|
a(15),
|
||||||
|
d(7),
|
||||||
|
s(7),
|
||||||
|
r(0) {}
|
||||||
|
};
|
||||||
|
|
||||||
struct DivInstrument {
|
struct DivInstrument {
|
||||||
String name;
|
String name;
|
||||||
bool mode;
|
bool mode;
|
||||||
|
@ -479,6 +536,8 @@ struct DivInstrument {
|
||||||
DivInstrumentMultiPCM multipcm;
|
DivInstrumentMultiPCM multipcm;
|
||||||
DivInstrumentWaveSynth ws;
|
DivInstrumentWaveSynth ws;
|
||||||
DivInstrumentSoundUnit su;
|
DivInstrumentSoundUnit su;
|
||||||
|
DivInstrumentES5506 es5506;
|
||||||
|
DivInstrumentSNES snes;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* save the instrument to a SafeWriter.
|
* save the instrument to a SafeWriter.
|
||||||
|
|
|
@ -32,6 +32,18 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
|
||||||
had=false;
|
had=false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (delay>0) {
|
||||||
|
delay--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (began && source.delay>0) {
|
||||||
|
delay=source.delay;
|
||||||
|
} else {
|
||||||
|
delay=source.speed-1;
|
||||||
|
}
|
||||||
|
if (began) {
|
||||||
|
began=false;
|
||||||
|
}
|
||||||
if (finished) {
|
if (finished) {
|
||||||
finished=false;
|
finished=false;
|
||||||
}
|
}
|
||||||
|
@ -41,16 +53,17 @@ void DivMacroStruct::doMacro(DivInstrumentMacro& source, bool released, bool tic
|
||||||
actualHad=has;
|
actualHad=has;
|
||||||
had=actualHad;
|
had=actualHad;
|
||||||
if (has) {
|
if (has) {
|
||||||
|
lastPos=pos;
|
||||||
val=source.val[pos++];
|
val=source.val[pos++];
|
||||||
if (source.rel>=0 && pos>source.rel && !released) {
|
if (pos>source.rel && !released) {
|
||||||
if (source.loop<source.len && source.loop>=0 && source.loop<source.rel) {
|
if (source.loop<source.len && source.loop<source.rel) {
|
||||||
pos=source.loop;
|
pos=source.loop;
|
||||||
} else {
|
} else {
|
||||||
pos--;
|
pos--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pos>=source.len) {
|
if (pos>=source.len) {
|
||||||
if (source.loop<source.len && source.loop>=0 && (source.loop>=source.rel || source.rel>=source.len)) {
|
if (source.loop<source.len && (source.loop>=source.rel || source.rel>=source.len)) {
|
||||||
pos=source.loop;
|
pos=source.loop;
|
||||||
} else if (linger) {
|
} else if (linger) {
|
||||||
pos--;
|
pos--;
|
||||||
|
@ -239,7 +252,7 @@ void DivMacroInt::init(DivInstrument* which) {
|
||||||
for (size_t i=0; i<macroListLen; i++) {
|
for (size_t i=0; i<macroListLen; i++) {
|
||||||
if (macroSource[i]!=NULL) {
|
if (macroSource[i]!=NULL) {
|
||||||
macroList[i]->prepare(*macroSource[i],e);
|
macroList[i]->prepare(*macroSource[i],e);
|
||||||
hasRelease=(macroSource[i]->rel>=0 && macroSource[i]->rel<macroSource[i]->len);
|
hasRelease=(macroSource[i]->rel<macroSource[i]->len);
|
||||||
} else {
|
} else {
|
||||||
hasRelease=false;
|
hasRelease=false;
|
||||||
}
|
}
|
||||||
|
@ -251,3 +264,110 @@ void DivMacroInt::notifyInsDeletion(DivInstrument* which) {
|
||||||
init(NULL);
|
init(NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// randomly-generated
|
||||||
|
constexpr unsigned int hashTable[256]={
|
||||||
|
0x0718657, 0xe904eb33, 0x14b2da2b, 0x0ef67ca9,
|
||||||
|
0x0f0559a, 0x4142065a, 0x4d9ab4ba, 0x3cdd601a,
|
||||||
|
0x6635aca, 0x2c41ab72, 0xf98e8d31, 0x1003ee63,
|
||||||
|
0x3fd9fb5, 0x30734d16, 0xe8964431, 0x29bb9b79,
|
||||||
|
0x817f580, 0xfe083b9e, 0x974b5e85, 0x3b5729c2,
|
||||||
|
0x2afea96, 0xf1573b4b, 0x308a1024, 0xaa94b92d,
|
||||||
|
0x693fa93, 0x547ba3da, 0xac4f206c, 0x93f72ea9,
|
||||||
|
0xcc44001, 0x37e27670, 0xf35a63d0, 0xd1cdbb92,
|
||||||
|
0x7c7ee24, 0xfa267ee9, 0xf9cd9956, 0x6a6768d4,
|
||||||
|
0x9e6a108, 0xf6ca4bd0, 0xa53cba9f, 0x526a523a,
|
||||||
|
0xf46f0c8, 0xf131bd4c, 0x82800d48, 0xabff9214,
|
||||||
|
0x40eabd4, 0xea0ef8f7, 0xdc3968d6, 0x54c3cb63,
|
||||||
|
0x8855023, 0xaab73861, 0xff0bea2c, 0x139b9765,
|
||||||
|
0x4a21279, 0x6b2aa29a, 0xf147cc3f, 0xc42edc1a,
|
||||||
|
0xfe2f86f, 0x6d352047, 0xd3cac3e4, 0x35e5c389,
|
||||||
|
0xe923727, 0x12fe3b32, 0x204295c5, 0x254a8b7a,
|
||||||
|
0xc1d995d, 0x26a512d2, 0xa3e34033, 0x9a968df0,
|
||||||
|
0x53447ed, 0x36cf4077, 0x189b03a7, 0x558790e8,
|
||||||
|
0x01f921a, 0x840f260c, 0x93dd2b86, 0x12f69cb0,
|
||||||
|
0x117d93a, 0xcb2cbc2b, 0xd41e3aed, 0x5ff6ec75,
|
||||||
|
0x607290d, 0xd41adb92, 0x64f94ba7, 0xaff720f7,
|
||||||
|
0x6bf1d5d, 0xc8e36c6d, 0x7095bab5, 0xdfbf7b0d,
|
||||||
|
0x01ddeea, 0xe8f262da, 0xf589512f, 0xc2ecac5d,
|
||||||
|
0xbe29d98, 0xff8b5a2e, 0x18e7279e, 0x6ad24dcb,
|
||||||
|
0x2b3b9b1, 0x6f5227d8, 0x076d7553, 0x6c5856e2,
|
||||||
|
0x995f655, 0xe9fcf5a6, 0x83671b70, 0xaf3aed1e,
|
||||||
|
0xac340f0, 0x5c7008b4, 0x14651282, 0x8bf855b9,
|
||||||
|
0x4a933af, 0x829b87f1, 0x9a673070, 0xb19da64f,
|
||||||
|
0x77d8f36, 0x584c9fdc, 0xa9e52c0d, 0x6da5e13d,
|
||||||
|
0xae1051f, 0xe85e976f, 0xfeac2d9a, 0x19c46754,
|
||||||
|
0x1cba6f3, 0xaf21bc31, 0x16b6a8d4, 0xe08b0fdb,
|
||||||
|
0x97e6e54, 0x5da499ae, 0xab472e19, 0xc2491f2e,
|
||||||
|
0xc08c563, 0xe91b131b, 0xc8e22451, 0x6995c8fe,
|
||||||
|
0x7042718, 0x01043738, 0xc7d88b28, 0x2d9f330f,
|
||||||
|
0x4b3aae5, 0xf1e705ba, 0xc5b8ee59, 0xa8ba4e8f,
|
||||||
|
0x55f65a2, 0xa1899e41, 0x296243c8, 0x1e502bf2,
|
||||||
|
0x20080de, 0x841d2239, 0x37b082af, 0xbdd7f7da,
|
||||||
|
0x4075090, 0x1dc7dc49, 0x5cd3c69a, 0x7fb13b62,
|
||||||
|
0xb382bf1, 0xa0cfbc2f, 0x9eca4dc1, 0xb9355453,
|
||||||
|
0x5d0dd24, 0x834f4d8e, 0xe9b136b2, 0xe7b8738d,
|
||||||
|
0x1c91d41, 0x8cb3ddb5, 0xdc600590, 0x607cff55,
|
||||||
|
0x2ca7675, 0x4622a8e4, 0x9340e414, 0xcb44928a,
|
||||||
|
0xa9e791c, 0x68849920, 0xc5b5fcd8, 0xbc352269,
|
||||||
|
0x3ab13cf, 0xaa3cbbd0, 0x1abacc64, 0x623b5b49,
|
||||||
|
0xcc8c4c3, 0x3c8f2f70, 0x3e584a28, 0x9316d24d,
|
||||||
|
0xfe315a2, 0x10f0ba7a, 0xed15a523, 0x4f987369,
|
||||||
|
0x7aa4a4a, 0x90eaf98f, 0xcf0af610, 0x1b38f4e7,
|
||||||
|
0x19df72d, 0xd8306808, 0xd54e25ac, 0x76b79c6d,
|
||||||
|
0x58110cf, 0x06a3e5f2, 0x873a6039, 0xf52684e3,
|
||||||
|
0xecf39c3, 0x7cbb2759, 0xe280d361, 0x91e8471a,
|
||||||
|
0xa67cdd3, 0x17cac3be, 0xfc9eff1f, 0x71abdf49,
|
||||||
|
0x6168624, 0xb68f86f7, 0x67a8e72a, 0xe746911d,
|
||||||
|
0xca48fd7, 0x8f3cc436, 0x3a3851a8, 0x30a7e26e,
|
||||||
|
0xca49308, 0xb598ef74, 0x49ef167a, 0xa9e17632,
|
||||||
|
0x0f7308a, 0xf156efed, 0xcf799645, 0xbae4b85a,
|
||||||
|
0xecba3fe, 0xd97f861d, 0xc164af62, 0xb1aca42f,
|
||||||
|
0xf249576, 0x83d1bf4e, 0x2f486a9c, 0xd3b53cc2,
|
||||||
|
0x17d7c26, 0xd95ddae1, 0x76c1a2f5, 0xf8af6782,
|
||||||
|
0xdbaece4, 0x010b2b53, 0x049be200, 0xd9fd0d1a,
|
||||||
|
0x37d7e6c, 0x5b848651, 0x203c98c7, 0x669681b0,
|
||||||
|
0x683086f, 0xdd0ee8ab, 0x5dbe008b, 0xe5d0690d,
|
||||||
|
0x23dd758, 0x6b34acbc, 0x4b2b3e65, 0xcc7b56c1,
|
||||||
|
0x196b0a0, 0x7b065105, 0xb731b01a, 0xd37daa16,
|
||||||
|
0xf77816b, 0x3c9fa546, 0x81dfadb8, 0x39b1fb8b
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr unsigned int NAME_HASH(const char* name) {
|
||||||
|
unsigned int nameHash=0xffffffff;
|
||||||
|
for (const char* i=name; *i; i++) {
|
||||||
|
nameHash=(nameHash>>8)^hashTable[(unsigned char)*i];
|
||||||
|
}
|
||||||
|
return nameHash;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CONSIDER(x) case NAME_HASH(#x): return &x; break;
|
||||||
|
|
||||||
|
DivMacroStruct* DivMacroInt::structByName(const String& name) {
|
||||||
|
unsigned int hash=NAME_HASH(name.c_str());
|
||||||
|
|
||||||
|
switch (hash) {
|
||||||
|
CONSIDER(vol)
|
||||||
|
CONSIDER(arp)
|
||||||
|
CONSIDER(duty)
|
||||||
|
CONSIDER(wave)
|
||||||
|
CONSIDER(pitch)
|
||||||
|
CONSIDER(ex1)
|
||||||
|
CONSIDER(ex2)
|
||||||
|
CONSIDER(ex3)
|
||||||
|
CONSIDER(alg)
|
||||||
|
CONSIDER(fb)
|
||||||
|
CONSIDER(fms)
|
||||||
|
CONSIDER(ams)
|
||||||
|
CONSIDER(panL)
|
||||||
|
CONSIDER(panR)
|
||||||
|
CONSIDER(phaseReset)
|
||||||
|
CONSIDER(ex4)
|
||||||
|
CONSIDER(ex5)
|
||||||
|
CONSIDER(ex6)
|
||||||
|
CONSIDER(ex7)
|
||||||
|
CONSIDER(ex8)
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -25,21 +25,24 @@
|
||||||
class DivEngine;
|
class DivEngine;
|
||||||
|
|
||||||
struct DivMacroStruct {
|
struct DivMacroStruct {
|
||||||
int pos;
|
int pos, lastPos, delay;
|
||||||
int val;
|
int val;
|
||||||
bool has, had, actualHad, finished, will, linger;
|
bool has, had, actualHad, finished, will, linger, began;
|
||||||
unsigned int mode;
|
unsigned int mode;
|
||||||
void doMacro(DivInstrumentMacro& source, bool released, bool tick);
|
void doMacro(DivInstrumentMacro& source, bool released, bool tick);
|
||||||
void init() {
|
void init() {
|
||||||
pos=mode=0;
|
pos=lastPos=mode=delay=0;
|
||||||
has=had=actualHad=will=false;
|
has=had=actualHad=will=false;
|
||||||
linger=false;
|
linger=false;
|
||||||
|
began=true;
|
||||||
// TODO: test whether this breaks anything?
|
// TODO: test whether this breaks anything?
|
||||||
val=0;
|
val=0;
|
||||||
}
|
}
|
||||||
void prepare(DivInstrumentMacro& source, DivEngine* e);
|
void prepare(DivInstrumentMacro& source, DivEngine* e);
|
||||||
DivMacroStruct():
|
DivMacroStruct():
|
||||||
pos(0),
|
pos(0),
|
||||||
|
lastPos(0),
|
||||||
|
delay(0),
|
||||||
val(0),
|
val(0),
|
||||||
has(false),
|
has(false),
|
||||||
had(false),
|
had(false),
|
||||||
|
@ -47,6 +50,7 @@ struct DivMacroStruct {
|
||||||
finished(false),
|
finished(false),
|
||||||
will(false),
|
will(false),
|
||||||
linger(false),
|
linger(false),
|
||||||
|
began(false),
|
||||||
mode(0) {}
|
mode(0) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,6 +131,13 @@ class DivMacroInt {
|
||||||
*/
|
*/
|
||||||
void notifyInsDeletion(DivInstrument* which);
|
void notifyInsDeletion(DivInstrument* which);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get DivMacroStruct by macro name.
|
||||||
|
* @param which the macro name.
|
||||||
|
* @return a DivMacroStruct, or NULL if none found.
|
||||||
|
*/
|
||||||
|
DivMacroStruct* structByName(const String& name);
|
||||||
|
|
||||||
DivMacroInt():
|
DivMacroInt():
|
||||||
e(NULL),
|
e(NULL),
|
||||||
ins(NULL),
|
ins(NULL),
|
||||||
|
|
|
@ -94,10 +94,6 @@ bool DivDispatch::getWantPreNote() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivDispatch::getEffectName(unsigned char effect) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivDispatch::setFlags(unsigned int flags) {
|
void DivDispatch::setFlags(unsigned int flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,21 +64,6 @@ const char** DivPlatformAmiga::getRegisterSheet() {
|
||||||
return regCheatSheetAmiga;
|
return regCheatSheetAmiga;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformAmiga::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Toggle filter (0 disables; 1 enables)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Toggle AM with next channel";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Toggle period modulation with next channel";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define writeAudDat(x) \
|
#define writeAudDat(x) \
|
||||||
chan[i].audDat=x; \
|
chan[i].audDat=x; \
|
||||||
if (i<3 && chan[i].useV) { \
|
if (i<3 && chan[i].useV) { \
|
||||||
|
@ -178,19 +163,9 @@ void DivPlatformAmiga::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
// TODO: why the off mult? this may be a bug!
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=round(off*NOTE_PERIODIC_NOROUND(parent->calcArp(chan[i].note,chan[i].std.arp.val)));
|
||||||
chan[i].baseFreq=round(off*NOTE_PERIODIC_NOROUND(chan[i].std.arp.val));
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=round(off*NOTE_PERIODIC_NOROUND(chan[i].note+chan[i].std.arp.val));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=round(off*NOTE_PERIODIC_NOROUND(chan[i].note));
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].useWave && chan[i].std.wave.had) {
|
if (chan[i].useWave && chan[i].std.wave.had) {
|
||||||
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
||||||
|
|
|
@ -105,7 +105,6 @@ class DivPlatformAmiga: public DivDispatch {
|
||||||
void notifyWaveChange(int wave);
|
void notifyWaveChange(int wave);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
};
|
};
|
||||||
|
|
|
@ -50,111 +50,6 @@ const char** DivPlatformArcade::getRegisterSheet() {
|
||||||
return regCheatSheetOPM;
|
return regCheatSheetOPM;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformArcade::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Set noise frequency (xx: value; 0 disables noise)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set level of operator 3 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set level of operator 4 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 4; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Set LFO speed";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Set LFO waveform (0 saw, 1 square, 2 triangle, 3 noise)";
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set attack of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set attack of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1e:
|
|
||||||
return "1Exx: Set AM depth (0 to 7F)";
|
|
||||||
break;
|
|
||||||
case 0x1f:
|
|
||||||
return "1Fxx: Set PM depth (0 to 7F)";
|
|
||||||
break;
|
|
||||||
case 0x30:
|
|
||||||
return "30xx: Toggle hard envelope reset on new notes";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 4 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 4 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 4 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set detune (x: operator from 1 to 4 (0 for all ops); y: detune where 3 is center)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set envelope scale (x: operator from 1 to 4 (0 for all ops); y: scale from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set detune 2 (x: operator from 1 to 4 (0 for all ops); y: detune from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x59:
|
|
||||||
return "59xx: Set decay of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
return "5Axx: Set decay of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxx: Set decay 2 of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5c:
|
|
||||||
return "5Cxx: Set decay 2 of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5d:
|
|
||||||
return "5Dxx: Set decay 2 of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5e:
|
|
||||||
return "5Exx: Set decay 2 of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5f:
|
|
||||||
return "5Fxx: Set decay 2 of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
static int o[2];
|
static int o[2];
|
||||||
|
|
||||||
|
@ -266,18 +161,9 @@ void DivPlatformArcade::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_LINEAR(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_LINEAR(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_LINEAR(chan[i].note+(signed char)chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_LINEAR(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
|
|
|
@ -115,7 +115,6 @@ class DivPlatformArcade: public DivPlatformOPM {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformArcade();
|
~DivPlatformArcade();
|
||||||
|
|
|
@ -73,42 +73,6 @@ const char** DivPlatformAY8910::getRegisterSheet() {
|
||||||
return intellivision?regCheatSheetAY8914:regCheatSheetAY;
|
return intellivision?regCheatSheetAY8914:regCheatSheetAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformAY8910::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set channel mode (bit 0: square; bit 1: noise; bit 2: envelope)";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: Set noise frequency (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xy: Set envelope mode (x: shape, y: enable for this channel)";
|
|
||||||
break;
|
|
||||||
case 0x23:
|
|
||||||
return "23xx: Set envelope period low byte";
|
|
||||||
break;
|
|
||||||
case 0x24:
|
|
||||||
return "24xx: Set envelope period high byte";
|
|
||||||
break;
|
|
||||||
case 0x25:
|
|
||||||
return "25xx: Envelope slide up";
|
|
||||||
break;
|
|
||||||
case 0x26:
|
|
||||||
return "26xx: Envelope slide down";
|
|
||||||
break;
|
|
||||||
case 0x29:
|
|
||||||
return "29xy: Set auto-envelope (x: numerator; y: denominator)";
|
|
||||||
break;
|
|
||||||
case 0x2e:
|
|
||||||
return "2Exx: Write to I/O port A";
|
|
||||||
break;
|
|
||||||
case 0x2f:
|
|
||||||
return "2Fxx: Write to I/O port B";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
if (ayBufLen<len) {
|
if (ayBufLen<len) {
|
||||||
ayBufLen=len;
|
ayBufLen=len;
|
||||||
|
@ -195,18 +159,9 @@ void DivPlatformAY8910::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
rWrite(0x06,31-chan[i].std.duty.val);
|
rWrite(0x06,31-chan[i].std.duty.val);
|
||||||
|
|
|
@ -112,7 +112,6 @@ class DivPlatformAY8910: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformAY8910(bool useExtMode=false, unsigned int eclk=COLOR_NTSC, unsigned char ediv=8):
|
DivPlatformAY8910(bool useExtMode=false, unsigned int eclk=COLOR_NTSC, unsigned char ediv=8):
|
||||||
|
|
|
@ -77,54 +77,6 @@ const char** DivPlatformAY8930::getRegisterSheet() {
|
||||||
return regCheatSheetAY8930;
|
return regCheatSheetAY8930;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformAY8930::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set duty cycle (0 to 8)";
|
|
||||||
break;
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set channel mode (bit 0: square; bit 1: noise; bit 2: envelope)";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: Set noise frequency (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xy: Set envelope mode (x: shape, y: enable for this channel)";
|
|
||||||
break;
|
|
||||||
case 0x23:
|
|
||||||
return "23xx: Set envelope period low byte";
|
|
||||||
break;
|
|
||||||
case 0x24:
|
|
||||||
return "24xx: Set envelope period high byte";
|
|
||||||
break;
|
|
||||||
case 0x25:
|
|
||||||
return "25xx: Envelope slide up";
|
|
||||||
break;
|
|
||||||
case 0x26:
|
|
||||||
return "26xx: Envelope slide down";
|
|
||||||
break;
|
|
||||||
case 0x27:
|
|
||||||
return "27xx: Set noise AND mask";
|
|
||||||
break;
|
|
||||||
case 0x28:
|
|
||||||
return "28xx: Set noise OR mask";
|
|
||||||
break;
|
|
||||||
case 0x29:
|
|
||||||
return "29xy: Set auto-envelope (x: numerator; y: denominator)";
|
|
||||||
break;
|
|
||||||
case 0x2d:
|
|
||||||
return "2Dxx: NOT TO BE EMPLOYED BY THE COMPOSER";
|
|
||||||
break;
|
|
||||||
case 0x2e:
|
|
||||||
return "2Exx: Write to I/O port A";
|
|
||||||
break;
|
|
||||||
case 0x2f:
|
|
||||||
return "2Fxx: Write to I/O port B";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
if (ayBufLen<len) {
|
if (ayBufLen<len) {
|
||||||
ayBufLen=len;
|
ayBufLen=len;
|
||||||
|
@ -215,18 +167,9 @@ void DivPlatformAY8930::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
rWrite(0x06,chan[i].std.duty.val);
|
rWrite(0x06,chan[i].std.duty.val);
|
||||||
|
|
|
@ -103,7 +103,6 @@ class DivPlatformAY8930: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
};
|
};
|
||||||
|
|
|
@ -39,15 +39,6 @@ const char** DivPlatformBubSysWSG::getRegisterSheet() {
|
||||||
return regCheatSheetBubSysWSG;
|
return regCheatSheetBubSysWSG;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformBubSysWSG::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformBubSysWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformBubSysWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
int chanOut=0;
|
int chanOut=0;
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
|
@ -101,18 +92,9 @@ void DivPlatformBubSysWSG::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.wave.had) {
|
if (chan[i].std.wave.had) {
|
||||||
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
||||||
|
|
|
@ -85,7 +85,6 @@ class DivPlatformBubSysWSG: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformBubSysWSG();
|
~DivPlatformBubSysWSG();
|
||||||
|
|
|
@ -62,52 +62,6 @@ const char** DivPlatformC64::getRegisterSheet() {
|
||||||
return regCheatSheetSID;
|
return regCheatSheetSID;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformC64::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Set waveform (bit 0: triangle; bit 1: saw; bit 2: pulse; bit 3: noise)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set coarse cutoff (not recommended; use 4xxx instead)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set coarse pulse width (not recommended; use 3xxx instead)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set resonance (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set filter mode (bit 0: low pass; bit 1: band pass; bit 2: high pass)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set envelope reset time";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Disable envelope reset for this channel (1 disables; 0 enables)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxy: Reset cutoff (x: on new note; y: now)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxy: Reset pulse width (x: on new note; y: now)";
|
|
||||||
break;
|
|
||||||
case 0x1e:
|
|
||||||
return "1Exy: Change additional parameters";
|
|
||||||
break;
|
|
||||||
case 0x30: case 0x31: case 0x32: case 0x33:
|
|
||||||
case 0x34: case 0x35: case 0x36: case 0x37:
|
|
||||||
case 0x38: case 0x39: case 0x3a: case 0x3b:
|
|
||||||
case 0x3c: case 0x3d: case 0x3e: case 0x3f:
|
|
||||||
return "3xxx: Set pulse width (0 to FFF)";
|
|
||||||
break;
|
|
||||||
case 0x40: case 0x41: case 0x42: case 0x43:
|
|
||||||
case 0x44: case 0x45: case 0x46: case 0x47:
|
|
||||||
return "4xxx: Set cutoff (0 to 7FF)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
int dcOff=sid.get_dc(0);
|
int dcOff=sid.get_dc(0);
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=start; i<start+len; i++) {
|
||||||
|
@ -150,18 +104,9 @@ void DivPlatformC64::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note+(signed char)chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_C64);
|
DivInstrument* ins=parent->getIns(chan[i].ins,DIV_INS_C64);
|
||||||
|
|
|
@ -103,7 +103,6 @@ class DivPlatformC64: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void setChipModel(bool is6581);
|
void setChipModel(bool is6581);
|
||||||
void quit();
|
void quit();
|
||||||
|
|
|
@ -55,30 +55,6 @@ const char** DivPlatformFDS::getRegisterSheet() {
|
||||||
return regCheatSheetFDS;
|
return regCheatSheetFDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformFDS::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set modulation depth";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xy: Set modulation speed high byte (x: enable; y: value)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set modulation speed low byte";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set modulator position";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set modulator table to waveform";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformFDS::acquire_puNES(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformFDS::acquire_puNES(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=start; i<start+len; i++) {
|
||||||
extcl_apu_tick_FDS(fds);
|
extcl_apu_tick_FDS(fds);
|
||||||
|
@ -145,18 +121,9 @@ void DivPlatformFDS::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
|
|
|
@ -104,7 +104,6 @@ class DivPlatformFDS: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformFDS();
|
~DivPlatformFDS();
|
||||||
|
|
|
@ -61,27 +61,6 @@ const char** DivPlatformGB::getRegisterSheet() {
|
||||||
return regCheatSheetGB;
|
return regCheatSheetGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformGB::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set noise length (0: long; 1: short)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set duty cycle (0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xy: Setup sweep (x: time; y: shift)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set sweep direction (0: up; 1: down)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformGB::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformGB::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=start; i<start+len; i++) {
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
|
@ -186,28 +165,13 @@ void DivPlatformGB::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (i==3) { // noise
|
if (i==3) { // noise
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=parent->calcArp(chan[i].note,chan[i].std.arp.val,24);
|
||||||
chan[i].baseFreq=chan[i].std.arp.val+24;
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=chan[i].note+chan[i].std.arp.val;
|
|
||||||
}
|
|
||||||
if (chan[i].baseFreq>255) chan[i].baseFreq=255;
|
if (chan[i].baseFreq>255) chan[i].baseFreq=255;
|
||||||
if (chan[i].baseFreq<0) chan[i].baseFreq=0;
|
if (chan[i].baseFreq<0) chan[i].baseFreq=0;
|
||||||
} else {
|
} else {
|
||||||
if (!chan[i].inPorta) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val,24));
|
||||||
if (chan[i].std.arp.mode) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val+24);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
chan[i].duty=chan[i].std.duty.val;
|
chan[i].duty=chan[i].std.duty.val;
|
||||||
|
|
|
@ -115,7 +115,6 @@ class DivPlatformGB: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
void setFlags(unsigned int flags);
|
void setFlags(unsigned int flags);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
|
|
|
@ -27,108 +27,6 @@
|
||||||
|
|
||||||
#define IS_REALLY_MUTED(x) (isMuted[x] && (x<5 || !softPCM || (isMuted[5] && isMuted[6])))
|
#define IS_REALLY_MUTED(x) (isMuted[x] && (x<5 || !softPCM || (isMuted[5] && isMuted[6])))
|
||||||
|
|
||||||
const char* DivPlatformGenesis::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xy: Setup LFO (x: enable; y: speed)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set level of operator 3 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set level of operator 4 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 4; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Enable channel 6 DAC";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Toggle extended channel 3 mode";
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set attack of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set attack of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x30:
|
|
||||||
return "30xx: Toggle hard envelope reset on new notes";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 4 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 4 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 4 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set detune (x: operator from 1 to 4 (0 for all ops); y: detune where 3 is center)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set envelope scale (x: operator from 1 to 4 (0 for all ops); y: scale from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set SSG envelope (x: operator from 1 to 4 (0 for all ops); y: 0-7 on, 8 off)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x59:
|
|
||||||
return "59xx: Set decay of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
return "5Axx: Set decay of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxx: Set decay 2 of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5c:
|
|
||||||
return "5Cxx: Set decay 2 of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5d:
|
|
||||||
return "5Dxx: Set decay 2 of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5e:
|
|
||||||
return "5Exx: Set decay 2 of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5f:
|
|
||||||
return "5Fxx: Set decay 2 of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0xdf:
|
|
||||||
return "DFxx: Set sample playback direction (0: normal; 1: reverse)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformGenesis::processDAC() {
|
void DivPlatformGenesis::processDAC() {
|
||||||
if (softPCM) {
|
if (softPCM) {
|
||||||
softPCMTimer+=chipClock/576;
|
softPCMTimer+=chipClock/576;
|
||||||
|
@ -365,26 +263,40 @@ void DivPlatformGenesis::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (i>=5 && chan[i].furnaceDac) {
|
||||||
if (!chan[i].inPorta) {
|
if (chan[i].std.arp.had) {
|
||||||
if (chan[i].std.arp.mode) {
|
if (!chan[i].inPorta) {
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].std.arp.val,11);
|
chan[i].baseFreq=parent->calcBaseFreq(1,1,parent->calcArp(chan[i].note,chan[i].std.arp.val),false);
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note+(signed char)chan[i].std.arp.val,11);
|
|
||||||
}
|
}
|
||||||
|
chan[i].freqChanged=true;
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
|
||||||
} else {
|
} else {
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
if (chan[i].std.arp.had) {
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note,11);
|
if (!chan[i].inPorta) {
|
||||||
|
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||||
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.panL.had) {
|
if (i>=5 && chan[i].furnaceDac) {
|
||||||
chan[i].pan=chan[i].std.panL.val&3;
|
if (chan[i].std.panL.had) {
|
||||||
if (i<6) {
|
chan[5].pan&=1;
|
||||||
rWrite(chanOffs[i]+ADDR_LRAF,(IS_REALLY_MUTED(i)?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
chan[5].pan|=chan[i].std.panL.val?2:0;
|
||||||
|
}
|
||||||
|
if (chan[i].std.panR.had) {
|
||||||
|
chan[5].pan&=2;
|
||||||
|
chan[5].pan|=chan[i].std.panR.val?1:0;
|
||||||
|
}
|
||||||
|
if (chan[i].std.panL.had || chan[i].std.panR.had) {
|
||||||
|
rWrite(chanOffs[5]+ADDR_LRAF,(IS_REALLY_MUTED(i)?0:(chan[5].pan<<6))|(chan[5].state.fms&7)|((chan[5].state.ams&3)<<4));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (chan[i].std.panL.had) {
|
||||||
|
chan[i].pan=chan[i].std.panL.val&3;
|
||||||
|
if (i<6) {
|
||||||
|
rWrite(chanOffs[i]+ADDR_LRAF,(IS_REALLY_MUTED(i)?0:(chan[i].pan<<6))|(chan[i].state.fms&7)|((chan[i].state.ams&3)<<4));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,6 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
||||||
int getPortaFloor(int ch);
|
int getPortaFloor(int ch);
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformGenesis():
|
DivPlatformGenesis():
|
||||||
|
|
|
@ -561,6 +561,11 @@ void DivPlatformGenesisExt::forceIns() {
|
||||||
opChan[i].freqChanged=true;
|
opChan[i].freqChanged=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (extMode && softPCM && chan[7].active) { // CSM
|
||||||
|
chan[7].insChanged=true;
|
||||||
|
chan[7].freqChanged=true;
|
||||||
|
chan[7].keyOn=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void* DivPlatformGenesisExt::getChanState(int ch) {
|
void* DivPlatformGenesisExt::getChanState(int ch) {
|
||||||
|
|
|
@ -129,19 +129,6 @@ const char** DivPlatformLynx::getRegisterSheet() {
|
||||||
return regCheatSheetLynx;
|
return regCheatSheetLynx;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformLynx::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect)
|
|
||||||
{
|
|
||||||
case 0x30: case 0x31: case 0x32: case 0x33:
|
|
||||||
case 0x34: case 0x35: case 0x36: case 0x37:
|
|
||||||
case 0x38: case 0x39: case 0x3a: case 0x3b:
|
|
||||||
case 0x3c: case 0x3d: case 0x3e: case 0x3f:
|
|
||||||
return "3xxx: Load LFSR (0 to FFF)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformLynx::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformLynx::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
|
@ -185,22 +172,9 @@ void DivPlatformLynx::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].actualNote=parent->calcArp(chan[i].note,chan[i].std.arp.val);
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
chan[i].baseFreq=NOTE_PERIODIC(chan[i].actualNote);
|
||||||
if (chan[i].pcm) chan[i].sampleBaseFreq=parent->calcBaseFreq(1.0,1.0,chan[i].std.arp.val,false);
|
if (chan[i].pcm) chan[i].sampleBaseFreq=parent->calcBaseFreq(1.0,1.0,chan[i].actualNote,false);
|
||||||
chan[i].actualNote=chan[i].std.arp.val;
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
if (chan[i].pcm) chan[i].sampleBaseFreq=parent->calcBaseFreq(1.0,1.0,chan[i].note+chan[i].std.arp.val,false);
|
|
||||||
chan[i].actualNote=chan[i].note+chan[i].std.arp.val;
|
|
||||||
}
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
if (chan[i].pcm) chan[i].sampleBaseFreq=parent->calcBaseFreq(1.0,1.0,chan[i].note,false);
|
|
||||||
chan[i].actualNote=chan[i].note;
|
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,6 @@ class DivPlatformLynx: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName( unsigned char effect );
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformLynx();
|
~DivPlatformLynx();
|
||||||
|
|
|
@ -43,15 +43,6 @@ const char** DivPlatformMMC5::getRegisterSheet() {
|
||||||
return regCheatSheetMMC5;
|
return regCheatSheetMMC5;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformMMC5::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set duty cycle/noise mode (pulse: 0 to 3; noise: 0 or 1)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=start; i<start+len; i++) {
|
||||||
if (dacSample!=-1) {
|
if (dacSample!=-1) {
|
||||||
|
@ -110,20 +101,12 @@ void DivPlatformMMC5::tick(bool sysTick) {
|
||||||
if (chan[i].outVol<0) chan[i].outVol=0;
|
if (chan[i].outVol<0) chan[i].outVol=0;
|
||||||
rWrite(0x5000+i*4,0x30|chan[i].outVol|((chan[i].duty&3)<<6));
|
rWrite(0x5000+i*4,0x30|chan[i].outVol|((chan[i].duty&3)<<6));
|
||||||
}
|
}
|
||||||
|
// TODO: arp macros on NES PCM?
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
chan[i].duty=chan[i].std.duty.val;
|
chan[i].duty=chan[i].std.duty.val;
|
||||||
|
|
|
@ -89,7 +89,6 @@ class DivPlatformMMC5: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformMMC5();
|
~DivPlatformMMC5();
|
||||||
|
|
|
@ -30,18 +30,6 @@ const char** DivPlatformMSM6258::getRegisterSheet() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformMSM6258::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set frequency divider (0-2)";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: Select clock rate (0: full; 1: half)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformMSM6258::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformMSM6258::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
short* outs[2]={
|
short* outs[2]={
|
||||||
&msmOut,
|
&msmOut,
|
||||||
|
|
|
@ -109,7 +109,6 @@ class DivPlatformMSM6258: public DivDispatch {
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
void setFlags(unsigned int flags);
|
void setFlags(unsigned int flags);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
const void* getSampleMem(int index);
|
const void* getSampleMem(int index);
|
||||||
size_t getSampleMemCapacity(int index);
|
size_t getSampleMemCapacity(int index);
|
||||||
size_t getSampleMemUsage(int index);
|
size_t getSampleMemUsage(int index);
|
||||||
|
|
|
@ -30,15 +30,6 @@ const char** DivPlatformMSM6295::getRegisterSheet() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformMSM6295::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set chip output rate (0: clock/132; 1: clock/165)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
u8 DivPlatformMSM6295::read_byte(u32 address) {
|
u8 DivPlatformMSM6295::read_byte(u32 address) {
|
||||||
if (adpcmMem==NULL || address>=getSampleMemCapacity(0)) {
|
if (adpcmMem==NULL || address>=getSampleMemCapacity(0)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -97,7 +97,6 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
|
||||||
virtual void poke(std::vector<DivRegWrite>& wlist) override;
|
virtual void poke(std::vector<DivRegWrite>& wlist) override;
|
||||||
virtual void setFlags(unsigned int flags) override;
|
virtual void setFlags(unsigned int flags) override;
|
||||||
virtual const char** getRegisterSheet() override;
|
virtual const char** getRegisterSheet() override;
|
||||||
virtual const char* getEffectName(unsigned char effect) override;
|
|
||||||
virtual const void* getSampleMem(int index) override;
|
virtual const void* getSampleMem(int index) override;
|
||||||
virtual size_t getSampleMemCapacity(int index) override;
|
virtual size_t getSampleMemCapacity(int index) override;
|
||||||
virtual size_t getSampleMemUsage(int index) override;
|
virtual size_t getSampleMemUsage(int index) override;
|
||||||
|
|
|
@ -108,51 +108,6 @@ const char** DivPlatformN163::getRegisterSheet() {
|
||||||
return regCheatSheetN163;
|
return regCheatSheetN163;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformN163::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Select waveform";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set waveform position in RAM (single nibble unit)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set waveform length in RAM (04 to FC, 4 nibble unit)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "130x: Change waveform update mode (0: off, bit 0: update now, bit 1: update when every waveform changes)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Select waveform for load to RAM";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set waveform position for load to RAM (single nibble unit)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xx: Set waveform length for load to RAM (04 to FC, 4 nibble unit)";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "170x: Change waveform load mode (0: off, bit 0: load now, bit 1: load when every waveform changes)";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "180x: Change channel limits (0 to 7, x + 1)";
|
|
||||||
break;
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: (Global) Select waveform for load to RAM";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: (Global) Set waveform position for load to RAM (single nibble unit)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xx: (Global) Set waveform length for load to RAM (04 to FC, 4 nibble unit)";
|
|
||||||
break;
|
|
||||||
case 0x23:
|
|
||||||
return "230x: (Global) Change waveform load mode (0: off, bit 0: load now, bit 1: load when every waveform changes)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformN163::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformN163::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=start; i<start+len; i++) {
|
||||||
n163.tick();
|
n163.tick();
|
||||||
|
@ -234,18 +189,9 @@ void DivPlatformN163::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note+(signed char)chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
if (chan[i].wavePos!=chan[i].std.duty.val) {
|
if (chan[i].wavePos!=chan[i].std.duty.val) {
|
||||||
|
|
|
@ -110,7 +110,6 @@ class DivPlatformN163: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformN163();
|
~DivPlatformN163();
|
||||||
|
|
|
@ -151,18 +151,6 @@ const char** DivPlatformNamcoWSG::getRegisterSheet() {
|
||||||
return regCheatSheetNamcoWSG;
|
return regCheatSheetNamcoWSG;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformNamcoWSG::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Toggle noise mode";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
|
@ -218,18 +206,9 @@ void DivPlatformNamcoWSG::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.wave.had) {
|
if (chan[i].std.wave.had) {
|
||||||
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
||||||
|
|
|
@ -96,7 +96,6 @@ class DivPlatformNamcoWSG: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformNamcoWSG();
|
~DivPlatformNamcoWSG();
|
||||||
|
|
|
@ -62,27 +62,6 @@ const char** DivPlatformNES::getRegisterSheet() {
|
||||||
return regCheatSheetNES;
|
return regCheatSheetNES;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformNES::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Write to delta modulation counter (0 to 7F)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set duty cycle/noise mode (pulse: 0 to 3; noise: 0 or 1)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xy: Sweep up (x: time; y: shift)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xy: Sweep down (x: time; y: shift)";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Select PCM/DPCM mode (0: PCM; 1: DPCM)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformNES::doWrite(unsigned short addr, unsigned char data) {
|
void DivPlatformNES::doWrite(unsigned short addr, unsigned char data) {
|
||||||
if (useNP) {
|
if (useNP) {
|
||||||
nes1_NP->Write(addr,data);
|
nes1_NP->Write(addr,data);
|
||||||
|
@ -240,28 +219,15 @@ void DivPlatformNES::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (i==3) { // noise
|
if (i==3) { // noise
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=parent->calcArp(chan[i].note,chan[i].std.arp.val);
|
||||||
chan[i].baseFreq=chan[i].std.arp.val;
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=chan[i].note+chan[i].std.arp.val;
|
|
||||||
}
|
|
||||||
if (chan[i].baseFreq>255) chan[i].baseFreq=255;
|
if (chan[i].baseFreq>255) chan[i].baseFreq=255;
|
||||||
if (chan[i].baseFreq<0) chan[i].baseFreq=0;
|
if (chan[i].baseFreq<0) chan[i].baseFreq=0;
|
||||||
} else {
|
} else {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
chan[i].duty=chan[i].std.duty.val;
|
chan[i].duty=chan[i].std.duty.val;
|
||||||
|
|
|
@ -106,7 +106,6 @@ class DivPlatformNES: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
const void* getSampleMem(int index);
|
const void* getSampleMem(int index);
|
||||||
size_t getSampleMemCapacity(int index);
|
size_t getSampleMemCapacity(int index);
|
||||||
size_t getSampleMemUsage(int index);
|
size_t getSampleMemUsage(int index);
|
||||||
|
|
|
@ -152,98 +152,6 @@ const int orderedOpsL[4]={
|
||||||
#define ADDR_FREQH 0xb0
|
#define ADDR_FREQH 0xb0
|
||||||
#define ADDR_LR_FB_ALG 0xc0
|
#define ADDR_LR_FB_ALG 0xc0
|
||||||
|
|
||||||
const char* DivPlatformOPL::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Set global AM depth (0: 1dB, 1: 4.8dB)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 3F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, 3F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set level of operator 3 (0 highest, 3F lowest; 4-op only)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set level of operator 4 (0 highest, 3F lowest; 4-op only)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 4; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Set global vibrato depth (0: normal, 1: double)";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
if (properDrumsSys) {
|
|
||||||
return "18xx: Toggle drums mode (1: enabled; 0: disabled)";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set attack of operator 3 (0 to F; 4-op only)";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set attack of operator 4 (0 to F; 4-op only)";
|
|
||||||
break;
|
|
||||||
case 0x2a:
|
|
||||||
return "2Axy: Set waveform (x: operator from 1 to 4 (0 for all ops); y: waveform from 0 to 3 in OPL2 and 0 to 7 in OPL3)";
|
|
||||||
break;
|
|
||||||
case 0x30:
|
|
||||||
return "30xx: Toggle hard envelope reset on new notes";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 4 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 4 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 4 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set vibrato (x: operator from 1 to 4 (0 for all ops); y: enabled)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set key scale level (x: operator from 1 to 4 (0 for all ops); y: level from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set envelope sustain (x: operator from 1 to 4 (0 for all ops); y: enabled)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x59:
|
|
||||||
return "59xx: Set decay of operator 3 (0 to F; 4-op only)";
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
return "5Axx: Set decay of operator 4 (0 to F; 4-op only)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxy: Set whether key will scale envelope (x: operator from 1 to 4 (0 for all ops); y: enabled)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
static short o[2];
|
static short o[2];
|
||||||
static int os[2];
|
static int os[2];
|
||||||
|
@ -389,18 +297,9 @@ void DivPlatformOPL::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note+(signed char)chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oplType==3 && chan[i].std.panL.had) {
|
if (oplType==3 && chan[i].std.panL.had) {
|
||||||
|
@ -583,18 +482,9 @@ void DivPlatformOPL::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[adpcmChan].std.arp.had) {
|
if (chan[adpcmChan].std.arp.had) {
|
||||||
if (!chan[adpcmChan].inPorta) {
|
if (!chan[adpcmChan].inPorta) {
|
||||||
if (chan[adpcmChan].std.arp.mode) {
|
chan[adpcmChan].baseFreq=NOTE_ADPCMB(parent->calcArp(chan[adpcmChan].note,chan[adpcmChan].std.arp.val));
|
||||||
chan[adpcmChan].baseFreq=NOTE_ADPCMB(chan[adpcmChan].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[adpcmChan].baseFreq=NOTE_ADPCMB(chan[adpcmChan].note+(signed char)chan[adpcmChan].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[adpcmChan].freqChanged=true;
|
chan[adpcmChan].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[adpcmChan].std.arp.mode && chan[adpcmChan].std.arp.finished) {
|
|
||||||
chan[adpcmChan].baseFreq=NOTE_ADPCMB(chan[adpcmChan].note);
|
|
||||||
chan[adpcmChan].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[adpcmChan].freqChanged) {
|
if (chan[adpcmChan].freqChanged) {
|
||||||
|
@ -1687,7 +1577,7 @@ void DivPlatformOPL::setOPLType(int type, bool drums) {
|
||||||
adpcmChan=drums?11:9;
|
adpcmChan=drums?11:9;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3: case 759:
|
case 3: case 4: case 759:
|
||||||
slotsNonDrums=slotsOPL3;
|
slotsNonDrums=slotsOPL3;
|
||||||
slotsDrums=slotsOPL3Drums;
|
slotsDrums=slotsOPL3Drums;
|
||||||
slots=drums?slotsDrums:slotsNonDrums;
|
slots=drums?slotsDrums:slotsNonDrums;
|
||||||
|
@ -1701,6 +1591,7 @@ void DivPlatformOPL::setOPLType(int type, bool drums) {
|
||||||
pretendYMU=true;
|
pretendYMU=true;
|
||||||
adpcmChan=16;
|
adpcmChan=16;
|
||||||
} else if (type==4) {
|
} else if (type==4) {
|
||||||
|
chipFreqBase=32768*684;
|
||||||
downsample=true;
|
downsample=true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -145,7 +145,6 @@ class DivPlatformOPL: public DivDispatch {
|
||||||
int getPortaFloor(int ch);
|
int getPortaFloor(int ch);
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
const void* getSampleMem(int index);
|
const void* getSampleMem(int index);
|
||||||
size_t getSampleMemCapacity(int index);
|
size_t getSampleMemCapacity(int index);
|
||||||
size_t getSampleMemUsage(int index);
|
size_t getSampleMemUsage(int index);
|
||||||
|
|
|
@ -27,68 +27,6 @@
|
||||||
|
|
||||||
#define CHIP_FREQBASE 1180068
|
#define CHIP_FREQBASE 1180068
|
||||||
|
|
||||||
const char* DivPlatformOPLL::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 3F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 2; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
if (properDrumsSys) {
|
|
||||||
return "18xx: Toggle drums mode (1: enabled; 0: disabled)";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 2 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 2 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 2 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set vibrato (x: operator from 1 to 2 (0 for all ops); y: enabled)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set key scale level (x: operator from 1 to 2 (0 for all ops); y: level from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set envelope sustain (x: operator from 1 to 2 (0 for all ops); y: enabled)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxy: Set whether key will scale envelope (x: operator from 1 to 2 (0 for all ops); y: enabled)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const unsigned char cycleMapOPLL[18]={
|
const unsigned char cycleMapOPLL[18]={
|
||||||
8, 7, 6, 7, 8, 7, 8, 6, 0, 1, 2, 7, 8, 9, 3, 4, 5, 9
|
8, 7, 6, 7, 8, 7, 8, 6, 0, 1, 2, 7, 8, 9, 3, 4, 5, 9
|
||||||
};
|
};
|
||||||
|
@ -169,18 +107,9 @@ void DivPlatformOPLL::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note+(signed char)chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.wave.had && chan[i].state.opllPreset!=16) {
|
if (chan[i].std.wave.had && chan[i].state.opllPreset!=16) {
|
||||||
|
|
|
@ -122,7 +122,6 @@ class DivPlatformOPLL: public DivDispatch {
|
||||||
int getPortaFloor(int ch);
|
int getPortaFloor(int ch);
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformOPLL();
|
~DivPlatformOPLL();
|
||||||
|
|
|
@ -53,27 +53,6 @@ const char** DivPlatformPCE::getRegisterSheet() {
|
||||||
return regCheatSheetPCE;
|
return regCheatSheetPCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformPCE::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Toggle noise mode";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Setup LFO (0: disabled; 1: 1x depth; 2: 16x depth; 3: 256x depth)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set LFO speed";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Toggle PCM mode";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
// PCM part
|
// PCM part
|
||||||
|
@ -183,28 +162,12 @@ void DivPlatformPCE::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
int noiseSeek=parent->calcArp(chan[i].note,chan[i].std.arp.val);
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
chan[i].baseFreq=NOTE_PERIODIC(noiseSeek);
|
||||||
// noise
|
|
||||||
int noiseSeek=chan[i].std.arp.val;
|
|
||||||
if (noiseSeek<0) noiseSeek=0;
|
|
||||||
chWrite(i,0x07,chan[i].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
int noiseSeek=chan[i].note+chan[i].std.arp.val;
|
|
||||||
if (noiseSeek<0) noiseSeek=0;
|
|
||||||
chWrite(i,0x07,chan[i].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
int noiseSeek=chan[i].note;
|
|
||||||
if (noiseSeek<0) noiseSeek=0;
|
if (noiseSeek<0) noiseSeek=0;
|
||||||
chWrite(i,0x07,chan[i].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0);
|
chWrite(i,0x07,chan[i].noise?(0x80|(parent->song.properNoiseLayout?(noiseSeek&31):noiseFreq[noiseSeek%12])):0);
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
}
|
||||||
|
chan[i].freqChanged=true;
|
||||||
}
|
}
|
||||||
if (chan[i].std.wave.had && !chan[i].pcm) {
|
if (chan[i].std.wave.had && !chan[i].pcm) {
|
||||||
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
||||||
|
|
|
@ -109,7 +109,6 @@ class DivPlatformPCE: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformPCE();
|
~DivPlatformPCE();
|
||||||
|
|
|
@ -83,18 +83,9 @@ void DivPlatformPCMDAC::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan.std.arp.had) {
|
if (chan.std.arp.had) {
|
||||||
if (!chan.inPorta) {
|
if (!chan.inPorta) {
|
||||||
if (chan.std.arp.mode) {
|
chan.baseFreq=NOTE_FREQUENCY(parent->calcArp(chan.note,chan.std.arp.val));
|
||||||
chan.baseFreq=NOTE_FREQUENCY(chan.std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan.baseFreq=NOTE_FREQUENCY(chan.note+chan.std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan.freqChanged=true;
|
chan.freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan.std.arp.mode && chan.std.arp.finished) {
|
|
||||||
chan.baseFreq=NOTE_FREQUENCY(chan.note);
|
|
||||||
chan.freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan.useWave && chan.std.wave.had) {
|
if (chan.useWave && chan.std.wave.had) {
|
||||||
if (chan.wave!=chan.std.wave.val || chan.ws.activeChanged()) {
|
if (chan.wave!=chan.std.wave.val || chan.ws.activeChanged()) {
|
||||||
|
|
|
@ -190,10 +190,6 @@ const char** DivPlatformPCSpeaker::getRegisterSheet() {
|
||||||
return regCheatSheetPCSpeaker;
|
return regCheatSheetPCSpeaker;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformPCSpeaker::getEffectName(unsigned char effect) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const float cut=0.05;
|
const float cut=0.05;
|
||||||
const float reso=0.06;
|
const float reso=0.06;
|
||||||
|
|
||||||
|
@ -351,18 +347,9 @@ void DivPlatformPCSpeaker::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.pitch.had) {
|
if (chan[i].std.pitch.had) {
|
||||||
if (chan[i].std.pitch.mode) {
|
if (chan[i].std.pitch.mode) {
|
||||||
|
|
|
@ -113,7 +113,6 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformPCSpeaker();
|
~DivPlatformPCSpeaker();
|
||||||
|
|
|
@ -37,15 +37,6 @@ const char** DivPlatformPET::getRegisterSheet() {
|
||||||
return regCheatSheet6522;
|
return regCheatSheet6522;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformPET::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// high-level emulation of 6522 shift register and driver software for now
|
// high-level emulation of 6522 shift register and driver software for now
|
||||||
void DivPlatformPET::rWrite(unsigned int addr, unsigned char val) {
|
void DivPlatformPET::rWrite(unsigned int addr, unsigned char val) {
|
||||||
bool hwSROutput=((regPool[11]>>2)&7)==4;
|
bool hwSROutput=((regPool[11]>>2)&7)==4;
|
||||||
|
@ -113,18 +104,9 @@ void DivPlatformPET::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan.std.arp.had) {
|
if (chan.std.arp.had) {
|
||||||
if (!chan.inPorta) {
|
if (!chan.inPorta) {
|
||||||
if (chan.std.arp.mode) {
|
chan.baseFreq=NOTE_PERIODIC(parent->calcArp(chan.note,chan.std.arp.val));
|
||||||
chan.baseFreq=NOTE_PERIODIC(chan.std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan.baseFreq=NOTE_PERIODIC(chan.note+chan.std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan.freqChanged=true;
|
chan.freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan.std.arp.mode && chan.std.arp.finished) {
|
|
||||||
chan.baseFreq=NOTE_PERIODIC(chan.note);
|
|
||||||
chan.freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan.std.wave.had) {
|
if (chan.std.wave.had) {
|
||||||
if (chan.wave!=chan.std.wave.val) {
|
if (chan.wave!=chan.std.wave.val) {
|
||||||
|
|
|
@ -80,7 +80,6 @@ class DivPlatformPET: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformPET();
|
~DivPlatformPET();
|
||||||
|
|
|
@ -249,24 +249,6 @@ const char** DivPlatformQSound::getRegisterSheet() {
|
||||||
return regCheatSheetQSound;
|
return regCheatSheetQSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformQSound::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Set echo feedback level (00 to FF)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set channel echo level (00 to FF)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Toggle QSound algorithm (0: disabled; 1: enabled)";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if ((effect & 0xf0) == 0x30) {
|
|
||||||
return "3xxx: Set echo delay buffer length (000 to AA5)";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
void DivPlatformQSound::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformQSound::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
qsound_update(&chip);
|
qsound_update(&chip);
|
||||||
|
@ -315,18 +297,9 @@ void DivPlatformQSound::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=QS_NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=QS_NOTE_FREQUENCY(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=QS_NOTE_FREQUENCY(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=QS_NOTE_FREQUENCY(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.pitch.had) {
|
if (chan[i].std.pitch.had) {
|
||||||
if (chan[i].std.pitch.mode) {
|
if (chan[i].std.pitch.mode) {
|
||||||
|
@ -365,7 +338,7 @@ void DivPlatformQSound::tick(bool sysTick) {
|
||||||
rWrite(q1_reg_map[Q1V_LOOP][i], qsound_loop);
|
rWrite(q1_reg_map[Q1V_LOOP][i], qsound_loop);
|
||||||
rWrite(q1_reg_map[Q1V_START][i], qsound_addr);
|
rWrite(q1_reg_map[Q1V_START][i], qsound_addr);
|
||||||
rWrite(q1_reg_map[Q1V_PHASE][i], 0x8000);
|
rWrite(q1_reg_map[Q1V_PHASE][i], 0x8000);
|
||||||
logV("ch %d bank=%04x, addr=%04x, end=%04x, loop=%04x!",i,qsound_bank,qsound_addr,qsound_end,qsound_loop);
|
//logV("ch %d bank=%04x, addr=%04x, end=%04x, loop=%04x!",i,qsound_bank,qsound_addr,qsound_end,qsound_loop);
|
||||||
// Write sample address. Enable volume
|
// Write sample address. Enable volume
|
||||||
if (!chan[i].std.vol.had) {
|
if (!chan[i].std.vol.had) {
|
||||||
rWrite(q1_reg_map[Q1V_VOL][i], chan[i].vol << 4);
|
rWrite(q1_reg_map[Q1V_VOL][i], chan[i].vol << 4);
|
||||||
|
|
|
@ -96,7 +96,6 @@ class DivPlatformQSound: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
const void* getSampleMem(int index = 0);
|
const void* getSampleMem(int index = 0);
|
||||||
size_t getSampleMemCapacity(int index = 0);
|
size_t getSampleMemCapacity(int index = 0);
|
||||||
size_t getSampleMemUsage(int index = 0);
|
size_t getSampleMemUsage(int index = 0);
|
||||||
|
|
|
@ -43,10 +43,6 @@ const char** DivPlatformRF5C68::getRegisterSheet() {
|
||||||
return regCheatSheetRF5C68;
|
return regCheatSheetRF5C68;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformRF5C68::getEffectName(unsigned char effect) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformRF5C68::chWrite(unsigned char ch, unsigned int addr, unsigned char val) {
|
void DivPlatformRF5C68::chWrite(unsigned char ch, unsigned int addr, unsigned char val) {
|
||||||
if (!skipRegisterWrites) {
|
if (!skipRegisterWrites) {
|
||||||
if (curChan!=ch) {
|
if (curChan!=ch) {
|
||||||
|
@ -88,18 +84,9 @@ void DivPlatformRF5C68::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FREQUENCY(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FREQUENCY(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.pitch.had) {
|
if (chan[i].std.pitch.had) {
|
||||||
if (chan[i].std.pitch.mode) {
|
if (chan[i].std.pitch.mode) {
|
||||||
|
@ -120,7 +107,7 @@ void DivPlatformRF5C68::tick(bool sysTick) {
|
||||||
chan[i].panning|=(chan[i].std.panR.val&15)<<4;
|
chan[i].panning|=(chan[i].std.panR.val&15)<<4;
|
||||||
}
|
}
|
||||||
if (chan[i].std.panL.had || chan[i].std.panR.had) {
|
if (chan[i].std.panL.had || chan[i].std.panR.had) {
|
||||||
chWrite(i,0x05,isMuted[i]?0:chan[i].panning);
|
chWrite(i,1,isMuted[i]?0:chan[i].panning);
|
||||||
}
|
}
|
||||||
if (chan[i].setPos) {
|
if (chan[i].setPos) {
|
||||||
// force keyon
|
// force keyon
|
||||||
|
|
|
@ -92,7 +92,6 @@ class DivPlatformRF5C68: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
const void* getSampleMem(int index = 0);
|
const void* getSampleMem(int index = 0);
|
||||||
size_t getSampleMemCapacity(int index = 0);
|
size_t getSampleMemCapacity(int index = 0);
|
||||||
size_t getSampleMemUsage(int index = 0);
|
size_t getSampleMemUsage(int index = 0);
|
||||||
|
|
|
@ -56,21 +56,6 @@ const char** DivPlatformSAA1099::getRegisterSheet() {
|
||||||
return regCheatSheetSAA;
|
return regCheatSheetSAA;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformSAA1099::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xy: Set channel mode (x: noise; y: tone)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set noise frequency";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Setup envelope (refer to docs for more information)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformSAA1099::acquire_saaSound(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSAA1099::acquire_saaSound(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
if (saaBufLen<len*2) {
|
if (saaBufLen<len*2) {
|
||||||
saaBufLen=len*2;
|
saaBufLen=len*2;
|
||||||
|
@ -114,18 +99,9 @@ void DivPlatformSAA1099::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
saaNoise[i/3]=chan[i].std.duty.val&3;
|
saaNoise[i/3]=chan[i].std.duty.val&3;
|
||||||
|
|
|
@ -96,7 +96,6 @@ class DivPlatformSAA1099: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,15 +80,6 @@ const char** DivPlatformSCC::getRegisterSheet() {
|
||||||
return isPlus ? regCheatSheetSCCPlus : regCheatSheetSCC;
|
return isPlus ? regCheatSheetSCCPlus : regCheatSheetSCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformSCC::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformSCC::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSCC::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
|
@ -124,18 +115,9 @@ void DivPlatformSCC::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.wave.had) {
|
if (chan[i].std.wave.had) {
|
||||||
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
||||||
|
|
|
@ -84,7 +84,6 @@ class DivPlatformSCC: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
void setFlags(unsigned int flags);
|
void setFlags(unsigned int flags);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void setChipModel(bool isPlus);
|
void setChipModel(bool isPlus);
|
||||||
|
|
|
@ -26,15 +26,6 @@
|
||||||
//#define rWrite(a,v) if (!skipRegisterWrites) {pendingWrites[a]=v;}
|
//#define rWrite(a,v) if (!skipRegisterWrites) {pendingWrites[a]=v;}
|
||||||
//#define immWrite(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} }
|
//#define immWrite(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} }
|
||||||
|
|
||||||
const char* DivPlatformSegaPCM::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set PCM frequency";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
static int os[2];
|
static int os[2];
|
||||||
|
|
||||||
|
@ -97,18 +88,9 @@ void DivPlatformSegaPCM::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=(parent->calcArp(chan[i].note,chan[i].std.arp.val)<<6);
|
||||||
chan[i].baseFreq=(chan[i].std.arp.val<<6);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=((chan[i].note+(signed char)chan[i].std.arp.val)<<6);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=(chan[i].note<<6);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.panL.had) {
|
if (chan[i].std.panL.had) {
|
||||||
|
|
|
@ -114,7 +114,6 @@ class DivPlatformSegaPCM: public DivDispatch {
|
||||||
bool isStereo();
|
bool isStereo();
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformSegaPCM();
|
~DivPlatformSegaPCM();
|
||||||
|
|
|
@ -38,15 +38,6 @@ const char** DivPlatformSMS::getRegisterSheet() {
|
||||||
return stereo?regCheatSheetGG:regCheatSheetSN;
|
return stereo?regCheatSheetGG:regCheatSheetSN;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformSMS::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x20:
|
|
||||||
return "20xy: Set noise mode (x: preset freq/ch3 freq; y: thin pulse/noise)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
int oL=0;
|
int oL=0;
|
||||||
int oR=0;
|
int oR=0;
|
||||||
|
@ -141,22 +132,12 @@ void DivPlatformSMS::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
// TODO: check whether this weird octave boundary thing applies to other systems as well
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
// TODO: add compatibility flag. this is horrible.
|
||||||
chan[i].actualNote=chan[i].std.arp.val;
|
int areYouSerious=parent->calcArp(chan[i].note,chan[i].std.arp.val);
|
||||||
} else {
|
while (areYouSerious>0x60) areYouSerious-=12;
|
||||||
// TODO: check whether this weird octave boundary thing applies to other systems as well
|
chan[i].baseFreq=NOTE_PERIODIC(areYouSerious);
|
||||||
int areYouSerious=chan[i].note+chan[i].std.arp.val;
|
chan[i].actualNote=areYouSerious;
|
||||||
while (areYouSerious>0x60) areYouSerious-=12;
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(areYouSerious);
|
|
||||||
chan[i].actualNote=areYouSerious;
|
|
||||||
}
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].actualNote=chan[i].note;
|
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +178,11 @@ void DivPlatformSMS::tick(bool sysTick) {
|
||||||
if (chan[i].freqChanged) {
|
if (chan[i].freqChanged) {
|
||||||
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true,0,chan[i].pitch2,chipClock,toneDivider);
|
chan[i].freq=parent->calcFreq(chan[i].baseFreq,chan[i].pitch,true,0,chan[i].pitch2,chipClock,toneDivider);
|
||||||
if (chan[i].freq>1023) chan[i].freq=1023;
|
if (chan[i].freq>1023) chan[i].freq=1023;
|
||||||
if (chan[i].freq<8) chan[i].freq=1;
|
if (parent->song.snNoLowPeriods) {
|
||||||
|
if (chan[i].freq<8) chan[i].freq=1;
|
||||||
|
} else {
|
||||||
|
if (chan[i].freq<0) chan[i].freq=0;
|
||||||
|
}
|
||||||
//if (chan[i].actualNote>0x5d) chan[i].freq=0x01;
|
//if (chan[i].actualNote>0x5d) chan[i].freq=0x01;
|
||||||
rWrite(0,0x80|i<<5|(chan[i].freq&15));
|
rWrite(0,0x80|i<<5|(chan[i].freq&15));
|
||||||
rWrite(0,chan[i].freq>>4);
|
rWrite(0,chan[i].freq>>4);
|
||||||
|
@ -212,7 +197,9 @@ void DivPlatformSMS::tick(bool sysTick) {
|
||||||
if (chan[3].freqChanged || updateSNMode) {
|
if (chan[3].freqChanged || updateSNMode) {
|
||||||
chan[3].freq=parent->calcFreq(chan[3].baseFreq,chan[3].pitch,true,0,chan[3].pitch2,chipClock,noiseDivider);
|
chan[3].freq=parent->calcFreq(chan[3].baseFreq,chan[3].pitch,true,0,chan[3].pitch2,chipClock,noiseDivider);
|
||||||
if (chan[3].freq>1023) chan[3].freq=1023;
|
if (chan[3].freq>1023) chan[3].freq=1023;
|
||||||
if (chan[3].actualNote>0x5d) chan[3].freq=0x01;
|
if (parent->song.snNoLowPeriods) {
|
||||||
|
if (chan[3].actualNote>0x5d) chan[3].freq=0x01;
|
||||||
|
}
|
||||||
if (snNoiseMode&2) { // take period from channel 3
|
if (snNoiseMode&2) { // take period from channel 3
|
||||||
if (updateSNMode || resetPhase) {
|
if (updateSNMode || resetPhase) {
|
||||||
if (snNoiseMode&1) {
|
if (snNoiseMode&1) {
|
||||||
|
@ -232,12 +219,8 @@ void DivPlatformSMS::tick(bool sysTick) {
|
||||||
} else { // 3 fixed values
|
} else { // 3 fixed values
|
||||||
unsigned char value;
|
unsigned char value;
|
||||||
if (chan[3].std.arp.had) {
|
if (chan[3].std.arp.had) {
|
||||||
if (chan[3].std.arp.mode) {
|
value=parent->calcArp(chan[3].note,chan[3].std.arp.val)%12;
|
||||||
value=chan[3].std.arp.val%12;
|
} else { // pardon?
|
||||||
} else {
|
|
||||||
value=(chan[3].note+chan[3].std.arp.val)%12;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
value=chan[3].note%12;
|
value=chan[3].note%12;
|
||||||
}
|
}
|
||||||
if (value<3) {
|
if (value<3) {
|
||||||
|
|
|
@ -101,7 +101,6 @@ class DivPlatformSMS: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
void setNuked(bool value);
|
void setNuked(bool value);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
|
|
|
@ -33,72 +33,6 @@ const char** DivPlatformSoundUnit::getRegisterSheet() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformSoundUnit::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Set waveform (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set pulse width (0 to 7F)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set resonance (0 to F)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set filter mode (bit 0: ring mod; bit 1: low pass; bit 2: high pass; bit 3: band pass)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set frequency sweep period low byte";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xx: Set frequency sweep period high byte";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Set volume sweep period low byte";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Set volume sweep period high byte";
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set cutoff sweep period low byte";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set cutoff sweep period high byte";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set frequency sweep boundary";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set volume sweep boundary";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set cutoff sweep boundary";
|
|
||||||
break;
|
|
||||||
case 0x1e:
|
|
||||||
return "1Exx: Set phase reset period low byte";
|
|
||||||
break;
|
|
||||||
case 0x1f:
|
|
||||||
return "1Fxx: Set phase reset period high byte";
|
|
||||||
break;
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Toggle frequency sweep (bit 0-6: speed; bit 7: direction is up)";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: Toggle volume sweep (bit 0-4: speed; bit 5: direciton is up; bit 6: loop; bit 7: alternate)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xx: Toggle cutoff sweep (bit 0-6: speed; bit 7: direction is up)";
|
|
||||||
break;
|
|
||||||
case 0x40: case 0x41: case 0x42: case 0x43:
|
|
||||||
case 0x44: case 0x45: case 0x46: case 0x47:
|
|
||||||
case 0x48: case 0x49: case 0x4a: case 0x4b:
|
|
||||||
case 0x4c: case 0x4d: case 0x4e: case 0x4f:
|
|
||||||
return "4xxx: Set cutoff (0 to FFF)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
double DivPlatformSoundUnit::NOTE_SU(int ch, int note) {
|
double DivPlatformSoundUnit::NOTE_SU(int ch, int note) {
|
||||||
if (chan[ch].switchRoles) {
|
if (chan[ch].switchRoles) {
|
||||||
return NOTE_PERIODIC(note);
|
return NOTE_PERIODIC(note);
|
||||||
|
@ -144,18 +78,9 @@ void DivPlatformSoundUnit::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_SU(i,parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_SU(i,chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_SU(i,chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_SU(i,chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
chan[i].duty=chan[i].std.duty.val;
|
chan[i].duty=chan[i].std.duty.val;
|
||||||
|
@ -432,7 +357,7 @@ int DivPlatformSoundUnit::dispatch(DivCommand c) {
|
||||||
writeControlUpper(c.chan);
|
writeControlUpper(c.chan);
|
||||||
break;
|
break;
|
||||||
case DIV_CMD_C64_FINE_CUTOFF:
|
case DIV_CMD_C64_FINE_CUTOFF:
|
||||||
chan[c.chan].baseCutoff=c.value;
|
chan[c.chan].baseCutoff=c.value*4;
|
||||||
if (!chan[c.chan].std.ex1.has) {
|
if (!chan[c.chan].std.ex1.has) {
|
||||||
chan[c.chan].cutoff=chan[c.chan].baseCutoff;
|
chan[c.chan].cutoff=chan[c.chan].baseCutoff;
|
||||||
chWrite(c.chan,0x06,chan[c.chan].cutoff&0xff);
|
chWrite(c.chan,0x06,chan[c.chan].cutoff&0xff);
|
||||||
|
|
|
@ -133,7 +133,6 @@ class DivPlatformSoundUnit: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
const void* getSampleMem(int index);
|
const void* getSampleMem(int index);
|
||||||
size_t getSampleMemCapacity(int index);
|
size_t getSampleMemCapacity(int index);
|
||||||
size_t getSampleMemUsage(int index);
|
size_t getSampleMemUsage(int index);
|
||||||
|
|
|
@ -50,27 +50,6 @@ const char** DivPlatformSwan::getRegisterSheet() {
|
||||||
return regCheatSheetWS;
|
return regCheatSheetWS;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformSwan::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Setup noise mode (0: disabled; 1-8: enabled/tap)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Setup sweep period (0: disabled; 1-20: enabled/period)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set sweep amount";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Toggle PCM mode";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformSwan::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSwan::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
// PCM part
|
// PCM part
|
||||||
|
@ -155,18 +134,9 @@ void DivPlatformSwan::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.wave.had && !(i==1 && pcm)) {
|
if (chan[i].std.wave.had && !(i==1 && pcm)) {
|
||||||
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
if (chan[i].wave!=chan[i].std.wave.val || chan[i].ws.activeChanged()) {
|
||||||
|
|
|
@ -93,7 +93,6 @@ class DivPlatformSwan: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformSwan();
|
~DivPlatformSwan();
|
||||||
|
|
|
@ -34,15 +34,6 @@ const char* regCheatSheetTIA[]={
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
const char* DivPlatformTIA::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Select shape (0 to F)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char** DivPlatformTIA::getRegisterSheet() {
|
const char** DivPlatformTIA::getRegisterSheet() {
|
||||||
return regCheatSheetTIA;
|
return regCheatSheetTIA;
|
||||||
}
|
}
|
||||||
|
@ -96,20 +87,18 @@ void DivPlatformTIA::tick(bool sysTick) {
|
||||||
rWrite(0x19+i,chan[i].outVol&15);
|
rWrite(0x19+i,chan[i].outVol&15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// TODO: the way arps work on TIA is really weird
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
if (chan[i].std.arp.val<0 && (!(chan[i].std.arp.val&0x40000000))) {
|
||||||
chan[i].baseFreq=0x80000000|chan[i].std.arp.val;
|
chan[i].baseFreq=0x80000000|(chan[i].std.arp.val|0x40000000);
|
||||||
|
} else if (chan[i].std.arp.val>=0 && chan[i].std.arp.val&0x40000000) {
|
||||||
|
chan[i].baseFreq=0x80000000|(chan[i].std.arp.val&(~0x40000000));
|
||||||
} else {
|
} else {
|
||||||
chan[i].baseFreq=(chan[i].note+chan[i].std.arp.val)<<8;
|
chan[i].baseFreq=(chan[i].note+chan[i].std.arp.val)<<8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=chan[i].note<<8;
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.wave.had) {
|
if (chan[i].std.wave.had) {
|
||||||
chan[i].shape=chan[i].std.wave.val&15;
|
chan[i].shape=chan[i].std.wave.val&15;
|
||||||
|
@ -126,13 +115,6 @@ void DivPlatformTIA::tick(bool sysTick) {
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
}
|
}
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
if (chan[i].insChanged) {
|
|
||||||
if (!chan[i].std.wave.will) {
|
|
||||||
chan[i].shape=4;
|
|
||||||
rWrite(0x15+i,chan[i].shape);
|
|
||||||
}
|
|
||||||
chan[i].insChanged=false;
|
|
||||||
}
|
|
||||||
chan[i].freq=dealWithFreq(chan[i].shape,chan[i].baseFreq,chan[i].pitch)+chan[i].pitch2;
|
chan[i].freq=dealWithFreq(chan[i].shape,chan[i].baseFreq,chan[i].pitch)+chan[i].pitch2;
|
||||||
if ((chan[i].shape==4 || chan[i].shape==5) && !(chan[i].baseFreq&0x80000000 && ((chan[i].baseFreq&0x7fffffff)<32))) {
|
if ((chan[i].shape==4 || chan[i].shape==5) && !(chan[i].baseFreq&0x80000000 && ((chan[i].baseFreq&0x7fffffff)<32))) {
|
||||||
if (chan[i].baseFreq<39*256) {
|
if (chan[i].baseFreq<39*256) {
|
||||||
|
@ -173,6 +155,13 @@ int DivPlatformTIA::dispatch(DivCommand c) {
|
||||||
if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) {
|
if (!parent->song.brokenOutVol && !chan[c.chan].std.vol.will) {
|
||||||
chan[c.chan].outVol=chan[c.chan].vol;
|
chan[c.chan].outVol=chan[c.chan].vol;
|
||||||
}
|
}
|
||||||
|
if (chan[c.chan].insChanged) {
|
||||||
|
if (!chan[c.chan].std.wave.will) {
|
||||||
|
chan[c.chan].shape=4;
|
||||||
|
rWrite(0x15+c.chan,chan[c.chan].shape);
|
||||||
|
}
|
||||||
|
chan[c.chan].insChanged=false;
|
||||||
|
}
|
||||||
if (isMuted[c.chan]) {
|
if (isMuted[c.chan]) {
|
||||||
rWrite(0x19+c.chan,0);
|
rWrite(0x19+c.chan,0);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -67,7 +67,6 @@ class DivPlatformTIA: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
};
|
};
|
||||||
|
|
|
@ -55,139 +55,6 @@ const char** DivPlatformTX81Z::getRegisterSheet() {
|
||||||
return regCheatSheetOPZ;
|
return regCheatSheetOPZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformTX81Z::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Set noise frequency (xx: value; 0 disables noise)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set level of operator 3 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set level of operator 4 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 4; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Set LFO speed";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Set LFO waveform (0 saw, 1 square, 2 triangle, 3 noise)";
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set attack of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set attack of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1e:
|
|
||||||
return "1Exx: Set AM depth (0 to 7F)";
|
|
||||||
break;
|
|
||||||
case 0x1f:
|
|
||||||
return "1Fxx: Set PM depth (0 to 7F)";
|
|
||||||
break;
|
|
||||||
case 0x28:
|
|
||||||
return "28xy: Set reverb (x: operator from 1 to 4 (0 for all ops); y: reverb from 0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x2a:
|
|
||||||
return "2Axy: Set waveform (x: operator from 1 to 4 (0 for all ops); y: waveform from 0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x2b:
|
|
||||||
return "2Bxy: Set envelope generator shift (x: operator from 1 to 4 (0 for all ops); y: shift from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x2c:
|
|
||||||
return "2Cxy: Set fine multiplier (x: operator from 1 to 4 (0 for all ops); y: fine)";
|
|
||||||
break;
|
|
||||||
case 0x2f:
|
|
||||||
return "2Fxx: Toggle hard envelope reset on new notes";
|
|
||||||
break;
|
|
||||||
case 0x30: case 0x31: case 0x32: case 0x33:
|
|
||||||
case 0x34: case 0x35: case 0x36: case 0x37:
|
|
||||||
return "3xyy: Set fixed frequency of operator 1 (x: octave from 0 to 7; y: frequency)";
|
|
||||||
break;
|
|
||||||
case 0x38: case 0x39: case 0x3a: case 0x3b:
|
|
||||||
case 0x3c: case 0x3d: case 0x3e: case 0x3f:
|
|
||||||
return "3xyy: Set fixed frequency of operator 2 (x: octave from 8 to F; y: frequency)";
|
|
||||||
break;
|
|
||||||
case 0x40: case 0x41: case 0x42: case 0x43:
|
|
||||||
case 0x44: case 0x45: case 0x46: case 0x47:
|
|
||||||
return "4xyy: Set fixed frequency of operator 3 (x: octave from 0 to 7; y: frequency)";
|
|
||||||
break;
|
|
||||||
case 0x48: case 0x49: case 0x4a: case 0x4b:
|
|
||||||
case 0x4c: case 0x4d: case 0x4e: case 0x4f:
|
|
||||||
return "4xyy: Set fixed frequency of operator 4 (x: octave from 8 to F; y: frequency)";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 4 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 4 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 4 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set detune (x: operator from 1 to 4 (0 for all ops); y: detune where 3 is center)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set envelope scale (x: operator from 1 to 4 (0 for all ops); y: scale from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set detune 2 (x: operator from 1 to 4 (0 for all ops); y: detune from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x59:
|
|
||||||
return "59xx: Set decay of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
return "5Axx: Set decay of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxx: Set decay 2 of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5c:
|
|
||||||
return "5Cxx: Set decay 2 of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5d:
|
|
||||||
return "5Dxx: Set decay 2 of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5e:
|
|
||||||
return "5Exx: Set decay 2 of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5f:
|
|
||||||
return "5Fxx: Set decay 2 of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformTX81Z::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformTX81Z::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
static int os[2];
|
static int os[2];
|
||||||
|
|
||||||
|
@ -256,18 +123,9 @@ void DivPlatformTX81Z::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_LINEAR(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_LINEAR(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_LINEAR(chan[i].note+(signed char)chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_LINEAR(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
|
|
|
@ -108,7 +108,6 @@ class DivPlatformTX81Z: public DivPlatformOPM {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformTX81Z();
|
~DivPlatformTX81Z();
|
||||||
|
|
|
@ -53,18 +53,6 @@ const char** DivPlatformVERA::getRegisterSheet() {
|
||||||
return regCheatSheetVERA;
|
return regCheatSheetVERA;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformVERA::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Change waveform";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xx: Set duty cycle (0 to 3F)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformVERA::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformVERA::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
// both PSG part and PCM part output a full 16-bit range, putting bufL/R
|
// both PSG part and PCM part output a full 16-bit range, putting bufL/R
|
||||||
// argument right into both could cause an overflow
|
// argument right into both could cause an overflow
|
||||||
|
@ -173,18 +161,9 @@ void DivPlatformVERA::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=calcNoteFreq(0,parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=calcNoteFreq(0,chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=calcNoteFreq(0,chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=calcNoteFreq(0,chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
rWriteLo(i,3,chan[i].std.duty.val);
|
rWriteLo(i,3,chan[i].std.duty.val);
|
||||||
|
@ -223,18 +202,9 @@ void DivPlatformVERA::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[16].std.arp.had) {
|
if (chan[16].std.arp.had) {
|
||||||
if (!chan[16].inPorta) {
|
if (!chan[16].inPorta) {
|
||||||
if (chan[16].std.arp.mode) {
|
chan[16].baseFreq=calcNoteFreq(16,parent->calcArp(chan[16].note,chan[16].std.arp.val));
|
||||||
chan[16].baseFreq=calcNoteFreq(16,chan[16].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[16].baseFreq=calcNoteFreq(16,chan[16].note+chan[16].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[16].freqChanged=true;
|
chan[16].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[16].std.arp.mode && chan[16].std.arp.finished) {
|
|
||||||
chan[16].baseFreq=calcNoteFreq(16,chan[16].note);
|
|
||||||
chan[16].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[16].freqChanged) {
|
if (chan[16].freqChanged) {
|
||||||
double off=65536.0;
|
double off=65536.0;
|
||||||
|
|
|
@ -79,7 +79,6 @@ class DivPlatformVERA: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformVERA();
|
~DivPlatformVERA();
|
||||||
|
|
|
@ -39,15 +39,6 @@ const char** DivPlatformVIC20::getRegisterSheet() {
|
||||||
return regCheatSheetVIC;
|
return regCheatSheetVIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformVIC20::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformVIC20::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformVIC20::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
const unsigned char loadFreq[3] = {0x7e, 0x7d, 0x7b};
|
const unsigned char loadFreq[3] = {0x7e, 0x7d, 0x7b};
|
||||||
const unsigned char wavePatterns[16] = {
|
const unsigned char wavePatterns[16] = {
|
||||||
|
@ -103,18 +94,9 @@ void DivPlatformVIC20::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.wave.had) {
|
if (chan[i].std.wave.had) {
|
||||||
if (chan[i].wave!=chan[i].std.wave.val) {
|
if (chan[i].wave!=chan[i].std.wave.val) {
|
||||||
|
|
|
@ -82,7 +82,6 @@ class DivPlatformVIC20: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformVIC20();
|
~DivPlatformVIC20();
|
||||||
|
|
|
@ -46,18 +46,6 @@ const char** DivPlatformVRC6::getRegisterSheet() {
|
||||||
return regCheatSheetVRC6;
|
return regCheatSheetVRC6;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformVRC6::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set duty cycle (pulse: 0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Toggle PCM mode (pulse channel)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformVRC6::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformVRC6::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=start; i<start+len; i++) {
|
||||||
// PCM part
|
// PCM part
|
||||||
|
@ -165,18 +153,9 @@ void DivPlatformVRC6::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_PERIODIC(parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_PERIODIC(chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (chan[i].std.duty.had) {
|
if (chan[i].std.duty.had) {
|
||||||
chan[i].duty=chan[i].std.duty.val;
|
chan[i].duty=chan[i].std.duty.val;
|
||||||
|
|
|
@ -99,7 +99,6 @@ class DivPlatformVRC6: public DivDispatch {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
DivPlatformVRC6() : vrc6(intf) {};
|
DivPlatformVRC6() : vrc6(intf) {};
|
||||||
|
|
|
@ -205,39 +205,6 @@ const char** DivPlatformX1_010::getRegisterSheet() {
|
||||||
return regCheatSheetX1_010;
|
return regCheatSheetX1_010;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformX1_010::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xx: Change waveform";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Change envelope shape";
|
|
||||||
break;
|
|
||||||
case 0x17:
|
|
||||||
return "17xx: Toggle PCM mode";
|
|
||||||
break;
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set PCM frequency (1 to FF)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xx: Set envelope mode (bit 0: enable, bit 1: one-shot, bit 2: split shape to L/R, bit 3/5: H.invert right/left, bit 4/6: V.invert right/left)";
|
|
||||||
break;
|
|
||||||
case 0x23:
|
|
||||||
return "23xx: Set envelope period";
|
|
||||||
break;
|
|
||||||
case 0x25:
|
|
||||||
return "25xx: Envelope slide up";
|
|
||||||
break;
|
|
||||||
case 0x26:
|
|
||||||
return "26xx: Envelope slide down";
|
|
||||||
break;
|
|
||||||
case 0x29:
|
|
||||||
return "29xy: Set auto-envelope (x: numerator; y: denominator)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformX1_010::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformX1_010::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=start; h<start+len; h++) {
|
||||||
x1_010->tick();
|
x1_010->tick();
|
||||||
|
@ -354,18 +321,9 @@ void DivPlatformX1_010::tick(bool sysTick) {
|
||||||
if ((!chan[i].pcm) || chan[i].furnacePCM) {
|
if ((!chan[i].pcm) || chan[i].furnacePCM) {
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NoteX1_010(i,parent->calcArp(chan[i].note,chan[i].std.arp.val));
|
||||||
chan[i].baseFreq=NoteX1_010(i,chan[i].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NoteX1_010(i,chan[i].note+chan[i].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NoteX1_010(i,chan[i].note);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[i].std.wave.had && !chan[i].pcm) {
|
if (chan[i].std.wave.had && !chan[i].pcm) {
|
||||||
|
|
|
@ -149,7 +149,6 @@ class DivPlatformX1_010: public DivDispatch {
|
||||||
size_t getSampleMemUsage(int index = 0);
|
size_t getSampleMemUsage(int index = 0);
|
||||||
void renderSamples();
|
void renderSamples();
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
~DivPlatformX1_010();
|
~DivPlatformX1_010();
|
||||||
|
|
|
@ -156,123 +156,6 @@ const char** DivPlatformYM2203::getRegisterSheet() {
|
||||||
return regCheatSheetYM2203;
|
return regCheatSheetYM2203;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformYM2203::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set level of operator 3 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set level of operator 4 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 4; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Toggle extended channel 3 mode";
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set attack of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set attack of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set SSG channel mode (bit 0: square; bit 1: noise; bit 2: envelope)";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: Set SSG noise frequency (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xy: Set SSG envelope mode (x: shape, y: enable for this channel)";
|
|
||||||
break;
|
|
||||||
case 0x23:
|
|
||||||
return "23xx: Set SSG envelope period low byte";
|
|
||||||
break;
|
|
||||||
case 0x24:
|
|
||||||
return "24xx: Set SSG envelope period high byte";
|
|
||||||
break;
|
|
||||||
case 0x25:
|
|
||||||
return "25xx: SSG envelope slide up";
|
|
||||||
break;
|
|
||||||
case 0x26:
|
|
||||||
return "26xx: SSG envelope slide down";
|
|
||||||
break;
|
|
||||||
case 0x29:
|
|
||||||
return "29xy: Set SSG auto-envelope (x: numerator; y: denominator)";
|
|
||||||
break;
|
|
||||||
case 0x30:
|
|
||||||
return "30xx: Toggle hard envelope reset on new notes";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 4 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 4 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 4 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set detune (x: operator from 1 to 4 (0 for all ops); y: detune where 3 is center)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set envelope scale (x: operator from 1 to 4 (0 for all ops); y: scale from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set SSG envelope (x: operator from 1 to 4 (0 for all ops); y: 0-7 on, 8 off)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x59:
|
|
||||||
return "59xx: Set decay of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
return "5Axx: Set decay of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxx: Set decay 2 of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5c:
|
|
||||||
return "5Cxx: Set decay 2 of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5d:
|
|
||||||
return "5Dxx: Set decay 2 of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5e:
|
|
||||||
return "5Exx: Set decay 2 of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5f:
|
|
||||||
return "5Fxx: Set decay 2 of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DivPlatformYM2203::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformYM2203::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
||||||
static int os;
|
static int os;
|
||||||
|
|
||||||
|
@ -348,18 +231,9 @@ void DivPlatformYM2203::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].std.arp.val,11);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note+(signed char)chan[i].std.arp.val,11);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note,11);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.pitch.had) {
|
if (chan[i].std.pitch.had) {
|
||||||
|
|
|
@ -114,7 +114,6 @@ class DivPlatformYM2203: public DivPlatformOPN {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
void setFlags(unsigned int flags);
|
void setFlags(unsigned int flags);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
|
|
|
@ -279,126 +279,6 @@ const char** DivPlatformYM2608::getRegisterSheet() {
|
||||||
return regCheatSheetYM2608;
|
return regCheatSheetYM2608;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformYM2608::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xy: Setup LFO (x: enable; y: speed)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set level of operator 3 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set level of operator 4 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 4; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Toggle extended channel 3 mode";
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set attack of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set attack of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set SSG channel mode (bit 0: square; bit 1: noise; bit 2: envelope)";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: Set SSG noise frequency (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xy: Set SSG envelope mode (x: shape, y: enable for this channel)";
|
|
||||||
break;
|
|
||||||
case 0x23:
|
|
||||||
return "23xx: Set SSG envelope period low byte";
|
|
||||||
break;
|
|
||||||
case 0x24:
|
|
||||||
return "24xx: Set SSG envelope period high byte";
|
|
||||||
break;
|
|
||||||
case 0x25:
|
|
||||||
return "25xx: SSG envelope slide up";
|
|
||||||
break;
|
|
||||||
case 0x26:
|
|
||||||
return "26xx: SSG envelope slide down";
|
|
||||||
break;
|
|
||||||
case 0x29:
|
|
||||||
return "29xy: Set SSG auto-envelope (x: numerator; y: denominator)";
|
|
||||||
break;
|
|
||||||
case 0x30:
|
|
||||||
return "30xx: Toggle hard envelope reset on new notes";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 4 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 4 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 4 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set detune (x: operator from 1 to 4 (0 for all ops); y: detune where 3 is center)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set envelope scale (x: operator from 1 to 4 (0 for all ops); y: scale from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set SSG envelope (x: operator from 1 to 4 (0 for all ops); y: 0-7 on, 8 off)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x59:
|
|
||||||
return "59xx: Set decay of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
return "5Axx: Set decay of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxx: Set decay 2 of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5c:
|
|
||||||
return "5Cxx: Set decay 2 of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5d:
|
|
||||||
return "5Dxx: Set decay 2 of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5e:
|
|
||||||
return "5Exx: Set decay 2 of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5f:
|
|
||||||
return "5Fxx: Set decay 2 of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
double DivPlatformYM2608::NOTE_OPNB(int ch, int note) {
|
double DivPlatformYM2608::NOTE_OPNB(int ch, int note) {
|
||||||
if (ch>8) { // ADPCM-B
|
if (ch>8) { // ADPCM-B
|
||||||
return NOTE_ADPCMB(note);
|
return NOTE_ADPCMB(note);
|
||||||
|
@ -506,18 +386,9 @@ void DivPlatformYM2608::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].std.arp.val,11);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note+(signed char)chan[i].std.arp.val,11);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note,11);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.panL.had) {
|
if (chan[i].std.panL.had) {
|
||||||
|
@ -658,18 +529,9 @@ void DivPlatformYM2608::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[15].std.arp.had) {
|
if (chan[15].std.arp.had) {
|
||||||
if (!chan[15].inPorta) {
|
if (!chan[15].inPorta) {
|
||||||
if (chan[15].std.arp.mode) {
|
chan[15].baseFreq=NOTE_ADPCMB(parent->calcArp(chan[15].note,chan[15].std.arp.val));
|
||||||
chan[15].baseFreq=NOTE_ADPCMB(chan[15].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[15].baseFreq=NOTE_ADPCMB(chan[15].note+(signed char)chan[15].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[15].freqChanged=true;
|
chan[15].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[15].std.arp.mode && chan[15].std.arp.finished) {
|
|
||||||
chan[15].baseFreq=NOTE_ADPCMB(chan[15].note);
|
|
||||||
chan[15].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[15].freqChanged) {
|
if (chan[15].freqChanged) {
|
||||||
|
|
|
@ -127,7 +127,6 @@ class DivPlatformYM2608: public DivPlatformOPN {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
const void* getSampleMem(int index);
|
const void* getSampleMem(int index);
|
||||||
size_t getSampleMemCapacity(int index);
|
size_t getSampleMemCapacity(int index);
|
||||||
size_t getSampleMemUsage(int index);
|
size_t getSampleMemUsage(int index);
|
||||||
|
|
|
@ -318,126 +318,6 @@ const char** DivPlatformYM2610::getRegisterSheet() {
|
||||||
return regCheatSheetYM2610;
|
return regCheatSheetYM2610;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformYM2610::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xy: Setup LFO (x: enable; y: speed)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set level of operator 3 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set level of operator 4 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 4; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Toggle extended channel 3 mode";
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set attack of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set attack of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set SSG channel mode (bit 0: square; bit 1: noise; bit 2: envelope)";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: Set SSG noise frequency (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xy: Set SSG envelope mode (x: shape, y: enable for this channel)";
|
|
||||||
break;
|
|
||||||
case 0x23:
|
|
||||||
return "23xx: Set SSG envelope period low byte";
|
|
||||||
break;
|
|
||||||
case 0x24:
|
|
||||||
return "24xx: Set SSG envelope period high byte";
|
|
||||||
break;
|
|
||||||
case 0x25:
|
|
||||||
return "25xx: SSG envelope slide up";
|
|
||||||
break;
|
|
||||||
case 0x26:
|
|
||||||
return "26xx: SSG envelope slide down";
|
|
||||||
break;
|
|
||||||
case 0x29:
|
|
||||||
return "29xy: Set SSG auto-envelope (x: numerator; y: denominator)";
|
|
||||||
break;
|
|
||||||
case 0x30:
|
|
||||||
return "30xx: Toggle hard envelope reset on new notes";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 4 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 4 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 4 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set detune (x: operator from 1 to 4 (0 for all ops); y: detune where 3 is center)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set envelope scale (x: operator from 1 to 4 (0 for all ops); y: scale from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set SSG envelope (x: operator from 1 to 4 (0 for all ops); y: 0-7 on, 8 off)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x59:
|
|
||||||
return "59xx: Set decay of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
return "5Axx: Set decay of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxx: Set decay 2 of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5c:
|
|
||||||
return "5Cxx: Set decay 2 of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5d:
|
|
||||||
return "5Dxx: Set decay 2 of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5e:
|
|
||||||
return "5Exx: Set decay 2 of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5f:
|
|
||||||
return "5Fxx: Set decay 2 of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
double DivPlatformYM2610::NOTE_OPNB(int ch, int note) {
|
double DivPlatformYM2610::NOTE_OPNB(int ch, int note) {
|
||||||
if (ch>6) { // ADPCM
|
if (ch>6) { // ADPCM
|
||||||
return NOTE_ADPCMB(note);
|
return NOTE_ADPCMB(note);
|
||||||
|
@ -547,18 +427,9 @@ void DivPlatformYM2610::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].std.arp.val,11);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note+(signed char)chan[i].std.arp.val,11);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note,11);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.panL.had) {
|
if (chan[i].std.panL.had) {
|
||||||
|
@ -700,18 +571,9 @@ void DivPlatformYM2610::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[13].std.arp.had) {
|
if (chan[13].std.arp.had) {
|
||||||
if (!chan[13].inPorta) {
|
if (!chan[13].inPorta) {
|
||||||
if (chan[13].std.arp.mode) {
|
chan[13].baseFreq=NOTE_ADPCMB(parent->calcArp(chan[13].note,chan[13].std.arp.val));
|
||||||
chan[13].baseFreq=NOTE_ADPCMB(chan[13].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[13].baseFreq=NOTE_ADPCMB(chan[13].note+(signed char)chan[13].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[13].freqChanged=true;
|
chan[13].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[13].std.arp.mode && chan[13].std.arp.finished) {
|
|
||||||
chan[13].baseFreq=NOTE_ADPCMB(chan[13].note);
|
|
||||||
chan[13].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[13].freqChanged) {
|
if (chan[13].freqChanged) {
|
||||||
|
|
|
@ -145,7 +145,6 @@ class DivPlatformYM2610: public DivPlatformYM2610Base {
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
void poke(std::vector<DivRegWrite>& wlist);
|
void poke(std::vector<DivRegWrite>& wlist);
|
||||||
const char** getRegisterSheet();
|
const char** getRegisterSheet();
|
||||||
const char* getEffectName(unsigned char effect);
|
|
||||||
void setFlags(unsigned int flags);
|
void setFlags(unsigned int flags);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
int init(DivEngine* parent, int channels, int sugRate, unsigned int flags);
|
||||||
void quit();
|
void quit();
|
||||||
|
|
|
@ -302,126 +302,6 @@ const char** DivPlatformYM2610B::getRegisterSheet() {
|
||||||
return regCheatSheetYM2610B;
|
return regCheatSheetYM2610B;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* DivPlatformYM2610B::getEffectName(unsigned char effect) {
|
|
||||||
switch (effect) {
|
|
||||||
case 0x10:
|
|
||||||
return "10xy: Setup LFO (x: enable; y: speed)";
|
|
||||||
break;
|
|
||||||
case 0x11:
|
|
||||||
return "11xx: Set feedback (0 to 7)";
|
|
||||||
break;
|
|
||||||
case 0x12:
|
|
||||||
return "12xx: Set level of operator 1 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x13:
|
|
||||||
return "13xx: Set level of operator 2 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x14:
|
|
||||||
return "14xx: Set level of operator 3 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x15:
|
|
||||||
return "15xx: Set level of operator 4 (0 highest, 7F lowest)";
|
|
||||||
break;
|
|
||||||
case 0x16:
|
|
||||||
return "16xy: Set operator multiplier (x: operator from 1 to 4; y: multiplier)";
|
|
||||||
break;
|
|
||||||
case 0x18:
|
|
||||||
return "18xx: Toggle extended channel 3 mode";
|
|
||||||
break;
|
|
||||||
case 0x19:
|
|
||||||
return "19xx: Set attack of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1a:
|
|
||||||
return "1Axx: Set attack of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1b:
|
|
||||||
return "1Bxx: Set attack of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1c:
|
|
||||||
return "1Cxx: Set attack of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x1d:
|
|
||||||
return "1Dxx: Set attack of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x20:
|
|
||||||
return "20xx: Set SSG channel mode (bit 0: square; bit 1: noise; bit 2: envelope)";
|
|
||||||
break;
|
|
||||||
case 0x21:
|
|
||||||
return "21xx: Set SSG noise frequency (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x22:
|
|
||||||
return "22xy: Set SSG envelope mode (x: shape, y: enable for this channel)";
|
|
||||||
break;
|
|
||||||
case 0x23:
|
|
||||||
return "23xx: Set SSG envelope period low byte";
|
|
||||||
break;
|
|
||||||
case 0x24:
|
|
||||||
return "24xx: Set SSG envelope period high byte";
|
|
||||||
break;
|
|
||||||
case 0x25:
|
|
||||||
return "25xx: SSG envelope slide up";
|
|
||||||
break;
|
|
||||||
case 0x26:
|
|
||||||
return "26xx: SSG envelope slide down";
|
|
||||||
break;
|
|
||||||
case 0x29:
|
|
||||||
return "29xy: Set SSG auto-envelope (x: numerator; y: denominator)";
|
|
||||||
break;
|
|
||||||
case 0x30:
|
|
||||||
return "30xx: Toggle hard envelope reset on new notes";
|
|
||||||
break;
|
|
||||||
case 0x50:
|
|
||||||
return "50xy: Set AM (x: operator from 1 to 4 (0 for all ops); y: AM)";
|
|
||||||
break;
|
|
||||||
case 0x51:
|
|
||||||
return "51xy: Set sustain level (x: operator from 1 to 4 (0 for all ops); y: sustain)";
|
|
||||||
break;
|
|
||||||
case 0x52:
|
|
||||||
return "52xy: Set release (x: operator from 1 to 4 (0 for all ops); y: release)";
|
|
||||||
break;
|
|
||||||
case 0x53:
|
|
||||||
return "53xy: Set detune (x: operator from 1 to 4 (0 for all ops); y: detune where 3 is center)";
|
|
||||||
break;
|
|
||||||
case 0x54:
|
|
||||||
return "54xy: Set envelope scale (x: operator from 1 to 4 (0 for all ops); y: scale from 0 to 3)";
|
|
||||||
break;
|
|
||||||
case 0x55:
|
|
||||||
return "55xy: Set SSG envelope (x: operator from 1 to 4 (0 for all ops); y: 0-7 on, 8 off)";
|
|
||||||
break;
|
|
||||||
case 0x56:
|
|
||||||
return "56xx: Set decay of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x57:
|
|
||||||
return "57xx: Set decay of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x58:
|
|
||||||
return "58xx: Set decay of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x59:
|
|
||||||
return "59xx: Set decay of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5a:
|
|
||||||
return "5Axx: Set decay of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5b:
|
|
||||||
return "5Bxx: Set decay 2 of all operators (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5c:
|
|
||||||
return "5Cxx: Set decay 2 of operator 1 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5d:
|
|
||||||
return "5Dxx: Set decay 2 of operator 2 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5e:
|
|
||||||
return "5Exx: Set decay 2 of operator 3 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
case 0x5f:
|
|
||||||
return "5Fxx: Set decay 2 of operator 4 (0 to 1F)";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
double DivPlatformYM2610B::NOTE_OPNB(int ch, int note) {
|
double DivPlatformYM2610B::NOTE_OPNB(int ch, int note) {
|
||||||
if (ch>8) { // ADPCM-B
|
if (ch>8) { // ADPCM-B
|
||||||
return NOTE_ADPCMB(note);
|
return NOTE_ADPCMB(note);
|
||||||
|
@ -530,18 +410,9 @@ void DivPlatformYM2610B::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[i].std.arp.had) {
|
if (chan[i].std.arp.had) {
|
||||||
if (!chan[i].inPorta) {
|
if (!chan[i].inPorta) {
|
||||||
if (chan[i].std.arp.mode) {
|
chan[i].baseFreq=NOTE_FNUM_BLOCK(parent->calcArp(chan[i].note,chan[i].std.arp.val),11);
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].std.arp.val,11);
|
|
||||||
} else {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note+(signed char)chan[i].std.arp.val,11);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[i].freqChanged=true;
|
chan[i].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[i].std.arp.mode && chan[i].std.arp.finished) {
|
|
||||||
chan[i].baseFreq=NOTE_FNUM_BLOCK(chan[i].note,11);
|
|
||||||
chan[i].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.panL.had) {
|
if (chan[i].std.panL.had) {
|
||||||
|
@ -682,18 +553,9 @@ void DivPlatformYM2610B::tick(bool sysTick) {
|
||||||
|
|
||||||
if (chan[15].std.arp.had) {
|
if (chan[15].std.arp.had) {
|
||||||
if (!chan[15].inPorta) {
|
if (!chan[15].inPorta) {
|
||||||
if (chan[15].std.arp.mode) {
|
chan[15].baseFreq=NOTE_ADPCMB(parent->calcArp(chan[15].note,chan[15].std.arp.val));
|
||||||
chan[15].baseFreq=NOTE_ADPCMB(chan[15].std.arp.val);
|
|
||||||
} else {
|
|
||||||
chan[15].baseFreq=NOTE_ADPCMB(chan[15].note+(signed char)chan[15].std.arp.val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
chan[15].freqChanged=true;
|
chan[15].freqChanged=true;
|
||||||
} else {
|
|
||||||
if (chan[15].std.arp.mode && chan[15].std.arp.finished) {
|
|
||||||
chan[15].baseFreq=NOTE_ADPCMB(chan[15].note);
|
|
||||||
chan[15].freqChanged=true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (chan[15].freqChanged) {
|
if (chan[15].freqChanged) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue