Skip to content

Commit

Permalink
C700Driverにレジスタログ開始終了イベントを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
osoumen committed Jul 3, 2016
1 parent fde875e commit 31bdddc
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 4 deletions.
10 changes: 9 additions & 1 deletion C700DSP.cpp
Expand Up @@ -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<int>(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()
Expand Down
2 changes: 1 addition & 1 deletion C700DSP.h
Expand Up @@ -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);
Expand Down
56 changes: 55 additions & 1 deletion C700Driver.cpp
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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 {
// ノートオフ以外のイベントは全て遅延実行する
// ノートオフとレジスタログ以外のイベントは全て遅延実行する
doNoteOn1(*evt);
}

Expand Down
9 changes: 8 additions & 1 deletion C700Driver.h
Expand Up @@ -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 );
Expand Down Expand Up @@ -177,7 +181,10 @@ class C700Driver
NOTE_OFF,
PROGRAM_CHANGE,
PITCH_BEND,
CONTROL_CHANGE
CONTROL_CHANGE,
START_REGLOG,
MARKLOOP_REGLOG,
END_REGLOG
};

typedef struct {
Expand Down
2 changes: 2 additions & 0 deletions DspController.h
Expand Up @@ -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 );

Expand Down

0 comments on commit 31bdddc

Please sign in to comment.