diff --git a/C700DSP.cpp b/C700DSP.cpp index ab43545..4caea43 100644 --- a/C700DSP.cpp +++ b/C700DSP.cpp @@ -658,13 +658,21 @@ bool C700DSP::writeDsp(int addr, unsigned char data) return mDsp.WriteDsp(addr, data, false); } -void C700DSP::BeginS98Log() +void C700DSP::BeginRegisterLog() { mLoggerSamplePos = 0; mTickPerSec = 15734; // Hsync mLogger.SetResolution(1, static_cast(mTickPerSec)); mLogger.BeginDump(0); mIsLoggerRunning = true; + + // 現在のレジスタ値を出力 + for (int i=0; i<128; i++) { + int reg = mDsp.GetDspMirror(i); + if (reg >= 0 && reg <= 0xff) { + mLogger.DumpReg(0, i, reg, 0); + } + } } void C700DSP::MarkRegisterLogLoop() diff --git a/C700DSP.h b/C700DSP.h index e4d8901..185d318 100644 --- a/C700DSP.h +++ b/C700DSP.h @@ -67,7 +67,7 @@ class C700DSP { void setBrr(int v, unsigned char *brrdata, unsigned int loopPoint); - void BeginS98Log(); + void BeginRegisterLog(); void MarkRegisterLogLoop(); void EndRegisterLog(); int SaveRegisterLog(const char *path); diff --git a/C700Driver.cpp b/C700Driver.cpp index d732104..22cffa9 100644 --- a/C700Driver.cpp +++ b/C700Driver.cpp @@ -186,6 +186,51 @@ void C700Driver::ControlChange( int ch, int controlNum, int value, int inFrame ) MutexUnlock(mMIDIEvtMtx); } +//----------------------------------------------------------------------------- +void C700Driver::StartRegisterLog( int inFrame ) +{ + MIDIEvt evt; + evt.type = START_REGLOG; + evt.ch = 0; + evt.note = 0; + evt.velo = 0; + evt.uniqueID = 0; + evt.remain_samples = inFrame; + MutexLock(mMIDIEvtMtx); + mMIDIEvt.push_back( evt ); + MutexUnlock(mMIDIEvtMtx); +} + +//----------------------------------------------------------------------------- +void C700Driver::MarkLoopRegisterLog( int inFrame ) +{ + MIDIEvt evt; + evt.type = MARKLOOP_REGLOG; + evt.ch = 0; + evt.note = 0; + evt.velo = 0; + evt.uniqueID = 0; + evt.remain_samples = inFrame; + MutexLock(mMIDIEvtMtx); + mMIDIEvt.push_back( evt ); + MutexUnlock(mMIDIEvtMtx); +} + +//----------------------------------------------------------------------------- +void C700Driver::EndRegisterLog( int inFrame ) +{ + MIDIEvt evt; + evt.type = END_REGLOG; + evt.ch = 0; + evt.note = 0; + evt.velo = 0; + evt.uniqueID = 0; + evt.remain_samples = inFrame; + MutexLock(mMIDIEvtMtx); + mMIDIEvt.push_back( evt ); + MutexUnlock(mMIDIEvtMtx); +} + //----------------------------------------------------------------------------- void C700Driver::AllNotesOff() { @@ -989,8 +1034,17 @@ bool C700Driver::doEvents1( const MIDIEvt *evt ) //mChStat[evt->ch].noteOns -= stops; } } + else if (evt->type == START_REGLOG) { + mDSP.BeginRegisterLog(); + } + else if (evt->type == MARKLOOP_REGLOG) { + mDSP.MarkRegisterLogLoop(); + } + else if (evt->type == END_REGLOG) { + mDSP.EndRegisterLog(); + } else { - // m[gItȊÕCxg͑SĒxs + // m[gItƃWX^OȊÕCxg͑SĒxs doNoteOn1(*evt); } diff --git a/C700Driver.h b/C700Driver.h index 878e960..f364c84 100644 --- a/C700Driver.h +++ b/C700Driver.h @@ -93,6 +93,10 @@ class C700Driver void AllNotesOff(); void AllSoundOff(); void ResetAllControllers(); + + void StartRegisterLog( int inFrame ); + void MarkLoopRegisterLog( int inFrame ); + void EndRegisterLog( int inFrame ); // channel params void ModWheel( int ch, int value ); @@ -177,7 +181,10 @@ class C700Driver NOTE_OFF, PROGRAM_CHANGE, PITCH_BEND, - CONTROL_CHANGE + CONTROL_CHANGE, + START_REGLOG, + MARKLOOP_REGLOG, + END_REGLOG }; typedef struct { diff --git a/DspController.h b/DspController.h index e17126f..9f42bf5 100644 --- a/DspController.h +++ b/DspController.h @@ -61,6 +61,8 @@ class DspController { void StartMuteEmulation(); void EndMuteEmulation(); + int GetDspMirror(int addr) { return mDspMirror[addr & 0x7f]; } + void setDeviceReadyFunc( void (*func) (void* ownerClass), void* ownerClass ); void setDeviceExitFunc( void (*func) (void* ownerClass) , void* ownerClass );