From: <pst...@us...> - 2008-04-28 06:01:02
|
Revision: 479 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=479&view=rev Author: pstieber Date: 2008-04-27 23:00:52 -0700 (Sun, 27 Apr 2008) Log Message: ----------- 1. Prefixed some data members with m. 2. Made some of the JZTrack data members private and added IsEditing. 3. Made some cosmetic indentation changes. Modified Paths: -------------- trunk/jazz/src/Player.cpp trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/mswin/WindowsPlayer.cpp Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2008-04-28 01:30:56 UTC (rev 478) +++ trunk/jazz/src/Player.cpp 2008-04-28 06:00:52 UTC (rev 479) @@ -648,11 +648,11 @@ void JZPlayer::OutNow(JZTrack *t, tParam *r) { - OutNow(t, &r->Msb); - OutNow(t, &r->Lsb); - OutNow(t, &r->DataMsb); - OutNow(t, &r->ResetMsb); - OutNow(t, &r->ResetLsb); + OutNow(t, &r->mMsb); + OutNow(t, &r->mLsb); + OutNow(t, &r->mDataMsb); + OutNow(t, &r->mResetMsb); + OutNow(t, &r->mResetLsb); } // ---------------------------------------------------------------------------------------------- Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2008-04-28 01:30:56 UTC (rev 478) +++ trunk/jazz/src/Track.cpp 2008-04-28 06:00:52 UTC (rev 479) @@ -37,20 +37,20 @@ int tParam::Write(JZWriteBase& Io) { - return Msb.Write(Io) + Lsb.Write(Io) + DataMsb.Write(Io); + return mMsb.Write(Io) + mLsb.Write(Io) + mDataMsb.Write(Io); } void tParam::SetCha(unsigned char cha) { - Msb.Channel = cha; - Lsb.Channel = cha; - DataMsb.Channel = cha; + mMsb.Channel = cha; + mLsb.Channel = cha; + mDataMsb.Channel = cha; #ifdef OBSOLETE - ResetMb.Channel = cha; //???? JAVE commented out this while porting + mResetMb.Channel = cha; //???? JAVE commented out this while porting #endif // OBSOLETE - ResetLsb.Channel = cha; + mResetLsb.Channel = cha; } /* @@ -246,14 +246,14 @@ } tDrumInstrumentParameter::tDrumInstrumentParameter(tNrpn *par) - : pitch(par->Lsb.mValue), - next(0) + : mPitch(par->mLsb.mValue), + mpNext(0) { for (int i = drumPitchIndex; i < numDrumParameters; i++) { param[i] = 0; } - param[drumParam2Index(par->Msb.mValue)] = par; + param[drumParam2Index(par->mMsb.mValue)] = par; } tNrpn *tDrumInstrumentParameter::Get(int index) @@ -264,17 +264,17 @@ void tDrumInstrumentParameter::Put(tNrpn *par) { - param[par->Lsb.mValue] = par; + param[par->mLsb.mValue] = par; } tDrumInstrumentParameter *tDrumInstrumentParameter::Next() { - return next; + return mpNext; } int tDrumInstrumentParameter::Pitch() { - return pitch; + return mPitch; } tDrumInstrumentParameter @@ -283,11 +283,11 @@ tDrumInstrumentParameter *ptr = list; while (ptr) { - if (ptr->pitch == pit) + if (ptr->mPitch == pit) { break; } - ptr = ptr->next; + ptr = ptr->mpNext; } return ptr; } @@ -304,16 +304,16 @@ void tDrumInstrumentParameterList::PutParam(tNrpn *par) { - tDrumInstrumentParameter* ptr = GetElem(par->Lsb.mValue); + tDrumInstrumentParameter* ptr = GetElem(par->mLsb.mValue); if (!ptr) { ptr = new tDrumInstrumentParameter(par); - ptr ->next = list; + ptr->mpNext = list; list = ptr; } else { - ptr->param[drumParam2Index(par->Msb.mValue)] = par; + ptr->param[drumParam2Index(par->mMsb.mValue)] = par; } } @@ -344,21 +344,21 @@ tDrumInstrumentParameter *prev = 0; while (ptr) { - if (ptr->pitch == pit) + if (ptr->mPitch == pit) { if (prev) { - prev->next = ptr->next; + prev->mpNext = ptr->mpNext; } else { - list = ptr->next; + list = ptr->mpNext; } delete ptr; break; } prev = ptr; - ptr = ptr->next; + ptr = ptr->mpNext; } } @@ -372,10 +372,10 @@ { if (cur) { - tDrumInstrumentParameter *ptr = GetElem(cur->pitch); + tDrumInstrumentParameter *ptr = GetElem(cur->mPitch); if (ptr) { - return ptr->next; + return ptr->mpNext; } else { @@ -393,7 +393,7 @@ tDrumInstrumentParameter *ptr = list; while (ptr) { - list = ptr->next; + list = ptr->mpNext; delete ptr; ptr = list; } @@ -1714,7 +1714,7 @@ void tTrackDlg::OnCancel() { - trk->DialogBox = 0; + trk->mpDialog = 0; TrackWin->Redraw(); wxForm::OnCancel(); } @@ -1726,8 +1726,8 @@ void tTrackDlg::OnOk() { - trk->DialogBox->GetPosition(&Config(C_TrackDlgXpos), &Config(C_TrackDlgYpos)); - trk->DialogBox = 0; + trk->mpDialog->GetPosition(&Config(C_TrackDlgXpos), &Config(C_TrackDlgYpos)); + trk->mpDialog = 0; trk->SetAudioMode(AudioMode); if (ClearTrack) @@ -1907,7 +1907,7 @@ JZTrackDialog TrackDialog(*this, pParent); TrackDialog.ShowModal(); #ifdef OBSOLETE - DialogBox = new wxDialogBox( + mpDialog = new wxDialogBox( pParent, "Track Settings", modal, @@ -1916,26 +1916,47 @@ #endif // OBSOLETE } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZTrack::IsEditing() const +{ + if (mpDialog) + { + return (mpDialog->GetHandle() != 0); + } + return false; +} -// *********************************************************************** -// JZTrack -// *********************************************************************** +//***************************************************************************** +// Description: +// This is the track class definition. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZTrack::mChanged = false; - -bool JZTrack::changed = false; - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- JZTrack::JZTrack() - : tEventArray() + : tEventArray(), + mUndoIndex(0), + mRedoCount(0), + mUndoCount(0), + mpDialog(0) { - iUndo = 0; - nRedo = 0; - nUndo = 0; - DialogBox = 0; ForceChannel = 1; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZTrack::~JZTrack() +{ + Clear(); +} +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- bool JZTrack::IsDrumTrack() { return Channel == gpConfig->GetValue(C_DrumChannel); @@ -1999,9 +2020,9 @@ void JZTrack::Undo() { - if (nUndo > 0) + if (mUndoCount > 0) { - tUndoBuffer *undo = &UndoBuffers[iUndo]; + tUndoBuffer *undo = &mUndoBuffers[mUndoIndex]; for (int i = undo->nEvents - 1; i >= 0; i--) { JZEvent *e = undo->Events[i]; @@ -2019,19 +2040,19 @@ } tEventArray::Cleanup(TRUE); - iUndo = (iUndo - 1 + MaxUndo) % MaxUndo; - nUndo--; - nRedo++; + mUndoIndex = (mUndoIndex - 1 + MaxUndo) % MaxUndo; + --mUndoCount; + ++mRedoCount; } } void JZTrack::Redo() { - if (nRedo > 0) + if (mRedoCount > 0) { - iUndo = (iUndo + 1) % MaxUndo; + mUndoIndex = (mUndoIndex + 1) % MaxUndo; - tUndoBuffer *undo = &UndoBuffers[iUndo]; + tUndoBuffer *undo = &mUndoBuffers[mUndoIndex]; for (int i = 0; i < undo->nEvents; i++) { JZEvent *e = undo->Events[i]; @@ -2049,23 +2070,23 @@ } tEventArray::Cleanup(TRUE); - nRedo--; - nUndo++; + --mRedoCount; + ++mUndoCount; } } void JZTrack::NewUndoBuffer() { - nRedo = 0; - nUndo++; - if (nUndo > MaxUndo) + mRedoCount = 0; + ++mUndoCount; + if (mUndoCount > MaxUndo) { - nUndo = MaxUndo; + mUndoCount = MaxUndo; } - iUndo = (iUndo + 1) % MaxUndo; - UndoBuffers[iUndo].Clear(); + mUndoIndex = (mUndoIndex + 1) % MaxUndo; + mUndoBuffers[mUndoIndex].Clear(); }; @@ -2073,7 +2094,7 @@ { for (int i = 0; i < MaxUndo; i++) { - UndoBuffers[i].Clear(); + mUndoBuffers[i].Clear(); } State = tsPlay; tEventArray::Clear(); @@ -2372,7 +2393,7 @@ mpBank2->Control, mpBank2->Value); ) - changed = true; + mChanged = true; } } @@ -2398,7 +2419,7 @@ { mPatch = new tProgram(0, Channel - 1, PatchNr - 1); gpMidiPlayer->OutNow(this, mPatch); - changed = true; + mChanged = true; } } @@ -2425,7 +2446,7 @@ { VibRate = new tNrpn(0, Channel - 1, 0x01, 0x08, Value - 1); gpMidiPlayer->OutNow(this, VibRate); - changed = true; + mChanged = true; } } @@ -2451,7 +2472,7 @@ { VibDepth = new tNrpn(0, Channel - 1, 0x01, 0x09, Value - 1); gpMidiPlayer->OutNow(this, VibDepth); - changed = true; + mChanged = true; } } @@ -2478,7 +2499,7 @@ { VibDelay = new tNrpn(0, Channel - 1, 0x01, 0x0a, Value - 1); gpMidiPlayer->OutNow(this, VibDelay); - changed = true; + mChanged = true; } } @@ -2505,7 +2526,7 @@ { Cutoff = new tNrpn(0, Channel - 1, 0x01, 0x20, Value - 1); gpMidiPlayer->OutNow(this, Cutoff); - changed = true; + mChanged = true; } } @@ -2532,7 +2553,7 @@ { Resonance = new tNrpn(0, Channel - 1, 0x01, 0x21, Value - 1); gpMidiPlayer->OutNow(this, Resonance); - changed = true; + mChanged = true; } } @@ -2559,7 +2580,7 @@ { EnvAttack = new tNrpn(0, Channel - 1, 0x01, 0x63, Value - 1); gpMidiPlayer->OutNow(this, EnvAttack); - changed = true; + mChanged = true; } } @@ -2586,7 +2607,7 @@ { EnvDecay = new tNrpn(0, Channel - 1, 0x01, 0x64, Value - 1); gpMidiPlayer->OutNow(this, EnvDecay); - changed = true; + mChanged = true; } } @@ -2613,7 +2634,7 @@ { EnvRelease = new tNrpn(0, Channel - 1, 0x01, 0x66, Value - 1); gpMidiPlayer->OutNow(this, EnvRelease); - changed = true; + mChanged = true; } } @@ -2640,7 +2661,7 @@ DrumParams.PutParam( new tNrpn(0, Channel - 1, drumIndex2Param(index), pitch, Value - 1)); gpMidiPlayer->OutNow(this, DrumParams.GetParam(pitch, index)); - changed = true; + mChanged = true; } } @@ -2666,8 +2687,8 @@ if (Value > 0) { BendPitchSens = new tRpn(0, Channel - 1, 0x00, 0x00, Value - 1); - gpMidiPlayer->OutNow(this, BendPitchSens); - changed = true; + gpMidiPlayer->OutNow(this, BendPitchSens); + mChanged = true; } } Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2008-04-28 01:30:56 UTC (rev 478) +++ trunk/jazz/src/Track.h 2008-04-28 06:00:52 UTC (rev 479) @@ -36,14 +36,41 @@ #define tsSolo 2 // Mixer-defs -enum { MxVol = 0, MxPan, MxRev, MxCho, MxParams }; +enum +{ + MxVol = 0, + MxPan, + MxRev, + MxCho, + MxParams +}; - // Param (Nrpn / Rpn) things -enum { NrpnVibRate = 0, NrpnVibDepth, NrpnVibDelay, NrpnVibParams }; -enum { NrpnCutoff = 0, NrpnResonance, NrpnSoundParams }; -enum { NrpnEnvAttack = 0, NrpnEnvDecay, NrpnEnvRelease, NrpnEnvParams }; +enum +{ + NrpnVibRate = 0, + NrpnVibDepth, + NrpnVibDelay, + NrpnVibParams +}; +enum +{ + NrpnCutoff = 0, + NrpnResonance, + NrpnSoundParams +}; + +enum +{ + NrpnEnvAttack = 0, + NrpnEnvDecay, + NrpnEnvRelease, + NrpnEnvParams +}; + +//***************************************************************************** +//***************************************************************************** class tParam { public: @@ -56,11 +83,11 @@ unsigned char id2, unsigned char lsb, unsigned char msbval) - : Msb( clk, cha, id1, msb ), - Lsb( clk, cha, id2, lsb ), - DataMsb( clk, cha, 0x06, msbval ), - ResetMsb( clk, cha, id1, 0x7f ), - ResetLsb( clk, cha, id2, 0x7f ) + : mMsb(clk, cha, id1, msb), + mLsb(clk, cha, id2, lsb), + mDataMsb(clk, cha, 0x06, msbval), + mResetMsb(clk, cha, id1, 0x7f), + mResetLsb(clk, cha, id2, 0x7f) { } @@ -69,19 +96,23 @@ } virtual int Write(JZWriteBase& Io); - virtual void SetCha( unsigned char cha ); + + virtual void SetCha(unsigned char cha); + virtual int GetVal() { - return DataMsb.mValue; + return mDataMsb.mValue; } - tControl Msb; - tControl Lsb; - tControl DataMsb; - tControl ResetMsb; - tControl ResetLsb; + tControl mMsb; + tControl mLsb; + tControl mDataMsb; + tControl mResetMsb; + tControl mResetLsb; }; +//***************************************************************************** +//***************************************************************************** class tNrpn : public tParam { public: @@ -97,6 +128,8 @@ } }; +//***************************************************************************** +//***************************************************************************** class tRpn : public tParam { public: @@ -123,56 +156,133 @@ enum ModulationSysexParameter { - mspModPitchControl = 0, mspModTvfCut, mspModAmpl, mspModLfo1Rate, - mspModLfo1Pitch, mspModLfo1Tvf, mspModLfo1Tva, mspModLfo2Rate, - mspModLfo2Pitch, mspModLfo2Tvf, mspModLfo2Tva, mspModulationSysexParameters + mspModPitchControl = 0, + mspModTvfCut, + mspModAmpl, + mspModLfo1Rate, + mspModLfo1Pitch, + mspModLfo1Tvf, + mspModLfo1Tva, + mspModLfo2Rate, + mspModLfo2Pitch, + mspModLfo2Tvf, + mspModLfo2Tva, + mspModulationSysexParameters }; -enum BenderSysexParameter { - bspBendPitchControl = 0, bspBendTvfCut, bspBendAmpl, bspBendLfo1Rate, - bspBendLfo1Pitch, bspBendLfo1Tvf, bspBendLfo1Tva, bspBendLfo2Rate, - bspBendLfo2Pitch, bspBendLfo2Tvf, bspBendLfo2Tva, bspBenderSysexParameters +enum BenderSysexParameter +{ + bspBendPitchControl = 0, + bspBendTvfCut, + bspBendAmpl, + bspBendLfo1Rate, + bspBendLfo1Pitch, + bspBendLfo1Tvf, + bspBendLfo1Tva, + bspBendLfo2Rate, + bspBendLfo2Pitch, + bspBendLfo2Tvf, + bspBendLfo2Tva, + bspBenderSysexParameters }; -enum CAfSysexParameter { - cspCAfPitchControl = 0, cspCAfTvfCut, cspCAfAmpl, cspCAfLfo1Rate, - cspCAfLfo1Pitch, cspCAfLfo1Tvf, cspCAfLfo1Tva, cspCAfLfo2Rate, - cspCAfLfo2Pitch, cspCAfLfo2Tvf, cspCAfLfo2Tva, cspCAfSysexParameters +enum CAfSysexParameter +{ + cspCAfPitchControl = 0, + cspCAfTvfCut, + cspCAfAmpl, + cspCAfLfo1Rate, + cspCAfLfo1Pitch, + cspCAfLfo1Tvf, + cspCAfLfo1Tva, + cspCAfLfo2Rate, + cspCAfLfo2Pitch, + cspCAfLfo2Tvf, + cspCAfLfo2Tva, + cspCAfSysexParameters }; -enum PAfSysexParameter { - pspPAfPitchControl = 0, pspPAfTvfCut, pspPAfAmpl, pspPAfLfo1Rate, - pspPAfLfo1Pitch, pspPAfLfo1Tvf, pspPAfLfo1Tva, pspPAfLfo2Rate, - pspPAfLfo2Pitch, pspPAfLfo2Tvf, pspPAfLfo2Tva, pspPAfSysexParameters +enum PAfSysexParameter +{ + pspPAfPitchControl = 0, + pspPAfTvfCut, + pspPAfAmpl, + pspPAfLfo1Rate, + pspPAfLfo1Pitch, + pspPAfLfo1Tvf, + pspPAfLfo1Tva, + pspPAfLfo2Rate, + pspPAfLfo2Pitch, + pspPAfLfo2Tvf, + pspPAfLfo2Tva, + pspPAfSysexParameters }; -enum CC1SysexParameter { - cspCC1PitchControl = 0, cspCC1TvfCut, cspCC1Ampl, cspCC1Lfo1Rate, - cspCC1Lfo1Pitch, cspCC1Lfo1Tvf, cspCC1Lfo1Tva, cspCC1Lfo2Rate, - cspCC1Lfo2Pitch, cspCC1Lfo2Tvf, cspCC1Lfo2Tva, cspCC1SysexParameters +enum CC1SysexParameter +{ + cspCC1PitchControl = 0, + cspCC1TvfCut, + cspCC1Ampl, + cspCC1Lfo1Rate, + cspCC1Lfo1Pitch, + cspCC1Lfo1Tvf, + cspCC1Lfo1Tva, + cspCC1Lfo2Rate, + cspCC1Lfo2Pitch, + cspCC1Lfo2Tvf, + cspCC1Lfo2Tva, + cspCC1SysexParameters }; -enum CC2SysexParameter { - cspCC2PitchControl = 0, cspCC2TvfCut, cspCC2Ampl, cspCC2Lfo1Rate, - cspCC2Lfo1Pitch, cspCC2Lfo1Tvf, cspCC2Lfo1Tva, cspCC2Lfo2Rate, - cspCC2Lfo2Pitch, cspCC2Lfo2Tvf, cspCC2Lfo2Tva, cspCC2SysexParameters +enum CC2SysexParameter +{ + cspCC2PitchControl = 0, + cspCC2TvfCut, + cspCC2Ampl, + cspCC2Lfo1Rate, + cspCC2Lfo1Pitch, + cspCC2Lfo1Tvf, + cspCC2Lfo1Tva, + cspCC2Lfo2Rate, + cspCC2Lfo2Pitch, + cspCC2Lfo2Tvf, + cspCC2Lfo2Tva, + cspCC2SysexParameters }; -enum ReverbSysexParameter { - rspRevCharacter = 0, rspRevPreLpf, rspRevLevel, rspRevTime, - rspRevDelayFeedback, rspRevSendChorus, rspReverbSysexParameters +enum ReverbSysexParameter +{ + rspRevCharacter = 0, + rspRevPreLpf, + rspRevLevel, + rspRevTime, + rspRevDelayFeedback, + rspRevSendChorus, + rspReverbSysexParameters }; -enum ChorusSysexParameter { - cspChoPreLpf = 0, cspChoLevel, cspChoFeedback, cspChoDelay, - cspChoRate, cspChoDepth, cspChoSendReverb, cspChorusSysexParameters +enum ChorusSysexParameter +{ + cspChoPreLpf = 0, + cspChoLevel, + cspChoFeedback, + cspChoDelay, + cspChoRate, + cspChoDepth, + cspChoSendReverb, + cspChorusSysexParameters }; -enum ModeSysexParameter { - mspRxChannel = 0x02, mspRxCAf = 0x04, mspRxPAf = 0x07, mspUseForRhythm = 0x15 +enum ModeSysexParameter +{ + mspRxChannel = 0x02, + mspRxCAf = 0x04, + mspRxPAf = 0x07, + mspUseForRhythm = 0x15 }; -enum DrumInstrumentParameter { +enum DrumInstrumentParameter +{ drumPitch = 0x18, drumTva = 0x1a, drumPan = 0x1c, @@ -180,7 +290,8 @@ drumChorus = 0x1e }; -enum DrumInstrumentParameterIndex { +enum DrumInstrumentParameterIndex +{ drumPitchIndex = 0, drumTvaIndex, drumPanIndex, @@ -189,34 +300,42 @@ numDrumParameters }; -int drumParam2Index( int par ); -int drumIndex2Param( int index ); +int drumParam2Index(int par); +int drumIndex2Param(int index); class tDrumInstrumentParameterList; +//***************************************************************************** +//***************************************************************************** class tDrumInstrumentParameter { - friend class tDrumInstrumentParameterList; - private: - int pitch; - tNrpn *param[numDrumParameters]; - tDrumInstrumentParameter *next; public: + tDrumInstrumentParameter( tNrpn *par ); tNrpn *Get( int index ); void Put( tNrpn *par ); tDrumInstrumentParameter *Next(); int Pitch(); + + private: + + int mPitch; + tNrpn* param[numDrumParameters]; + tDrumInstrumentParameter* mpNext; }; +//***************************************************************************** +//***************************************************************************** class tDrumInstrumentParameterList { - private: - tDrumInstrumentParameter *list; public: - tDrumInstrumentParameterList() : list(0) {} + + tDrumInstrumentParameterList() + : list(0) + { + } tDrumInstrumentParameter *GetElem( int pit ); tNrpn *GetParam( int pit, int index ); void PutParam( tNrpn *par ); @@ -225,14 +344,30 @@ tDrumInstrumentParameter *NextElem( tDrumInstrumentParameter *cur ); void DelElem( int pit ); void Clear(); - int IsEmpty() { return( list == 0 ); } + int IsEmpty() + { + return( list == 0 ); + } + + private: + + tDrumInstrumentParameter* list; }; -enum tMtcType { Mtc24 = 0, Mtc25, Mtc30Df, Mtc30Ndf }; +enum tMtcType +{ + Mtc24 = 0, + Mtc25, + Mtc30Df, + Mtc30Ndf +}; +//***************************************************************************** +//***************************************************************************** class tMtcTime { public: + tMtcType type; int hour; int min; @@ -249,6 +384,8 @@ }; +//***************************************************************************** +//***************************************************************************** class tSimpleEventArray : public wxObject { public: @@ -282,6 +419,8 @@ }; +//***************************************************************************** +//***************************************************************************** class tUndoBuffer : public tSimpleEventArray { friend class JZTrack; @@ -289,10 +428,11 @@ public: virtual void Clear(); - void Put(JZEvent *e, int killed) + + void Put(JZEvent* pEvent, int killed) { bits.set(nEvents, killed); - tSimpleEventArray::Put(e); + tSimpleEventArray::Put(pEvent); } private: @@ -301,6 +441,8 @@ }; +//***************************************************************************** +//***************************************************************************** class tEventArray : public tSimpleEventArray { friend class tEventIterator; @@ -402,41 +544,42 @@ }; - #define MaxUndo 20 +//***************************************************************************** +// Description: +// This is the track class declaration. +//***************************************************************************** class JZTrack : public tEventArray { public: - static bool changed; + static bool mChanged; JZTrack(); - ~JZTrack() { Clear(); } + virtual ~JZTrack(); + bool IsDrumTrack(); - int iUndo; // index to actual undo buffer - int nRedo; // current number of possible redo's - int nUndo; // current number of possible undo's - tUndoBuffer UndoBuffers[MaxUndo]; + public: - wxDialog *DialogBox; + void Dialog(JZTrackWindow* pParent); - void Dialog(JZTrackWindow *parent); + bool IsEditing() const; - void Put(JZEvent *e) + void Put(JZEvent* pEvent) { - changed = true; - tEventArray::Put(e); - UndoBuffers[iUndo].Put(e, 0); + mChanged = true; + tEventArray::Put(pEvent); + mUndoBuffers[mUndoIndex].Put(pEvent, 0); } - void Kill(JZEvent *e) + void Kill(JZEvent* pEvent) { - changed = true; - e->Kill(); - UndoBuffers[iUndo].Put(e, 1); + mChanged = true; + pEvent->Kill(); + mUndoBuffers[mUndoIndex].Put(pEvent, 1); } void Merge(tEventArray *other); @@ -508,7 +651,7 @@ int GetEnvRelease(); void SetEnvRelease(int EnvRelease); - int GetDrumParam( int pitch, int index ); + int GetDrumParam(int pitch, int index); void SetDrumParam(int pitch, int index, int Value); int GetBendPitchSens(); @@ -577,95 +720,111 @@ tMtcTime* GetMtcOffset(); void SetMtcOffset( tMtcTime* mtc ); + + private: + + // Index in the actual undo buffer. + int mUndoIndex; + + // Current number of possible redo's. + int mRedoCount; + + // Current number of possible undo's. + int mUndoCount; + + tUndoBuffer mUndoBuffers[MaxUndo]; + + wxDialog* mpDialog; }; -// *********************************************************************** -// tEventIterator -// ********************************************************************* - +//***************************************************************************** +// Description: +// This is the event iterator class declaration. +//***************************************************************************** class tEventIterator { - const tSimpleEventArray* Track; - int Start, Stop, Actual; - public: - tEventIterator(const tSimpleEventArray* t) + tEventIterator(const tSimpleEventArray* pTrack) { - Track = t; - Start = 0; - Stop = Track->nEvents; - Actual = Start; + mpTrack = pTrack; + mStart = 0; + mStop = mpTrack->nEvents; + mActual = mStart; } - - JZEvent *GreaterEqual(int Clock) + JZEvent* GreaterEqual(int Clock) { - int lo = Start; - int hi = Stop; - int clk = 0; - while (lo < hi) + int Lo = mStart; + int Hi = mStop; + int TestClock = 0; + while (Lo < Hi) { - Actual = (hi + lo) / 2; - clk = Track->Events[Actual]->GetClock(); - if (clk < Clock) + mActual = (Hi + Lo) / 2; + TestClock = mpTrack->Events[mActual]->GetClock(); + if (TestClock < Clock) { - lo = Actual + 1; + Lo = mActual + 1; } else { - hi = Actual; + Hi = mActual; } } - if (Actual < Stop-1 && clk < Clock) + if (mActual < mStop - 1 && TestClock < Clock) { - clk = Track->Events[++Actual]->GetClock(); + TestClock = mpTrack->Events[++mActual]->GetClock(); } - if (Actual < Stop && clk >= Clock) + if (mActual < mStop && TestClock >= Clock) { - return Track->Events[Actual]; + return mpTrack->Events[mActual]; } return 0; } - - JZEvent *First(int Clock = 0) + JZEvent* First(int Clock = 0) { - Actual = Start; + mActual = mStart; return GreaterEqual(Clock); } - - JZEvent *Range(int frClock, unsigned toClock) + JZEvent* Range(int FromClock, unsigned ToClock) { - Start = Actual = 0; - Stop = Track->nEvents; + mStart = mActual = 0; + mStop = mpTrack->nEvents; - if (!GreaterEqual(frClock)) + if (!GreaterEqual(FromClock)) + { return 0; - Start = Actual; - if (GreaterEqual(toClock)) - Stop = Actual; - Actual = Start; - return (Actual < Stop ? Track->Events[Actual] : 0); + } + mStart = mActual; + if (GreaterEqual(ToClock)) + { + mStop = mActual; + } + mActual = mStart; + return (mActual < mStop ? mpTrack->Events[mActual] : 0); } - - JZEvent *Next() + JZEvent* Next() { - if (Actual < Stop) + if (mActual < mStop) { - ++Actual; + ++mActual; } - return (Actual < Stop ? Track->Events[Actual] : 0); + return (mActual < mStop ? mpTrack->Events[mActual] : 0); } int EventsLeft() { - return Stop - Actual; + return mStop - mActual; } + private: + + const tSimpleEventArray* mpTrack; + int mStart, mStop, mActual; }; #endif // !defined(JZ_TRACK_H) Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-04-28 01:30:56 UTC (rev 478) +++ trunk/jazz/src/TrackWindow.cpp 2008-04-28 06:00:52 UTC (rev 479) @@ -685,14 +685,28 @@ mEventsHeight); // Draw the track name. - if (pTrack->DialogBox) + if (pTrack->IsEditing()) { // Show the button pressed when the dialog box is open. - LineText(LocalDc, mTrackNameX, y, mTrackNameWidth, pTrack->GetName(), -1, true); + LineText( + LocalDc, + mTrackNameX, + y, + mTrackNameWidth, + pTrack->GetName(), + -1, + true); } else { - LineText(LocalDc, mTrackNameX, y, mTrackNameWidth, pTrack->GetName(), -1, false); + LineText( + LocalDc, + mTrackNameX, + y, + mTrackNameWidth, + pTrack->GetName(), + -1, + false); } // Draw the track status. Modified: trunk/jazz/src/mswin/WindowsPlayer.cpp =================================================================== --- trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-04-28 01:30:56 UTC (rev 478) +++ trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-04-28 06:00:52 UTC (rev 479) @@ -506,11 +506,11 @@ //----------------------------------------------------------------------------- void JZWindowsPlayer::OutNow(tParam *r) { - OutNow(&r->Msb); - OutNow(&r->Lsb); - OutNow(&r->DataMsb); - OutNow(&r->ResetMsb); - OutNow(&r->ResetLsb); + OutNow(&r->mMsb); + OutNow(&r->mLsb); + OutNow(&r->mDataMsb); + OutNow(&r->mResetMsb); + OutNow(&r->mResetLsb); } //----------------------------------------------------------------------------- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |