Merge branch 'master' of https://github.com/tildearrow/furnace into es5506_alt
This commit is contained in:
commit
536c345763
|
@ -15,8 +15,8 @@ android {
|
||||||
}
|
}
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 26
|
targetSdkVersion 26
|
||||||
versionCode 113
|
versionCode 136
|
||||||
versionName "dev113"
|
versionName "dev136"
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
arguments "-DANDROID_APP_PLATFORM=android-21", "-DANDROID_STL=c++_static"
|
arguments "-DANDROID_APP_PLATFORM=android-21", "-DANDROID_STL=c++_static"
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -946,10 +946,8 @@ static void OPL3_ChannelSetupAlg(opl3_channel *channel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void OPL3_ChannelWriteC0(opl3_channel *channel, uint8_t data)
|
static void OPL3_ChannelUpdateAlg(opl3_channel *channel)
|
||||||
{
|
{
|
||||||
channel->fb = (data & 0x0e) >> 1;
|
|
||||||
channel->con = data & 0x01;
|
|
||||||
channel->alg = channel->con;
|
channel->alg = channel->con;
|
||||||
if (channel->chip->newm)
|
if (channel->chip->newm)
|
||||||
{
|
{
|
||||||
|
@ -974,14 +972,25 @@ static void OPL3_ChannelWriteC0(opl3_channel *channel, uint8_t data)
|
||||||
{
|
{
|
||||||
OPL3_ChannelSetupAlg(channel);
|
OPL3_ChannelSetupAlg(channel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OPL3_ChannelWriteC0(opl3_channel *channel, uint8_t data)
|
||||||
|
{
|
||||||
|
channel->fb = (data & 0x0e) >> 1;
|
||||||
|
channel->con = data & 0x01;
|
||||||
|
OPL3_ChannelUpdateAlg(channel);
|
||||||
if (channel->chip->newm)
|
if (channel->chip->newm)
|
||||||
{
|
{
|
||||||
channel->cha = ((data >> 4) & 0x01) ? ~0 : 0;
|
channel->cha = ((data >> 4) & 0x01) ? ~0 : 0;
|
||||||
channel->chb = ((data >> 5) & 0x01) ? ~0 : 0;
|
channel->chb = ((data >> 5) & 0x01) ? ~0 : 0;
|
||||||
|
channel->chc = ((data >> 6) & 0x01) ? ~0 : 0;
|
||||||
|
channel->chd = ((data >> 7) & 0x01) ? ~0 : 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
channel->cha = channel->chb = (uint16_t)~0;
|
channel->cha = channel->chb = (uint16_t)~0;
|
||||||
|
// TODO: Verify on real chip if DAC2 output is disabled in compat mode
|
||||||
|
channel->chc = channel->chd = 0;
|
||||||
}
|
}
|
||||||
#if OPL_ENABLE_STEREOEXT
|
#if OPL_ENABLE_STEREOEXT
|
||||||
if (!channel->chip->stereoext)
|
if (!channel->chip->stereoext)
|
||||||
|
@ -1066,11 +1075,14 @@ static void OPL3_ChannelSet4Op(opl3_chip *chip, uint8_t data)
|
||||||
{
|
{
|
||||||
chip->channel[chnum].chtype = ch_4op;
|
chip->channel[chnum].chtype = ch_4op;
|
||||||
chip->channel[chnum + 3].chtype = ch_4op2;
|
chip->channel[chnum + 3].chtype = ch_4op2;
|
||||||
|
OPL3_ChannelUpdateAlg(&chip->channel[chnum]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
chip->channel[chnum].chtype = ch_2op;
|
chip->channel[chnum].chtype = ch_2op;
|
||||||
chip->channel[chnum + 3].chtype = ch_2op;
|
chip->channel[chnum + 3].chtype = ch_2op;
|
||||||
|
OPL3_ChannelUpdateAlg(&chip->channel[chnum]);
|
||||||
|
OPL3_ChannelUpdateAlg(&chip->channel[chnum+3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1096,17 +1108,18 @@ static void OPL3_ProcessSlot(opl3_slot *slot)
|
||||||
OPL3_SlotGenerate(slot);
|
OPL3_SlotGenerate(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPL3_Generate(opl3_chip *chip, int16_t *buf)
|
inline void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4)
|
||||||
{
|
{
|
||||||
opl3_channel *channel;
|
opl3_channel *channel;
|
||||||
opl3_writebuf *writebuf;
|
opl3_writebuf *writebuf;
|
||||||
int16_t **out;
|
int16_t **out;
|
||||||
int32_t mix;
|
int32_t mix[2];
|
||||||
uint8_t ii;
|
uint8_t ii;
|
||||||
int16_t accm;
|
int16_t accm;
|
||||||
uint8_t shift = 0;
|
uint8_t shift = 0;
|
||||||
|
|
||||||
buf[1] = OPL3_ClipSample(chip->mixbuff[1]);
|
buf4[1] = OPL3_ClipSample(chip->mixbuff[1]);
|
||||||
|
buf4[3] = OPL3_ClipSample(chip->mixbuff[3]);
|
||||||
|
|
||||||
#if OPL_QUIRK_CHANNELSAMPLEDELAY
|
#if OPL_QUIRK_CHANNELSAMPLEDELAY
|
||||||
for (ii = 0; ii < 15; ii++)
|
for (ii = 0; ii < 15; ii++)
|
||||||
|
@ -1117,7 +1130,7 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf)
|
||||||
OPL3_ProcessSlot(&chip->slot[ii]);
|
OPL3_ProcessSlot(&chip->slot[ii]);
|
||||||
}
|
}
|
||||||
|
|
||||||
mix = 0;
|
mix[0] = mix[1] = 0;
|
||||||
for (ii = 0; ii < 18; ii++)
|
for (ii = 0; ii < 18; ii++)
|
||||||
{
|
{
|
||||||
channel = &chip->channel[ii];
|
channel = &chip->channel[ii];
|
||||||
|
@ -1125,12 +1138,14 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf)
|
||||||
out = channel->out;
|
out = channel->out;
|
||||||
accm = *out[0] + *out[1] + *out[2] + *out[3];
|
accm = *out[0] + *out[1] + *out[2] + *out[3];
|
||||||
#if OPL_ENABLE_STEREOEXT
|
#if OPL_ENABLE_STEREOEXT
|
||||||
mix += (int16_t)((accm * channel->leftpan) >> 16);
|
mix[0] += (int16_t)((accm * channel->leftpan) >> 16);
|
||||||
#else
|
#else
|
||||||
mix += (int16_t)(accm & channel->cha);
|
mix[0] += (int16_t)(accm & channel->cha);
|
||||||
#endif
|
#endif
|
||||||
|
mix[1] += (int16_t)(accm & channel->chc);
|
||||||
}
|
}
|
||||||
chip->mixbuff[0] = mix;
|
chip->mixbuff[0] = mix[0];
|
||||||
|
chip->mixbuff[2] = mix[1];
|
||||||
|
|
||||||
#if OPL_QUIRK_CHANNELSAMPLEDELAY
|
#if OPL_QUIRK_CHANNELSAMPLEDELAY
|
||||||
for (ii = 15; ii < 18; ii++)
|
for (ii = 15; ii < 18; ii++)
|
||||||
|
@ -1139,7 +1154,8 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
buf[0] = OPL3_ClipSample(chip->mixbuff[0]);
|
buf4[0] = OPL3_ClipSample(chip->mixbuff[0]);
|
||||||
|
buf4[2] = OPL3_ClipSample(chip->mixbuff[2]);
|
||||||
|
|
||||||
#if OPL_QUIRK_CHANNELSAMPLEDELAY
|
#if OPL_QUIRK_CHANNELSAMPLEDELAY
|
||||||
for (ii = 18; ii < 33; ii++)
|
for (ii = 18; ii < 33; ii++)
|
||||||
|
@ -1148,7 +1164,7 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mix = 0;
|
mix[0] = mix[1] = 0;
|
||||||
for (ii = 0; ii < 18; ii++)
|
for (ii = 0; ii < 18; ii++)
|
||||||
{
|
{
|
||||||
channel = &chip->channel[ii];
|
channel = &chip->channel[ii];
|
||||||
|
@ -1156,12 +1172,14 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf)
|
||||||
out = channel->out;
|
out = channel->out;
|
||||||
accm = *out[0] + *out[1] + *out[2] + *out[3];
|
accm = *out[0] + *out[1] + *out[2] + *out[3];
|
||||||
#if OPL_ENABLE_STEREOEXT
|
#if OPL_ENABLE_STEREOEXT
|
||||||
mix += (int16_t)((accm * channel->rightpan) >> 16);
|
mix[0] += (int16_t)((accm * channel->rightpan) >> 16);
|
||||||
#else
|
#else
|
||||||
mix += (int16_t)(accm & channel->chb);
|
mix[0] += (int16_t)(accm & channel->chb);
|
||||||
#endif
|
#endif
|
||||||
|
mix[1] += (int16_t)(accm & channel->chd);
|
||||||
}
|
}
|
||||||
chip->mixbuff[1] = mix;
|
chip->mixbuff[1] = mix[0];
|
||||||
|
chip->mixbuff[3] = mix[1];
|
||||||
|
|
||||||
#if OPL_QUIRK_CHANNELSAMPLEDELAY
|
#if OPL_QUIRK_CHANNELSAMPLEDELAY
|
||||||
for (ii = 33; ii < 36; ii++)
|
for (ii = 33; ii < 36; ii++)
|
||||||
|
@ -1236,22 +1254,44 @@ void OPL3_Generate(opl3_chip *chip, int16_t *buf)
|
||||||
chip->writebuf_samplecnt++;
|
chip->writebuf_samplecnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPL3_GenerateResampled(opl3_chip *chip, int16_t *buf)
|
void OPL3_Generate(opl3_chip *chip, int16_t *buf)
|
||||||
|
{
|
||||||
|
int16_t samples[4];
|
||||||
|
OPL3_Generate4Ch(chip, samples);
|
||||||
|
buf[0] = samples[0];
|
||||||
|
buf[1] = samples[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
void OPL3_Generate4ChResampled(opl3_chip *chip, int16_t *buf4)
|
||||||
{
|
{
|
||||||
while (chip->samplecnt >= chip->rateratio)
|
while (chip->samplecnt >= chip->rateratio)
|
||||||
{
|
{
|
||||||
chip->oldsamples[0] = chip->samples[0];
|
chip->oldsamples[0] = chip->samples[0];
|
||||||
chip->oldsamples[1] = chip->samples[1];
|
chip->oldsamples[1] = chip->samples[1];
|
||||||
OPL3_Generate(chip, chip->samples);
|
chip->oldsamples[2] = chip->samples[2];
|
||||||
|
chip->oldsamples[3] = chip->samples[3];
|
||||||
|
OPL3_Generate4Ch(chip, chip->samples);
|
||||||
chip->samplecnt -= chip->rateratio;
|
chip->samplecnt -= chip->rateratio;
|
||||||
}
|
}
|
||||||
buf[0] = (int16_t)((chip->oldsamples[0] * (chip->rateratio - chip->samplecnt)
|
buf4[0] = (int16_t)((chip->oldsamples[0] * (chip->rateratio - chip->samplecnt)
|
||||||
+ chip->samples[0] * chip->samplecnt) / chip->rateratio);
|
+ chip->samples[0] * chip->samplecnt) / chip->rateratio);
|
||||||
buf[1] = (int16_t)((chip->oldsamples[1] * (chip->rateratio - chip->samplecnt)
|
buf4[1] = (int16_t)((chip->oldsamples[1] * (chip->rateratio - chip->samplecnt)
|
||||||
+ chip->samples[1] * chip->samplecnt) / chip->rateratio);
|
+ chip->samples[1] * chip->samplecnt) / chip->rateratio);
|
||||||
|
buf4[2] = (int16_t)((chip->oldsamples[2] * (chip->rateratio - chip->samplecnt)
|
||||||
|
+ chip->samples[2] * chip->samplecnt) / chip->rateratio);
|
||||||
|
buf4[3] = (int16_t)((chip->oldsamples[3] * (chip->rateratio - chip->samplecnt)
|
||||||
|
+ chip->samples[3] * chip->samplecnt) / chip->rateratio);
|
||||||
chip->samplecnt += 1 << RSM_FRAC;
|
chip->samplecnt += 1 << RSM_FRAC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPL3_GenerateResampled(opl3_chip *chip, int16_t *buf)
|
||||||
|
{
|
||||||
|
int16_t samples[4];
|
||||||
|
OPL3_Generate4ChResampled(chip, samples);
|
||||||
|
buf[0] = samples[0];
|
||||||
|
buf[1] = samples[1];
|
||||||
|
}
|
||||||
|
|
||||||
void OPL3_Reset(opl3_chip *chip, uint32_t samplerate)
|
void OPL3_Reset(opl3_chip *chip, uint32_t samplerate)
|
||||||
{
|
{
|
||||||
opl3_slot *slot;
|
opl3_slot *slot;
|
||||||
|
@ -1464,9 +1504,26 @@ void OPL3_WriteRegBuffered(opl3_chip *chip, uint16_t reg, uint8_t v)
|
||||||
chip->writebuf_last = (writebuf_last + 1) % OPL_WRITEBUF_SIZE;
|
chip->writebuf_last = (writebuf_last + 1) % OPL_WRITEBUF_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OPL3_Generate4ChStream(opl3_chip *chip, int16_t *sndptr1, int16_t *sndptr2, uint32_t numsamples)
|
||||||
|
{
|
||||||
|
uint_fast32_t i;
|
||||||
|
int16_t samples[4];
|
||||||
|
|
||||||
|
for(i = 0; i < numsamples; i++)
|
||||||
|
{
|
||||||
|
OPL3_Generate4ChResampled(chip, samples);
|
||||||
|
sndptr1[0] = samples[0];
|
||||||
|
sndptr1[1] = samples[1];
|
||||||
|
sndptr2[0] = samples[2];
|
||||||
|
sndptr2[1] = samples[3];
|
||||||
|
sndptr1 += 2;
|
||||||
|
sndptr2 += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples)
|
void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint_fast32_t i;
|
||||||
|
|
||||||
for(i = 0; i < numsamples; i++)
|
for(i = 0; i < numsamples; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -101,6 +101,7 @@ struct _opl3_channel {
|
||||||
uint8_t alg;
|
uint8_t alg;
|
||||||
uint8_t ksv;
|
uint8_t ksv;
|
||||||
uint16_t cha, chb;
|
uint16_t cha, chb;
|
||||||
|
uint16_t chc, chd;
|
||||||
uint8_t ch_num;
|
uint8_t ch_num;
|
||||||
uint8_t muted;
|
uint8_t muted;
|
||||||
};
|
};
|
||||||
|
@ -129,7 +130,7 @@ struct _opl3_chip {
|
||||||
uint8_t tremoloshift;
|
uint8_t tremoloshift;
|
||||||
uint32_t noise;
|
uint32_t noise;
|
||||||
int16_t zeromod;
|
int16_t zeromod;
|
||||||
int32_t mixbuff[2];
|
int32_t mixbuff[4];
|
||||||
uint8_t rm_hh_bit2;
|
uint8_t rm_hh_bit2;
|
||||||
uint8_t rm_hh_bit3;
|
uint8_t rm_hh_bit3;
|
||||||
uint8_t rm_hh_bit7;
|
uint8_t rm_hh_bit7;
|
||||||
|
@ -144,8 +145,8 @@ struct _opl3_chip {
|
||||||
/* OPL3L */
|
/* OPL3L */
|
||||||
int32_t rateratio;
|
int32_t rateratio;
|
||||||
int32_t samplecnt;
|
int32_t samplecnt;
|
||||||
int16_t oldsamples[2];
|
int16_t oldsamples[4];
|
||||||
int16_t samples[2];
|
int16_t samples[4];
|
||||||
|
|
||||||
uint64_t writebuf_samplecnt;
|
uint64_t writebuf_samplecnt;
|
||||||
uint32_t writebuf_cur;
|
uint32_t writebuf_cur;
|
||||||
|
@ -161,6 +162,10 @@ void OPL3_WriteReg(opl3_chip *chip, uint16_t reg, uint8_t v);
|
||||||
void OPL3_WriteRegBuffered(opl3_chip *chip, uint16_t reg, uint8_t v);
|
void OPL3_WriteRegBuffered(opl3_chip *chip, uint16_t reg, uint8_t v);
|
||||||
void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples);
|
void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples);
|
||||||
|
|
||||||
|
void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4);
|
||||||
|
void OPL3_Generate4ChResampled(opl3_chip *chip, int16_t *buf4);
|
||||||
|
void OPL3_Generate4ChStream(opl3_chip *chip, int16_t *sndptr1, int16_t *sndptr2, uint32_t numsamples);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -32,6 +32,9 @@ these fields are 0 in format versions prior to 100 (0.6pre1).
|
||||||
|
|
||||||
the format versions are:
|
the format versions are:
|
||||||
|
|
||||||
|
- 136: Furnace dev136
|
||||||
|
- 135: Furnace dev135
|
||||||
|
- 134: Furnace dev134
|
||||||
- 133: Furnace 0.6pre3
|
- 133: Furnace 0.6pre3
|
||||||
- 132: Furnace 0.6pre2
|
- 132: Furnace 0.6pre2
|
||||||
- 131: Furnace dev131
|
- 131: Furnace dev131
|
||||||
|
@ -386,8 +389,42 @@ size | description
|
||||||
STR | song author (Japanese)
|
STR | song author (Japanese)
|
||||||
STR | system name (Japanese)
|
STR | system name (Japanese)
|
||||||
STR | album/category/game name (Japanese)
|
STR | album/category/game name (Japanese)
|
||||||
|
--- | **extra chip output settings (× chipCount)** (>=135)
|
||||||
|
4f | chip volume
|
||||||
|
4f | chip panning
|
||||||
|
4f | chip front/rear balance
|
||||||
|
--- | **patchbay** (>=135)
|
||||||
|
4 | patchbay connection count
|
||||||
|
4?? | patchbay
|
||||||
|
| - see next section for more details.
|
||||||
|
1 | automatic patchbay (>=136)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# patchbay
|
||||||
|
|
||||||
|
Furnace dev135 adds a "patchbay" which allows for arbitrary connection of chip outputs to system outputs.
|
||||||
|
it eventually will allow connecting outputs to effects and so on.
|
||||||
|
|
||||||
|
a connection is represented as an unsigned int in the following format:
|
||||||
|
|
||||||
|
- bit 16-31: source port
|
||||||
|
- bit 0-15: destination port
|
||||||
|
|
||||||
|
a port is in the following format (hexadecimal): `xxxy`
|
||||||
|
|
||||||
|
- `xxx` (bit 4 to 15) represents a portset.
|
||||||
|
- `y` (bit 0 to 3) is the port in that portset.
|
||||||
|
|
||||||
|
reserved input portsets:
|
||||||
|
- `000`: system outputs
|
||||||
|
- `FFF`: "null" portset
|
||||||
|
|
||||||
|
reserved output portsets:
|
||||||
|
- `000` through `01F`: chip outputs
|
||||||
|
- `FFD`: wave/sample preview
|
||||||
|
- `FFE`: metronome
|
||||||
|
- `FFF`: "null" portset
|
||||||
|
|
||||||
# subsong
|
# subsong
|
||||||
|
|
||||||
from version 95 onwards, Furnace supports storing multiple songs on a single file.
|
from version 95 onwards, Furnace supports storing multiple songs on a single file.
|
||||||
|
|
|
@ -33,4 +33,7 @@
|
||||||
// sample related
|
// sample related
|
||||||
#define DIV_MAX_SAMPLE_TYPE 4
|
#define DIV_MAX_SAMPLE_TYPE 4
|
||||||
|
|
||||||
|
// dispatch
|
||||||
|
#define DIV_MAX_OUTPUTS 16
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -225,6 +225,8 @@ enum DivDispatchCmds {
|
||||||
DIV_CMD_ES5506_ENVELOPE_K2RAMP, // (ramp, slowdown)
|
DIV_CMD_ES5506_ENVELOPE_K2RAMP, // (ramp, slowdown)
|
||||||
DIV_CMD_ES5506_PAUSE, // (value)
|
DIV_CMD_ES5506_PAUSE, // (value)
|
||||||
|
|
||||||
|
DIV_CMD_SURROUND_PANNING, // (out, val)
|
||||||
|
|
||||||
DIV_ALWAYS_SET_VOLUME, // () -> alwaysSetVol
|
DIV_ALWAYS_SET_VOLUME, // () -> alwaysSetVol
|
||||||
|
|
||||||
DIV_CMD_MAX
|
DIV_CMD_MAX
|
||||||
|
@ -334,12 +336,10 @@ class DivDispatch {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fill a buffer with sound data.
|
* fill a buffer with sound data.
|
||||||
* @param bufL the left or mono channel buffer.
|
* @param buf pointers to output buffers.
|
||||||
* @param bufR the right channel buffer.
|
|
||||||
* @param start the start offset.
|
|
||||||
* @param len the amount of samples to fill.
|
* @param len the amount of samples to fill.
|
||||||
*/
|
*/
|
||||||
virtual void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
virtual void acquire(short** buf, size_t len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fill a write stream with data (e.g. for software-mixed PCM).
|
* fill a write stream with data (e.g. for software-mixed PCM).
|
||||||
|
@ -425,10 +425,10 @@ class DivDispatch {
|
||||||
virtual void muteChannel(int ch, bool mute);
|
virtual void muteChannel(int ch, bool mute);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test whether this dispatch outputs audio in two channels.
|
* get the number of outputs this dispatch provides.
|
||||||
* @return whether it does.
|
* @return number of outputs (usually 1 or 2 but may be more). SHALL NOT be less than one.
|
||||||
*/
|
*/
|
||||||
virtual bool isStereo();
|
virtual int getOutputCount();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test whether sending a key off command to a channel should reset arp too.
|
* test whether sending a key off command to a channel should reset arp too.
|
||||||
|
|
|
@ -81,79 +81,131 @@
|
||||||
#include "song.h"
|
#include "song.h"
|
||||||
|
|
||||||
void DivDispatchContainer::setRates(double gotRate) {
|
void DivDispatchContainer::setRates(double gotRate) {
|
||||||
blip_set_rates(bb[0],dispatch->rate,gotRate);
|
int outs=dispatch->getOutputCount();
|
||||||
blip_set_rates(bb[1],dispatch->rate,gotRate);
|
|
||||||
|
for (int i=0; i<outs; i++) {
|
||||||
|
if (bb[i]==NULL) continue;
|
||||||
|
blip_set_rates(bb[i],dispatch->rate,gotRate);
|
||||||
|
}
|
||||||
|
rateMemory=gotRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivDispatchContainer::setQuality(bool lowQual) {
|
void DivDispatchContainer::setQuality(bool lowQual) {
|
||||||
lowQuality=lowQual;
|
lowQuality=lowQual;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivDispatchContainer::grow(size_t size) {
|
||||||
|
bbInLen=size;
|
||||||
|
for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
|
||||||
|
if (bbIn[i]!=NULL) {
|
||||||
|
delete[] bbIn[i];
|
||||||
|
bbIn[i]=new short[bbInLen];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define CHECK_MISSING_BUFS \
|
||||||
|
int outs=dispatch->getOutputCount(); \
|
||||||
|
\
|
||||||
|
/* create missing buffers if any */ \
|
||||||
|
bool mustClear=false; \
|
||||||
|
for (int i=0; i<outs; i++) { \
|
||||||
|
if (bb[i]==NULL) { \
|
||||||
|
logV("creating buf %d because it doesn't exist",i); \
|
||||||
|
bb[i]=blip_new(bbInLen); \
|
||||||
|
if (bb[i]==NULL) { \
|
||||||
|
logE("not enough memory!"); \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
|
blip_set_rates(bb[i],dispatch->rate,rateMemory); \
|
||||||
|
\
|
||||||
|
if (bbIn[i]==NULL) bbIn[i]=new short[bbInLen]; \
|
||||||
|
if (bbOut[i]==NULL) bbOut[i]=new short[bbInLen]; \
|
||||||
|
memset(bbIn[i],0,bbInLen*sizeof(short)); \
|
||||||
|
memset(bbOut[i],0,bbInLen*sizeof(short)); \
|
||||||
|
mustClear=true; \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
if (mustClear) clear(); \
|
||||||
|
|
||||||
void DivDispatchContainer::acquire(size_t offset, size_t count) {
|
void DivDispatchContainer::acquire(size_t offset, size_t count) {
|
||||||
dispatch->acquire(bbIn[0],bbIn[1],offset,count);
|
CHECK_MISSING_BUFS;
|
||||||
|
|
||||||
|
for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
|
||||||
|
if (i>=outs) {
|
||||||
|
bbInMapped[i]=NULL;
|
||||||
|
} else {
|
||||||
|
if (bbIn[i]==NULL) {
|
||||||
|
bbInMapped[i]=NULL;
|
||||||
|
} else {
|
||||||
|
bbInMapped[i]=&bbIn[i][offset];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dispatch->acquire(bbInMapped,count);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivDispatchContainer::flush(size_t count) {
|
void DivDispatchContainer::flush(size_t count) {
|
||||||
blip_read_samples(bb[0],bbOut[0],count,0);
|
int outs=dispatch->getOutputCount();
|
||||||
|
|
||||||
if (dispatch->isStereo()) {
|
for (int i=0; i<outs; i++) {
|
||||||
blip_read_samples(bb[1],bbOut[1],count,0);
|
if (bb[i]==NULL) continue;
|
||||||
|
blip_read_samples(bb[i],bbOut[i],count,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) {
|
void DivDispatchContainer::fillBuf(size_t runtotal, size_t offset, size_t size) {
|
||||||
|
CHECK_MISSING_BUFS;
|
||||||
|
|
||||||
if (dcOffCompensation && runtotal>0) {
|
if (dcOffCompensation && runtotal>0) {
|
||||||
dcOffCompensation=false;
|
dcOffCompensation=false;
|
||||||
prevSample[0]=bbIn[0][0];
|
for (int i=0; i<outs; i++) {
|
||||||
if (dispatch->isStereo()) prevSample[1]=bbIn[1][0];
|
if (bbIn[i]==NULL) continue;
|
||||||
|
prevSample[i]=bbIn[i][0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (lowQuality) {
|
if (lowQuality) {
|
||||||
for (size_t i=0; i<runtotal; i++) {
|
for (int i=0; i<outs; i++) {
|
||||||
temp[0]=bbIn[0][i];
|
if (bbIn[i]==NULL) continue;
|
||||||
blip_add_delta_fast(bb[0],i,temp[0]-prevSample[0]);
|
if (bb[i]==NULL) continue;
|
||||||
prevSample[0]=temp[0];
|
for (size_t j=0; j<runtotal; j++) {
|
||||||
|
temp[i]=bbIn[i][j];
|
||||||
|
blip_add_delta_fast(bb[i],j,temp[i]-prevSample[i]);
|
||||||
|
prevSample[i]=temp[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dispatch->isStereo()) for (size_t i=0; i<runtotal; i++) {
|
|
||||||
temp[1]=bbIn[1][i];
|
|
||||||
blip_add_delta_fast(bb[1],i,temp[1]-prevSample[1]);
|
|
||||||
prevSample[1]=temp[1];
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (size_t i=0; i<runtotal; i++) {
|
for (int i=0; i<outs; i++) {
|
||||||
temp[0]=bbIn[0][i];
|
if (bbIn[i]==NULL) continue;
|
||||||
blip_add_delta(bb[0],i,temp[0]-prevSample[0]);
|
if (bb[i]==NULL) continue;
|
||||||
prevSample[0]=temp[0];
|
for (size_t j=0; j<runtotal; j++) {
|
||||||
|
temp[i]=bbIn[i][j];
|
||||||
|
blip_add_delta(bb[i],j,temp[i]-prevSample[i]);
|
||||||
|
prevSample[i]=temp[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dispatch->isStereo()) for (size_t i=0; i<runtotal; i++) {
|
|
||||||
temp[1]=bbIn[1][i];
|
|
||||||
blip_add_delta(bb[1],i,temp[1]-prevSample[1]);
|
|
||||||
prevSample[1]=temp[1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blip_end_frame(bb[0],runtotal);
|
for (int i=0; i<outs; i++) {
|
||||||
blip_read_samples(bb[0],bbOut[0]+offset,size,0);
|
if (bbOut[i]==NULL) continue;
|
||||||
|
if (bb[i]==NULL) continue;
|
||||||
|
blip_end_frame(bb[i],runtotal);
|
||||||
|
blip_read_samples(bb[i],bbOut[i]+offset,size,0);
|
||||||
|
}
|
||||||
/*if (totalRead<(int)size && totalRead>0) {
|
/*if (totalRead<(int)size && totalRead>0) {
|
||||||
for (size_t i=totalRead; i<size; i++) {
|
for (size_t i=totalRead; i<size; i++) {
|
||||||
bbOut[0][i]=bbOut[0][totalRead-1];//bbOut[0][totalRead];
|
bbOut[0][i]=bbOut[0][totalRead-1];//bbOut[0][totalRead];
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
if (dispatch->isStereo()) {
|
|
||||||
blip_end_frame(bb[1],runtotal);
|
|
||||||
blip_read_samples(bb[1],bbOut[1]+offset,size,0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivDispatchContainer::clear() {
|
void DivDispatchContainer::clear() {
|
||||||
blip_clear(bb[0]);
|
for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
|
||||||
blip_clear(bb[1]);
|
if (bb[i]!=NULL) blip_clear(bb[i]);
|
||||||
temp[0]=0;
|
temp[i]=0;
|
||||||
temp[1]=0;
|
prevSample[i]=0;
|
||||||
prevSample[0]=0;
|
}
|
||||||
prevSample[1]=0;
|
|
||||||
if (dispatch->getDCOffRequired()) {
|
if (dispatch->getDCOffRequired()) {
|
||||||
dcOffCompensation=true;
|
dcOffCompensation=true;
|
||||||
}
|
}
|
||||||
|
@ -167,26 +219,10 @@ void DivDispatchContainer::clear() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, const DivConfig& flags) {
|
void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, double gotRate, const DivConfig& flags) {
|
||||||
|
// quit if we already initialized
|
||||||
if (dispatch!=NULL) return;
|
if (dispatch!=NULL) return;
|
||||||
|
|
||||||
bb[0]=blip_new(32768);
|
// initialize chip
|
||||||
if (bb[0]==NULL) {
|
|
||||||
logE("not enough memory!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bb[1]=blip_new(32768);
|
|
||||||
if (bb[1]==NULL) {
|
|
||||||
logE("not enough memory!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
bbOut[0]=new short[32768];
|
|
||||||
bbOut[1]=new short[32768];
|
|
||||||
bbIn[0]=new short[32768];
|
|
||||||
bbIn[1]=new short[32768];
|
|
||||||
bbInLen=32768;
|
|
||||||
|
|
||||||
switch (sys) {
|
switch (sys) {
|
||||||
case DIV_SYSTEM_YMU759:
|
case DIV_SYSTEM_YMU759:
|
||||||
dispatch=new DivPlatformOPL;
|
dispatch=new DivPlatformOPL;
|
||||||
|
@ -465,6 +501,23 @@ void DivDispatchContainer::init(DivSystem sys, DivEngine* eng, int chanCount, do
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
dispatch->init(eng,chanCount,gotRate,flags);
|
dispatch->init(eng,chanCount,gotRate,flags);
|
||||||
|
|
||||||
|
// initialize output buffers
|
||||||
|
int outs=dispatch->getOutputCount();
|
||||||
|
bbInLen=32768;
|
||||||
|
|
||||||
|
for (int i=0; i<outs; i++) {
|
||||||
|
bb[i]=blip_new(bbInLen);
|
||||||
|
if (bb[i]==NULL) {
|
||||||
|
logE("not enough memory!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bbIn[i]=new short[bbInLen];
|
||||||
|
bbOut[i]=new short[bbInLen];
|
||||||
|
memset(bbIn[i],0,bbInLen*sizeof(short));
|
||||||
|
memset(bbOut[i],0,bbInLen*sizeof(short));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivDispatchContainer::quit() {
|
void DivDispatchContainer::quit() {
|
||||||
|
@ -473,11 +526,19 @@ void DivDispatchContainer::quit() {
|
||||||
delete dispatch;
|
delete dispatch;
|
||||||
dispatch=NULL;
|
dispatch=NULL;
|
||||||
|
|
||||||
delete[] bbOut[0];
|
for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
|
||||||
delete[] bbOut[1];
|
if (bbOut[i]!=NULL) {
|
||||||
delete[] bbIn[0];
|
delete[] bbOut[i];
|
||||||
delete[] bbIn[1];
|
bbOut[i]=NULL;
|
||||||
|
}
|
||||||
|
if (bbIn[i]!=NULL) {
|
||||||
|
delete[] bbIn[i];
|
||||||
|
bbIn[i]=NULL;
|
||||||
|
}
|
||||||
|
if (bb[i]!=NULL) {
|
||||||
|
blip_delete(bb[i]);
|
||||||
|
bb[i]=NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
bbInLen=0;
|
bbInLen=0;
|
||||||
blip_delete(bb[0]);
|
|
||||||
blip_delete(bb[1]);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,15 @@ const char* DivEngine::getEffectDesc(unsigned char effect, int chan, bool notNul
|
||||||
return "81xx: Set panning (left channel)";
|
return "81xx: Set panning (left channel)";
|
||||||
case 0x82:
|
case 0x82:
|
||||||
return "82xx: Set panning (right channel)";
|
return "82xx: Set panning (right channel)";
|
||||||
|
case 0x88:
|
||||||
|
return "88xx: Set panning (rear channels; x: left; y: right)";
|
||||||
|
break;
|
||||||
|
case 0x89:
|
||||||
|
return "89xx: Set panning (rear left channel)";
|
||||||
|
break;
|
||||||
|
case 0x8a:
|
||||||
|
return "8Axx: Set panning (rear right channel)";
|
||||||
|
break;
|
||||||
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
|
case 0xc0: case 0xc1: case 0xc2: case 0xc3:
|
||||||
return "Cxxx: Set tick rate (hz)";
|
return "Cxxx: Set tick rate (hz)";
|
||||||
case 0xe0:
|
case 0xe0:
|
||||||
|
@ -435,6 +444,7 @@ void writePackedCommandValues(SafeWriter* w, const DivCommand& c) {
|
||||||
case DIV_CMD_FM_FINE:
|
case DIV_CMD_FM_FINE:
|
||||||
case DIV_CMD_AY_IO_WRITE:
|
case DIV_CMD_AY_IO_WRITE:
|
||||||
case DIV_CMD_AY_AUTO_PWM:
|
case DIV_CMD_AY_AUTO_PWM:
|
||||||
|
case DIV_CMD_SURROUND_PANNING:
|
||||||
w->writeC(2); // length
|
w->writeC(2); // length
|
||||||
w->writeC(c.value);
|
w->writeC(c.value);
|
||||||
w->writeC(c.value2);
|
w->writeC(c.value2);
|
||||||
|
@ -897,11 +907,7 @@ void DivEngine::runExportThread() {
|
||||||
for (int i=0; i<song.systemLen; i++) {
|
for (int i=0; i<song.systemLen; i++) {
|
||||||
sf[i]=NULL;
|
sf[i]=NULL;
|
||||||
si[i].samplerate=got.rate;
|
si[i].samplerate=got.rate;
|
||||||
if (disCont[i].dispatch->isStereo()) {
|
si[i].channels=disCont[i].dispatch->getOutputCount();
|
||||||
si[i].channels=2;
|
|
||||||
} else {
|
|
||||||
si[i].channels=1;
|
|
||||||
}
|
|
||||||
si[i].format=SF_FORMAT_WAV|SF_FORMAT_PCM_16;
|
si[i].format=SF_FORMAT_WAV|SF_FORMAT_PCM_16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -944,11 +950,12 @@ void DivEngine::runExportThread() {
|
||||||
if (isFadingOut) {
|
if (isFadingOut) {
|
||||||
double mul=(1.0-((double)curFadeOutSample/(double)fadeOutSamples));
|
double mul=(1.0-((double)curFadeOutSample/(double)fadeOutSamples));
|
||||||
for (int i=0; i<song.systemLen; i++) {
|
for (int i=0; i<song.systemLen; i++) {
|
||||||
if (!disCont[i].dispatch->isStereo()) {
|
for (int k=0; k<si[i].channels; k++) {
|
||||||
sysBuf[i][j]=(double)disCont[i].bbOut[0][j]*mul;
|
if (disCont[i].bbOut[k]==NULL) {
|
||||||
|
sysBuf[i][k+(j*si[i].channels)]=0;
|
||||||
} else {
|
} else {
|
||||||
sysBuf[i][j<<1]=(double)disCont[i].bbOut[0][j]*mul;
|
sysBuf[i][k+(j*si[i].channels)]=(double)disCont[i].bbOut[k][j]*mul;
|
||||||
sysBuf[i][1+(j<<1)]=(double)disCont[i].bbOut[1][j]*mul;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (++curFadeOutSample>=fadeOutSamples) {
|
if (++curFadeOutSample>=fadeOutSamples) {
|
||||||
|
@ -957,11 +964,12 @@ void DivEngine::runExportThread() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i=0; i<song.systemLen; i++) {
|
for (int i=0; i<song.systemLen; i++) {
|
||||||
if (!disCont[i].dispatch->isStereo()) {
|
for (int k=0; k<si[i].channels; k++) {
|
||||||
sysBuf[i][j]=disCont[i].bbOut[0][j];
|
if (disCont[i].bbOut[k]==NULL) {
|
||||||
|
sysBuf[i][k+(j*si[i].channels)]=0;
|
||||||
} else {
|
} else {
|
||||||
sysBuf[i][j<<1]=disCont[i].bbOut[0][j];
|
sysBuf[i][k+(j*si[i].channels)]=disCont[i].bbOut[k][j];
|
||||||
sysBuf[i][1+(j<<1)]=disCont[i].bbOut[1][j];
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastLoopPos>-1 && j>=lastLoopPos && totalLoops>=exportLoopCount) {
|
if (lastLoopPos>-1 && j>=lastLoopPos && totalLoops>=exportLoopCount) {
|
||||||
|
@ -1333,8 +1341,8 @@ String DivEngine::decodeSysDesc(String desc) {
|
||||||
int val=0;
|
int val=0;
|
||||||
int curStage=0;
|
int curStage=0;
|
||||||
int sysID=0;
|
int sysID=0;
|
||||||
int sysVol=0;
|
float sysVol=0;
|
||||||
int sysPan=0;
|
float sysPan=0;
|
||||||
int sysFlags=0;
|
int sysFlags=0;
|
||||||
int curSys=0;
|
int curSys=0;
|
||||||
desc+=' '; // ha
|
desc+=' '; // ha
|
||||||
|
@ -1349,24 +1357,25 @@ String DivEngine::decodeSysDesc(String desc) {
|
||||||
curStage++;
|
curStage++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
sysVol=val;
|
sysVol=(float)val/64.0f;
|
||||||
curStage++;
|
curStage++;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
sysPan=val;
|
sysPan=(float)val/127.0f;
|
||||||
curStage++;
|
curStage++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
sysFlags=val;
|
sysFlags=val;
|
||||||
|
|
||||||
if (sysID!=0) {
|
if (sysID!=0) {
|
||||||
if (sysVol<-128) sysVol=-128;
|
if (sysVol<-1.0f) sysVol=-1.0f;
|
||||||
if (sysVol>127) sysVol=127;
|
if (sysVol>1.0f) sysVol=1.0f;
|
||||||
if (sysPan<-128) sysPan=-128;
|
if (sysPan<-1.0f) sysPan=-1.0f;
|
||||||
if (sysPan>127) sysPan=127;
|
if (sysPan>1.0f) sysPan=1.0f;
|
||||||
newDesc.set(fmt::sprintf("id%d",curSys),sysID);
|
newDesc.set(fmt::sprintf("id%d",curSys),sysID);
|
||||||
newDesc.set(fmt::sprintf("vol%d",curSys),sysVol);
|
newDesc.set(fmt::sprintf("vol%d",curSys),sysVol);
|
||||||
newDesc.set(fmt::sprintf("pan%d",curSys),sysPan);
|
newDesc.set(fmt::sprintf("pan%d",curSys),sysPan);
|
||||||
|
newDesc.set(fmt::sprintf("fr%d",curSys),0.0f);
|
||||||
DivConfig newFlagsC;
|
DivConfig newFlagsC;
|
||||||
newFlagsC.clear();
|
newFlagsC.clear();
|
||||||
convertOldFlags((unsigned int)sysFlags,newFlagsC,systemFromFileFur(sysID));
|
convertOldFlags((unsigned int)sysFlags,newFlagsC,systemFromFileFur(sysID));
|
||||||
|
@ -1396,7 +1405,7 @@ String DivEngine::decodeSysDesc(String desc) {
|
||||||
return newDesc.toBase64();
|
return newDesc.toBase64();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivEngine::initSongWithDesc(const char* description, bool inBase64) {
|
void DivEngine::initSongWithDesc(const char* description, bool inBase64, bool oldVol) {
|
||||||
int chanCount=0;
|
int chanCount=0;
|
||||||
DivConfig c;
|
DivConfig c;
|
||||||
if (inBase64) {
|
if (inBase64) {
|
||||||
|
@ -1415,9 +1424,16 @@ void DivEngine::initSongWithDesc(const char* description, bool inBase64) {
|
||||||
song.system[index]=DIV_SYSTEM_NULL;
|
song.system[index]=DIV_SYSTEM_NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
song.systemVol[index]=c.getInt(fmt::sprintf("vol%d",index),DIV_SYSTEM_NULL);
|
song.systemVol[index]=c.getFloat(fmt::sprintf("vol%d",index),1.0f);
|
||||||
song.systemPan[index]=c.getInt(fmt::sprintf("pan%d",index),DIV_SYSTEM_NULL);
|
song.systemPan[index]=c.getFloat(fmt::sprintf("pan%d",index),0.0f);
|
||||||
|
song.systemPanFR[index]=c.getFloat(fmt::sprintf("fr%d",index),0.0f);
|
||||||
song.systemFlags[index].clear();
|
song.systemFlags[index].clear();
|
||||||
|
|
||||||
|
if (oldVol) {
|
||||||
|
song.systemVol[index]/=64.0f;
|
||||||
|
song.systemPan[index]/=127.0f;
|
||||||
|
}
|
||||||
|
|
||||||
String flags=c.getString(fmt::sprintf("flags%d",index),"");
|
String flags=c.getString(fmt::sprintf("flags%d",index),"");
|
||||||
song.systemFlags[index].loadFromBase64(flags.c_str());
|
song.systemFlags[index].loadFromBase64(flags.c_str());
|
||||||
}
|
}
|
||||||
|
@ -1667,14 +1683,36 @@ bool DivEngine::addSystem(DivSystem which) {
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
saveLock.lock();
|
saveLock.lock();
|
||||||
song.system[song.systemLen]=which;
|
song.system[song.systemLen]=which;
|
||||||
song.systemVol[song.systemLen]=64;
|
song.systemVol[song.systemLen]=1.0;
|
||||||
song.systemPan[song.systemLen]=0;
|
song.systemPan[song.systemLen]=0;
|
||||||
|
song.systemPanFR[song.systemLen]=0;
|
||||||
song.systemFlags[song.systemLen++].clear();
|
song.systemFlags[song.systemLen++].clear();
|
||||||
recalcChans();
|
recalcChans();
|
||||||
saveLock.unlock();
|
saveLock.unlock();
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
initDispatch();
|
initDispatch();
|
||||||
BUSY_BEGIN;
|
BUSY_BEGIN;
|
||||||
|
saveLock.lock();
|
||||||
|
if (song.patchbayAuto) {
|
||||||
|
autoPatchbay();
|
||||||
|
} else {
|
||||||
|
int i=song.systemLen-1;
|
||||||
|
if (disCont[i].dispatch!=NULL) {
|
||||||
|
unsigned int outs=disCont[i].dispatch->getOutputCount();
|
||||||
|
if (outs>16) outs=16;
|
||||||
|
if (outs<2) {
|
||||||
|
for (unsigned int j=0; j<DIV_MAX_OUTPUTS; j++) {
|
||||||
|
song.patchbay.push_back((i<<20)|j);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (unsigned int j=0; j<outs; j++) {
|
||||||
|
|
||||||
|
song.patchbay.push_back((i<<20)|(j<<16)|j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
saveLock.unlock();
|
||||||
renderSamples();
|
renderSamples();
|
||||||
reset();
|
reset();
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
|
@ -1707,12 +1745,21 @@ bool DivEngine::removeSystem(int index, bool preserveOrder) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// patchbay
|
||||||
|
for (size_t i=0; i<song.patchbay.size(); i++) {
|
||||||
|
if (((song.patchbay[i]>>20)&0xfff)==(unsigned int)index) {
|
||||||
|
song.patchbay.erase(song.patchbay.begin()+i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
song.system[index]=DIV_SYSTEM_NULL;
|
song.system[index]=DIV_SYSTEM_NULL;
|
||||||
song.systemLen--;
|
song.systemLen--;
|
||||||
for (int i=index; i<song.systemLen; i++) {
|
for (int i=index; i<song.systemLen; i++) {
|
||||||
song.system[i]=song.system[i+1];
|
song.system[i]=song.system[i+1];
|
||||||
song.systemVol[i]=song.systemVol[i+1];
|
song.systemVol[i]=song.systemVol[i+1];
|
||||||
song.systemPan[i]=song.systemPan[i+1];
|
song.systemPan[i]=song.systemPan[i+1];
|
||||||
|
song.systemPanFR[i]=song.systemPanFR[i+1];
|
||||||
song.systemFlags[i]=song.systemFlags[i+1];
|
song.systemFlags[i]=song.systemFlags[i+1];
|
||||||
}
|
}
|
||||||
recalcChans();
|
recalcChans();
|
||||||
|
@ -1827,23 +1874,36 @@ bool DivEngine::swapSystem(int src, int dest, bool preserveOrder) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DivSystem srcSystem=song.system[src];
|
DivSystem srcSystem=song.system[src];
|
||||||
|
float srcVol=song.systemVol[src];
|
||||||
|
float srcPan=song.systemPan[src];
|
||||||
|
float srcPanFR=song.systemPanFR[src];
|
||||||
|
|
||||||
song.system[src]=song.system[dest];
|
song.system[src]=song.system[dest];
|
||||||
song.system[dest]=srcSystem;
|
song.system[dest]=srcSystem;
|
||||||
|
|
||||||
song.systemVol[src]^=song.systemVol[dest];
|
song.systemVol[src]=song.systemVol[dest];
|
||||||
song.systemVol[dest]^=song.systemVol[src];
|
song.systemVol[dest]=srcVol;
|
||||||
song.systemVol[src]^=song.systemVol[dest];
|
|
||||||
|
|
||||||
song.systemPan[src]^=song.systemPan[dest];
|
song.systemPan[src]=song.systemPan[dest];
|
||||||
song.systemPan[dest]^=song.systemPan[src];
|
song.systemPan[dest]=srcPan;
|
||||||
song.systemPan[src]^=song.systemPan[dest];
|
|
||||||
|
song.systemPanFR[src]=song.systemPanFR[dest];
|
||||||
|
song.systemPanFR[dest]=srcPanFR;
|
||||||
|
|
||||||
// I am kinda scared to use std::swap
|
// I am kinda scared to use std::swap
|
||||||
DivConfig oldFlags=song.systemFlags[src];
|
DivConfig oldFlags=song.systemFlags[src];
|
||||||
song.systemFlags[src]=song.systemFlags[dest];
|
song.systemFlags[src]=song.systemFlags[dest];
|
||||||
song.systemFlags[dest]=oldFlags;
|
song.systemFlags[dest]=oldFlags;
|
||||||
|
|
||||||
|
// patchbay
|
||||||
|
for (unsigned int& i: song.patchbay) {
|
||||||
|
if (((i>>20)&0xfff)==(unsigned int)src) {
|
||||||
|
i=(i&(~0xfff00000))|((unsigned int)dest<<20);
|
||||||
|
} else if (((i>>20)&0xfff)==(unsigned int)dest) {
|
||||||
|
i=(i&(~0xfff00000))|((unsigned int)src<<20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
recalcChans();
|
recalcChans();
|
||||||
saveLock.unlock();
|
saveLock.unlock();
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
|
@ -1904,10 +1964,11 @@ String DivEngine::getPlaybackDebugInfo() {
|
||||||
"speed1: %d\n"
|
"speed1: %d\n"
|
||||||
"speed2: %d\n"
|
"speed2: %d\n"
|
||||||
"tempoAccum: %d\n"
|
"tempoAccum: %d\n"
|
||||||
"totalProcessed: %d\n",
|
"totalProcessed: %d\n"
|
||||||
|
"bufferPos: %d\n",
|
||||||
curOrder,prevOrder,curRow,prevRow,ticks,subticks,totalLoops,lastLoopPos,nextSpeed,divider,cycles,clockDrift,
|
curOrder,prevOrder,curRow,prevRow,ticks,subticks,totalLoops,lastLoopPos,nextSpeed,divider,cycles,clockDrift,
|
||||||
changeOrd,changePos,totalSeconds,totalTicks,totalTicksR,totalCmds,lastCmds,cmdsPerSecond,globalPitch,
|
changeOrd,changePos,totalSeconds,totalTicks,totalTicksR,totalCmds,lastCmds,cmdsPerSecond,globalPitch,
|
||||||
(int)extValue,(int)speed1,(int)speed2,(int)tempoAccum,(int)totalProcessed
|
(int)extValue,(int)speed1,(int)speed2,(int)tempoAccum,(int)totalProcessed,(int)bufferPos
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3752,6 +3813,102 @@ bool DivEngine::moveSampleDown(int which) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivEngine::autoPatchbay() {
|
||||||
|
song.patchbay.clear();
|
||||||
|
for (unsigned int i=0; i<song.systemLen; i++) {
|
||||||
|
if (disCont[i].dispatch==NULL) continue;
|
||||||
|
|
||||||
|
unsigned int outs=disCont[i].dispatch->getOutputCount();
|
||||||
|
if (outs>16) outs=16;
|
||||||
|
if (outs<2) {
|
||||||
|
for (unsigned int j=0; j<DIV_MAX_OUTPUTS; j++) {
|
||||||
|
song.patchbay.push_back((i<<20)|j);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (unsigned int j=0; j<outs; j++) {
|
||||||
|
|
||||||
|
song.patchbay.push_back((i<<20)|(j<<16)|j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wave/sample preview
|
||||||
|
for (unsigned int j=0; j<DIV_MAX_OUTPUTS; j++) {
|
||||||
|
song.patchbay.push_back(0xffd00000|j);
|
||||||
|
}
|
||||||
|
|
||||||
|
// metronome
|
||||||
|
for (unsigned int j=0; j<DIV_MAX_OUTPUTS; j++) {
|
||||||
|
song.patchbay.push_back(0xffe00000|j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DivEngine::autoPatchbayP() {
|
||||||
|
BUSY_BEGIN;
|
||||||
|
saveLock.lock();
|
||||||
|
autoPatchbay();
|
||||||
|
saveLock.unlock();
|
||||||
|
BUSY_END;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DivEngine::patchConnect(unsigned int src, unsigned int dest) {
|
||||||
|
unsigned int armed=(src<<16)|(dest&0xffff);
|
||||||
|
for (unsigned int i: song.patchbay) {
|
||||||
|
if (i==armed) return false;
|
||||||
|
}
|
||||||
|
BUSY_BEGIN;
|
||||||
|
saveLock.lock();
|
||||||
|
song.patchbay.push_back(armed);
|
||||||
|
song.patchbayAuto=false;
|
||||||
|
saveLock.unlock();
|
||||||
|
BUSY_END;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DivEngine::patchDisconnect(unsigned int src, unsigned int dest) {
|
||||||
|
unsigned int armed=(src<<16)|(dest&0xffff);
|
||||||
|
for (auto i=song.patchbay.begin(); i!=song.patchbay.end(); i++) {
|
||||||
|
if (*i==armed) {
|
||||||
|
BUSY_BEGIN;
|
||||||
|
saveLock.lock();
|
||||||
|
song.patchbay.erase(i);
|
||||||
|
song.patchbayAuto=false;
|
||||||
|
saveLock.unlock();
|
||||||
|
BUSY_END;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DivEngine::patchDisconnectAll(unsigned int portSet) {
|
||||||
|
BUSY_BEGIN;
|
||||||
|
saveLock.lock();
|
||||||
|
|
||||||
|
if (portSet&0x1000) {
|
||||||
|
portSet&=0xfff;
|
||||||
|
|
||||||
|
for (size_t i=0; i<song.patchbay.size(); i++) {
|
||||||
|
if ((song.patchbay[i]&0xfff0)==(portSet<<4)) {
|
||||||
|
song.patchbay.erase(song.patchbay.begin()+i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
portSet&=0xfff;
|
||||||
|
|
||||||
|
for (size_t i=0; i<song.patchbay.size(); i++) {
|
||||||
|
if ((song.patchbay[i]&0xfff00000)==(portSet<<20)) {
|
||||||
|
song.patchbay.erase(song.patchbay.begin()+i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
saveLock.unlock();
|
||||||
|
BUSY_END;
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -3891,6 +4048,14 @@ void DivEngine::updateSysFlags(int system, bool restart) {
|
||||||
BUSY_BEGIN_SOFT;
|
BUSY_BEGIN_SOFT;
|
||||||
disCont[system].dispatch->setFlags(song.systemFlags[system]);
|
disCont[system].dispatch->setFlags(song.systemFlags[system]);
|
||||||
disCont[system].setRates(got.rate);
|
disCont[system].setRates(got.rate);
|
||||||
|
|
||||||
|
// patchbay
|
||||||
|
if (song.patchbayAuto) {
|
||||||
|
saveLock.lock();
|
||||||
|
autoPatchbay();
|
||||||
|
saveLock.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
if (restart && isPlaying()) {
|
if (restart && isPlaying()) {
|
||||||
playSub(false);
|
playSub(false);
|
||||||
}
|
}
|
||||||
|
@ -4055,6 +4220,11 @@ void DivEngine::initDispatch() {
|
||||||
disCont[i].setRates(got.rate);
|
disCont[i].setRates(got.rate);
|
||||||
disCont[i].setQuality(lowQuality);
|
disCont[i].setQuality(lowQuality);
|
||||||
}
|
}
|
||||||
|
if (song.patchbayAuto) {
|
||||||
|
saveLock.lock();
|
||||||
|
autoPatchbay();
|
||||||
|
saveLock.unlock();
|
||||||
|
}
|
||||||
recalcChans();
|
recalcChans();
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
}
|
}
|
||||||
|
@ -4153,10 +4323,13 @@ bool DivEngine::initAudioBackend() {
|
||||||
want.rate=getConfInt("audioRate",44100);
|
want.rate=getConfInt("audioRate",44100);
|
||||||
want.fragments=2;
|
want.fragments=2;
|
||||||
want.inChans=0;
|
want.inChans=0;
|
||||||
want.outChans=2;
|
want.outChans=getConfInt("audioChans",2);
|
||||||
want.outFormat=TA_AUDIO_FORMAT_F32;
|
want.outFormat=TA_AUDIO_FORMAT_F32;
|
||||||
want.name="Furnace";
|
want.name="Furnace";
|
||||||
|
|
||||||
|
if (want.outChans<1) want.outChans=1;
|
||||||
|
if (want.outChans>16) want.outChans=16;
|
||||||
|
|
||||||
output->setCallback(process,this);
|
output->setCallback(process,this);
|
||||||
|
|
||||||
if (!output->init(want,got)) {
|
if (!output->init(want,got)) {
|
||||||
|
@ -4167,6 +4340,13 @@ bool DivEngine::initAudioBackend() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<got.outChans; i++) {
|
||||||
|
if (oscBuf[i]==NULL) {
|
||||||
|
oscBuf[i]=new float[32768];
|
||||||
|
}
|
||||||
|
memset(oscBuf[i],0,32768*sizeof(float));
|
||||||
|
}
|
||||||
|
|
||||||
if (output->initMidi(false)) {
|
if (output->initMidi(false)) {
|
||||||
midiIns=output->midiIn->listDevices();
|
midiIns=output->midiIn->listDevices();
|
||||||
midiOuts=output->midiOut->listDevices();
|
midiOuts=output->midiOut->listDevices();
|
||||||
|
@ -4248,13 +4428,15 @@ bool DivEngine::init() {
|
||||||
if (!hasLoadedSomething) {
|
if (!hasLoadedSomething) {
|
||||||
logD("setting default preset");
|
logD("setting default preset");
|
||||||
String preset=getConfString("initialSys2","");
|
String preset=getConfString("initialSys2","");
|
||||||
|
bool oldVol=getConfInt("configVersion",DIV_ENGINE_VERSION)<135;
|
||||||
if (preset.empty()) {
|
if (preset.empty()) {
|
||||||
// try loading old preset
|
// try loading old preset
|
||||||
preset=decodeSysDesc(getConfString("initialSys",""));
|
preset=decodeSysDesc(getConfString("initialSys",""));
|
||||||
|
oldVol=false;
|
||||||
}
|
}
|
||||||
logD("preset size %ld",preset.size());
|
logD("preset size %ld",preset.size());
|
||||||
if (preset.size()>0 && (preset.size()&3)==0) {
|
if (preset.size()>0 && (preset.size()&3)==0) {
|
||||||
initSongWithDesc(preset.c_str());
|
initSongWithDesc(preset.c_str(),true,oldVol);
|
||||||
}
|
}
|
||||||
String sysName=getConfString("initialSysName","");
|
String sysName=getConfString("initialSysName","");
|
||||||
if (sysName=="") {
|
if (sysName=="") {
|
||||||
|
@ -4284,6 +4466,9 @@ bool DivEngine::init() {
|
||||||
samp_bbIn=new short[32768];
|
samp_bbIn=new short[32768];
|
||||||
samp_bbInLen=32768;
|
samp_bbInLen=32768;
|
||||||
|
|
||||||
|
metroBuf=new float[8192];
|
||||||
|
metroBufLen=8192;
|
||||||
|
|
||||||
blip_set_rates(samp_bb,44100,got.rate);
|
blip_set_rates(samp_bb,44100,got.rate);
|
||||||
|
|
||||||
for (int i=0; i<64; i++) {
|
for (int i=0; i<64; i++) {
|
||||||
|
@ -4299,12 +4484,6 @@ bool DivEngine::init() {
|
||||||
keyHit[i]=false;
|
keyHit[i]=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
oscBuf[0]=new float[32768];
|
|
||||||
oscBuf[1]=new float[32768];
|
|
||||||
|
|
||||||
memset(oscBuf[0],0,32768*sizeof(float));
|
|
||||||
memset(oscBuf[1],0,32768*sizeof(float));
|
|
||||||
|
|
||||||
initDispatch();
|
initDispatch();
|
||||||
renderSamples();
|
renderSamples();
|
||||||
reset();
|
reset();
|
||||||
|
@ -4313,6 +4492,10 @@ bool DivEngine::init() {
|
||||||
if (!haveAudio) {
|
if (!haveAudio) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
if (output==NULL) {
|
||||||
|
logE("output is NULL!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (!output->setRun(true)) {
|
if (!output->setRun(true)) {
|
||||||
logE("error while activating!");
|
logE("error while activating!");
|
||||||
return false;
|
return false;
|
||||||
|
@ -4327,8 +4510,14 @@ bool DivEngine::quit() {
|
||||||
logI("saving config.");
|
logI("saving config.");
|
||||||
saveConf();
|
saveConf();
|
||||||
active=false;
|
active=false;
|
||||||
delete[] oscBuf[0];
|
for (int i=0; i<DIV_MAX_OUTPUTS; i++) {
|
||||||
delete[] oscBuf[1];
|
if (oscBuf[i]!=NULL) delete[] oscBuf[i];
|
||||||
|
}
|
||||||
|
if (metroBuf!=NULL) {
|
||||||
|
delete[] metroBuf;
|
||||||
|
metroBuf=NULL;
|
||||||
|
metroBufLen=0;
|
||||||
|
}
|
||||||
if (yrw801ROM!=NULL) delete[] yrw801ROM;
|
if (yrw801ROM!=NULL) delete[] yrw801ROM;
|
||||||
if (tg100ROM!=NULL) delete[] tg100ROM;
|
if (tg100ROM!=NULL) delete[] tg100ROM;
|
||||||
if (mu5ROM!=NULL) delete[] mu5ROM;
|
if (mu5ROM!=NULL) delete[] mu5ROM;
|
||||||
|
|
|
@ -47,8 +47,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 "0.6pre3"
|
#define DIV_VERSION "dev136"
|
||||||
#define DIV_ENGINE_VERSION 133
|
#define DIV_ENGINE_VERSION 136
|
||||||
// for imports
|
// for imports
|
||||||
#define DIV_VERSION_MOD 0xff01
|
#define DIV_VERSION_MOD 0xff01
|
||||||
#define DIV_VERSION_FC 0xff02
|
#define DIV_VERSION_FC 0xff02
|
||||||
|
@ -97,7 +97,7 @@ struct DivChannelState {
|
||||||
int delayOrder, delayRow, retrigSpeed, retrigTick;
|
int delayOrder, delayRow, retrigSpeed, retrigTick;
|
||||||
int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoDir, vibratoFine;
|
int vibratoDepth, vibratoRate, vibratoPos, vibratoPosGiant, vibratoDir, vibratoFine;
|
||||||
int tremoloDepth, tremoloRate, tremoloPos;
|
int tremoloDepth, tremoloRate, tremoloPos;
|
||||||
unsigned char arp, arpStage, arpTicks, panL, panR;
|
unsigned char arp, arpStage, arpTicks, panL, panR, panRL, panRR;
|
||||||
bool doNote, legato, portaStop, keyOn, keyOff, nowYouCanStop, stopOnOff;
|
bool doNote, legato, portaStop, keyOn, keyOff, nowYouCanStop, stopOnOff;
|
||||||
bool arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, wasShorthandPorta, noteOnInhibit, resetArp;
|
bool arpYield, delayLocked, inPorta, scheduledSlideReset, shorthandPorta, wasShorthandPorta, noteOnInhibit, resetArp;
|
||||||
|
|
||||||
|
@ -135,6 +135,8 @@ struct DivChannelState {
|
||||||
arpTicks(1),
|
arpTicks(1),
|
||||||
panL(255),
|
panL(255),
|
||||||
panR(255),
|
panR(255),
|
||||||
|
panRL(0),
|
||||||
|
panRR(0),
|
||||||
doNote(false),
|
doNote(false),
|
||||||
legato(false),
|
legato(false),
|
||||||
portaStop(false),
|
portaStop(false),
|
||||||
|
@ -170,15 +172,18 @@ struct DivNoteEvent {
|
||||||
|
|
||||||
struct DivDispatchContainer {
|
struct DivDispatchContainer {
|
||||||
DivDispatch* dispatch;
|
DivDispatch* dispatch;
|
||||||
blip_buffer_t* bb[2];
|
blip_buffer_t* bb[DIV_MAX_OUTPUTS];
|
||||||
size_t bbInLen, runtotal, runLeft, runPos, lastAvail;
|
size_t bbInLen, runtotal, runLeft, runPos, lastAvail;
|
||||||
int temp[2], prevSample[2];
|
int temp[DIV_MAX_OUTPUTS], prevSample[DIV_MAX_OUTPUTS];
|
||||||
short* bbIn[2];
|
short* bbInMapped[DIV_MAX_OUTPUTS];
|
||||||
short* bbOut[2];
|
short* bbIn[DIV_MAX_OUTPUTS];
|
||||||
|
short* bbOut[DIV_MAX_OUTPUTS];
|
||||||
bool lowQuality, dcOffCompensation;
|
bool lowQuality, dcOffCompensation;
|
||||||
|
double rateMemory;
|
||||||
|
|
||||||
void setRates(double gotRate);
|
void setRates(double gotRate);
|
||||||
void setQuality(bool lowQual);
|
void setQuality(bool lowQual);
|
||||||
|
void grow(size_t size);
|
||||||
void acquire(size_t offset, size_t count);
|
void acquire(size_t offset, size_t count);
|
||||||
void flush(size_t count);
|
void flush(size_t count);
|
||||||
void fillBuf(size_t runtotal, size_t offset, size_t size);
|
void fillBuf(size_t runtotal, size_t offset, size_t size);
|
||||||
|
@ -187,18 +192,21 @@ struct DivDispatchContainer {
|
||||||
void quit();
|
void quit();
|
||||||
DivDispatchContainer():
|
DivDispatchContainer():
|
||||||
dispatch(NULL),
|
dispatch(NULL),
|
||||||
bb{NULL,NULL},
|
|
||||||
bbInLen(0),
|
bbInLen(0),
|
||||||
runtotal(0),
|
runtotal(0),
|
||||||
runLeft(0),
|
runLeft(0),
|
||||||
runPos(0),
|
runPos(0),
|
||||||
lastAvail(0),
|
lastAvail(0),
|
||||||
temp{0,0},
|
|
||||||
prevSample{0,0},
|
|
||||||
bbIn{NULL,NULL},
|
|
||||||
bbOut{NULL,NULL},
|
|
||||||
lowQuality(false),
|
lowQuality(false),
|
||||||
dcOffCompensation(false) {}
|
dcOffCompensation(false),
|
||||||
|
rateMemory(0.0) {
|
||||||
|
memset(bb,0,DIV_MAX_OUTPUTS*sizeof(blip_buffer_t*));
|
||||||
|
memset(temp,0,DIV_MAX_OUTPUTS*sizeof(int));
|
||||||
|
memset(prevSample,0,DIV_MAX_OUTPUTS*sizeof(int));
|
||||||
|
memset(bbIn,0,DIV_MAX_OUTPUTS*sizeof(short*));
|
||||||
|
memset(bbInMapped,0,DIV_MAX_OUTPUTS*sizeof(short*));
|
||||||
|
memset(bbOut,0,DIV_MAX_OUTPUTS*sizeof(short*));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int EffectValConversion(unsigned char,unsigned char);
|
typedef int EffectValConversion(unsigned char,unsigned char);
|
||||||
|
@ -353,6 +361,7 @@ class DivEngine {
|
||||||
int softLockCount;
|
int softLockCount;
|
||||||
int subticks, ticks, curRow, curOrder, prevRow, prevOrder, remainingLoops, totalLoops, lastLoopPos, exportLoopCount, nextSpeed, elapsedBars, elapsedBeats;
|
int subticks, ticks, curRow, curOrder, prevRow, prevOrder, remainingLoops, totalLoops, lastLoopPos, exportLoopCount, nextSpeed, elapsedBars, elapsedBeats;
|
||||||
size_t curSubSongIndex;
|
size_t curSubSongIndex;
|
||||||
|
size_t bufferPos;
|
||||||
double divider;
|
double divider;
|
||||||
int cycles;
|
int cycles;
|
||||||
double clockDrift;
|
double clockDrift;
|
||||||
|
@ -418,6 +427,8 @@ class DivEngine {
|
||||||
short* samp_bbOut;
|
short* samp_bbOut;
|
||||||
unsigned char* metroTick;
|
unsigned char* metroTick;
|
||||||
size_t metroTickLen;
|
size_t metroTickLen;
|
||||||
|
float* metroBuf;
|
||||||
|
size_t metroBufLen;
|
||||||
float metroFreq, metroPos;
|
float metroFreq, metroPos;
|
||||||
float metroAmp;
|
float metroAmp;
|
||||||
float metroVol;
|
float metroVol;
|
||||||
|
@ -467,7 +478,7 @@ class DivEngine {
|
||||||
bool deinitAudioBackend(bool dueToSwitchMaster=false);
|
bool deinitAudioBackend(bool dueToSwitchMaster=false);
|
||||||
|
|
||||||
void registerSystems();
|
void registerSystems();
|
||||||
void initSongWithDesc(const char* description, bool inBase64=true);
|
void initSongWithDesc(const char* description, bool inBase64=true, bool oldVol=false);
|
||||||
|
|
||||||
void exchangeIns(int one, int two);
|
void exchangeIns(int one, int two);
|
||||||
void swapChannels(int src, int dest);
|
void swapChannels(int src, int dest);
|
||||||
|
@ -486,7 +497,7 @@ class DivEngine {
|
||||||
int dispatchOfChan[DIV_MAX_CHANS];
|
int dispatchOfChan[DIV_MAX_CHANS];
|
||||||
int dispatchChanOfChan[DIV_MAX_CHANS];
|
int dispatchChanOfChan[DIV_MAX_CHANS];
|
||||||
bool keyHit[DIV_MAX_CHANS];
|
bool keyHit[DIV_MAX_CHANS];
|
||||||
float* oscBuf[2];
|
float* oscBuf[DIV_MAX_OUTPUTS];
|
||||||
float oscSize;
|
float oscSize;
|
||||||
int oscReadPos, oscWritePos;
|
int oscReadPos, oscWritePos;
|
||||||
int tickMult;
|
int tickMult;
|
||||||
|
@ -826,6 +837,21 @@ class DivEngine {
|
||||||
bool moveWaveDown(int which);
|
bool moveWaveDown(int which);
|
||||||
bool moveSampleDown(int which);
|
bool moveSampleDown(int which);
|
||||||
|
|
||||||
|
// automatic patchbay
|
||||||
|
void autoPatchbay();
|
||||||
|
void autoPatchbayP();
|
||||||
|
|
||||||
|
// connect in patchbay
|
||||||
|
// returns false if connection already made
|
||||||
|
bool patchConnect(unsigned int src, unsigned int dest);
|
||||||
|
|
||||||
|
// disconnect in patchbay
|
||||||
|
// returns false if connection doesn't exist
|
||||||
|
bool patchDisconnect(unsigned int src, unsigned int dest);
|
||||||
|
|
||||||
|
// disconnect all in patchbay
|
||||||
|
void patchDisconnectAll(unsigned int portSet);
|
||||||
|
|
||||||
// play note
|
// play note
|
||||||
void noteOn(int chan, int ins, int note, int vol=-1);
|
void noteOn(int chan, int ins, int note, int vol=-1);
|
||||||
|
|
||||||
|
@ -902,6 +928,9 @@ class DivEngine {
|
||||||
// set metronome volume (1.0 = 100%)
|
// set metronome volume (1.0 = 100%)
|
||||||
void setMetronomeVol(float vol);
|
void setMetronomeVol(float vol);
|
||||||
|
|
||||||
|
// get buffer position
|
||||||
|
int getBufferPos();
|
||||||
|
|
||||||
// halt now
|
// halt now
|
||||||
void halt();
|
void halt();
|
||||||
|
|
||||||
|
@ -1070,6 +1099,7 @@ class DivEngine {
|
||||||
elapsedBars(0),
|
elapsedBars(0),
|
||||||
elapsedBeats(0),
|
elapsedBeats(0),
|
||||||
curSubSongIndex(0),
|
curSubSongIndex(0),
|
||||||
|
bufferPos(0),
|
||||||
divider(60),
|
divider(60),
|
||||||
cycles(0),
|
cycles(0),
|
||||||
clockDrift(0),
|
clockDrift(0),
|
||||||
|
@ -1104,6 +1134,8 @@ class DivEngine {
|
||||||
samp_bbOut(NULL),
|
samp_bbOut(NULL),
|
||||||
metroTick(NULL),
|
metroTick(NULL),
|
||||||
metroTickLen(0),
|
metroTickLen(0),
|
||||||
|
metroBuf(NULL),
|
||||||
|
metroBufLen(0),
|
||||||
metroFreq(0),
|
metroFreq(0),
|
||||||
metroPos(0),
|
metroPos(0),
|
||||||
metroAmp(0.0f),
|
metroAmp(0.0f),
|
||||||
|
@ -1112,7 +1144,6 @@ class DivEngine {
|
||||||
curOrders(NULL),
|
curOrders(NULL),
|
||||||
curPat(NULL),
|
curPat(NULL),
|
||||||
tempIns(NULL),
|
tempIns(NULL),
|
||||||
oscBuf{NULL,NULL},
|
|
||||||
oscSize(1),
|
oscSize(1),
|
||||||
oscReadPos(0),
|
oscReadPos(0),
|
||||||
oscWritePos(0),
|
oscWritePos(0),
|
||||||
|
@ -1131,6 +1162,7 @@ class DivEngine {
|
||||||
memset(pitchTable,0,4096*sizeof(int));
|
memset(pitchTable,0,4096*sizeof(int));
|
||||||
memset(sysDefs,0,256*sizeof(void*));
|
memset(sysDefs,0,256*sizeof(void*));
|
||||||
memset(walked,0,8192);
|
memset(walked,0,8192);
|
||||||
|
memset(oscBuf,0,DIV_MAX_OUTPUTS*(sizeof(float*)));
|
||||||
|
|
||||||
for (int i=0; i<256; i++) {
|
for (int i=0; i<256; i++) {
|
||||||
sysFileMapFur[i]=DIV_SYSTEM_NULL;
|
sysFileMapFur[i]=DIV_SYSTEM_NULL;
|
||||||
|
|
|
@ -939,13 +939,13 @@ bool DivEngine::loadDMF(unsigned char* file, size_t len) {
|
||||||
ds.systemLen=2;
|
ds.systemLen=2;
|
||||||
ds.system[0]=DIV_SYSTEM_YM2612;
|
ds.system[0]=DIV_SYSTEM_YM2612;
|
||||||
ds.system[1]=DIV_SYSTEM_SMS;
|
ds.system[1]=DIV_SYSTEM_SMS;
|
||||||
ds.systemVol[1]=32;
|
ds.systemVol[1]=0.5f;
|
||||||
}
|
}
|
||||||
if (ds.system[0]==DIV_SYSTEM_GENESIS_EXT) {
|
if (ds.system[0]==DIV_SYSTEM_GENESIS_EXT) {
|
||||||
ds.systemLen=2;
|
ds.systemLen=2;
|
||||||
ds.system[0]=DIV_SYSTEM_YM2612_EXT;
|
ds.system[0]=DIV_SYSTEM_YM2612_EXT;
|
||||||
ds.system[1]=DIV_SYSTEM_SMS;
|
ds.system[1]=DIV_SYSTEM_SMS;
|
||||||
ds.systemVol[1]=32;
|
ds.systemVol[1]=0.5f;
|
||||||
}
|
}
|
||||||
if (ds.system[0]==DIV_SYSTEM_ARCADE) {
|
if (ds.system[0]==DIV_SYSTEM_ARCADE) {
|
||||||
ds.systemLen=2;
|
ds.systemLen=2;
|
||||||
|
@ -1830,14 +1830,18 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
|
|
||||||
// system volume
|
// system volume
|
||||||
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||||
ds.systemVol[i]=reader.readC();
|
signed char oldSysVol=reader.readC();
|
||||||
|
ds.systemVol[i]=(float)oldSysVol/64.0f;
|
||||||
if (ds.version<59 && ds.system[i]==DIV_SYSTEM_NES) {
|
if (ds.version<59 && ds.system[i]==DIV_SYSTEM_NES) {
|
||||||
ds.systemVol[i]/=4;
|
ds.systemVol[i]/=4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// system panning
|
// system panning
|
||||||
for (int i=0; i<DIV_MAX_CHIPS; i++) ds.systemPan[i]=reader.readC();
|
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||||
|
signed char oldSysPan=reader.readC();
|
||||||
|
ds.systemPan[i]=(float)oldSysPan/127.0f;
|
||||||
|
}
|
||||||
|
|
||||||
// system props
|
// system props
|
||||||
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||||
|
@ -1860,14 +1864,14 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
ds.system[i]=DIV_SYSTEM_YM2612;
|
ds.system[i]=DIV_SYSTEM_YM2612;
|
||||||
if (i<31) {
|
if (i<31) {
|
||||||
ds.system[i+1]=DIV_SYSTEM_SMS;
|
ds.system[i+1]=DIV_SYSTEM_SMS;
|
||||||
ds.systemVol[i+1]=(((ds.systemVol[i]&127)*3)>>3)|(ds.systemVol[i]&128);
|
ds.systemVol[i+1]=ds.systemVol[i]*0.375f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ds.system[i]==DIV_SYSTEM_GENESIS_EXT) {
|
if (ds.system[i]==DIV_SYSTEM_GENESIS_EXT) {
|
||||||
ds.system[i]=DIV_SYSTEM_YM2612_EXT;
|
ds.system[i]=DIV_SYSTEM_YM2612_EXT;
|
||||||
if (i<31) {
|
if (i<31) {
|
||||||
ds.system[i+1]=DIV_SYSTEM_SMS;
|
ds.system[i+1]=DIV_SYSTEM_SMS;
|
||||||
ds.systemVol[i+1]=(((ds.systemVol[i]&127)*3)>>3)|(ds.systemVol[i]&128);
|
ds.systemVol[i+1]=ds.systemVol[i]*0.375f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ds.system[i]==DIV_SYSTEM_ARCADE) {
|
if (ds.system[i]==DIV_SYSTEM_ARCADE) {
|
||||||
|
@ -2200,6 +2204,23 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
ds.autoSystem=true;
|
ds.autoSystem=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// system output config
|
||||||
|
if (ds.version>=135) {
|
||||||
|
for (int i=0; i<ds.systemLen; i++) {
|
||||||
|
ds.systemVol[i]=reader.readF();
|
||||||
|
ds.systemPan[i]=reader.readF();
|
||||||
|
ds.systemPanFR[i]=reader.readF();
|
||||||
|
}
|
||||||
|
|
||||||
|
// patchbay
|
||||||
|
unsigned int conns=reader.readI();
|
||||||
|
for (unsigned int i=0; i<conns; i++) {
|
||||||
|
ds.patchbay.push_back((unsigned int)reader.readI());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ds.version>=136) song.patchbayAuto=reader.readC();
|
||||||
|
|
||||||
// read system flags
|
// read system flags
|
||||||
if (ds.version>=119) {
|
if (ds.version>=119) {
|
||||||
logD("reading chip flags...");
|
logD("reading chip flags...");
|
||||||
|
@ -2543,6 +2564,16 @@ bool DivEngine::loadFur(unsigned char* file, size_t len) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OPL3 pan compat
|
||||||
|
if (ds.version<134) {
|
||||||
|
for (int i=0; i<ds.systemLen; i++) {
|
||||||
|
if (ds.system[i]==DIV_SYSTEM_OPL3 ||
|
||||||
|
ds.system[i]==DIV_SYSTEM_OPL3_DRUMS) {
|
||||||
|
ds.systemFlags[i].set("compatPan",true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (active) quitDispatch();
|
if (active) quitDispatch();
|
||||||
BUSY_BEGIN_SOFT;
|
BUSY_BEGIN_SOFT;
|
||||||
saveLock.lock();
|
saveLock.lock();
|
||||||
|
@ -3147,7 +3178,7 @@ bool DivEngine::loadFC(unsigned char* file, size_t len) {
|
||||||
|
|
||||||
ds.systemLen=1;
|
ds.systemLen=1;
|
||||||
ds.system[0]=DIV_SYSTEM_AMIGA;
|
ds.system[0]=DIV_SYSTEM_AMIGA;
|
||||||
ds.systemVol[0]=64;
|
ds.systemVol[0]=1.0f;
|
||||||
ds.systemPan[0]=0;
|
ds.systemPan[0]=0;
|
||||||
ds.systemFlags[0].set("clockSel",1); // PAL
|
ds.systemFlags[0].set("clockSel",1); // PAL
|
||||||
ds.systemFlags[0].set("stereoSep",80);
|
ds.systemFlags[0].set("stereoSep",80);
|
||||||
|
@ -4298,11 +4329,11 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||||
w->writeC(song.systemVol[i]);
|
w->writeC(song.systemVol[i]*64.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
for (int i=0; i<DIV_MAX_CHIPS; i++) {
|
||||||
w->writeC(song.systemPan[i]);
|
w->writeC(song.systemPan[i]*127.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// chip flags (we'll seek here later)
|
// chip flags (we'll seek here later)
|
||||||
|
@ -4446,6 +4477,18 @@ SafeWriter* DivEngine::saveFur(bool notPrimary) {
|
||||||
w->writeString(song.systemNameJ,false);
|
w->writeString(song.systemNameJ,false);
|
||||||
w->writeString(song.categoryJ,false);
|
w->writeString(song.categoryJ,false);
|
||||||
|
|
||||||
|
// system output config
|
||||||
|
for (int i=0; i<song.systemLen; i++) {
|
||||||
|
w->writeF(song.systemVol[i]);
|
||||||
|
w->writeF(song.systemPan[i]);
|
||||||
|
w->writeF(song.systemPanFR[i]);
|
||||||
|
}
|
||||||
|
w->writeI(song.patchbay.size());
|
||||||
|
for (unsigned int i: song.patchbay) {
|
||||||
|
w->writeI(i);
|
||||||
|
}
|
||||||
|
w->writeC(song.patchbayAuto);
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -372,24 +372,15 @@ struct DivInstrumentC64 {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DivInstrumentAmiga {
|
struct DivInstrumentAmiga {
|
||||||
enum DivReverseMode: unsigned char {
|
|
||||||
DIV_REVERSE_DISABLE=0,
|
|
||||||
DIV_REVERSE_ENABLE,
|
|
||||||
DIV_REVERSE_DEFAULT
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SampleMap {
|
struct SampleMap {
|
||||||
int freq;
|
int freq;
|
||||||
short map;
|
short map;
|
||||||
DivInstrumentAmiga::DivReverseMode reversed;
|
SampleMap(int f=0, short m=-1):
|
||||||
SampleMap(int f=0, short m=-1, DivInstrumentAmiga::DivReverseMode r=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT):
|
|
||||||
freq(f),
|
freq(f),
|
||||||
map(m),
|
map(m) {}
|
||||||
reversed(r) {}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
short initSample;
|
short initSample;
|
||||||
DivInstrumentAmiga::DivReverseMode reversed;
|
|
||||||
bool useNoteMap;
|
bool useNoteMap;
|
||||||
bool useSample;
|
bool useSample;
|
||||||
bool useWave;
|
bool useWave;
|
||||||
|
@ -427,22 +418,8 @@ struct DivInstrumentAmiga {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* get the sample reversed flag at specified note.
|
|
||||||
* @return the reversed flag.
|
|
||||||
*/
|
|
||||||
inline DivInstrumentAmiga::DivReverseMode getReversed(int note) {
|
|
||||||
if (useNoteMap) {
|
|
||||||
if (note<0) note=0;
|
|
||||||
if (note>119) note=119;
|
|
||||||
return noteMap[note].reversed;
|
|
||||||
}
|
|
||||||
return reversed;
|
|
||||||
}
|
|
||||||
|
|
||||||
DivInstrumentAmiga():
|
DivInstrumentAmiga():
|
||||||
initSample(0),
|
initSample(0),
|
||||||
reversed(DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DISABLE),
|
|
||||||
useNoteMap(false),
|
useNoteMap(false),
|
||||||
useSample(false),
|
useSample(false),
|
||||||
useWave(false),
|
useWave(false),
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "../dispatch.h"
|
#include "../dispatch.h"
|
||||||
|
|
||||||
void DivDispatch::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivDispatch::acquire(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivDispatch::fillStream(std::vector<DivDelayedWrite>& stream, int sRate, size_t len) {
|
void DivDispatch::fillStream(std::vector<DivDelayedWrite>& stream, int sRate, size_t len) {
|
||||||
|
@ -69,8 +69,8 @@ int DivDispatch::dispatch(DivCommand c) {
|
||||||
void DivDispatch::reset() {
|
void DivDispatch::reset() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivDispatch::isStereo() {
|
int DivDispatch::getOutputCount() {
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivDispatch::keyOffAffectsArp(int ch) {
|
bool DivDispatch::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -75,9 +75,9 @@ const char** DivPlatformAmiga::getRegisterSheet() {
|
||||||
if (chan[i+1].freq<AMIGA_DIVIDER) chan[i+1].freq=AMIGA_DIVIDER; \
|
if (chan[i+1].freq<AMIGA_DIVIDER) chan[i+1].freq=AMIGA_DIVIDER; \
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformAmiga::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformAmiga::acquire(short** buf, size_t len) {
|
||||||
static int outL, outR, output;
|
static int outL, outR, output;
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
outL=0;
|
outL=0;
|
||||||
outR=0;
|
outR=0;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
|
@ -142,8 +142,8 @@ void DivPlatformAmiga::acquire(short* bufL, short* bufR, size_t start, size_t le
|
||||||
filter[0][1]+=(filtConst*(filter[0][0]-filter[0][1]))>>12;
|
filter[0][1]+=(filtConst*(filter[0][0]-filter[0][1]))>>12;
|
||||||
filter[1][0]+=(filtConst*(outR-filter[1][0]))>>12;
|
filter[1][0]+=(filtConst*(outR-filter[1][0]))>>12;
|
||||||
filter[1][1]+=(filtConst*(filter[1][0]-filter[1][1]))>>12;
|
filter[1][1]+=(filtConst*(filter[1][0]-filter[1][1]))>>12;
|
||||||
bufL[h]=filter[0][1];
|
buf[0][h]=filter[0][1];
|
||||||
bufR[h]=filter[1][1];
|
buf[1][h]=filter[1][1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,8 +401,8 @@ void DivPlatformAmiga::reset() {
|
||||||
filtConst=filterOn?filtConstOn:filtConstOff;
|
filtConst=filterOn?filtConstOn:filtConstOff;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformAmiga::isStereo() {
|
int DivPlatformAmiga::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformAmiga::keyOffAffectsArp(int ch) {
|
bool DivPlatformAmiga::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class DivPlatformAmiga: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||||
|
@ -75,7 +75,7 @@ class DivPlatformAmiga: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
|
|
|
@ -50,10 +50,10 @@ const char** DivPlatformArcade::getRegisterSheet() {
|
||||||
return regCheatSheetOPM;
|
return regCheatSheetOPM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformArcade::acquire_nuked(short** buf, size_t len) {
|
||||||
static int o[2];
|
static int o[2];
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
if (!writes.empty() && !fm.write_busy) {
|
if (!writes.empty() && !fm.write_busy) {
|
||||||
QueuedWrite& w=writes.front();
|
QueuedWrite& w=writes.front();
|
||||||
|
@ -84,17 +84,17 @@ void DivPlatformArcade::acquire_nuked(short* bufL, short* bufR, size_t start, si
|
||||||
if (o[1]<-32768) o[1]=-32768;
|
if (o[1]<-32768) o[1]=-32768;
|
||||||
if (o[1]>32767) o[1]=32767;
|
if (o[1]>32767) o[1]=32767;
|
||||||
|
|
||||||
bufL[h]=o[0];
|
buf[0][h]=o[0];
|
||||||
bufR[h]=o[1];
|
buf[1][h]=o[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformArcade::acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformArcade::acquire_ymfm(short** buf, size_t len) {
|
||||||
static int os[2];
|
static int os[2];
|
||||||
|
|
||||||
ymfm::ym2151::fm_engine* fme=fm_ymfm->debug_engine();
|
ymfm::ym2151::fm_engine* fme=fm_ymfm->debug_engine();
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
os[0]=0; os[1]=0;
|
os[0]=0; os[1]=0;
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
if (--delay<1) {
|
if (--delay<1) {
|
||||||
|
@ -121,16 +121,16 @@ void DivPlatformArcade::acquire_ymfm(short* bufL, short* bufR, size_t start, siz
|
||||||
if (os[1]<-32768) os[1]=-32768;
|
if (os[1]<-32768) os[1]=-32768;
|
||||||
if (os[1]>32767) os[1]=32767;
|
if (os[1]>32767) os[1]=32767;
|
||||||
|
|
||||||
bufL[h]=os[0];
|
buf[0][h]=os[0];
|
||||||
bufR[h]=os[1];
|
buf[1][h]=os[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformArcade::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformArcade::acquire(short** buf, size_t len) {
|
||||||
if (useYMFM) {
|
if (useYMFM) {
|
||||||
acquire_ymfm(bufL,bufR,start,len);
|
acquire_ymfm(buf,len);
|
||||||
} else {
|
} else {
|
||||||
acquire_nuked(bufL,bufR,start,len);
|
acquire_nuked(buf,len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,8 +885,8 @@ void DivPlatformArcade::setFlags(const DivConfig& flags) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformArcade::isStereo() {
|
int DivPlatformArcade::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformArcade::setYMFM(bool use) {
|
void DivPlatformArcade::setYMFM(bool use) {
|
||||||
|
|
|
@ -58,13 +58,13 @@ class DivPlatformArcade: public DivPlatformOPM {
|
||||||
int octave(int freq);
|
int octave(int freq);
|
||||||
int toFreq(int freq);
|
int toFreq(int freq);
|
||||||
|
|
||||||
void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_nuked(short** buf, size_t len);
|
||||||
void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_ymfm(short** buf, size_t len);
|
||||||
|
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||||
|
@ -77,7 +77,7 @@ class DivPlatformArcade: public DivPlatformOPM {
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
void setYMFM(bool use);
|
void setYMFM(bool use);
|
||||||
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);
|
||||||
|
|
|
@ -169,7 +169,7 @@ void DivPlatformAY8910::checkWrites() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformAY8910::acquire(short** buf, size_t len) {
|
||||||
if (ayBufLen<len) {
|
if (ayBufLen<len) {
|
||||||
ayBufLen=len;
|
ayBufLen=len;
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
|
@ -184,8 +184,8 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
|
||||||
checkWrites();
|
checkWrites();
|
||||||
|
|
||||||
ay->sound_stream_update(ayBuf,1);
|
ay->sound_stream_update(ayBuf,1);
|
||||||
bufL[i+start]=ayBuf[0][0];
|
buf[0][i]=ayBuf[0][0];
|
||||||
bufR[i+start]=bufL[i+start];
|
buf[1][i]=buf[0][i];
|
||||||
|
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=sunsoftVolTable[31-(ay->lastIndx&31)]>>3;
|
oscBuf[0]->data[oscBuf[0]->needle++]=sunsoftVolTable[31-(ay->lastIndx&31)]>>3;
|
||||||
oscBuf[1]->data[oscBuf[1]->needle++]=sunsoftVolTable[31-((ay->lastIndx>>5)&31)]>>3;
|
oscBuf[1]->data[oscBuf[1]->needle++]=sunsoftVolTable[31-((ay->lastIndx>>5)&31)]>>3;
|
||||||
|
@ -198,11 +198,11 @@ void DivPlatformAY8910::acquire(short* bufL, short* bufR, size_t start, size_t l
|
||||||
|
|
||||||
ay->sound_stream_update(ayBuf,1);
|
ay->sound_stream_update(ayBuf,1);
|
||||||
if (stereo) {
|
if (stereo) {
|
||||||
bufL[i+start]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8);
|
buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8);
|
||||||
bufR[i+start]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0];
|
buf[1][i]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0];
|
||||||
} else {
|
} else {
|
||||||
bufL[i+start]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0];
|
buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0];
|
||||||
bufR[i+start]=bufL[i+start];
|
buf[1][i]=buf[0][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=ayBuf[0][0]<<2;
|
oscBuf[0]->data[oscBuf[0]->needle++]=ayBuf[0][0]<<2;
|
||||||
|
@ -751,8 +751,8 @@ void DivPlatformAY8910::reset() {
|
||||||
portBVal=0;
|
portBVal=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformAY8910::isStereo() {
|
int DivPlatformAY8910::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformAY8910::keyOffAffectsArp(int ch) {
|
bool DivPlatformAY8910::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -128,7 +128,7 @@ class DivPlatformAY8910: public DivDispatch {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setExtClockDiv(unsigned int eclk=COLOR_NTSC, unsigned char ediv=8);
|
void setExtClockDiv(unsigned int eclk=COLOR_NTSC, unsigned char ediv=8);
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||||
|
@ -140,7 +140,7 @@ class DivPlatformAY8910: public DivDispatch {
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
bool getDCOffRequired();
|
bool getDCOffRequired();
|
||||||
|
|
|
@ -164,7 +164,7 @@ void DivPlatformAY8930::checkWrites() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformAY8930::acquire(short** buf, size_t len) {
|
||||||
if (ayBufLen<len) {
|
if (ayBufLen<len) {
|
||||||
ayBufLen=len;
|
ayBufLen=len;
|
||||||
for (int i=0; i<3; i++) {
|
for (int i=0; i<3; i++) {
|
||||||
|
@ -179,11 +179,11 @@ void DivPlatformAY8930::acquire(short* bufL, short* bufR, size_t start, size_t l
|
||||||
|
|
||||||
ay->sound_stream_update(ayBuf,1);
|
ay->sound_stream_update(ayBuf,1);
|
||||||
if (stereo) {
|
if (stereo) {
|
||||||
bufL[i+start]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8);
|
buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+((ayBuf[2][0]*stereoSep)>>8);
|
||||||
bufR[i+start]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0];
|
buf[1][i]=((ayBuf[0][0]*stereoSep)>>8)+ayBuf[1][0]+ayBuf[2][0];
|
||||||
} else {
|
} else {
|
||||||
bufL[i+start]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0];
|
buf[0][i]=ayBuf[0][0]+ayBuf[1][0]+ayBuf[2][0];
|
||||||
bufR[i+start]=bufL[i+start];
|
buf[1][i]=buf[0][i];
|
||||||
}
|
}
|
||||||
|
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=ayBuf[0][0]<<2;
|
oscBuf[0]->data[oscBuf[0]->needle++]=ayBuf[0][0]<<2;
|
||||||
|
@ -747,8 +747,8 @@ void DivPlatformAY8930::reset() {
|
||||||
immWrite(0x1a,0x00); // or mask
|
immWrite(0x1a,0x00); // or mask
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformAY8930::isStereo() {
|
int DivPlatformAY8930::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformAY8930::keyOffAffectsArp(int ch) {
|
bool DivPlatformAY8930::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -131,7 +131,7 @@ class DivPlatformAY8930: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||||
|
@ -142,7 +142,7 @@ class DivPlatformAY8930: public DivDispatch {
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
|
|
|
@ -39,9 +39,9 @@ const char** DivPlatformBubSysWSG::getRegisterSheet() {
|
||||||
return regCheatSheetBubSysWSG;
|
return regCheatSheetBubSysWSG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformBubSysWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformBubSysWSG::acquire(short** buf, size_t len) {
|
||||||
int chanOut=0;
|
int chanOut=0;
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
signed int out=0;
|
signed int out=0;
|
||||||
// K005289 part
|
// K005289 part
|
||||||
k005289.tick();
|
k005289.tick();
|
||||||
|
@ -68,7 +68,7 @@ void DivPlatformBubSysWSG::acquire(short* bufL, short* bufR, size_t start, size_
|
||||||
if (out>32767) out=32767;
|
if (out>32767) out=32767;
|
||||||
|
|
||||||
//printf("out: %d\n",out);
|
//printf("out: %d\n",out);
|
||||||
bufL[h]=bufR[h]=out;
|
buf[0][h]=buf[1][h]=out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,8 +306,8 @@ void DivPlatformBubSysWSG::reset() {
|
||||||
k005289.reset();
|
k005289.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformBubSysWSG::isStereo() {
|
int DivPlatformBubSysWSG::getOutputCount() {
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformBubSysWSG::keyOffAffectsArp(int ch) {
|
bool DivPlatformBubSysWSG::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ class DivPlatformBubSysWSG: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||||
|
@ -56,7 +56,7 @@ class DivPlatformBubSysWSG: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
|
|
|
@ -63,9 +63,9 @@ const char** DivPlatformC64::getRegisterSheet() {
|
||||||
return regCheatSheetSID;
|
return regCheatSheetSID;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformC64::acquire(short** buf, size_t len) {
|
||||||
int dcOff=isFP?0:sid.get_dc(0);
|
int dcOff=isFP?0:sid.get_dc(0);
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
if (isFP) {
|
if (isFP) {
|
||||||
|
@ -77,7 +77,7 @@ void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
||||||
writes.pop();
|
writes.pop();
|
||||||
}
|
}
|
||||||
if (isFP) {
|
if (isFP) {
|
||||||
sid_fp.clock(4,&bufL[i]);
|
sid_fp.clock(4,&buf[0][i]);
|
||||||
if (++writeOscBuf>=4) {
|
if (++writeOscBuf>=4) {
|
||||||
writeOscBuf=0;
|
writeOscBuf=0;
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=(sid_fp.lastChanOut[0]-dcOff)>>5;
|
oscBuf[0]->data[oscBuf[0]->needle++]=(sid_fp.lastChanOut[0]-dcOff)>>5;
|
||||||
|
@ -86,7 +86,7 @@ void DivPlatformC64::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
sid.clock();
|
sid.clock();
|
||||||
bufL[i]=sid.output();
|
buf[0][i]=sid.output();
|
||||||
if (++writeOscBuf>=16) {
|
if (++writeOscBuf>=16) {
|
||||||
writeOscBuf=0;
|
writeOscBuf=0;
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=(sid.last_chan_out[0]-dcOff)>>5;
|
oscBuf[0]->data[oscBuf[0]->needle++]=(sid.last_chan_out[0]-dcOff)>>5;
|
||||||
|
|
|
@ -79,7 +79,7 @@ class DivPlatformC64: public DivDispatch {
|
||||||
|
|
||||||
void updateFilter();
|
void updateFilter();
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
|
|
||||||
#define CHIP_FREQBASE 2048
|
#define CHIP_FREQBASE 2048
|
||||||
|
|
||||||
void DivPlatformDummy::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformDummy::acquire(short** buf, size_t len) {
|
||||||
int chanOut;
|
int chanOut;
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
int out=0;
|
int out=0;
|
||||||
for (unsigned char j=0; j<chans; j++) {
|
for (unsigned char j=0; j<chans; j++) {
|
||||||
if (chan[j].active) {
|
if (chan[j].active) {
|
||||||
|
@ -44,7 +44,7 @@ void DivPlatformDummy::acquire(short* bufL, short* bufR, size_t start, size_t le
|
||||||
}
|
}
|
||||||
if (out<-32768) out=-32768;
|
if (out<-32768) out=-32768;
|
||||||
if (out>32767) out=32767;
|
if (out>32767) out=32767;
|
||||||
bufL[i]=out;
|
buf[0][i]=out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class DivPlatformDummy: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
|
|
|
@ -112,8 +112,8 @@ const char** DivPlatformES5506::getRegisterSheet() {
|
||||||
return regCheatSheetES5506;
|
return regCheatSheetES5506;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformES5506::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformES5506::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
// convert 32 bit access to 8 bit host interface
|
// convert 32 bit access to 8 bit host interface
|
||||||
while (!hostIntf32.empty()) {
|
while (!hostIntf32.empty()) {
|
||||||
QueuedHostIntf w=hostIntf32.front();
|
QueuedHostIntf w=hostIntf32.front();
|
||||||
|
@ -132,8 +132,10 @@ void DivPlatformES5506::acquire(short* bufL, short* bufR, size_t start, size_t l
|
||||||
}
|
}
|
||||||
prevChanCycle=es5506.voice_cycle();
|
prevChanCycle=es5506.voice_cycle();
|
||||||
es5506.tick_perf();
|
es5506.tick_perf();
|
||||||
bufL[h]=es5506.lout(0);
|
for (int o=0; o<6; o++) {
|
||||||
bufR[h]=es5506.rout(0);
|
buf[(o<<1)|0][h]=es5506.lout(o);
|
||||||
|
buf[(o<<1)|1][h]=es5506.rout(o);
|
||||||
|
}
|
||||||
for (int i=0; i<32; i++) {
|
for (int i=0; i<32; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=(short)(chan[i].oscOut&0xffff);
|
oscBuf[i]->data[oscBuf[i]->needle++]=(short)(chan[i].oscOut&0xffff);
|
||||||
}
|
}
|
||||||
|
@ -212,7 +214,7 @@ void DivPlatformES5506::e_pin(bool state) {
|
||||||
if (!queuedRead.empty()) {
|
if (!queuedRead.empty()) {
|
||||||
unsigned char ch=queuedRead.front()&0x1f;
|
unsigned char ch=queuedRead.front()&0x1f;
|
||||||
if (chan[ch].isReverseLoop) { // Reversed loop
|
if (chan[ch].isReverseLoop) { // Reversed loop
|
||||||
pageWriteMask(0x00|ch,0x5f,0x00,(chan[ch].pcm.reversed?0x0000:0x0040)|0x08,0x78);
|
pageWriteMask(0x00|ch,0x5f,0x00,(0x0040)|0x08,0x78);
|
||||||
chan[ch].isReverseLoop=false;
|
chan[ch].isReverseLoop=false;
|
||||||
}
|
}
|
||||||
queuedRead.pop();
|
queuedRead.pop();
|
||||||
|
@ -236,7 +238,8 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
if (chan[i].outVol!=nextVol) {
|
if (chan[i].outVol!=nextVol) {
|
||||||
chan[i].outVol=nextVol;
|
chan[i].outVol=nextVol;
|
||||||
if (!isMuted[i]) {
|
if (!isMuted[i]) {
|
||||||
chan[i].volChanged.changed=0xff;
|
chan[i].volChanged.lVol=1;
|
||||||
|
chan[i].volChanged.rVol=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -401,6 +404,16 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// channel assignment
|
||||||
|
if (chan[i].active && chan[i].std.fb.had) {
|
||||||
|
const unsigned char ca=CLAMP(chan[i].std.fb.val,0,5);
|
||||||
|
if (chan[i].ca!=ca) {
|
||||||
|
chan[i].ca=ca;
|
||||||
|
if (!chan[i].keyOn) {
|
||||||
|
chan[i].volChanged.ca=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// control macros
|
// control macros
|
||||||
if (chan[i].active && chan[i].std.alg.had) {
|
if (chan[i].active && chan[i].std.alg.had) {
|
||||||
if (chan[i].pcm.pause!=(bool)(chan[i].std.alg.val&1)) {
|
if (chan[i].pcm.pause!=(bool)(chan[i].std.alg.val&1)) {
|
||||||
|
@ -412,7 +425,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
if (chan[i].pcm.direction!=(bool)(chan[i].std.alg.val&2)) {
|
if (chan[i].pcm.direction!=(bool)(chan[i].std.alg.val&2)) {
|
||||||
chan[i].pcm.direction=chan[i].std.alg.val&2;
|
chan[i].pcm.direction=chan[i].std.alg.val&2;
|
||||||
if (!chan[i].keyOn) {
|
if (!chan[i].keyOn) {
|
||||||
pageWriteMask(0x00|i,0x5f,0x00,chan[i].pcm.isReversed()?0x0040:0x0000,0x0040);
|
pageWriteMask(0x00|i,0x5f,0x00,chan[i].pcm.direction?0x0040:0x0000,0x0040);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -451,6 +464,9 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
pageWrite(0x00|i,0x04,chan[i].resRVol);
|
pageWrite(0x00|i,0x04,chan[i].resRVol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (chan[i].volChanged.ca) {
|
||||||
|
pageWriteMask(0x00|i,0x5f,0x00,(chan[i].ca<<10),0x1c00);
|
||||||
|
}
|
||||||
} else { // mute
|
} else { // mute
|
||||||
pageWrite(0x00|i,0x02,0);
|
pageWrite(0x00|i,0x02,0);
|
||||||
pageWrite(0x00|i,0x04,0);
|
pageWrite(0x00|i,0x04,0);
|
||||||
|
@ -488,25 +504,18 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
// get loop mode
|
// get loop mode
|
||||||
DivSampleLoopMode loopMode=s->isLoopable()?s->loopMode:DIV_SAMPLE_LOOP_MAX;
|
DivSampleLoopMode loopMode=s->isLoopable()?s->loopMode:DIV_SAMPLE_LOOP_MAX;
|
||||||
// get reversed
|
|
||||||
bool reversed=ins->amiga.reversed;
|
|
||||||
if (ins->amiga.useNoteMap&¬eMapind.reversed!=DivInstrumentAmiga::DivReverseMode::DIV_REVERSE_DEFAULT) {
|
|
||||||
reversed=noteMapind.reversed;
|
|
||||||
}
|
|
||||||
const unsigned int start=offES5506<<10;
|
const unsigned int start=offES5506<<10;
|
||||||
const unsigned int length=s->samples-1;
|
const unsigned int length=s->samples-1;
|
||||||
const unsigned int end=start+(length<<11);
|
const unsigned int end=start+(length<<11);
|
||||||
const unsigned int nextBank=(offES5506>>22)&3;
|
const unsigned int nextBank=(offES5506>>22)&3;
|
||||||
const double nextFreqOffs=PITCH_OFFSET*off;
|
const double nextFreqOffs=PITCH_OFFSET*off;
|
||||||
chan[i].pcm.loopMode=loopMode;
|
chan[i].pcm.loopMode=loopMode;
|
||||||
chan[i].pcm.reversed=reversed;
|
|
||||||
chan[i].pcm.bank=nextBank;
|
chan[i].pcm.bank=nextBank;
|
||||||
chan[i].pcm.start=start;
|
chan[i].pcm.start=start;
|
||||||
chan[i].pcm.end=end;
|
chan[i].pcm.end=end;
|
||||||
chan[i].pcm.length=length;
|
chan[i].pcm.length=length;
|
||||||
if ((chan[i].pcm.loopMode!=loopMode) || (chan[i].pcm.reversed!=reversed) || (chan[i].pcm.bank!=nextBank)) {
|
if ((chan[i].pcm.loopMode!=loopMode) || (chan[i].pcm.bank!=nextBank)) {
|
||||||
chan[i].pcm.loopMode=loopMode;
|
chan[i].pcm.loopMode=loopMode;
|
||||||
chan[i].pcm.reversed=reversed;
|
|
||||||
chan[i].pcm.bank=nextBank;
|
chan[i].pcm.bank=nextBank;
|
||||||
chan[i].pcmChanged.loopBank=1;
|
chan[i].pcmChanged.loopBank=1;
|
||||||
}
|
}
|
||||||
|
@ -518,7 +527,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (sampleVaild) {
|
if (sampleVaild) {
|
||||||
if (!chan[i].keyOn) {
|
if (!chan[i].keyOn) {
|
||||||
pageWrite(0x20|i,0x03,(chan[i].pcm.isReversed())?chan[i].pcm.end:chan[i].pcm.start);
|
pageWrite(0x20|i,0x03,(chan[i].pcm.direction)?chan[i].pcm.end:chan[i].pcm.start);
|
||||||
}
|
}
|
||||||
chan[i].pcmChanged.slice=1;
|
chan[i].pcmChanged.slice=1;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +561,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].pcmChanged.loopBank) {
|
if (chan[i].pcmChanged.loopBank) {
|
||||||
if (!chan[i].keyOn) {
|
if (!chan[i].keyOn) {
|
||||||
unsigned int loopFlag=(chan[i].pcm.bank<<14)|(chan[i].pcm.isReversed()?0x0040:0x0000);
|
unsigned int loopFlag=(chan[i].pcm.bank<<14)|(chan[i].pcm.direction?0x0040:0x0000);
|
||||||
chan[i].isReverseLoop=false;
|
chan[i].isReverseLoop=false;
|
||||||
switch (chan[i].pcm.loopMode) {
|
switch (chan[i].pcm.loopMode) {
|
||||||
case DIV_SAMPLE_LOOP_FORWARD: // Forward loop
|
case DIV_SAMPLE_LOOP_FORWARD: // Forward loop
|
||||||
|
@ -570,7 +579,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Set loop mode & Bank
|
// Set loop mode & Bank
|
||||||
pageWriteMask(0x00|i,0x5f,0x00,loopFlag,0xfcfd);
|
pageWriteMask(0x00|i,0x5f,0x00,loopFlag,0xe0fd);
|
||||||
}
|
}
|
||||||
chan[i].pcmChanged.loopBank=0;
|
chan[i].pcmChanged.loopBank=0;
|
||||||
}
|
}
|
||||||
|
@ -649,11 +658,11 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
chan[i].freq=CLAMP(parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,chan[i].pcm.freqOffs),0,0x1ffff);
|
chan[i].freq=CLAMP(parent->calcFreq(chan[i].baseFreq,chan[i].pitch,chan[i].fixedArp?chan[i].baseNoteOverride:chan[i].arpOff,chan[i].fixedArp,false,2,chan[i].pitch2,chipClock,chan[i].pcm.freqOffs),0,0x1ffff);
|
||||||
if (chan[i].keyOn) {
|
if (chan[i].keyOn) {
|
||||||
if (chan[i].pcm.index>=0 && chan[i].pcm.index<parent->song.sampleLen) {
|
if (chan[i].pcm.index>=0 && chan[i].pcm.index<parent->song.sampleLen) {
|
||||||
unsigned int startPos=chan[i].pcm.isReversed()?chan[i].pcm.end:chan[i].pcm.start;
|
unsigned int startPos=chan[i].pcm.direction?chan[i].pcm.end:chan[i].pcm.start;
|
||||||
if (chan[i].pcm.nextPos) {
|
if (chan[i].pcm.nextPos) {
|
||||||
const unsigned int start=chan[i].pcm.start;
|
const unsigned int start=chan[i].pcm.start;
|
||||||
const unsigned int end=chan[i].pcm.length;
|
const unsigned int end=chan[i].pcm.length;
|
||||||
startPos=start+((chan[i].pcm.isReversed()?(end-chan[i].pcm.nextPos):(chan[i].pcm.nextPos))<<11);
|
startPos=start+((chan[i].pcm.direction?(end-chan[i].pcm.nextPos):(chan[i].pcm.nextPos))<<11);
|
||||||
chan[i].pcm.nextPos=0;
|
chan[i].pcm.nextPos=0;
|
||||||
}
|
}
|
||||||
chan[i].k1Prev=0xffff;
|
chan[i].k1Prev=0xffff;
|
||||||
|
@ -721,7 +730,7 @@ void DivPlatformES5506::tick(bool sysTick) {
|
||||||
chan[i].k1Prev=k1;
|
chan[i].k1Prev=k1;
|
||||||
pageWrite(0x00|i,0x02,chan[i].resLVol);
|
pageWrite(0x00|i,0x02,chan[i].resLVol);
|
||||||
pageWrite(0x00|i,0x04,chan[i].resRVol);
|
pageWrite(0x00|i,0x04,chan[i].resRVol);
|
||||||
unsigned int loopFlag=chan[i].pcm.isReversed()?0x0040:0x0000;
|
unsigned int loopFlag=(chan[i].ca<<10)|(chan[i].pcm.direction?0x0040:0x0000);
|
||||||
chan[i].isReverseLoop=false;
|
chan[i].isReverseLoop=false;
|
||||||
switch (chan[i].pcm.loopMode) {
|
switch (chan[i].pcm.loopMode) {
|
||||||
case DIV_SAMPLE_LOOP_FORWARD: // Forward loop
|
case DIV_SAMPLE_LOOP_FORWARD: // Forward loop
|
||||||
|
@ -851,6 +860,10 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
||||||
return chan[c.chan].outVol;
|
return chan[c.chan].outVol;
|
||||||
break;
|
break;
|
||||||
case DIV_CMD_PANNING: {
|
case DIV_CMD_PANNING: {
|
||||||
|
if (chan[c.chan].ca!=0) {
|
||||||
|
chan[c.chan].ca=0;
|
||||||
|
chan[c.chan].volChanged.ca=1;
|
||||||
|
}
|
||||||
// Left volume
|
// Left volume
|
||||||
if (chan[c.chan].lVol!=(unsigned int)(c.value)) {
|
if (chan[c.chan].lVol!=(unsigned int)(c.value)) {
|
||||||
chan[c.chan].lVol=c.value;
|
chan[c.chan].lVol=c.value;
|
||||||
|
@ -873,6 +886,38 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case DIV_CMD_SURROUND_PANNING: {
|
||||||
|
unsigned char ca=CLAMP(c.value>>1,0,5);
|
||||||
|
if (chan[c.chan].ca!=ca) {
|
||||||
|
chan[c.chan].ca=ca;
|
||||||
|
chan[c.chan].volChanged.ca=1;
|
||||||
|
}
|
||||||
|
if ((c.value&1)==0) {
|
||||||
|
// Left volume
|
||||||
|
if (chan[c.chan].lVol!=(unsigned int)(c.value2)) {
|
||||||
|
chan[c.chan].lVol=c.value2;
|
||||||
|
if (!chan[c.chan].std.panL.has) {
|
||||||
|
chan[c.chan].outLVol=(0xffff*c.value2)/0xff;
|
||||||
|
if (!isMuted[c.chan]) {
|
||||||
|
chan[c.chan].volChanged.lVol=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ((c.value&1)==1) {
|
||||||
|
// Right volume
|
||||||
|
if (chan[c.chan].rVol!=(unsigned int)(c.value2)) {
|
||||||
|
chan[c.chan].rVol=c.value2;
|
||||||
|
if (!chan[c.chan].std.panR.has) {
|
||||||
|
chan[c.chan].outRVol=(0xffff*c.value2)/0xff;
|
||||||
|
if (!isMuted[c.chan]) {
|
||||||
|
chan[c.chan].volChanged.rVol=1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case DIV_CMD_PITCH:
|
case DIV_CMD_PITCH:
|
||||||
chan[c.chan].pitch=c.value;
|
chan[c.chan].pitch=c.value;
|
||||||
chan[c.chan].freqChanged=true;
|
chan[c.chan].freqChanged=true;
|
||||||
|
@ -1048,8 +1093,8 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
||||||
if (chan[c.chan].active) {
|
if (chan[c.chan].active) {
|
||||||
const unsigned int start=chan[c.chan].pcm.start;
|
const unsigned int start=chan[c.chan].pcm.start;
|
||||||
const unsigned int end=chan[c.chan].pcm.length;
|
const unsigned int end=chan[c.chan].pcm.length;
|
||||||
const unsigned int pos=chan[c.chan].pcm.isReversed()?(end-c.value):c.value;
|
const unsigned int pos=chan[c.chan].pcm.direction?(end-c.value):c.value;
|
||||||
if ((chan[c.chan].pcm.isReversed() && pos>0) || ((!chan[c.chan].pcm.isReversed()) && pos<end)) {
|
if ((chan[c.chan].pcm.direction && pos>0) || ((!chan[c.chan].pcm.direction) && pos<end)) {
|
||||||
pageWrite(0x20|c.chan,0x03,start+(pos<<11));
|
pageWrite(0x20|c.chan,0x03,start+(pos<<11));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1063,7 +1108,7 @@ int DivPlatformES5506::dispatch(DivCommand c) {
|
||||||
case DIV_CMD_SAMPLE_DIR: {
|
case DIV_CMD_SAMPLE_DIR: {
|
||||||
if (chan[c.chan].pcm.direction!=(bool)(c.value&1)) {
|
if (chan[c.chan].pcm.direction!=(bool)(c.value&1)) {
|
||||||
chan[c.chan].pcm.direction=c.value&1;
|
chan[c.chan].pcm.direction=c.value&1;
|
||||||
pageWriteMask(0x00|c.chan,0x5f,0x00,chan[c.chan].pcm.isReversed()?0x0040:0x0000,0x0040);
|
pageWriteMask(0x00|c.chan,0x5f,0x00,chan[c.chan].pcm.direction?0x0040:0x0000,0x0040);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1143,8 +1188,8 @@ void DivPlatformES5506::reset() {
|
||||||
pageWriteMask(0x00,0x60,0x0c,0x08); // Reset serial output
|
pageWriteMask(0x00,0x60,0x0c,0x08); // Reset serial output
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformES5506::isStereo() {
|
int DivPlatformES5506::getOutputCount() {
|
||||||
return true;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformES5506::keyOffAffectsArp(int ch) {
|
bool DivPlatformES5506::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -32,13 +32,12 @@
|
||||||
class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
struct Channel : public SharedChannel<unsigned int> {
|
struct Channel : public SharedChannel<unsigned int> {
|
||||||
struct PCM {
|
struct PCM {
|
||||||
bool isReversed() { return reversed^direction; }
|
|
||||||
bool isNoteMap;
|
bool isNoteMap;
|
||||||
int index, next;
|
int index, next;
|
||||||
int note;
|
int note;
|
||||||
double freqOffs;
|
double freqOffs;
|
||||||
double nextFreqOffs;
|
double nextFreqOffs;
|
||||||
bool reversed, pause, direction;
|
bool pause, direction;
|
||||||
unsigned int bank;
|
unsigned int bank;
|
||||||
unsigned int start;
|
unsigned int start;
|
||||||
unsigned int end;
|
unsigned int end;
|
||||||
|
@ -54,7 +53,6 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
note(0),
|
note(0),
|
||||||
freqOffs(1.0),
|
freqOffs(1.0),
|
||||||
nextFreqOffs(1.0),
|
nextFreqOffs(1.0),
|
||||||
reversed(false),
|
|
||||||
pause(false),
|
pause(false),
|
||||||
direction(false),
|
direction(false),
|
||||||
bank(0),
|
bank(0),
|
||||||
|
@ -91,7 +89,8 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
struct { // flag bits
|
struct { // flag bits
|
||||||
unsigned char lVol: 1; // left volume
|
unsigned char lVol: 1; // left volume
|
||||||
unsigned char rVol: 1; // right volume
|
unsigned char rVol: 1; // right volume
|
||||||
unsigned char dummy: 6; // dummy for bit padding
|
unsigned char ca: 1; // Channel assignment
|
||||||
|
unsigned char dummy: 5; // dummy for bit padding
|
||||||
};
|
};
|
||||||
unsigned char changed; // Packed flags are stored here
|
unsigned char changed; // Packed flags are stored here
|
||||||
};
|
};
|
||||||
|
@ -176,6 +175,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
state(State()) {}
|
state(State()) {}
|
||||||
} overwrite;
|
} overwrite;
|
||||||
|
|
||||||
|
unsigned char ca;
|
||||||
signed int k1Offs, k2Offs;
|
signed int k1Offs, k2Offs;
|
||||||
signed int k1Slide, k2Slide;
|
signed int k1Slide, k2Slide;
|
||||||
signed int k1Prev, k2Prev;
|
signed int k1Prev, k2Prev;
|
||||||
|
@ -214,6 +214,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
envChanged(EnvChanged()),
|
envChanged(EnvChanged()),
|
||||||
pcmChanged(PCMChanged()),
|
pcmChanged(PCMChanged()),
|
||||||
overwrite(Overwrite()),
|
overwrite(Overwrite()),
|
||||||
|
ca(0),
|
||||||
k1Offs(0),
|
k1Offs(0),
|
||||||
k2Offs(0),
|
k2Offs(0),
|
||||||
k1Slide(0),
|
k1Slide(0),
|
||||||
|
@ -303,7 +304,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
return sampleMem[((bank&3)<<21)|(address&0x1fffff)];
|
return sampleMem[((bank&3)<<21)|(address&0x1fffff)];
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void acquire(short* bufL, short* bufR, size_t start, size_t len) override;
|
virtual void acquire(short** buf, size_t len) override;
|
||||||
virtual int dispatch(DivCommand c) override;
|
virtual int dispatch(DivCommand c) override;
|
||||||
virtual void* getChanState(int chan) override;
|
virtual void* getChanState(int chan) override;
|
||||||
virtual DivMacroInt* getChanMacroInt(int ch) override;
|
virtual DivMacroInt* getChanMacroInt(int ch) override;
|
||||||
|
@ -314,7 +315,7 @@ class DivPlatformES5506: public DivDispatch, public es550x_intf {
|
||||||
virtual void forceIns() override;
|
virtual void forceIns() override;
|
||||||
virtual void tick(bool sysTick=true) override;
|
virtual void tick(bool sysTick=true) override;
|
||||||
virtual void muteChannel(int ch, bool mute) override;
|
virtual void muteChannel(int ch, bool mute) override;
|
||||||
virtual bool isStereo() override;
|
virtual int getOutputCount() override;
|
||||||
virtual bool keyOffAffectsArp(int ch) override;
|
virtual bool keyOffAffectsArp(int ch) override;
|
||||||
virtual void setFlags(const DivConfig& flags) override;
|
virtual void setFlags(const DivConfig& flags) override;
|
||||||
virtual void notifyInsChange(int ins) override;
|
virtual void notifyInsChange(int ins) override;
|
||||||
|
|
|
@ -55,13 +55,13 @@ const char** DivPlatformFDS::getRegisterSheet() {
|
||||||
return regCheatSheetFDS;
|
return regCheatSheetFDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformFDS::acquire_puNES(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformFDS::acquire_puNES(short* buf, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
extcl_apu_tick_FDS(fds);
|
extcl_apu_tick_FDS(fds);
|
||||||
int sample=isMuted[0]?0:fds->snd.main.output;
|
int sample=isMuted[0]?0:fds->snd.main.output;
|
||||||
if (sample>32767) sample=32767;
|
if (sample>32767) sample=32767;
|
||||||
if (sample<-32768) sample=-32768;
|
if (sample<-32768) sample=-32768;
|
||||||
bufL[i]=sample;
|
buf[i]=sample;
|
||||||
if (++writeOscBuf>=32) {
|
if (++writeOscBuf>=32) {
|
||||||
writeOscBuf=0;
|
writeOscBuf=0;
|
||||||
oscBuf->data[oscBuf->needle++]=sample<<1;
|
oscBuf->data[oscBuf->needle++]=sample<<1;
|
||||||
|
@ -69,15 +69,15 @@ void DivPlatformFDS::acquire_puNES(short* bufL, short* bufR, size_t start, size_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformFDS::acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformFDS::acquire_NSFPlay(short* buf, size_t len) {
|
||||||
int out[2];
|
int out[2];
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
fds_NP->Tick(1);
|
fds_NP->Tick(1);
|
||||||
fds_NP->Render(out);
|
fds_NP->Render(out);
|
||||||
int sample=isMuted[0]?0:(out[0]<<1);
|
int sample=isMuted[0]?0:(out[0]<<1);
|
||||||
if (sample>32767) sample=32767;
|
if (sample>32767) sample=32767;
|
||||||
if (sample<-32768) sample=-32768;
|
if (sample<-32768) sample=-32768;
|
||||||
bufL[i]=sample;
|
buf[i]=sample;
|
||||||
if (++writeOscBuf>=32) {
|
if (++writeOscBuf>=32) {
|
||||||
writeOscBuf=0;
|
writeOscBuf=0;
|
||||||
oscBuf->data[oscBuf->needle++]=sample<<1;
|
oscBuf->data[oscBuf->needle++]=sample<<1;
|
||||||
|
@ -93,11 +93,11 @@ void DivPlatformFDS::doWrite(unsigned short addr, unsigned char data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformFDS::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformFDS::acquire(short** buf, size_t len) {
|
||||||
if (useNP) {
|
if (useNP) {
|
||||||
acquire_NSFPlay(bufL,bufR,start,len);
|
acquire_NSFPlay(buf[0],len);
|
||||||
} else {
|
} else {
|
||||||
acquire_puNES(bufL,bufR,start,len);
|
acquire_puNES(buf[0],len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,11 +62,11 @@ class DivPlatformFDS: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
void doWrite(unsigned short addr, unsigned char data);
|
void doWrite(unsigned short addr, unsigned char data);
|
||||||
void acquire_puNES(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_puNES(short* buf, size_t len);
|
||||||
void acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_NSFPlay(short* buf, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -51,7 +51,7 @@ inline void DivPlatformGA20::chWrite(unsigned char ch, unsigned int addr, unsign
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformGA20::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformGA20::acquire(short** buf, size_t len) {
|
||||||
if (ga20BufLen<len) {
|
if (ga20BufLen<len) {
|
||||||
ga20BufLen=len;
|
ga20BufLen=len;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
|
@ -60,7 +60,7 @@ void DivPlatformGA20::acquire(short* bufL, short* bufR, size_t start, size_t len
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if ((--delay)<=0) {
|
if ((--delay)<=0) {
|
||||||
delay=MAX(0,delay);
|
delay=MAX(0,delay);
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
|
@ -73,7 +73,7 @@ void DivPlatformGA20::acquire(short* bufL, short* bufR, size_t start, size_t len
|
||||||
}
|
}
|
||||||
short *buffer[4] = {&ga20Buf[0][h],&ga20Buf[1][h],&ga20Buf[2][h],&ga20Buf[3][h]};
|
short *buffer[4] = {&ga20Buf[0][h],&ga20Buf[1][h],&ga20Buf[2][h],&ga20Buf[3][h]};
|
||||||
ga20.sound_stream_update(buffer, 1);
|
ga20.sound_stream_update(buffer, 1);
|
||||||
bufL[h]=(signed int)(ga20Buf[0][h]+ga20Buf[1][h]+ga20Buf[2][h]+ga20Buf[3][h])>>2;
|
buf[0][h]=(signed int)(ga20Buf[0][h]+ga20Buf[1][h]+ga20Buf[2][h]+ga20Buf[3][h])>>2;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=ga20Buf[i][h];
|
oscBuf[i]->data[oscBuf[i]->needle++]=ga20Buf[i][h];
|
||||||
}
|
}
|
||||||
|
@ -361,8 +361,8 @@ void DivPlatformGA20::reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformGA20::isStereo() {
|
int DivPlatformGA20::getOutputCount() {
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformGA20::notifyInsChange(int ins) {
|
void DivPlatformGA20::notifyInsChange(int ins) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
|
||||||
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
|
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
|
||||||
public:
|
public:
|
||||||
virtual u8 read_byte(u32 address) override;
|
virtual u8 read_byte(u32 address) override;
|
||||||
virtual void acquire(short* bufL, short* bufR, size_t start, size_t len) override;
|
virtual void acquire(short** buf, size_t len) override;
|
||||||
virtual int dispatch(DivCommand c) override;
|
virtual int dispatch(DivCommand c) override;
|
||||||
virtual void* getChanState(int chan) override;
|
virtual void* getChanState(int chan) override;
|
||||||
virtual DivMacroInt* getChanMacroInt(int ch) override;
|
virtual DivMacroInt* getChanMacroInt(int ch) override;
|
||||||
|
@ -85,7 +85,7 @@ class DivPlatformGA20: public DivDispatch, public iremga20_intf {
|
||||||
virtual void forceIns() override;
|
virtual void forceIns() override;
|
||||||
virtual void tick(bool sysTick=true) override;
|
virtual void tick(bool sysTick=true) override;
|
||||||
virtual void muteChannel(int ch, bool mute) override;
|
virtual void muteChannel(int ch, bool mute) override;
|
||||||
virtual bool isStereo() override;
|
virtual int getOutputCount() override;
|
||||||
virtual void notifyInsChange(int ins) override;
|
virtual void notifyInsChange(int ins) override;
|
||||||
virtual void notifyWaveChange(int wave) override;
|
virtual void notifyWaveChange(int wave) override;
|
||||||
virtual void notifyInsDeletion(void* ins) override;
|
virtual void notifyInsDeletion(void* ins) override;
|
||||||
|
|
|
@ -61,8 +61,8 @@ const char** DivPlatformGB::getRegisterSheet() {
|
||||||
return regCheatSheetGB;
|
return regCheatSheetGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformGB::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformGB::acquire(short** buf, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
QueuedWrite& w=writes.front();
|
QueuedWrite& w=writes.front();
|
||||||
GB_apu_write(gb,w.addr,w.val);
|
GB_apu_write(gb,w.addr,w.val);
|
||||||
|
@ -70,8 +70,8 @@ void DivPlatformGB::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
GB_advance_cycles(gb,16);
|
GB_advance_cycles(gb,16);
|
||||||
bufL[i]=gb->apu_output.final_sample.left;
|
buf[0][i]=gb->apu_output.final_sample.left;
|
||||||
bufR[i]=gb->apu_output.final_sample.right;
|
buf[1][i]=gb->apu_output.final_sample.right;
|
||||||
|
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=(gb->apu_output.current_sample[i].left+gb->apu_output.current_sample[i].right)<<6;
|
oscBuf[i]->data[oscBuf[i]->needle++]=(gb->apu_output.current_sample[i].left+gb->apu_output.current_sample[i].right)<<6;
|
||||||
|
@ -604,8 +604,8 @@ int DivPlatformGB::getPortaFloor(int ch) {
|
||||||
return 24;
|
return 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformGB::isStereo() {
|
int DivPlatformGB::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformGB::getDCOffRequired() {
|
bool DivPlatformGB::getDCOffRequired() {
|
||||||
|
|
|
@ -78,7 +78,7 @@ class DivPlatformGB: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -90,7 +90,7 @@ class DivPlatformGB: public DivDispatch {
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
int getPortaFloor(int ch);
|
int getPortaFloor(int ch);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool getDCOffRequired();
|
bool getDCOffRequired();
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
void notifyWaveChange(int wave);
|
void notifyWaveChange(int wave);
|
||||||
|
|
|
@ -56,9 +56,9 @@ void DivPlatformGenesis::processDAC(int iRate) {
|
||||||
DivSample* s=parent->getSample(chan[i].dacSample);
|
DivSample* s=parent->getSample(chan[i].dacSample);
|
||||||
if (!isMuted[i] && s->samples>0) {
|
if (!isMuted[i] && s->samples>0) {
|
||||||
if (parent->song.noOPN2Vol) {
|
if (parent->song.noOPN2Vol) {
|
||||||
chan[i].dacOutput=s->data8[chan[i].getDacDirection()?(s->samples-chan[i].dacPos-1):chan[i].dacPos];
|
chan[i].dacOutput=s->data8[chan[i].dacDirection?(s->samples-chan[i].dacPos-1):chan[i].dacPos];
|
||||||
} else {
|
} else {
|
||||||
chan[i].dacOutput=(s->data8[chan[i].getDacDirection()?(s->samples-chan[i].dacPos-1):chan[i].dacPos]*dacVolTable[chan[i].outVol])>>7;
|
chan[i].dacOutput=(s->data8[chan[i].dacDirection?(s->samples-chan[i].dacPos-1):chan[i].dacPos]*dacVolTable[chan[i].outVol])>>7;
|
||||||
}
|
}
|
||||||
sample+=chan[i].dacOutput;
|
sample+=chan[i].dacOutput;
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,9 +106,9 @@ void DivPlatformGenesis::processDAC(int iRate) {
|
||||||
if (chan[5].dacReady && writes.size()<16) {
|
if (chan[5].dacReady && writes.size()<16) {
|
||||||
int sample;
|
int sample;
|
||||||
if (parent->song.noOPN2Vol) {
|
if (parent->song.noOPN2Vol) {
|
||||||
sample=s->data8[chan[5].getDacDirection()?(s->samples-chan[5].dacPos-1):chan[5].dacPos];
|
sample=s->data8[chan[5].dacDirection?(s->samples-chan[5].dacPos-1):chan[5].dacPos];
|
||||||
} else {
|
} else {
|
||||||
sample=(s->data8[chan[5].getDacDirection()?(s->samples-chan[5].dacPos-1):chan[5].dacPos]*dacVolTable[chan[5].outVol])>>7;
|
sample=(s->data8[chan[5].dacDirection?(s->samples-chan[5].dacPos-1):chan[5].dacPos]*dacVolTable[chan[5].outVol])>>7;
|
||||||
}
|
}
|
||||||
urgentWrite(0x2a,(unsigned char)sample+0x80);
|
urgentWrite(0x2a,(unsigned char)sample+0x80);
|
||||||
chan[5].dacReady=false;
|
chan[5].dacReady=false;
|
||||||
|
@ -132,11 +132,11 @@ void DivPlatformGenesis::processDAC(int iRate) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformGenesis::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformGenesis::acquire_nuked(short** buf, size_t len) {
|
||||||
static short o[2];
|
static short o[2];
|
||||||
static int os[2];
|
static int os[2];
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
processDAC(rate);
|
processDAC(rate);
|
||||||
|
|
||||||
os[0]=0; os[1]=0;
|
os[0]=0; os[1]=0;
|
||||||
|
@ -186,17 +186,17 @@ void DivPlatformGenesis::acquire_nuked(short* bufL, short* bufR, size_t start, s
|
||||||
if (os[1]<-32768) os[1]=-32768;
|
if (os[1]<-32768) os[1]=-32768;
|
||||||
if (os[1]>32767) os[1]=32767;
|
if (os[1]>32767) os[1]=32767;
|
||||||
|
|
||||||
bufL[h]=os[0];
|
buf[0][h]=os[0];
|
||||||
bufR[h]=os[1];
|
buf[1][h]=os[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformGenesis::acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformGenesis::acquire_ymfm(short** buf, size_t len) {
|
||||||
static int os[2];
|
static int os[2];
|
||||||
|
|
||||||
ymfm::ym2612::fm_engine* fme=fm_ymfm->debug_engine();
|
ymfm::ym2612::fm_engine* fme=fm_ymfm->debug_engine();
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
processDAC(rate);
|
processDAC(rate);
|
||||||
|
|
||||||
os[0]=0; os[1]=0;
|
os[0]=0; os[1]=0;
|
||||||
|
@ -242,16 +242,16 @@ void DivPlatformGenesis::acquire_ymfm(short* bufL, short* bufR, size_t start, si
|
||||||
if (os[1]<-32768) os[1]=-32768;
|
if (os[1]<-32768) os[1]=-32768;
|
||||||
if (os[1]>32767) os[1]=32767;
|
if (os[1]>32767) os[1]=32767;
|
||||||
|
|
||||||
bufL[h]=os[0];
|
buf[0][h]=os[0];
|
||||||
bufR[h]=os[1];
|
buf[1][h]=os[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformGenesis::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformGenesis::acquire(short** buf, size_t len) {
|
||||||
if (useYMFM) {
|
if (useYMFM) {
|
||||||
acquire_ymfm(bufL,bufR,start,len);
|
acquire_ymfm(buf,len);
|
||||||
} else {
|
} else {
|
||||||
acquire_nuked(bufL,bufR,start,len);
|
acquire_nuked(buf,len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,11 +594,10 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
||||||
if (dumpWrites) addWrite(0xffff0002,0);
|
if (dumpWrites) addWrite(0xffff0002,0);
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
chan[c.chan].dacReversed=ins->amiga.getReversed(c.value);
|
|
||||||
rWrite(0x2b,1<<7);
|
rWrite(0x2b,1<<7);
|
||||||
if (dumpWrites) {
|
if (dumpWrites) {
|
||||||
addWrite(0xffff0000,chan[c.chan].dacSample);
|
addWrite(0xffff0000,chan[c.chan].dacSample);
|
||||||
addWrite(0xffff0003,chan[c.chan].getDacDirection());
|
addWrite(0xffff0003,chan[c.chan].dacDirection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chan[c.chan].dacPos=0;
|
chan[c.chan].dacPos=0;
|
||||||
|
@ -637,7 +636,6 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
||||||
chan[c.chan].dacRate=MAX(1,parent->getSample(chan[c.chan].dacSample)->rate);
|
chan[c.chan].dacRate=MAX(1,parent->getSample(chan[c.chan].dacSample)->rate);
|
||||||
if (dumpWrites) addWrite(0xffff0001,parent->getSample(chan[c.chan].dacSample)->rate);
|
if (dumpWrites) addWrite(0xffff0001,parent->getSample(chan[c.chan].dacSample)->rate);
|
||||||
chan[c.chan].furnaceDac=false;
|
chan[c.chan].furnaceDac=false;
|
||||||
chan[c.chan].dacReversed=false;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -859,7 +857,7 @@ int DivPlatformGenesis::dispatch(DivCommand c) {
|
||||||
case DIV_CMD_SAMPLE_DIR: {
|
case DIV_CMD_SAMPLE_DIR: {
|
||||||
if (c.chan<5) c.chan=5;
|
if (c.chan<5) c.chan=5;
|
||||||
chan[c.chan].dacDirection=c.value;
|
chan[c.chan].dacDirection=c.value;
|
||||||
if (dumpWrites) addWrite(0xffff0003,chan[c.chan].getDacDirection());
|
if (dumpWrites) addWrite(0xffff0003,chan[c.chan].dacDirection);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIV_CMD_LEGATO: {
|
case DIV_CMD_LEGATO: {
|
||||||
|
@ -1198,8 +1196,8 @@ void DivPlatformGenesis::reset() {
|
||||||
delay=0;
|
delay=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformGenesis::isStereo() {
|
int DivPlatformGenesis::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformGenesis::keyOffAffectsArp(int ch) {
|
bool DivPlatformGenesis::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -56,12 +56,8 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
||||||
int dacDelay;
|
int dacDelay;
|
||||||
bool dacReady;
|
bool dacReady;
|
||||||
bool dacDirection;
|
bool dacDirection;
|
||||||
bool dacReversed;
|
|
||||||
unsigned char sampleBank;
|
unsigned char sampleBank;
|
||||||
signed char dacOutput;
|
signed char dacOutput;
|
||||||
bool getDacDirection() {
|
|
||||||
return dacReversed^dacDirection;
|
|
||||||
}
|
|
||||||
Channel():
|
Channel():
|
||||||
FMChannelStereo(),
|
FMChannelStereo(),
|
||||||
furnaceDac(false),
|
furnaceDac(false),
|
||||||
|
@ -73,7 +69,6 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
||||||
dacDelay(0),
|
dacDelay(0),
|
||||||
dacReady(true),
|
dacReady(true),
|
||||||
dacDirection(false),
|
dacDirection(false),
|
||||||
dacReversed(false),
|
|
||||||
sampleBank(0),
|
sampleBank(0),
|
||||||
dacOutput(0) {}
|
dacOutput(0) {}
|
||||||
};
|
};
|
||||||
|
@ -97,13 +92,13 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
inline void processDAC(int iRate);
|
inline void processDAC(int iRate);
|
||||||
void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_nuked(short** buf, size_t len);
|
||||||
void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_ymfm(short** buf, size_t len);
|
||||||
|
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
void fillStream(std::vector<DivDelayedWrite>& stream, int sRate, size_t len);
|
void fillStream(std::vector<DivDelayedWrite>& stream, int sRate, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
|
@ -115,7 +110,7 @@ class DivPlatformGenesis: public DivPlatformOPN {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
void setYMFM(bool use);
|
void setYMFM(bool use);
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
bool keyOffAffectsPorta(int ch);
|
bool keyOffAffectsPorta(int ch);
|
||||||
|
|
|
@ -54,8 +54,8 @@ inline void DivPlatformK007232::chWrite(unsigned char ch, unsigned int addr, uns
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformK007232::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformK007232::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if ((--delay)<=0) {
|
if ((--delay)<=0) {
|
||||||
delay=MAX(0,delay);
|
delay=MAX(0,delay);
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
|
@ -76,15 +76,15 @@ void DivPlatformK007232::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
const unsigned char vol1=regPool[0x10],vol2=regPool[0x11];
|
const unsigned char vol1=regPool[0x10],vol2=regPool[0x11];
|
||||||
const signed int lout[2]={(k007232.output(0)*(vol1&0xf)),(k007232.output(1)*(vol2&0xf))};
|
const signed int lout[2]={(k007232.output(0)*(vol1&0xf)),(k007232.output(1)*(vol2&0xf))};
|
||||||
const signed int rout[2]={(k007232.output(0)*((vol1>>4)&0xf)),(k007232.output(1)*((vol2>>4)&0xf))};
|
const signed int rout[2]={(k007232.output(0)*((vol1>>4)&0xf)),(k007232.output(1)*((vol2>>4)&0xf))};
|
||||||
bufL[h]=(lout[0]+lout[1])<<4;
|
buf[0][h]=(lout[0]+lout[1])<<4;
|
||||||
bufR[h]=(rout[0]+rout[1])<<4;
|
buf[1][h]=(rout[0]+rout[1])<<4;
|
||||||
for (int i=0; i<2; i++) {
|
for (int i=0; i<2; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=(lout[i]+rout[i])<<4;
|
oscBuf[i]->data[oscBuf[i]->needle++]=(lout[i]+rout[i])<<4;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const unsigned char vol=regPool[0xc];
|
const unsigned char vol=regPool[0xc];
|
||||||
const signed int out[2]={(k007232.output(0)*(vol&0xf)),(k007232.output(1)*((vol>>4)&0xf))};
|
const signed int out[2]={(k007232.output(0)*(vol&0xf)),(k007232.output(1)*((vol>>4)&0xf))};
|
||||||
bufL[h]=bufR[h]=(out[0]+out[1])<<4;
|
buf[0][h]=(out[0]+out[1])<<4;
|
||||||
for (int i=0; i<2; i++) {
|
for (int i=0; i<2; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=out[i]<<5;
|
oscBuf[i]->data[oscBuf[i]->needle++]=out[i]<<5;
|
||||||
}
|
}
|
||||||
|
@ -448,8 +448,8 @@ void DivPlatformK007232::reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformK007232::isStereo() {
|
int DivPlatformK007232::getOutputCount() {
|
||||||
return stereo;
|
return stereo?2:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformK007232::notifyInsChange(int ins) {
|
void DivPlatformK007232::notifyInsChange(int ins) {
|
||||||
|
|
|
@ -80,7 +80,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
|
||||||
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
|
void chWrite(unsigned char ch, unsigned int addr, unsigned char val);
|
||||||
public:
|
public:
|
||||||
u8 read_sample(u8 ne, u32 address);
|
u8 read_sample(u8 ne, u32 address);
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -91,7 +91,7 @@ class DivPlatformK007232: public DivDispatch, public k007232_intf {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
void notifyWaveChange(int wave);
|
void notifyWaveChange(int wave);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
|
|
|
@ -130,8 +130,8 @@ const char** DivPlatformLynx::getRegisterSheet() {
|
||||||
return regCheatSheetLynx;
|
return regCheatSheetLynx;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformLynx::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformLynx::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
if (chan[i].pcm && chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
|
if (chan[i].pcm && chan[i].sample>=0 && chan[i].sample<parent->song.sampleLen) {
|
||||||
chan[i].sampleAccum-=chan[i].sampleFreq;
|
chan[i].sampleAccum-=chan[i].sampleFreq;
|
||||||
|
@ -156,7 +156,7 @@ void DivPlatformLynx::acquire(short* bufL, short* bufR, size_t start, size_t len
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mikey->sampleAudio( bufL + h, bufR + h, 1, oscBuf );
|
mikey->sampleAudio(buf[0]+h,buf[1]+h,1,oscBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,8 +393,8 @@ void DivPlatformLynx::muteChannel(int ch, bool mute) {
|
||||||
if (chan[ch].active) WRITE_VOLUME(ch,(isMuted[ch]?0:(chan[ch].outVol&127)));
|
if (chan[ch].active) WRITE_VOLUME(ch,(isMuted[ch]?0:(chan[ch].outVol&127)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformLynx::isStereo() {
|
int DivPlatformLynx::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformLynx::forceIns() {
|
void DivPlatformLynx::forceIns() {
|
||||||
|
|
|
@ -68,7 +68,7 @@ class DivPlatformLynx: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -79,7 +79,7 @@ class DivPlatformLynx: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
bool keyOffAffectsPorta(int ch);
|
bool keyOffAffectsPorta(int ch);
|
||||||
//int getPortaFloor(int ch);
|
//int getPortaFloor(int ch);
|
||||||
|
|
|
@ -43,8 +43,8 @@ const char** DivPlatformMMC5::getRegisterSheet() {
|
||||||
return regCheatSheetMMC5;
|
return regCheatSheetMMC5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformMMC5::acquire(short** buf, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (dacSample!=-1) {
|
if (dacSample!=-1) {
|
||||||
dacPeriod+=dacRate;
|
dacPeriod+=dacRate;
|
||||||
if (dacPeriod>=rate) {
|
if (dacPeriod>=rate) {
|
||||||
|
@ -81,7 +81,7 @@ void DivPlatformMMC5::acquire(short* bufL, short* bufR, size_t start, size_t len
|
||||||
}
|
}
|
||||||
if (sample>32767) sample=32767;
|
if (sample>32767) sample=32767;
|
||||||
if (sample<-32768) sample=-32768;
|
if (sample<-32768) sample=-32768;
|
||||||
bufL[i]=sample;
|
buf[0][i]=sample;
|
||||||
|
|
||||||
if (++writeOscBuf>=32) {
|
if (++writeOscBuf>=32) {
|
||||||
writeOscBuf=0;
|
writeOscBuf=0;
|
||||||
|
|
|
@ -50,7 +50,7 @@ class DivPlatformMMC5: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -45,8 +45,8 @@ const char** DivPlatformMSM5232::getRegisterSheet() {
|
||||||
return regCheatSheetMSM5232;
|
return regCheatSheetMSM5232;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformMSM5232::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformMSM5232::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
msm->write(w.addr,w.val);
|
msm->write(w.addr,w.val);
|
||||||
|
@ -75,9 +75,9 @@ void DivPlatformMSM5232::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
//printf("tempL: %d tempR: %d\n",tempL,tempR);
|
//printf("tempL: %d tempR: %d\n",tempL,tempR);
|
||||||
bufL[h]=0;
|
buf[0][h]=0;
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
bufL[h]+=(temp[i]*partVolume[i])>>8;
|
buf[0][h]+=(temp[i]*partVolume[i])>>8;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -371,8 +371,8 @@ void DivPlatformMSM5232::reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformMSM5232::isStereo() {
|
int DivPlatformMSM5232::getOutputCount() {
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformMSM5232::keyOffAffectsArp(int ch) {
|
bool DivPlatformMSM5232::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ class DivPlatformMSM5232: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -71,7 +71,7 @@ class DivPlatformMSM5232: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
|
|
|
@ -30,12 +30,12 @@ const char** DivPlatformMSM6258::getRegisterSheet() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformMSM6258::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformMSM6258::acquire(short** buf, size_t len) {
|
||||||
short* outs[2]={
|
short* outs[2]={
|
||||||
&msmOut,
|
&msmOut,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if (--msmClockCount<0) {
|
if (--msmClockCount<0) {
|
||||||
if (--msmDividerCount<=0) {
|
if (--msmDividerCount<=0) {
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
|
@ -78,12 +78,12 @@ void DivPlatformMSM6258::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isMuted[0]) {
|
if (isMuted[0]) {
|
||||||
bufL[h]=0;
|
buf[0][h]=0;
|
||||||
bufR[h]=0;
|
buf[1][h]=0;
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=0;
|
oscBuf[0]->data[oscBuf[0]->needle++]=0;
|
||||||
} else {
|
} else {
|
||||||
bufL[h]=(msmPan&2)?msmOut:0;
|
buf[0][h]=(msmPan&2)?msmOut:0;
|
||||||
bufR[h]=(msmPan&1)?msmOut:0;
|
buf[1][h]=(msmPan&1)?msmOut:0;
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=msmPan?msmOut:0;
|
oscBuf[0]->data[oscBuf[0]->needle++]=msmPan?msmOut:0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,8 +336,8 @@ void DivPlatformMSM6258::reset() {
|
||||||
delay=0;
|
delay=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformMSM6258::isStereo() {
|
int DivPlatformMSM6258::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformMSM6258::keyOffAffectsArp(int ch) {
|
bool DivPlatformMSM6258::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -58,7 +58,7 @@ class DivPlatformMSM6258: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -69,7 +69,7 @@ class DivPlatformMSM6258: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
|
|
|
@ -37,8 +37,8 @@ u8 DivPlatformMSM6295::read_byte(u32 address) {
|
||||||
return adpcmMem[address&0x3ffff];
|
return adpcmMem[address&0x3ffff];
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformMSM6295::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformMSM6295::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if (delay<=0) {
|
if (delay<=0) {
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
QueuedWrite& w=writes.front();
|
QueuedWrite& w=writes.front();
|
||||||
|
@ -75,7 +75,7 @@ void DivPlatformMSM6295::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
msm.tick();
|
msm.tick();
|
||||||
msm.tick();
|
msm.tick();
|
||||||
|
|
||||||
bufL[h]=msm.out()<<4;
|
buf[0][h]=msm.out()<<4;
|
||||||
|
|
||||||
if (++updateOsc>=22) {
|
if (++updateOsc>=22) {
|
||||||
updateOsc=0;
|
updateOsc=0;
|
||||||
|
|
|
@ -64,7 +64,7 @@ class DivPlatformMSM6295: public DivDispatch, public vgsound_emu_mem_intf {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual u8 read_byte(u32 address) override;
|
virtual u8 read_byte(u32 address) override;
|
||||||
virtual void acquire(short* bufL, short* bufR, size_t start, size_t len) override;
|
virtual void acquire(short** buf, size_t len) override;
|
||||||
virtual int dispatch(DivCommand c) override;
|
virtual int dispatch(DivCommand c) override;
|
||||||
virtual void* getChanState(int chan) override;
|
virtual void* getChanState(int chan) override;
|
||||||
virtual DivMacroInt* getChanMacroInt(int ch) override;
|
virtual DivMacroInt* getChanMacroInt(int ch) override;
|
||||||
|
|
|
@ -108,13 +108,13 @@ const char** DivPlatformN163::getRegisterSheet() {
|
||||||
return regCheatSheetN163;
|
return regCheatSheetN163;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformN163::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformN163::acquire(short** buf, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
n163.tick();
|
n163.tick();
|
||||||
int out=(n163.out()<<6)*2; // scale to 16 bit
|
int out=(n163.out()<<6)*2; // scale to 16 bit
|
||||||
if (out>32767) out=32767;
|
if (out>32767) out=32767;
|
||||||
if (out<-32768) out=-32768;
|
if (out<-32768) out=-32768;
|
||||||
bufL[i]=bufR[i]=out;
|
buf[0][i]=buf[1][i]=out;
|
||||||
|
|
||||||
if (n163.voice_cycle()==0x78) for (int i=0; i<8; i++) {
|
if (n163.voice_cycle()==0x78) for (int i=0; i<8; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=n163.voice_out(i)<<7;
|
oscBuf[i]->data[oscBuf[i]->needle++]=n163.voice_out(i)<<7;
|
||||||
|
|
|
@ -74,7 +74,7 @@ class DivPlatformN163: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -151,7 +151,7 @@ const char** DivPlatformNamcoWSG::getRegisterSheet() {
|
||||||
return regCheatSheetNamcoWSG;
|
return regCheatSheetNamcoWSG;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformNamcoWSG::acquire(short** buf, size_t len) {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
switch (devType) {
|
switch (devType) {
|
||||||
|
@ -171,11 +171,11 @@ void DivPlatformNamcoWSG::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
regPool[w.addr&0x3f]=w.val;
|
regPool[w.addr&0x3f]=w.val;
|
||||||
writes.pop();
|
writes.pop();
|
||||||
}
|
}
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
short* buf[2]={
|
short* bufC[2]={
|
||||||
bufL+h, bufR+h
|
buf[0]+h, buf[1]+h
|
||||||
};
|
};
|
||||||
namco->sound_stream_update(buf,1);
|
namco->sound_stream_update(bufC,1);
|
||||||
for (int i=0; i<chans; i++) {
|
for (int i=0; i<chans; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=namco->m_channel_list[i].last_out*chans;
|
oscBuf[i]->data[oscBuf[i]->needle++]=namco->m_channel_list[i].last_out*chans;
|
||||||
}
|
}
|
||||||
|
@ -494,8 +494,8 @@ void DivPlatformNamcoWSG::reset() {
|
||||||
namco->device_start(NULL);
|
namco->device_start(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformNamcoWSG::isStereo() {
|
int DivPlatformNamcoWSG::getOutputCount() {
|
||||||
return (devType==30);
|
return (devType==30)?2:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformNamcoWSG::keyOffAffectsArp(int ch) {
|
bool DivPlatformNamcoWSG::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ class DivPlatformNamcoWSG: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -65,7 +65,7 @@ class DivPlatformNamcoWSG: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void setDeviceType(int type);
|
void setDeviceType(int type);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
|
|
|
@ -100,8 +100,8 @@ void DivPlatformNES::doWrite(unsigned short addr, unsigned char data) {
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNES::acquire_puNES(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformNES::acquire_puNES(short** buf, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
doPCM;
|
doPCM;
|
||||||
|
|
||||||
apu_tick(nes,NULL);
|
apu_tick(nes,NULL);
|
||||||
|
@ -112,7 +112,7 @@ void DivPlatformNES::acquire_puNES(short* bufL, short* bufR, size_t start, size_
|
||||||
int sample=(pulse_output(nes)+tnd_output(nes))<<6;
|
int sample=(pulse_output(nes)+tnd_output(nes))<<6;
|
||||||
if (sample>32767) sample=32767;
|
if (sample>32767) sample=32767;
|
||||||
if (sample<-32768) sample=-32768;
|
if (sample<-32768) sample=-32768;
|
||||||
bufL[i]=sample;
|
buf[0][i]=sample;
|
||||||
if (++writeOscBuf>=32) {
|
if (++writeOscBuf>=32) {
|
||||||
writeOscBuf=0;
|
writeOscBuf=0;
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=isMuted[0]?0:(nes->S1.output<<11);
|
oscBuf[0]->data[oscBuf[0]->needle++]=isMuted[0]?0:(nes->S1.output<<11);
|
||||||
|
@ -124,10 +124,10 @@ void DivPlatformNES::acquire_puNES(short* bufL, short* bufR, size_t start, size_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNES::acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformNES::acquire_NSFPlay(short** buf, size_t len) {
|
||||||
int out1[2];
|
int out1[2];
|
||||||
int out2[2];
|
int out2[2];
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
doPCM;
|
doPCM;
|
||||||
|
|
||||||
nes1_NP->Tick(1);
|
nes1_NP->Tick(1);
|
||||||
|
@ -139,7 +139,7 @@ void DivPlatformNES::acquire_NSFPlay(short* bufL, short* bufR, size_t start, siz
|
||||||
int sample=(out1[0]+out1[1]+out2[0]+out2[1])<<1;
|
int sample=(out1[0]+out1[1]+out2[0]+out2[1])<<1;
|
||||||
if (sample>32767) sample=32767;
|
if (sample>32767) sample=32767;
|
||||||
if (sample<-32768) sample=-32768;
|
if (sample<-32768) sample=-32768;
|
||||||
bufL[i]=sample;
|
buf[0][i]=sample;
|
||||||
if (++writeOscBuf>=32) {
|
if (++writeOscBuf>=32) {
|
||||||
writeOscBuf=0;
|
writeOscBuf=0;
|
||||||
oscBuf[0]->data[oscBuf[0]->needle++]=nes1_NP->out[0]<<11;
|
oscBuf[0]->data[oscBuf[0]->needle++]=nes1_NP->out[0]<<11;
|
||||||
|
@ -151,11 +151,11 @@ void DivPlatformNES::acquire_NSFPlay(short* bufL, short* bufR, size_t start, siz
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformNES::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformNES::acquire(short** buf, size_t len) {
|
||||||
if (useNP) {
|
if (useNP) {
|
||||||
acquire_NSFPlay(bufL,bufR,start,len);
|
acquire_NSFPlay(buf,len);
|
||||||
} else {
|
} else {
|
||||||
acquire_puNES(bufL,bufR,start,len);
|
acquire_puNES(buf,len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,11 +68,11 @@ class DivPlatformNES: public DivDispatch {
|
||||||
|
|
||||||
void doWrite(unsigned short addr, unsigned char data);
|
void doWrite(unsigned short addr, unsigned char data);
|
||||||
unsigned char calcDPCMRate(int inRate);
|
unsigned char calcDPCMRate(int inRate);
|
||||||
void acquire_puNES(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_puNES(short** buf, size_t len);
|
||||||
void acquire_NSFPlay(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_NSFPlay(short** buf, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -159,13 +159,13 @@ const int orderedOpsL[4]={
|
||||||
#define ADDR_FREQH 0xb0
|
#define ADDR_FREQH 0xb0
|
||||||
#define ADDR_LR_FB_ALG 0xc0
|
#define ADDR_LR_FB_ALG 0xc0
|
||||||
|
|
||||||
void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformOPL::acquire_nuked(short** buf, size_t len) {
|
||||||
static short o[2];
|
static short o[4];
|
||||||
static int os[2];
|
static int os[4];
|
||||||
static ymfm::ymfm_output<2> aOut;
|
static ymfm::ymfm_output<2> aOut;
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
os[0]=0; os[1]=0;
|
os[0]=0; os[1]=0; os[2]=0; os[3]=0;
|
||||||
if (!writes.empty() && --delay<0) {
|
if (!writes.empty() && --delay<0) {
|
||||||
delay=1;
|
delay=1;
|
||||||
QueuedWrite& w=writes.front();
|
QueuedWrite& w=writes.front();
|
||||||
|
@ -194,11 +194,14 @@ void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_
|
||||||
}
|
}
|
||||||
|
|
||||||
if (downsample) {
|
if (downsample) {
|
||||||
OPL3_GenerateResampled(&fm,o);
|
OPL3_Generate4ChResampled(&fm,o);
|
||||||
} else {
|
} else {
|
||||||
OPL3_Generate(&fm,o);
|
OPL3_Generate4Ch(&fm,o);
|
||||||
}
|
}
|
||||||
os[0]+=o[0]; os[1]+=o[1];
|
os[0]+=o[0];
|
||||||
|
os[1]+=o[1];
|
||||||
|
os[2]+=o[2];
|
||||||
|
os[3]+=o[3];
|
||||||
|
|
||||||
if (adpcmChan>=0) {
|
if (adpcmChan>=0) {
|
||||||
adpcmB->clock();
|
adpcmB->clock();
|
||||||
|
@ -225,6 +228,12 @@ void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_
|
||||||
if (fm.channel[i].out[1]!=NULL) {
|
if (fm.channel[i].out[1]!=NULL) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[1];
|
oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[1];
|
||||||
}
|
}
|
||||||
|
if (fm.channel[i].out[2]!=NULL) {
|
||||||
|
oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[2];
|
||||||
|
}
|
||||||
|
if (fm.channel[i].out[3]!=NULL) {
|
||||||
|
oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[3];
|
||||||
|
}
|
||||||
oscBuf[i]->data[oscBuf[i]->needle]<<=1;
|
oscBuf[i]->data[oscBuf[i]->needle]<<=1;
|
||||||
oscBuf[i]->needle++;
|
oscBuf[i]->needle++;
|
||||||
}
|
}
|
||||||
|
@ -244,6 +253,12 @@ void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_
|
||||||
if (fm.channel[i].out[1]!=NULL) {
|
if (fm.channel[i].out[1]!=NULL) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[1];
|
oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[1];
|
||||||
}
|
}
|
||||||
|
if (fm.channel[i].out[2]!=NULL) {
|
||||||
|
oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[2];
|
||||||
|
}
|
||||||
|
if (fm.channel[i].out[3]!=NULL) {
|
||||||
|
oscBuf[i]->data[oscBuf[i]->needle]+=*fm.channel[ch].out[3];
|
||||||
|
}
|
||||||
oscBuf[i]->data[oscBuf[i]->needle]<<=1;
|
oscBuf[i]->data[oscBuf[i]->needle]<<=1;
|
||||||
oscBuf[i]->needle++;
|
oscBuf[i]->needle++;
|
||||||
}
|
}
|
||||||
|
@ -255,18 +270,26 @@ void DivPlatformOPL::acquire_nuked(short* bufL, short* bufR, size_t start, size_
|
||||||
if (os[1]<-32768) os[1]=-32768;
|
if (os[1]<-32768) os[1]=-32768;
|
||||||
if (os[1]>32767) os[1]=32767;
|
if (os[1]>32767) os[1]=32767;
|
||||||
|
|
||||||
bufL[h]=os[0];
|
if (os[2]<-32768) os[2]=-32768;
|
||||||
|
if (os[2]>32767) os[2]=32767;
|
||||||
|
|
||||||
|
if (os[3]<-32768) os[3]=-32768;
|
||||||
|
if (os[3]>32767) os[3]=32767;
|
||||||
|
|
||||||
|
buf[0][h]=os[0];
|
||||||
if (oplType==3 || oplType==759) {
|
if (oplType==3 || oplType==759) {
|
||||||
bufR[h]=os[1];
|
buf[1][h]=os[1];
|
||||||
|
buf[2][h]=os[2];
|
||||||
|
buf[3][h]=os[3];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformOPL::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformOPL::acquire(short** buf, size_t len) {
|
||||||
//if (useYMFM) {
|
//if (useYMFM) {
|
||||||
// acquire_ymfm(bufL,bufR,start,len);
|
// acquire_ymfm(buf,len);
|
||||||
//} else {
|
//} else {
|
||||||
acquire_nuked(bufL,bufR,start,len);
|
acquire_nuked(buf,len);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +337,7 @@ void DivPlatformOPL::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oplType==3 && chan[i].std.panL.had) {
|
if (oplType==3 && chan[i].std.panL.had) {
|
||||||
chan[i].pan=((chan[i].std.panL.val&1)<<1)|((chan[i].std.panL.val&2)>>1);
|
chan[i].pan=((chan[i].std.panL.val&1)<<1)|((chan[i].std.panL.val&2)>>1)|((chan[i].std.panL.val&4)<<1)|((chan[i].std.panL.val&8)>>1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan[i].std.pitch.had) {
|
if (chan[i].std.pitch.had) {
|
||||||
|
@ -347,9 +370,9 @@ void DivPlatformOPL::tick(bool sysTick) {
|
||||||
rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1));
|
rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)|((chan[i].pan&3)<<4));
|
rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)|((chan[i].pan&15)<<4));
|
||||||
if (ops==4) {
|
if (ops==4) {
|
||||||
rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)|((chan[i].pan&3)<<4));
|
rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)|((chan[i].pan&15)<<4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,9 +682,9 @@ void DivPlatformOPL::muteChannel(int ch, bool mute) {
|
||||||
rWrite(chanMap[ch+1]+ADDR_LR_FB_ALG,((chan[ch].state.alg>>1)&1)|(chan[ch].state.fb<<1));
|
rWrite(chanMap[ch+1]+ADDR_LR_FB_ALG,((chan[ch].state.alg>>1)&1)|(chan[ch].state.fb<<1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&3)<<4));
|
rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&15)<<4));
|
||||||
if (ops==4) {
|
if (ops==4) {
|
||||||
rWrite(chanMap[ch+1]+ADDR_LR_FB_ALG,((chan[ch].state.alg>>1)&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&3)<<4));
|
rWrite(chanMap[ch+1]+ADDR_LR_FB_ALG,((chan[ch].state.alg>>1)&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&15)<<4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -797,7 +820,7 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1));
|
rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1));
|
||||||
} else {
|
} else {
|
||||||
oldWrites[chanMap[ch]+ADDR_LR_FB_ALG]=-1;
|
oldWrites[chanMap[ch]+ADDR_LR_FB_ALG]=-1;
|
||||||
rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&3)<<4));
|
rWrite(chanMap[ch]+ADDR_LR_FB_ALG,(chan[ch].state.alg&1)|(chan[ch].state.fb<<1)|((chan[ch].pan&15)<<4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -847,10 +870,10 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
oldWrites[chanMap[c.chan]+ADDR_LR_FB_ALG]=-1;
|
oldWrites[chanMap[c.chan]+ADDR_LR_FB_ALG]=-1;
|
||||||
rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4));
|
rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4));
|
||||||
if (ops==4) {
|
if (ops==4) {
|
||||||
oldWrites[chanMap[c.chan+1]+ADDR_LR_FB_ALG]=-1;
|
oldWrites[chanMap[c.chan+1]+ADDR_LR_FB_ALG]=-1;
|
||||||
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4));
|
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -956,10 +979,11 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
case DIV_CMD_PANNING: {
|
case DIV_CMD_PANNING: {
|
||||||
if (oplType!=3) break;
|
if (oplType!=3) break;
|
||||||
if (c.chan==adpcmChan) break;
|
if (c.chan==adpcmChan) break;
|
||||||
if (c.value==0 && c.value2==0) {
|
chan[c.chan].pan&=~3;
|
||||||
chan[c.chan].pan=3;
|
if (c.value==0 && c.value2==0 && compatPan) {
|
||||||
|
chan[c.chan].pan|=3;
|
||||||
} else {
|
} else {
|
||||||
chan[c.chan].pan=(c.value>0)|((c.value2>0)<<1);
|
chan[c.chan].pan|=(c.value>0)|((c.value2>0)<<1);
|
||||||
}
|
}
|
||||||
int ops=(slots[3][c.chan]!=255 && chan[c.chan].state.ops==4 && oplType==3)?4:2;
|
int ops=(slots[3][c.chan]!=255 && chan[c.chan].state.ops==4 && oplType==3)?4:2;
|
||||||
if (isMuted[c.chan]) {
|
if (isMuted[c.chan]) {
|
||||||
|
@ -968,9 +992,36 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1));
|
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4));
|
rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4));
|
||||||
if (ops==4) {
|
if (ops==4) {
|
||||||
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4));
|
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case DIV_CMD_SURROUND_PANNING: {
|
||||||
|
if (oplType!=3) break;
|
||||||
|
if (c.chan==adpcmChan) break;
|
||||||
|
|
||||||
|
if (c.value==2) {
|
||||||
|
chan[c.chan].pan&=3;
|
||||||
|
if (c.value2>0) chan[c.chan].pan|=4;
|
||||||
|
} else if (c.value==3) {
|
||||||
|
if (c.value2>0) chan[c.chan].pan|=8;
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ops=(slots[3][c.chan]!=255 && chan[c.chan].state.ops==4 && oplType==3)?4:2;
|
||||||
|
if (isMuted[c.chan]) {
|
||||||
|
rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1));
|
||||||
|
if (ops==4) {
|
||||||
|
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4));
|
||||||
|
if (ops==4) {
|
||||||
|
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1049,9 +1100,9 @@ int DivPlatformOPL::dispatch(DivCommand c) {
|
||||||
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1));
|
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4));
|
rWrite(chanMap[c.chan]+ADDR_LR_FB_ALG,(chan[c.chan].state.alg&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4));
|
||||||
if (ops==4) {
|
if (ops==4) {
|
||||||
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&3)<<4));
|
rWrite(chanMap[c.chan+1]+ADDR_LR_FB_ALG,((chan[c.chan].state.alg>>1)&1)|(chan[c.chan].state.fb<<1)|((chan[c.chan].pan&15)<<4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1431,9 +1482,9 @@ void DivPlatformOPL::forceIns() {
|
||||||
rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1));
|
rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)|((chan[i].pan&3)<<4));
|
rWrite(chanMap[i]+ADDR_LR_FB_ALG,(chan[i].state.alg&1)|(chan[i].state.fb<<1)|((chan[i].pan&15)<<4));
|
||||||
if (ops==4) {
|
if (ops==4) {
|
||||||
rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)|((chan[i].pan&3)<<4));
|
rWrite(chanMap[i+1]+ADDR_LR_FB_ALG,((chan[i].state.alg>>1)&1)|(chan[i].state.fb<<1)|((chan[i].pan&15)<<4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
@ -1568,8 +1619,8 @@ void DivPlatformOPL::reset() {
|
||||||
immWrite(0xbd,(dam<<7)|(dvb<<6)|(properDrums<<5)|drumState);
|
immWrite(0xbd,(dam<<7)|(dvb<<6)|(properDrums<<5)|drumState);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformOPL::isStereo() {
|
int DivPlatformOPL::getOutputCount() {
|
||||||
return (oplType==3 || oplType==759);
|
return (oplType==3 || oplType==759)?4:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformOPL::keyOffAffectsArp(int ch) {
|
bool DivPlatformOPL::keyOffAffectsArp(int ch) {
|
||||||
|
@ -1681,6 +1732,8 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
|
||||||
rate=chipClock/36;
|
rate=chipClock/36;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
compatPan=false;
|
||||||
|
|
||||||
switch (chipType) {
|
switch (chipType) {
|
||||||
default:
|
default:
|
||||||
case 1: case 2: case 8950:
|
case 1: case 2: case 8950:
|
||||||
|
@ -1729,6 +1782,7 @@ void DivPlatformOPL::setFlags(const DivConfig& flags) {
|
||||||
CHECK_CUSTOM_CLOCK;
|
CHECK_CUSTOM_CLOCK;
|
||||||
rate=chipClock/288;
|
rate=chipClock/288;
|
||||||
chipRateBase=rate;
|
chipRateBase=rate;
|
||||||
|
compatPan=flags.getBool("compatPan",false);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
switch (flags.getInt("clockSel",0)) {
|
switch (flags.getInt("clockSel",0)) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ class DivPlatformOPL: public DivDispatch {
|
||||||
|
|
||||||
unsigned char lfoValue;
|
unsigned char lfoValue;
|
||||||
|
|
||||||
bool useYMFM, update4OpMask, pretendYMU, downsample;
|
bool useYMFM, update4OpMask, pretendYMU, downsample, compatPan;
|
||||||
|
|
||||||
short oldWrites[512];
|
short oldWrites[512];
|
||||||
short pendingWrites[512];
|
short pendingWrites[512];
|
||||||
|
@ -104,11 +104,11 @@ class DivPlatformOPL: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_nuked(short** buf, size_t len);
|
||||||
//void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len);
|
//void acquire_ymfm(short** buf, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -119,7 +119,7 @@ class DivPlatformOPL: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
void setYMFM(bool use);
|
void setYMFM(bool use);
|
||||||
void setOPLType(int type, bool drums);
|
void setOPLType(int type, bool drums);
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
|
|
|
@ -39,11 +39,11 @@ const unsigned char visMapOPLL[9]={
|
||||||
6, 7, 8, 3, 4, 5, 0, 1, 2
|
6, 7, 8, 3, 4, 5, 0, 1, 2
|
||||||
};
|
};
|
||||||
|
|
||||||
void DivPlatformOPLL::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformOPLL::acquire_nuked(short** buf, size_t len) {
|
||||||
static int o[2];
|
static int o[2];
|
||||||
static int os;
|
static int os;
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
os=0;
|
os=0;
|
||||||
for (int i=0; i<9; i++) {
|
for (int i=0; i<9; i++) {
|
||||||
if (!writes.empty() && --delay<0) {
|
if (!writes.empty() && --delay<0) {
|
||||||
|
@ -83,15 +83,15 @@ void DivPlatformOPLL::acquire_nuked(short* bufL, short* bufR, size_t start, size
|
||||||
os*=50;
|
os*=50;
|
||||||
if (os<-32768) os=-32768;
|
if (os<-32768) os=-32768;
|
||||||
if (os>32767) os=32767;
|
if (os>32767) os=32767;
|
||||||
bufL[h]=os;
|
buf[0][h]=os;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformOPLL::acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformOPLL::acquire_ymfm(short** buf, size_t len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformOPLL::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformOPLL::acquire(short** buf, size_t len) {
|
||||||
acquire_nuked(bufL,bufR,start,len);
|
acquire_nuked(buf,len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformOPLL::tick(bool sysTick) {
|
void DivPlatformOPLL::tick(bool sysTick) {
|
||||||
|
|
|
@ -77,11 +77,11 @@ class DivPlatformOPLL: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_nuked(short** buf, size_t len);
|
||||||
void acquire_ymfm(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_ymfm(short** buf, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -53,8 +53,8 @@ const char** DivPlatformPCE::getRegisterSheet() {
|
||||||
return regCheatSheetPCE;
|
return regCheatSheetPCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCE::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
// PCM part
|
// PCM part
|
||||||
for (int i=0; i<6; i++) {
|
for (int i=0; i<6; i++) {
|
||||||
if (chan[i].pcm && chan[i].dacSample!=-1) {
|
if (chan[i].pcm && chan[i].dacSample!=-1) {
|
||||||
|
@ -113,8 +113,8 @@ void DivPlatformPCE::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
||||||
if (tempR[0]>32767) tempR[0]=32767;
|
if (tempR[0]>32767) tempR[0]=32767;
|
||||||
|
|
||||||
//printf("tempL: %d tempR: %d\n",tempL,tempR);
|
//printf("tempL: %d tempR: %d\n",tempL,tempR);
|
||||||
bufL[h]=tempL[0];
|
buf[0][h]=tempL[0];
|
||||||
bufR[h]=tempR[0];
|
buf[1][h]=tempR[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,8 +547,8 @@ void DivPlatformPCE::reset() {
|
||||||
delay=500;
|
delay=500;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformPCE::isStereo() {
|
int DivPlatformPCE::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformPCE::keyOffAffectsArp(int ch) {
|
bool DivPlatformPCE::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ class DivPlatformPCE: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -87,7 +87,7 @@ class DivPlatformPCE: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyWaveChange(int wave);
|
void notifyWaveChange(int wave);
|
||||||
|
|
|
@ -26,13 +26,13 @@
|
||||||
// to ease the driver, freqency register is a 8.16 counter relative to output sample rate
|
// to ease the driver, freqency register is a 8.16 counter relative to output sample rate
|
||||||
#define CHIP_FREQBASE 65536
|
#define CHIP_FREQBASE 65536
|
||||||
|
|
||||||
void DivPlatformPCMDAC::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCMDAC::acquire(short** buf, size_t len) {
|
||||||
const int depthScale=(15-outDepth);
|
const int depthScale=(15-outDepth);
|
||||||
int output=0;
|
int output=0;
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if (!chan[0].active || isMuted) {
|
if (!chan[0].active || isMuted) {
|
||||||
bufL[h]=0;
|
buf[0][h]=0;
|
||||||
bufR[h]=0;
|
buf[1][h]=0;
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -157,12 +157,12 @@ void DivPlatformPCMDAC::acquire(short* bufL, short* bufR, size_t start, size_t l
|
||||||
output=output*chan[0].vol*chan[0].envVol/16384;
|
output=output*chan[0].vol*chan[0].envVol/16384;
|
||||||
oscBuf->data[oscBuf->needle++]=output;
|
oscBuf->data[oscBuf->needle++]=output;
|
||||||
if (outStereo) {
|
if (outStereo) {
|
||||||
bufL[h]=((output*chan[0].panL)>>(depthScale+8))<<depthScale;
|
buf[0][h]=((output*chan[0].panL)>>(depthScale+8))<<depthScale;
|
||||||
bufR[h]=((output*chan[0].panR)>>(depthScale+8))<<depthScale;
|
buf[1][h]=((output*chan[0].panR)>>(depthScale+8))<<depthScale;
|
||||||
} else {
|
} else {
|
||||||
output=(output>>depthScale)<<depthScale;
|
output=(output>>depthScale)<<depthScale;
|
||||||
bufL[h]=output;
|
buf[0][h]=output;
|
||||||
bufR[h]=output;
|
buf[1][h]=output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,8 +410,8 @@ void DivPlatformPCMDAC::reset() {
|
||||||
chan[0].ws.init(NULL,32,255);
|
chan[0].ws.init(NULL,32,255);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformPCMDAC::isStereo() {
|
int DivPlatformPCMDAC::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
DivMacroInt* DivPlatformPCMDAC::getChanMacroInt(int ch) {
|
DivMacroInt* DivPlatformPCMDAC::getChanMacroInt(int ch) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class DivPlatformPCMDAC: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivDispatchOscBuffer* getOscBuffer(int chan);
|
DivDispatchOscBuffer* getOscBuffer(int chan);
|
||||||
|
@ -75,7 +75,7 @@ class DivPlatformPCMDAC: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
|
|
|
@ -193,9 +193,9 @@ const char** DivPlatformPCSpeaker::getRegisterSheet() {
|
||||||
const float cut=0.05;
|
const float cut=0.05;
|
||||||
const float reso=0.06;
|
const float reso=0.06;
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::acquire_unfilt(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCSpeaker::acquire_unfilt(short** buf, size_t len) {
|
||||||
int out=0;
|
int out=0;
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (on) {
|
if (on) {
|
||||||
pos-=PCSPKR_DIVIDER;
|
pos-=PCSPKR_DIVIDER;
|
||||||
if (pos>freq) pos=freq;
|
if (pos>freq) pos=freq;
|
||||||
|
@ -207,17 +207,17 @@ void DivPlatformPCSpeaker::acquire_unfilt(short* bufL, short* bufR, size_t start
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
out=(pos>(freq>>1) && !isMuted[0])?32767:0;
|
out=(pos>(freq>>1) && !isMuted[0])?32767:0;
|
||||||
bufL[i]=out;
|
buf[0][i]=out;
|
||||||
oscBuf->data[oscBuf->needle++]=out;
|
oscBuf->data[oscBuf->needle++]=out;
|
||||||
} else {
|
} else {
|
||||||
bufL[i]=0;
|
buf[0][i]=0;
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::acquire_cone(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCSpeaker::acquire_cone(short** buf, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (on) {
|
if (on) {
|
||||||
pos-=PCSPKR_DIVIDER;
|
pos-=PCSPKR_DIVIDER;
|
||||||
if (pos>freq) pos=freq;
|
if (pos>freq) pos=freq;
|
||||||
|
@ -234,17 +234,17 @@ void DivPlatformPCSpeaker::acquire_cone(short* bufL, short* bufR, size_t start,
|
||||||
float out=(low+band)*0.75;
|
float out=(low+band)*0.75;
|
||||||
if (out>1.0) out=1.0;
|
if (out>1.0) out=1.0;
|
||||||
if (out<-1.0) out=-1.0;
|
if (out<-1.0) out=-1.0;
|
||||||
bufL[i]=out*32767;
|
buf[0][i]=out*32767;
|
||||||
oscBuf->data[oscBuf->needle++]=out*32767;
|
oscBuf->data[oscBuf->needle++]=out*32767;
|
||||||
} else {
|
} else {
|
||||||
bufL[i]=0;
|
buf[0][i]=0;
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::acquire_piezo(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCSpeaker::acquire_piezo(short** buf, size_t len) {
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (on) {
|
if (on) {
|
||||||
pos-=PCSPKR_DIVIDER;
|
pos-=PCSPKR_DIVIDER;
|
||||||
if (pos>freq) pos=freq;
|
if (pos>freq) pos=freq;
|
||||||
|
@ -261,10 +261,10 @@ void DivPlatformPCSpeaker::acquire_piezo(short* bufL, short* bufR, size_t start,
|
||||||
float out=band*0.15-(next-low)*0.06;
|
float out=band*0.15-(next-low)*0.06;
|
||||||
if (out>1.0) out=1.0;
|
if (out>1.0) out=1.0;
|
||||||
if (out<-1.0) out=-1.0;
|
if (out<-1.0) out=-1.0;
|
||||||
bufL[i]=out*32767;
|
buf[0][i]=out*32767;
|
||||||
oscBuf->data[oscBuf->needle++]=out*32767;
|
oscBuf->data[oscBuf->needle++]=out*32767;
|
||||||
} else {
|
} else {
|
||||||
bufL[i]=0;
|
buf[0][i]=0;
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ void DivPlatformPCSpeaker::beepFreq(int freq, int delay) {
|
||||||
realQueueLock.lock();
|
realQueueLock.lock();
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
double addition=1000000000.0*(double)delay/(double)rate;
|
double addition=1000000000.0*(double)delay/parent->getAudioDescGot().rate;
|
||||||
addition+=1500000000.0*((double)parent->getAudioDescGot().bufsize/parent->getAudioDescGot().rate);
|
addition+=1500000000.0*((double)parent->getAudioDescGot().bufsize/parent->getAudioDescGot().rate);
|
||||||
if (clock_gettime(CLOCK_MONOTONIC,&ts)<0) {
|
if (clock_gettime(CLOCK_MONOTONIC,&ts)<0) {
|
||||||
ts.tv_sec=0;
|
ts.tv_sec=0;
|
||||||
|
@ -294,14 +294,14 @@ void DivPlatformPCSpeaker::beepFreq(int freq, int delay) {
|
||||||
realOutCond.notify_one();
|
realOutCond.notify_one();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::acquire_real(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCSpeaker::acquire_real(short** buf, size_t len) {
|
||||||
int out=0;
|
int out=0;
|
||||||
if (lastOn!=on || lastFreq!=freq) {
|
if (lastOn!=on || lastFreq!=freq) {
|
||||||
lastOn=on;
|
lastOn=on;
|
||||||
lastFreq=freq;
|
lastFreq=freq;
|
||||||
beepFreq((on && !isMuted[0])?freq:0,start);
|
beepFreq((on && !isMuted[0])?freq:0,parent->getBufferPos());
|
||||||
}
|
}
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (on) {
|
if (on) {
|
||||||
pos-=PCSPKR_DIVIDER;
|
pos-=PCSPKR_DIVIDER;
|
||||||
if (pos>freq) pos=freq;
|
if (pos>freq) pos=freq;
|
||||||
|
@ -317,23 +317,23 @@ void DivPlatformPCSpeaker::acquire_real(short* bufL, short* bufR, size_t start,
|
||||||
} else {
|
} else {
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
}
|
}
|
||||||
bufL[i]=0;
|
buf[0][i]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPCSpeaker::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPCSpeaker::acquire(short** buf, size_t len) {
|
||||||
switch (speakerType) {
|
switch (speakerType) {
|
||||||
case 0:
|
case 0:
|
||||||
acquire_unfilt(bufL,bufR,start,len);
|
acquire_unfilt(buf,len);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
acquire_cone(bufL,bufR,start,len);
|
acquire_cone(buf,len);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
acquire_piezo(bufL,bufR,start,len);
|
acquire_piezo(buf,len);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
acquire_real(bufL,bufR,start,len);
|
acquire_real(buf,len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,14 +61,14 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
||||||
|
|
||||||
void beepFreq(int freq, int delay=0);
|
void beepFreq(int freq, int delay=0);
|
||||||
|
|
||||||
void acquire_unfilt(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_unfilt(short** buf, size_t len);
|
||||||
void acquire_cone(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_cone(short** buf, size_t len);
|
||||||
void acquire_piezo(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_piezo(short** buf, size_t len);
|
||||||
void acquire_real(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_real(short** buf, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void pcSpeakerThread();
|
void pcSpeakerThread();
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -55,14 +55,14 @@ void DivPlatformPET::rWrite(unsigned int addr, unsigned char val) {
|
||||||
regPool[addr]=val;
|
regPool[addr]=val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPET::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPET::acquire(short** buf, size_t len) {
|
||||||
bool hwSROutput=((regPool[11]>>2)&7)==4;
|
bool hwSROutput=((regPool[11]>>2)&7)==4;
|
||||||
if (chan[0].enable) {
|
if (chan[0].enable) {
|
||||||
int reload=regPool[8]*2+4;
|
int reload=regPool[8]*2+4;
|
||||||
if (!hwSROutput) {
|
if (!hwSROutput) {
|
||||||
reload+=regPool[9]*512;
|
reload+=regPool[9]*512;
|
||||||
}
|
}
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if (SAMP_DIVIDER>chan[0].cnt) {
|
if (SAMP_DIVIDER>chan[0].cnt) {
|
||||||
chan[0].out=(chan[0].sreg&1)*32767;
|
chan[0].out=(chan[0].sreg&1)*32767;
|
||||||
chan[0].sreg=(chan[0].sreg>>1)|((chan[0].sreg&1)<<7);
|
chan[0].sreg=(chan[0].sreg>>1)|((chan[0].sreg&1)<<7);
|
||||||
|
@ -70,17 +70,15 @@ void DivPlatformPET::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
||||||
} else {
|
} else {
|
||||||
chan[0].cnt-=SAMP_DIVIDER;
|
chan[0].cnt-=SAMP_DIVIDER;
|
||||||
}
|
}
|
||||||
bufL[h]=chan[0].out;
|
buf[0][h]=chan[0].out;
|
||||||
bufR[h]=chan[0].out;
|
|
||||||
oscBuf->data[oscBuf->needle++]=chan[0].out;
|
oscBuf->data[oscBuf->needle++]=chan[0].out;
|
||||||
}
|
}
|
||||||
// emulate driver writes to PCR
|
// emulate driver writes to PCR
|
||||||
if (!hwSROutput) regPool[12]=chan[0].out?0xe0:0xc0;
|
if (!hwSROutput) regPool[12]=chan[0].out?0xe0:0xc0;
|
||||||
} else {
|
} else {
|
||||||
chan[0].out=0;
|
chan[0].out=0;
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
bufL[h]=0;
|
buf[0][h]=0;
|
||||||
bufR[h]=0;
|
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,8 +285,8 @@ void DivPlatformPET::reset() {
|
||||||
chan[0].std.setEngine(parent);
|
chan[0].std.setEngine(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformPET::isStereo() {
|
int DivPlatformPET::getOutputCount() {
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPET::notifyInsDeletion(void* ins) {
|
void DivPlatformPET::notifyInsDeletion(void* ins) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ class DivPlatformPET: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -57,7 +57,7 @@ class DivPlatformPET: public DivDispatch {
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
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();
|
||||||
|
|
|
@ -86,9 +86,9 @@ void DivPlatformPokeMini::rWrite(unsigned char addr, unsigned char val) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPokeMini::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPokeMini::acquire(short** buf, size_t len) {
|
||||||
int out=0;
|
int out=0;
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
for (int j=0; j<PCSPKR_DIVIDER; j++) {
|
for (int j=0; j<PCSPKR_DIVIDER; j++) {
|
||||||
elapsedMain++;
|
elapsedMain++;
|
||||||
if (on) {
|
if (on) {
|
||||||
|
@ -102,10 +102,10 @@ void DivPlatformPokeMini::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
}
|
}
|
||||||
if (on) {
|
if (on) {
|
||||||
out=(pos>=pivot && !isMuted[0])?volTable[vol&3]:0;
|
out=(pos>=pivot && !isMuted[0])?volTable[vol&3]:0;
|
||||||
bufL[i]=out;
|
buf[0][i]=out;
|
||||||
oscBuf->data[oscBuf->needle++]=out;
|
oscBuf->data[oscBuf->needle++]=out;
|
||||||
} else {
|
} else {
|
||||||
bufL[i]=0;
|
buf[0][i]=0;
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class DivPlatformPokeMini: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -64,16 +64,16 @@ const char** DivPlatformPOKEY::getRegisterSheet() {
|
||||||
return regCheatSheetPOKEY;
|
return regCheatSheetPOKEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPOKEY::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPOKEY::acquire(short** buf, size_t len) {
|
||||||
if (useAltASAP) {
|
if (useAltASAP) {
|
||||||
acquireASAP(bufL, start, len);
|
acquireASAP(buf[0],len);
|
||||||
} else {
|
} else {
|
||||||
acquireMZ(bufL, start, len);
|
acquireMZ(buf[0],len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPOKEY::acquireMZ(short* buf, size_t start, size_t len) {
|
void DivPlatformPOKEY::acquireMZ(short* buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
Update_pokey_sound_mz(&pokey,w.addr,w.val,0);
|
Update_pokey_sound_mz(&pokey,w.addr,w.val,0);
|
||||||
|
@ -93,14 +93,14 @@ void DivPlatformPOKEY::acquireMZ(short* buf, size_t start, size_t len) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformPOKEY::acquireASAP(short* buf, size_t start, size_t len) {
|
void DivPlatformPOKEY::acquireASAP(short* buf, size_t len) {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
altASAP.write(w.addr, w.val);
|
altASAP.write(w.addr, w.val);
|
||||||
writes.pop();
|
writes.pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if (++oscBufDelay>=2) {
|
if (++oscBufDelay>=2) {
|
||||||
oscBufDelay=0;
|
oscBufDelay=0;
|
||||||
buf[h]=altASAP.sampleAudio(oscBuf);
|
buf[h]=altASAP.sampleAudio(oscBuf);
|
||||||
|
@ -241,7 +241,7 @@ void DivPlatformPOKEY::tick(bool sysTick) {
|
||||||
chan[i].ctlChanged=false;
|
chan[i].ctlChanged=false;
|
||||||
if ((i==1 && audctl&16) || (i==3 && audctl&8)) {
|
if ((i==1 && audctl&16) || (i==3 && audctl&8)) {
|
||||||
// ignore - channel is paired
|
// ignore - channel is paired
|
||||||
} else if ((i==0 && audctl&16) || (i==0 && audctl&8)) {
|
} else if ((i==0 && audctl&16) || (i==2 && audctl&8)) {
|
||||||
rWrite(1+(i<<1),0);
|
rWrite(1+(i<<1),0);
|
||||||
rWrite(3+(i<<1),val);
|
rWrite(3+(i<<1),val);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -58,9 +58,9 @@ class DivPlatformPOKEY: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
void acquireMZ(short* buf, size_t start, size_t len);
|
void acquireMZ(short* buf, size_t len);
|
||||||
void acquireASAP(short* buf, size_t start, size_t len);
|
void acquireASAP(short* buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
|
|
||||||
#define CHIP_DIVIDER 1024
|
#define CHIP_DIVIDER 1024
|
||||||
|
|
||||||
void DivPlatformPong::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformPong::acquire(short** buf, size_t len) {
|
||||||
int out=0;
|
int out=0;
|
||||||
for (size_t i=start; i<start+len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
if (on) {
|
if (on) {
|
||||||
if (--pos<=0) {
|
if (--pos<=0) {
|
||||||
pos=(freq?2:1)<<4;
|
pos=(freq?2:1)<<4;
|
||||||
flip=!flip;
|
flip=!flip;
|
||||||
}
|
}
|
||||||
out=(flip && !isMuted[0])?32767:0;
|
out=(flip && !isMuted[0])?32767:0;
|
||||||
bufL[i]=out;
|
buf[0][i]=out;
|
||||||
oscBuf->data[oscBuf->needle++]=out;
|
oscBuf->data[oscBuf->needle++]=out;
|
||||||
} else {
|
} else {
|
||||||
bufL[i]=0;
|
buf[0][i]=0;
|
||||||
oscBuf->data[oscBuf->needle++]=0;
|
oscBuf->data[oscBuf->needle++]=0;
|
||||||
flip=false;
|
flip=false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ class DivPlatformPong: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
|
|
@ -265,11 +265,11 @@ const char** DivPlatformQSound::getRegisterSheet() {
|
||||||
return regCheatSheetQSound;
|
return regCheatSheetQSound;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformQSound::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformQSound::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
qsound_update(&chip);
|
qsound_update(&chip);
|
||||||
bufL[h]=chip.out[0];
|
buf[0][h]=chip.out[0];
|
||||||
bufR[h]=chip.out[1];
|
buf[1][h]=chip.out[1];
|
||||||
|
|
||||||
for (int i=0; i<19; i++) {
|
for (int i=0; i<19; i++) {
|
||||||
int data=chip.voice_output[i]<<2;
|
int data=chip.voice_output[i]<<2;
|
||||||
|
@ -636,8 +636,8 @@ void DivPlatformQSound::reset() {
|
||||||
immWrite(Q1_ECHO_FEEDBACK, echoFeedback << 6);
|
immWrite(Q1_ECHO_FEEDBACK, echoFeedback << 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformQSound::isStereo() {
|
int DivPlatformQSound::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformQSound::keyOffAffectsArp(int ch) {
|
bool DivPlatformQSound::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ class DivPlatformQSound: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -74,7 +74,7 @@ class DivPlatformQSound: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
|
|
|
@ -54,25 +54,27 @@ void DivPlatformRF5C68::chWrite(unsigned char ch, unsigned int addr, unsigned ch
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformRF5C68::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
// TODO: this code is weird
|
||||||
short buf[16][256];
|
// make sure newDispatch didn't break it up
|
||||||
|
void DivPlatformRF5C68::acquire(short** buf, size_t len) {
|
||||||
|
short bufC[16][256];
|
||||||
short* chBufPtrs[16]={
|
short* chBufPtrs[16]={
|
||||||
buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7],
|
bufC[0],bufC[1],bufC[2],bufC[3],bufC[4],bufC[5],bufC[6],bufC[7],
|
||||||
buf[8],buf[9],buf[10],buf[11],buf[12],buf[13],buf[14],buf[15]
|
bufC[8],bufC[9],bufC[10],bufC[11],bufC[12],bufC[13],bufC[14],bufC[15]
|
||||||
};
|
};
|
||||||
size_t pos=start;
|
size_t pos=0;
|
||||||
|
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
memset(buf[i],0,256*sizeof(short));
|
memset(bufC[i],0,256*sizeof(short));
|
||||||
}
|
}
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
size_t blockLen=MIN(len,256);
|
size_t blockLen=MIN(len,256);
|
||||||
short* bufPtrs[2]={&bufL[pos],&bufR[pos]};
|
short* bufPtrs[2]={&buf[0][pos],&buf[1][pos]};
|
||||||
rf5c68.sound_stream_update(bufPtrs,chBufPtrs,blockLen);
|
rf5c68.sound_stream_update(bufPtrs,chBufPtrs,blockLen);
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
for (size_t j=0; j<blockLen; j++) {
|
for (size_t j=0; j<blockLen; j++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=buf[i*2][j]+buf[i*2+1][j];
|
oscBuf[i]->data[oscBuf[i]->needle++]=bufC[i*2][j]+bufC[i*2+1][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pos+=blockLen;
|
pos+=blockLen;
|
||||||
|
@ -332,8 +334,8 @@ void DivPlatformRF5C68::reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformRF5C68::isStereo() {
|
int DivPlatformRF5C68::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformRF5C68::notifyInsChange(int ins) {
|
void DivPlatformRF5C68::notifyInsChange(int ins) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ class DivPlatformRF5C68: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -67,7 +67,7 @@ class DivPlatformRF5C68: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
void setChipModel(int type);
|
void setChipModel(int type);
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
void notifyWaveChange(int wave);
|
void notifyWaveChange(int wave);
|
||||||
|
|
|
@ -56,7 +56,7 @@ const char** DivPlatformSAA1099::getRegisterSheet() {
|
||||||
return regCheatSheetSAA;
|
return regCheatSheetSAA;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSAA1099::acquire_saaSound(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSAA1099::acquire_saaSound(short** buf, size_t len) {
|
||||||
if (saaBufLen<len*2) {
|
if (saaBufLen<len*2) {
|
||||||
saaBufLen=len*2;
|
saaBufLen=len*2;
|
||||||
for (int i=0; i<2; i++) {
|
for (int i=0; i<2; i++) {
|
||||||
|
@ -73,19 +73,19 @@ void DivPlatformSAA1099::acquire_saaSound(short* bufL, short* bufR, size_t start
|
||||||
saa_saaSound->GenerateMany((unsigned char*)saaBuf[0],len,oscBuf);
|
saa_saaSound->GenerateMany((unsigned char*)saaBuf[0],len,oscBuf);
|
||||||
#ifdef TA_BIG_ENDIAN
|
#ifdef TA_BIG_ENDIAN
|
||||||
for (size_t i=0; i<len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
bufL[i+start]=(short)((((unsigned short)saaBuf[0][1+(i<<1)])<<8)|(((unsigned short)saaBuf[0][1+(i<<1)])>>8));
|
buf[0][i]=(short)((((unsigned short)saaBuf[0][1+(i<<1)])<<8)|(((unsigned short)saaBuf[0][1+(i<<1)])>>8));
|
||||||
bufR[i+start]=(short)((((unsigned short)saaBuf[0][i<<1])<<8)|(((unsigned short)saaBuf[0][i<<1])>>8));
|
buf[1][i]=(short)((((unsigned short)saaBuf[0][i<<1])<<8)|(((unsigned short)saaBuf[0][i<<1])>>8));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
for (size_t i=0; i<len; i++) {
|
for (size_t i=0; i<len; i++) {
|
||||||
bufL[i+start]=saaBuf[0][i<<1];
|
buf[0][i]=saaBuf[0][i<<1];
|
||||||
bufR[i+start]=saaBuf[0][1+(i<<1)];
|
buf[1][i]=saaBuf[0][1+(i<<1)];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSAA1099::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSAA1099::acquire(short** buf, size_t len) {
|
||||||
acquire_saaSound(bufL,bufR,start,len);
|
acquire_saaSound(buf,len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline unsigned char applyPan(unsigned char vol, unsigned char pan) {
|
inline unsigned char applyPan(unsigned char vol, unsigned char pan) {
|
||||||
|
@ -419,8 +419,8 @@ void DivPlatformSAA1099::reset() {
|
||||||
rWrite(0x1c,1);
|
rWrite(0x1c,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSAA1099::isStereo() {
|
int DivPlatformSAA1099::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivPlatformSAA1099::getPortaFloor(int ch) {
|
int DivPlatformSAA1099::getPortaFloor(int ch) {
|
||||||
|
|
|
@ -71,10 +71,10 @@ class DivPlatformSAA1099: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
void acquire_saaSound(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_saaSound(short** buf, size_t len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -86,7 +86,7 @@ class DivPlatformSAA1099: public DivDispatch {
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
int getPortaFloor(int ch);
|
int getPortaFloor(int ch);
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
|
|
|
@ -80,13 +80,13 @@ const char** DivPlatformSCC::getRegisterSheet() {
|
||||||
return isPlus ? regCheatSheetSCCPlus : regCheatSheetSCC;
|
return isPlus ? regCheatSheetSCCPlus : regCheatSheetSCC;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSCC::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSCC::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
for (int i=0; i<16; i++) {
|
for (int i=0; i<16; i++) {
|
||||||
scc->tick();
|
scc->tick();
|
||||||
}
|
}
|
||||||
short out=(short)scc->out()<<5;
|
short out=(short)scc->out()<<5;
|
||||||
bufL[h]=bufR[h]=out;
|
buf[0][h]=out;
|
||||||
|
|
||||||
for (int i=0; i<5; i++) {
|
for (int i=0; i<5; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=scc->voice_out(i)<<7;
|
oscBuf[i]->data[oscBuf[i]->needle++]=scc->voice_out(i)<<7;
|
||||||
|
@ -335,8 +335,8 @@ void DivPlatformSCC::reset() {
|
||||||
lastUpdated34=0;
|
lastUpdated34=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSCC::isStereo() {
|
int DivPlatformSCC::getOutputCount() {
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSCC::notifyWaveChange(int wave) {
|
void DivPlatformSCC::notifyWaveChange(int wave) {
|
||||||
|
|
|
@ -50,7 +50,7 @@ class DivPlatformSCC: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -61,7 +61,7 @@ class DivPlatformSCC: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
void notifyWaveChange(int wave);
|
void notifyWaveChange(int wave);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
//#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);} }
|
||||||
|
|
||||||
void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSegaPCM::acquire(short** buf, size_t len) {
|
||||||
static int os[2];
|
static int os[2];
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
os[0]=0; os[1]=0;
|
os[0]=0; os[1]=0;
|
||||||
// do a PCM cycle
|
// do a PCM cycle
|
||||||
pcmL=0; pcmR=0;
|
pcmL=0; pcmR=0;
|
||||||
|
@ -67,8 +67,8 @@ void DivPlatformSegaPCM::acquire(short* bufL, short* bufR, size_t start, size_t
|
||||||
if (os[1]<-32768) os[1]=-32768;
|
if (os[1]<-32768) os[1]=-32768;
|
||||||
if (os[1]>32767) os[1]=32767;
|
if (os[1]>32767) os[1]=32767;
|
||||||
|
|
||||||
bufL[h]=os[0];
|
buf[0][h]=os[0];
|
||||||
bufR[h]=os[1];
|
buf[1][h]=os[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -502,8 +502,8 @@ void DivPlatformSegaPCM::setFlags(const DivConfig& flags) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSegaPCM::isStereo() {
|
int DivPlatformSegaPCM::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivPlatformSegaPCM::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
int DivPlatformSegaPCM::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ class DivPlatformSegaPCM: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -91,7 +91,7 @@ class DivPlatformSegaPCM: public DivDispatch {
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
void renderSamples(int chipID);
|
void renderSamples(int chipID);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
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);
|
||||||
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
int init(DivEngine* parent, int channels, int sugRate, const DivConfig& flags);
|
||||||
|
|
|
@ -39,10 +39,10 @@ const char** DivPlatformSMS::getRegisterSheet() {
|
||||||
return stereo?regCheatSheetGG:regCheatSheetSN;
|
return stereo?regCheatSheetGG:regCheatSheetSN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSMS::acquire_nuked(short** buf, size_t len) {
|
||||||
int oL=0;
|
int oL=0;
|
||||||
int oR=0;
|
int oR=0;
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
if (w.addr==0) {
|
if (w.addr==0) {
|
||||||
|
@ -73,8 +73,8 @@ void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_
|
||||||
if (oL>32767) oL=32767;
|
if (oL>32767) oL=32767;
|
||||||
if (oR<-32768) oR=-32768;
|
if (oR<-32768) oR=-32768;
|
||||||
if (oR>32767) oR=32767;
|
if (oR>32767) oR=32767;
|
||||||
bufL[h]=oL;
|
buf[0][h]=oL;
|
||||||
bufR[h]=oR;
|
if (stereo) buf[1][h]=oR;
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
if (isMuted[i]) {
|
if (isMuted[i]) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=0;
|
oscBuf[i]->data[oscBuf[i]->needle++]=0;
|
||||||
|
@ -85,7 +85,7 @@ void DivPlatformSMS::acquire_nuked(short* bufL, short* bufR, size_t start, size_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSMS::acquire_mame(short** buf, size_t len) {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
if (stereo && (w.addr==1))
|
if (stereo && (w.addr==1))
|
||||||
|
@ -95,10 +95,10 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t
|
||||||
}
|
}
|
||||||
writes.pop();
|
writes.pop();
|
||||||
}
|
}
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
short* outs[2]={
|
short* outs[2]={
|
||||||
&bufL[h],
|
&buf[0][h],
|
||||||
&bufR[h]
|
stereo?(&buf[1][h]):NULL
|
||||||
};
|
};
|
||||||
sn->sound_stream_update(outs,1);
|
sn->sound_stream_update(outs,1);
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
|
@ -111,11 +111,11 @@ void DivPlatformSMS::acquire_mame(short* bufL, short* bufR, size_t start, size_t
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSMS::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSMS::acquire(short** buf, size_t len) {
|
||||||
if (nuked) {
|
if (nuked) {
|
||||||
acquire_nuked(bufL,bufR,start,len);
|
acquire_nuked(buf,len);
|
||||||
} else {
|
} else {
|
||||||
acquire_mame(bufL,bufR,start,len);
|
acquire_mame(buf,len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -228,6 +228,7 @@ void DivPlatformSMS::tick(bool sysTick) {
|
||||||
if (parent->song.snNoLowPeriods) {
|
if (parent->song.snNoLowPeriods) {
|
||||||
if (chan[3].actualNote>0x5d) chan[3].freq=0x01;
|
if (chan[3].actualNote>0x5d) chan[3].freq=0x01;
|
||||||
}
|
}
|
||||||
|
if (chan[3].freq<0) chan[3].freq=0;
|
||||||
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) {
|
||||||
|
@ -444,8 +445,8 @@ void DivPlatformSMS::reset() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSMS::isStereo() {
|
int DivPlatformSMS::getOutputCount() {
|
||||||
return stereo;
|
return stereo?2:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSMS::keyOffAffectsArp(int ch) {
|
bool DivPlatformSMS::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -66,10 +66,10 @@ class DivPlatformSMS: public DivDispatch {
|
||||||
double NOTE_SN(int ch, int note);
|
double NOTE_SN(int ch, int note);
|
||||||
int snCalcFreq(int ch);
|
int snCalcFreq(int ch);
|
||||||
|
|
||||||
void acquire_nuked(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_nuked(short** buf, size_t len);
|
||||||
void acquire_mame(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire_mame(short** buf, size_t len);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -78,7 +78,7 @@ class DivPlatformSMS: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
bool keyOffAffectsPorta(int ch);
|
bool keyOffAffectsPorta(int ch);
|
||||||
int getPortaFloor(int ch);
|
int getPortaFloor(int ch);
|
||||||
|
|
|
@ -65,10 +65,10 @@ const char** DivPlatformSNES::getRegisterSheet() {
|
||||||
return regCheatSheetSNESDSP;
|
return regCheatSheetSNESDSP;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSNES::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSNES::acquire(short** buf, size_t len) {
|
||||||
short out[2];
|
short out[2];
|
||||||
short chOut[16];
|
short chOut[16];
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
if (--delay<=0) {
|
if (--delay<=0) {
|
||||||
delay=0;
|
delay=0;
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
|
@ -82,8 +82,8 @@ void DivPlatformSNES::acquire(short* bufL, short* bufR, size_t start, size_t len
|
||||||
dsp.set_output(out,1);
|
dsp.set_output(out,1);
|
||||||
dsp.run(32);
|
dsp.run(32);
|
||||||
dsp.get_voice_outputs(chOut);
|
dsp.get_voice_outputs(chOut);
|
||||||
bufL[h]=out[0];
|
buf[0][h]=out[0];
|
||||||
bufR[h]=out[1];
|
buf[1][h]=out[1];
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
int next=(3*(chOut[i*2]+chOut[i*2+1]))>>2;
|
int next=(3*(chOut[i*2]+chOut[i*2+1]))>>2;
|
||||||
if (next<-32768) next=-32768;
|
if (next<-32768) next=-32768;
|
||||||
|
@ -768,8 +768,8 @@ void DivPlatformSNES::reset() {
|
||||||
initEcho();
|
initEcho();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSNES::isStereo() {
|
int DivPlatformSNES::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSNES::notifyInsChange(int ins) {
|
void DivPlatformSNES::notifyInsChange(int ins) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ class DivPlatformSNES: public DivDispatch {
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -104,7 +104,7 @@ class DivPlatformSNES: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
void notifyWaveChange(int wave);
|
void notifyWaveChange(int wave);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
|
|
|
@ -40,14 +40,14 @@ double DivPlatformSoundUnit::NOTE_SU(int ch, int note) {
|
||||||
return NOTE_FREQUENCY(note);
|
return NOTE_FREQUENCY(note);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSoundUnit::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSoundUnit::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
su->Write(w.addr,w.val);
|
su->Write(w.addr,w.val);
|
||||||
writes.pop();
|
writes.pop();
|
||||||
}
|
}
|
||||||
su->NextSample(&bufL[h],&bufR[h]);
|
su->NextSample(&buf[0][h],&buf[1][h]);
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=su->GetSample(i);
|
oscBuf[i]->data[oscBuf[i]->needle++]=su->GetSample(i);
|
||||||
}
|
}
|
||||||
|
@ -499,8 +499,8 @@ void DivPlatformSoundUnit::reset() {
|
||||||
rWrite(0xbd,fil1);
|
rWrite(0xbd,fil1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSoundUnit::isStereo() {
|
int DivPlatformSoundUnit::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSoundUnit::keyOffAffectsArp(int ch) {
|
bool DivPlatformSoundUnit::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -98,7 +98,7 @@ class DivPlatformSoundUnit: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -109,7 +109,7 @@ class DivPlatformSoundUnit: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
|
|
|
@ -50,8 +50,8 @@ const char** DivPlatformSwan::getRegisterSheet() {
|
||||||
return regCheatSheetWS;
|
return regCheatSheetWS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSwan::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformSwan::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
// PCM part
|
// PCM part
|
||||||
if (pcm && dacSample!=-1) {
|
if (pcm && dacSample!=-1) {
|
||||||
dacPeriod+=dacRate;
|
dacPeriod+=dacRate;
|
||||||
|
@ -83,8 +83,8 @@ void DivPlatformSwan::acquire(short* bufL, short* bufR, size_t start, size_t len
|
||||||
int16_t samp[2]{0, 0};
|
int16_t samp[2]{0, 0};
|
||||||
ws->SoundUpdate(16);
|
ws->SoundUpdate(16);
|
||||||
ws->SoundFlush(samp, 1);
|
ws->SoundFlush(samp, 1);
|
||||||
bufL[h]=samp[0];
|
buf[0][h]=samp[0];
|
||||||
bufR[h]=samp[1];
|
buf[1][h]=samp[1];
|
||||||
for (int i=0; i<4; i++) {
|
for (int i=0; i<4; i++) {
|
||||||
oscBuf[i]->data[oscBuf[i]->needle++]=(ws->sample_cache[i][0]+ws->sample_cache[i][1])<<6;
|
oscBuf[i]->data[oscBuf[i]->needle++]=(ws->sample_cache[i][0]+ws->sample_cache[i][1])<<6;
|
||||||
}
|
}
|
||||||
|
@ -490,8 +490,8 @@ void DivPlatformSwan::reset() {
|
||||||
rWrite(0x11,0x09); // enable speakers
|
rWrite(0x11,0x09); // enable speakers
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformSwan::isStereo() {
|
int DivPlatformSwan::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformSwan::notifyWaveChange(int wave) {
|
void DivPlatformSwan::notifyWaveChange(int wave) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ class DivPlatformSwan: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -69,7 +69,7 @@ class DivPlatformSwan: public DivDispatch {
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
void notifyWaveChange(int wave);
|
void notifyWaveChange(int wave);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
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();
|
||||||
|
|
|
@ -35,8 +35,8 @@ const char** DivPlatformT6W28::getRegisterSheet() {
|
||||||
return regCheatSheetT6W28;
|
return regCheatSheetT6W28;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformT6W28::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformT6W28::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
cycles=0;
|
cycles=0;
|
||||||
while (!writes.empty() && cycles<16) {
|
while (!writes.empty() && cycles<16) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
|
@ -64,8 +64,8 @@ void DivPlatformT6W28::acquire(short* bufL, short* bufR, size_t start, size_t le
|
||||||
if (tempR<-32768) tempR=-32768;
|
if (tempR<-32768) tempR=-32768;
|
||||||
if (tempR>32767) tempR=32767;
|
if (tempR>32767) tempR=32767;
|
||||||
|
|
||||||
bufL[h]=tempL;
|
buf[0][h]=tempL;
|
||||||
bufR[h]=tempR;
|
buf[1][h]=tempR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,6 +146,7 @@ void DivPlatformT6W28::tick(bool sysTick) {
|
||||||
}
|
}
|
||||||
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
if (chan[i].freqChanged || chan[i].keyOn || chan[i].keyOff) {
|
||||||
chan[i].freq=snCalcFreq(i);
|
chan[i].freq=snCalcFreq(i);
|
||||||
|
if (chan[i].freq<0) chan[i].freq=0;
|
||||||
if (chan[i].freq>1023) chan[i].freq=1023;
|
if (chan[i].freq>1023) chan[i].freq=1023;
|
||||||
if (i==3) {
|
if (i==3) {
|
||||||
rWrite(1,0x80|(2<<5)|(chan[3].freq&15));
|
rWrite(1,0x80|(2<<5)|(chan[3].freq&15));
|
||||||
|
@ -335,8 +336,8 @@ void DivPlatformT6W28::reset() {
|
||||||
rWrite(1,0xe7);
|
rWrite(1,0xe7);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformT6W28::isStereo() {
|
int DivPlatformT6W28::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformT6W28::keyOffAffectsArp(int ch) {
|
bool DivPlatformT6W28::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ class DivPlatformT6W28: public DivDispatch {
|
||||||
|
|
||||||
void writeOutVol(int ch);
|
void writeOutVol(int ch);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -70,7 +70,7 @@ class DivPlatformT6W28: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
|
|
|
@ -38,16 +38,16 @@ const char** DivPlatformTIA::getRegisterSheet() {
|
||||||
return regCheatSheetTIA;
|
return regCheatSheetTIA;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformTIA::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformTIA::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
tia.tick();
|
tia.tick();
|
||||||
if (mixingType==2) {
|
if (mixingType==2) {
|
||||||
bufL[h]=tia.myCurrentSample[0];
|
buf[0][h]=tia.myCurrentSample[0];
|
||||||
bufR[h]=tia.myCurrentSample[1];
|
buf[1][h]=tia.myCurrentSample[1];
|
||||||
} else if (mixingType==1) {
|
} else if (mixingType==1) {
|
||||||
bufL[h]=(tia.myCurrentSample[0]+tia.myCurrentSample[1])>>1;
|
buf[0][h]=(tia.myCurrentSample[0]+tia.myCurrentSample[1])>>1;
|
||||||
} else {
|
} else {
|
||||||
bufL[h]=tia.myCurrentSample[0];
|
buf[0][h]=tia.myCurrentSample[0];
|
||||||
}
|
}
|
||||||
if (++chanOscCounter>=114) {
|
if (++chanOscCounter>=114) {
|
||||||
chanOscCounter=0;
|
chanOscCounter=0;
|
||||||
|
@ -342,8 +342,8 @@ float DivPlatformTIA::getPostAmp() {
|
||||||
return 0.5f;
|
return 0.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformTIA::isStereo() {
|
int DivPlatformTIA::getOutputCount() {
|
||||||
return (mixingType==2);
|
return (mixingType==2)?2:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformTIA::keyOffAffectsArp(int ch) {
|
bool DivPlatformTIA::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ class DivPlatformTIA: public DivDispatch {
|
||||||
unsigned char dealWithFreq(unsigned char shape, int base, int pitch);
|
unsigned char dealWithFreq(unsigned char shape, int base, int pitch);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -58,7 +58,7 @@ class DivPlatformTIA: public DivDispatch {
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
float getPostAmp();
|
float getPostAmp();
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
void notifyInsDeletion(void* ins);
|
void notifyInsDeletion(void* ins);
|
||||||
void poke(unsigned int addr, unsigned short val);
|
void poke(unsigned int addr, unsigned short val);
|
||||||
|
|
|
@ -55,12 +55,12 @@ const char** DivPlatformTX81Z::getRegisterSheet() {
|
||||||
return regCheatSheetOPZ;
|
return regCheatSheetOPZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformTX81Z::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformTX81Z::acquire(short** buf, size_t len) {
|
||||||
static int os[2];
|
static int os[2];
|
||||||
|
|
||||||
ymfm::ym2414::fm_engine* fme=fm_ymfm->debug_engine();
|
ymfm::ym2414::fm_engine* fme=fm_ymfm->debug_engine();
|
||||||
|
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
os[0]=0; os[1]=0;
|
os[0]=0; os[1]=0;
|
||||||
if (!writes.empty()) {
|
if (!writes.empty()) {
|
||||||
if (--delay<1) {
|
if (--delay<1) {
|
||||||
|
@ -87,8 +87,8 @@ void DivPlatformTX81Z::acquire(short* bufL, short* bufR, size_t start, size_t le
|
||||||
if (os[1]<-32768) os[1]=-32768;
|
if (os[1]<-32768) os[1]=-32768;
|
||||||
if (os[1]>32767) os[1]=32767;
|
if (os[1]>32767) os[1]=32767;
|
||||||
|
|
||||||
bufL[h]=os[0];
|
buf[0][h]=os[0];
|
||||||
bufR[h]=os[1];
|
buf[1][h]=os[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -947,8 +947,8 @@ void DivPlatformTX81Z::setFlags(const DivConfig& flags) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformTX81Z::isStereo() {
|
int DivPlatformTX81Z::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivPlatformTX81Z::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
int DivPlatformTX81Z::init(DivEngine* p, int channels, int sugRate, const DivConfig& flags) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ class DivPlatformTX81Z: public DivPlatformOPM {
|
||||||
|
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -73,7 +73,7 @@ class DivPlatformTX81Z: public DivPlatformOPM {
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
void notifyInsChange(int ins);
|
void notifyInsChange(int ins);
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
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();
|
||||||
|
|
|
@ -93,8 +93,8 @@ const char** DivPlatformVB::getRegisterSheet() {
|
||||||
return regCheatSheetVB;
|
return regCheatSheetVB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivPlatformVB::acquire(short* bufL, short* bufR, size_t start, size_t len) {
|
void DivPlatformVB::acquire(short** buf, size_t len) {
|
||||||
for (size_t h=start; h<start+len; h++) {
|
for (size_t h=0; h<len; h++) {
|
||||||
cycles=0;
|
cycles=0;
|
||||||
while (!writes.empty()) {
|
while (!writes.empty()) {
|
||||||
QueuedWrite w=writes.front();
|
QueuedWrite w=writes.front();
|
||||||
|
@ -117,8 +117,8 @@ void DivPlatformVB::acquire(short* bufL, short* bufR, size_t start, size_t len)
|
||||||
if (tempR<-32768) tempR=-32768;
|
if (tempR<-32768) tempR=-32768;
|
||||||
if (tempR>32767) tempR=32767;
|
if (tempR>32767) tempR=32767;
|
||||||
|
|
||||||
bufL[h]=tempL;
|
buf[0][h]=tempL;
|
||||||
bufR[h]=tempR;
|
buf[1][h]=tempR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -465,8 +465,8 @@ void DivPlatformVB::reset() {
|
||||||
delay=500;
|
delay=500;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformVB::isStereo() {
|
int DivPlatformVB::getOutputCount() {
|
||||||
return true;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivPlatformVB::keyOffAffectsArp(int ch) {
|
bool DivPlatformVB::keyOffAffectsArp(int ch) {
|
||||||
|
|
|
@ -64,7 +64,7 @@ class DivPlatformVB: public DivDispatch {
|
||||||
friend void putDispatchChip(void*,int);
|
friend void putDispatchChip(void*,int);
|
||||||
friend void putDispatchChan(void*,int,int);
|
friend void putDispatchChan(void*,int,int);
|
||||||
public:
|
public:
|
||||||
void acquire(short* bufL, short* bufR, size_t start, size_t len);
|
void acquire(short** buf, size_t len);
|
||||||
int dispatch(DivCommand c);
|
int dispatch(DivCommand c);
|
||||||
void* getChanState(int chan);
|
void* getChanState(int chan);
|
||||||
DivMacroInt* getChanMacroInt(int ch);
|
DivMacroInt* getChanMacroInt(int ch);
|
||||||
|
@ -76,7 +76,7 @@ class DivPlatformVB: public DivDispatch {
|
||||||
void forceIns();
|
void forceIns();
|
||||||
void tick(bool sysTick=true);
|
void tick(bool sysTick=true);
|
||||||
void muteChannel(int ch, bool mute);
|
void muteChannel(int ch, bool mute);
|
||||||
bool isStereo();
|
int getOutputCount();
|
||||||
bool keyOffAffectsArp(int ch);
|
bool keyOffAffectsArp(int ch);
|
||||||
float getPostAmp();
|
float getPostAmp();
|
||||||
void setFlags(const DivConfig& flags);
|
void setFlags(const DivConfig& flags);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue