2
0
Fork 0

Fix some percussion recording issues.

This commit is contained in:
bsutherland 2015-01-15 12:07:49 +09:00
parent 2ebe0a43bc
commit 2482447f98
3 changed files with 12 additions and 14 deletions

View File

@ -75,7 +75,7 @@
<JUCEOPTIONS JUCE_QUICKTIME="disabled"/> <JUCEOPTIONS JUCE_QUICKTIME="disabled"/>
<EXPORTFORMATS> <EXPORTFORMATS>
<VS2013 targetFolder="Builds/VisualStudio2013" vstFolder="C:\code\audio\vstsdk2.4" <VS2013 targetFolder="Builds/VisualStudio2013" vstFolder="C:\code\audio\vstsdk2.4"
externalLibraries=""> externalLibraries="" toolset="v120_xp">
<CONFIGURATIONS> <CONFIGURATIONS>
<CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit" <CONFIGURATION name="Debug" winWarningLevel="4" generateManifest="1" winArchitecture="32-bit"
isDebug="1" optimisation="1" targetName="JuceOPLVSTi"/> isDebug="1" optimisation="1" targetName="JuceOPLVSTi"/>

View File

@ -67,7 +67,7 @@ static Bit32u CHANNEL_OFFSETS[15]= {
// bass drum uses two operators. // bass drum uses two operators.
// others use either modulator or carrier. // others use either modulator or carrier.
static Bit32u PERCUSSION_OPERATORS[5][2] = { static Bit32u PERCUSSION_OPERATORS[5][2] = {
{ 0x10, 0x13 }, // bd { 0x13, 0x10 }, // bd
{ 0x00, 0x14 }, // sd { 0x00, 0x14 }, // sd
{ 0x12, 0x00 }, // tt { 0x12, 0x00 }, // tt
{ 0x00, 0x15}, // cy { 0x00, 0x15}, // cy
@ -145,7 +145,7 @@ void DROMultiplexer::_CopyOplPercussionSettings(Hiopl* opl, int pIdx) {
int chInOff = opl->_GetOffset(1); int chInOff = opl->_GetOffset(1);
inAddr = 0xc0 + chInOff; inAddr = 0xc0 + chInOff;
outAddr = 0xc0 + PERCUSSION_CHANNELS[pIdx]; outAddr = 0xc0 + PERCUSSION_CHANNELS[pIdx];
_CaptureRegWrite(outAddr, 0x30 | opl->_ReadReg(inAddr)); _CaptureRegWrite(outAddr, 0x30 | opl->_ReadReg(inAddr)); // make sure L+R channels always enabled
} }
void DROMultiplexer::_CopyOplChannelSettings(Hiopl* opl, int inCh, int outCh) { void DROMultiplexer::_CopyOplChannelSettings(Hiopl* opl, int inCh, int outCh) {
@ -256,12 +256,11 @@ void DROMultiplexer::PercussionChange(Hiopl* opl, int pIdx) {
const ScopedLock sl(lock); const ScopedLock sl(lock);
_CopyOplPercussionSettings(opl, pIdx); _CopyOplPercussionSettings(opl, pIdx);
Bit8u val = opl->_ReadReg(0xbd); Bit8u val = opl->_ReadReg(0xbd);
Bit8u masked = 0x1f & val; Bit8u maskOut = 1 << abs(4 - pIdx);
if (0 == masked) { // note-off if (0 == (val & maskOut)) { // note-off
// TODO: clear the correct bit only _CaptureRegWriteWithDelay(0xbd, 0xBD & (0xe0 | ~maskOut));
_CaptureRegWriteWithDelay(0xbd, val & 0xe0); } else { // note-on
} else { // note-on _CaptureRegWriteWithDelay(0xbd, OxBD | maskOut);
_CaptureRegWriteWithDelay(0xbd, OxBD | masked);
} }
} }
@ -275,7 +274,7 @@ void DROMultiplexer::InitCaptureVariables() {
channels[i].opl = NULL; channels[i].opl = NULL;
channels[i].ch = -1; channels[i].ch = -1;
} }
OxBD = 0x0; OxBD = 0x20; // percussion mode should always be enabled
} }
bool DROMultiplexer::StartCapture(const char* filepath, Hiopl *opl) { bool DROMultiplexer::StartCapture(const char* filepath, Hiopl *opl) {
@ -302,8 +301,7 @@ bool DROMultiplexer::StartCapture(const char* filepath, Hiopl *opl) {
for (Bit8u i = 0x80; i <= 0x95; i++) { for (Bit8u i = 0x80; i <= 0x95; i++) {
_CaptureRegWrite(i, opl->_ReadReg(i)); _CaptureRegWrite(i, opl->_ReadReg(i));
} }
_CaptureRegWrite(0xbd, opl->_ReadReg(0xbd)); _CaptureRegWrite(0xbd, OxBD | (opl->_ReadReg(0xbd) & 0xc0)); // enable percmode, copy tremolo and vibrato depth only
OxBD = opl->_ReadReg(0xbd);
for (Bit8u i = 0xc0; i <= 0xc8; i++) { for (Bit8u i = 0xc0; i <= 0xc8; i++) {
_CaptureRegWrite(i, opl->_ReadReg(i) | 0x30); // enable L + R channels _CaptureRegWrite(i, opl->_ReadReg(i) | 0x30); // enable L + R channels
} }

View File

@ -732,7 +732,7 @@ void JuceOplvstiAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuf
} }
Opl->HitPercussion(DRUM_INDEX[perc - 1]); Opl->HitPercussion(DRUM_INDEX[perc - 1]);
if (isAnyInstanceRecording()) { if (isAnyInstanceRecording()) {
dro->GetMaster()->PercussionChange(Opl, perc); dro->GetMaster()->PercussionChange(Opl, perc - 1);
} }
} else { } else {
if (!available_channels.empty()) if (!available_channels.empty())
@ -783,7 +783,7 @@ void JuceOplvstiAudioProcessor::processBlock (AudioSampleBuffer& buffer, MidiBuf
if (perc > 0) { if (perc > 0) {
Opl->ReleasePercussion(); Opl->ReleasePercussion();
if (isAnyInstanceRecording()) { if (isAnyInstanceRecording()) {
dro->GetMaster()->PercussionChange(Opl, perc-1); dro->GetMaster()->PercussionChange(Opl, perc - 1);
} }
} }
else { else {