Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
/**
|
|
|
|
* Furnace Tracker - multi-system chiptune tracker
|
|
|
|
* Copyright (C) 2021-2022 tildearrow and contributors
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _YM2610SHARED_H
|
|
|
|
#define _YM2610SHARED_H
|
2022-12-13 07:22:48 +00:00
|
|
|
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
#include "fmshared_OPN.h"
|
|
|
|
#include "../engine.h"
|
|
|
|
#include "../../ta-log.h"
|
|
|
|
#include "ay.h"
|
|
|
|
#include "sound/ymfm/ymfm.h"
|
|
|
|
#include "sound/ymfm/ymfm_opn.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define CHIP_FREQBASE fmFreqBase
|
|
|
|
#define CHIP_DIVIDER fmDivBase
|
|
|
|
|
|
|
|
class DivYM2610Interface: public ymfm::ymfm_interface {
|
|
|
|
public:
|
|
|
|
unsigned char* adpcmAMem;
|
|
|
|
unsigned char* adpcmBMem;
|
|
|
|
int sampleBank;
|
|
|
|
uint8_t ymfm_external_read(ymfm::access_class type, uint32_t address);
|
|
|
|
void ymfm_external_write(ymfm::access_class type, uint32_t address, uint8_t data);
|
|
|
|
DivYM2610Interface():
|
|
|
|
adpcmAMem(NULL),
|
|
|
|
adpcmBMem(NULL),
|
|
|
|
sampleBank(0) {}
|
|
|
|
};
|
|
|
|
|
2022-08-27 09:22:36 +00:00
|
|
|
template<int ChanNum> class DivPlatformYM2610Base: public DivPlatformOPN {
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
protected:
|
2022-12-04 10:58:58 +00:00
|
|
|
OPNChannelStereo chan[ChanNum];
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
DivDispatchOscBuffer* oscBuf[ChanNum];
|
|
|
|
bool isMuted[ChanNum];
|
|
|
|
|
|
|
|
ymfm::ym2610b* fm;
|
|
|
|
ymfm::ym2610b::output_data fmout;
|
|
|
|
DivPlatformAY8910* ay;
|
|
|
|
|
|
|
|
unsigned char* adpcmAMem;
|
|
|
|
size_t adpcmAMemLen;
|
|
|
|
unsigned char* adpcmBMem;
|
|
|
|
size_t adpcmBMemLen;
|
|
|
|
DivYM2610Interface iface;
|
|
|
|
|
2022-09-26 01:07:21 +00:00
|
|
|
unsigned int sampleOffA[256];
|
|
|
|
unsigned int sampleOffB[256];
|
|
|
|
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
unsigned char sampleBank;
|
|
|
|
|
2022-11-07 23:39:04 +00:00
|
|
|
bool extMode, noExtMacros;
|
2022-11-26 23:44:04 +00:00
|
|
|
|
|
|
|
bool sampleLoaded[2][256];
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
|
|
|
|
unsigned char writeADPCMAOff, writeADPCMAOn;
|
|
|
|
int globalADPCMAVolume;
|
|
|
|
|
|
|
|
const int extChanOffs, psgChanOffs, adpcmAChanOffs, adpcmBChanOffs;
|
|
|
|
const int chanNum=ChanNum;
|
|
|
|
|
|
|
|
double NOTE_OPNB(int ch, int note) {
|
|
|
|
if (ch>=adpcmBChanOffs) { // ADPCM
|
|
|
|
return NOTE_ADPCMB(note);
|
|
|
|
} else if (ch>=psgChanOffs) { // PSG
|
|
|
|
return NOTE_PERIODIC(note);
|
|
|
|
}
|
|
|
|
// FM
|
|
|
|
return NOTE_FNUM_BLOCK(note,11);
|
|
|
|
}
|
|
|
|
double NOTE_ADPCMB(int note) {
|
|
|
|
if (chan[adpcmBChanOffs].sample>=0 && chan[adpcmBChanOffs].sample<parent->song.sampleLen) {
|
|
|
|
double off=65535.0*(double)(parent->getSample(chan[adpcmBChanOffs].sample)->centerRate)/8363.0;
|
|
|
|
return parent->calcBaseFreq((double)chipClock/144,off,note,false);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
public:
|
|
|
|
void reset() {
|
|
|
|
writeADPCMAOff=0;
|
|
|
|
writeADPCMAOn=0;
|
|
|
|
globalADPCMAVolume=0x3f;
|
|
|
|
|
|
|
|
ay->reset();
|
|
|
|
ay->getRegisterWrites().clear();
|
|
|
|
ay->flushWrites();
|
|
|
|
}
|
|
|
|
|
|
|
|
void muteChannel(int ch, bool mute) {
|
|
|
|
isMuted[ch]=mute;
|
|
|
|
if (ch>=adpcmBChanOffs) { // ADPCM-B
|
|
|
|
immWrite(0x11,isMuted[ch]?0:(chan[ch].pan<<6));
|
|
|
|
}
|
|
|
|
if (ch>=adpcmAChanOffs) { // ADPCM-A
|
|
|
|
immWrite(0x108+(ch-adpcmAChanOffs),isMuted[ch]?0:((chan[ch].pan<<6)|chan[ch].outVol));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (ch>=psgChanOffs) { // PSG
|
|
|
|
ay->muteChannel(ch-psgChanOffs,mute);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isStereo() {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
const void* getSampleMem(int index) {
|
|
|
|
return index == 0 ? adpcmAMem : index == 1 ? adpcmBMem : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t getSampleMemCapacity(int index) {
|
|
|
|
return index == 0 ? 16777216 : index == 1 ? 16777216 : 0;
|
|
|
|
}
|
|
|
|
|
2022-11-27 03:11:49 +00:00
|
|
|
const char* getSampleMemName(int index=0) {
|
|
|
|
return index == 0 ? "ADPCM-A" : index == 1 ? "ADPCM-B" : NULL;
|
|
|
|
}
|
|
|
|
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
size_t getSampleMemUsage(int index) {
|
|
|
|
return index == 0 ? adpcmAMemLen : index == 1 ? adpcmBMemLen : 0;
|
|
|
|
}
|
|
|
|
|
2022-11-26 23:44:04 +00:00
|
|
|
bool isSampleLoaded(int index, int sample) {
|
|
|
|
if (index<0 || index>1) return false;
|
|
|
|
if (sample<0 || sample>255) return false;
|
|
|
|
return sampleLoaded[index][sample];
|
|
|
|
}
|
|
|
|
|
2022-11-27 04:50:20 +00:00
|
|
|
void renderSamples(int sysID) {
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
memset(adpcmAMem,0,getSampleMemCapacity(0));
|
2022-09-26 01:07:21 +00:00
|
|
|
memset(sampleOffA,0,256*sizeof(unsigned int));
|
|
|
|
memset(sampleOffB,0,256*sizeof(unsigned int));
|
2022-11-26 23:44:04 +00:00
|
|
|
memset(sampleLoaded,0,256*2*sizeof(bool));
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
|
|
|
|
size_t memPos=0;
|
|
|
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
|
|
|
DivSample* s=parent->song.sample[i];
|
2022-11-27 04:50:20 +00:00
|
|
|
if (!s->renderOn[0][sysID]) {
|
|
|
|
sampleOffA[i]=0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
int paddedLen=(s->lengthA+255)&(~0xff);
|
|
|
|
if ((memPos&0xf00000)!=((memPos+paddedLen)&0xf00000)) {
|
|
|
|
memPos=(memPos+0xfffff)&0xf00000;
|
|
|
|
}
|
|
|
|
if (memPos>=getSampleMemCapacity(0)) {
|
|
|
|
logW("out of ADPCM-A memory for sample %d!",i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (memPos+paddedLen>=getSampleMemCapacity(0)) {
|
|
|
|
memcpy(adpcmAMem+memPos,s->dataA,getSampleMemCapacity(0)-memPos);
|
|
|
|
logW("out of ADPCM-A memory for sample %d!",i);
|
|
|
|
} else {
|
|
|
|
memcpy(adpcmAMem+memPos,s->dataA,paddedLen);
|
2022-11-27 03:11:49 +00:00
|
|
|
sampleLoaded[0][i]=true;
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
}
|
2022-09-26 01:07:21 +00:00
|
|
|
sampleOffA[i]=memPos;
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
memPos+=paddedLen;
|
|
|
|
}
|
|
|
|
adpcmAMemLen=memPos+256;
|
|
|
|
|
|
|
|
memset(adpcmBMem,0,getSampleMemCapacity(1));
|
|
|
|
|
|
|
|
memPos=0;
|
|
|
|
for (int i=0; i<parent->song.sampleLen; i++) {
|
|
|
|
DivSample* s=parent->song.sample[i];
|
2022-11-27 04:50:20 +00:00
|
|
|
if (!s->renderOn[1][sysID]) {
|
|
|
|
sampleOffB[i]=0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
int paddedLen=(s->lengthB+255)&(~0xff);
|
|
|
|
if ((memPos&0xf00000)!=((memPos+paddedLen)&0xf00000)) {
|
|
|
|
memPos=(memPos+0xfffff)&0xf00000;
|
|
|
|
}
|
|
|
|
if (memPos>=getSampleMemCapacity(1)) {
|
|
|
|
logW("out of ADPCM-B memory for sample %d!",i);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (memPos+paddedLen>=getSampleMemCapacity(1)) {
|
|
|
|
memcpy(adpcmBMem+memPos,s->dataB,getSampleMemCapacity(1)-memPos);
|
|
|
|
logW("out of ADPCM-B memory for sample %d!",i);
|
|
|
|
} else {
|
|
|
|
memcpy(adpcmBMem+memPos,s->dataB,paddedLen);
|
2022-11-27 03:11:49 +00:00
|
|
|
sampleLoaded[1][i]=true;
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
}
|
2022-09-26 01:07:21 +00:00
|
|
|
sampleOffB[i]=memPos;
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
memPos+=paddedLen;
|
|
|
|
}
|
|
|
|
adpcmBMemLen=memPos+256;
|
|
|
|
}
|
|
|
|
|
2022-09-30 01:13:40 +00:00
|
|
|
void setFlags(const DivConfig& flags) {
|
|
|
|
switch (flags.getInt("clockSel",0)) {
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
case 0x01:
|
|
|
|
chipClock=24167829/3;
|
|
|
|
break;
|
2022-09-30 01:13:40 +00:00
|
|
|
default:
|
|
|
|
chipClock=8000000.0;
|
|
|
|
break;
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
}
|
2022-12-04 07:04:42 +00:00
|
|
|
CHECK_CUSTOM_CLOCK;
|
2022-11-07 23:39:04 +00:00
|
|
|
noExtMacros=flags.getBool("noExtMacros",false);
|
2022-09-24 00:01:01 +00:00
|
|
|
rate=chipClock/16;
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
for (int i=0; i<ChanNum; i++) {
|
|
|
|
oscBuf[i]->rate=rate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-30 01:13:40 +00:00
|
|
|
int init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
parent=p;
|
2022-09-30 01:13:40 +00:00
|
|
|
ayFlags.set("chipType",1);
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
dumpWrites=false;
|
|
|
|
skipRegisterWrites=false;
|
|
|
|
for (int i=0; i<ChanNum; i++) {
|
|
|
|
isMuted[i]=false;
|
|
|
|
oscBuf[i]=new DivDispatchOscBuffer;
|
|
|
|
}
|
|
|
|
adpcmAMem=new unsigned char[getSampleMemCapacity(0)];
|
|
|
|
adpcmAMemLen=0;
|
|
|
|
adpcmBMem=new unsigned char[getSampleMemCapacity(1)];
|
|
|
|
adpcmBMemLen=0;
|
|
|
|
iface.adpcmAMem=adpcmAMem;
|
|
|
|
iface.adpcmBMem=adpcmBMem;
|
|
|
|
iface.sampleBank=0;
|
|
|
|
fm=new ymfm::ym2610b(iface);
|
2022-09-24 00:01:01 +00:00
|
|
|
fm->set_fidelity(ymfm::OPN_FIDELITY_MAX);
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
setFlags(flags);
|
|
|
|
// YM2149, 2MHz
|
|
|
|
ay=new DivPlatformAY8910(true,chipClock,32);
|
2022-09-30 01:13:40 +00:00
|
|
|
ay->init(p,3,sugRate,ayFlags);
|
Prepare for split sample chip instrument
(MSM6258, MSM6295, QSound, Sega PCM, ADPCM-A, ADPCM-B, YMZ280B, RF5C68)
Instrument color and icons are placeholder.
different volume range, hard panned/soft panned and/or independent volume per output, chip-dependent features (global volume, echo, etc)
Allow use sample in instrument tab for chip with sample support
Prepare to support X1-010 Seta 2 style bankswitch behavior
Prepare to support AY89x0 PCM DAC
Support volume for PCE sample (DAC)
Fix Lynx, Y8950 sample pitch matches to sample preview
Support PCM DAC with backward and pingpong loop mode
Reduce some codes
Add Sega PCM, AY89x0, QSound, PCM DAC, Lynx per-channel debug support
2022-08-27 07:27:36 +00:00
|
|
|
ay->toggleRegisterDump(true);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void quit() {
|
|
|
|
for (int i=0; i<ChanNum; i++) {
|
|
|
|
delete oscBuf[i];
|
|
|
|
}
|
|
|
|
ay->quit();
|
|
|
|
delete ay;
|
|
|
|
delete[] adpcmAMem;
|
|
|
|
delete[] adpcmBMem;
|
|
|
|
}
|
|
|
|
|
|
|
|
DivPlatformYM2610Base(int ext, int psg, int adpcmA, int adpcmB):
|
|
|
|
DivPlatformOPN(9440540.0, 72, 32),
|
|
|
|
extChanOffs(ext),
|
|
|
|
psgChanOffs(psg),
|
|
|
|
adpcmAChanOffs(adpcmA),
|
|
|
|
adpcmBChanOffs(adpcmB) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|