From: <pst...@us...> - 2008-05-19 05:56:51
|
Revision: 546 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=546&view=rev Author: pstieber Date: 2008-05-18 22:56:49 -0700 (Sun, 18 May 2008) Log Message: ----------- Made all members of the key on event private and added the appropriate accessors. Modified Paths: -------------- trunk/jazz/src/AlsaPlayer.cpp trunk/jazz/src/Audio.cpp trunk/jazz/src/Command.cpp trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/Dialogs/KeyOnDialog.cpp trunk/jazz/src/Dialogs/KeyOnDialog.h trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Events.h trunk/jazz/src/Harmony.cpp trunk/jazz/src/HarmonyBrowserAnalyzer.cpp trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/Player.cpp trunk/jazz/src/Rhythm.cpp trunk/jazz/src/Song.cpp trunk/jazz/src/Track.cpp trunk/jazz/src/mswin/WindowsPlayer.cpp Modified: trunk/jazz/src/AlsaPlayer.cpp =================================================================== --- trunk/jazz/src/AlsaPlayer.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/AlsaPlayer.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -411,22 +411,22 @@ { case StatKeyOn: { - tKeyOn *k = pEvent->IsKeyOn(); + tKeyOn* pKeyOn = pEvent->IsKeyOn(); set_event_header(&ev, pEvent->GetClock(), SND_SEQ_EVENT_NOTEON); - ev.data.note.channel = k->Channel; - ev.data.note.note = k->mKey; - ev.data.note.velocity = k->mVelocity; + ev.data.note.channel = pKeyOn->Channel; + ev.data.note.note = pKeyOn->GetKey(); + ev.data.note.velocity = pKeyOn->GetVelocity(); rc = write(&ev, now); } break; case StatKeyOff: { - tKeyOff *k = pEvent->IsKeyOff(); + tKeyOff* pKeyOff = pEvent->IsKeyOff(); set_event_header(&ev, pEvent->GetClock(), SND_SEQ_EVENT_NOTEOFF); - ev.data.note.channel = k->Channel; - ev.data.note.note = k->Key; - ev.data.note.velocity = k->OffVeloc; + ev.data.note.channel = pKeyOff->Channel; + ev.data.note.note = pKeyOff->Key; + ev.data.note.velocity = pKeyOff->OffVeloc; rc = write(&ev, now); } break; Modified: trunk/jazz/src/Audio.cpp =================================================================== --- trunk/jazz/src/Audio.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Audio.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -466,7 +466,7 @@ tKeyOn* pKeyOn = e->IsKeyOn(); if (pKeyOn && num_voices < MAXPOLY) { - voices[num_voices++]->Start(samples[pKeyOn->mKey], pKeyOn->GetClock()); + voices[num_voices++]->Start(samples[pKeyOn->GetKey()], pKeyOn->GetClock()); } } @@ -582,11 +582,13 @@ tKeyOn* pKeyOn = e->IsKeyOn(); if (pKeyOn) { - pKeyOn->mLength = - (int)Samples2Ticks(samples[pKeyOn->mKey]->GetLength()); - if (pKeyOn->mLength < 15) // invisble? + pKeyOn->SetLength( + (int)Samples2Ticks(samples[pKeyOn->GetKey()]->GetLength())); + + // Is the event visble? + if (pKeyOn->GetEventLength() < 15) { - pKeyOn->mLength = 15; + pKeyOn->SetLength(15); } } e = it.Next(); Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Command.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -140,7 +140,7 @@ tKeyOn* pKeyOn = pEvent->IsKeyOn(); if (pKeyOn) { - Keys[pKeyOn->mKey] += pKeyOn->mLength; + Keys[pKeyOn->GetKey()] += pKeyOn->GetEventLength(); } } @@ -371,7 +371,7 @@ } if (NoteLength) { - pKeyOn->mLength = Quantize(pKeyOn->mLength, 2); + pKeyOn->SetLength(Quantize(pKeyOn->GetEventLength(), 2)); } pTrack->Kill(pEvent); pTrack->Put(pKeyOn); @@ -398,12 +398,12 @@ pKeyOn = (tKeyOn *)pEvent->Copy(); if (FitIntoScale) { - pKeyOn->mKey += Notes; - pKeyOn->mKey = Scale.FitInto(pKeyOn->mKey); + pKeyOn->SetKey(pKeyOn->GetKey() + Notes); + pKeyOn->SetKey(Scale.FitInto(pKeyOn->GetKey())); } else if (Notes) { - pKeyOn->mKey = Scale.Transpose(pKeyOn->mKey, Notes); + pKeyOn->SetKey(Scale.Transpose(pKeyOn->GetKey(), Notes)); } pTrack->Kill(pEvent); pTrack->Put(pKeyOn); @@ -478,13 +478,13 @@ case 0: break; case 1: - val = pKeyOn->mVelocity + val; + val = pKeyOn->GetVelocity() + val; break; case 2: - val = pKeyOn->mVelocity - val; + val = pKeyOn->GetVelocity() - val; break; } - pKeyOn->mVelocity = val < 1 ? 1 : (val > 127 ? 127 : val); + pKeyOn->SetVelocity(val < 1 ? 1 : (val > 127 ? 127 : val)); pTrack->Kill(pEvent); pTrack->Put(pKeyOn); } @@ -519,14 +519,14 @@ case 0: break; case 1: - val = pKeyOn->mLength + val; + val = pKeyOn->GetEventLength() + val; break; case 2: - val = pKeyOn->mLength - val; + val = pKeyOn->GetEventLength() - val; break; } - pKeyOn->mLength = val < 1 ? 1 : val; + pKeyOn->SetLength(val < 1 ? 1 : val); pTrack->Kill(pEvent); pTrack->Put(pKeyOn); } @@ -619,9 +619,9 @@ if (startclock == -1) { startclock = pEvent->IsKeyOn()->GetClock(); - startvelocity = pEvent->IsKeyOn()->mVelocity; + startvelocity = pEvent->IsKeyOn()->GetVelocity(); channel = pEvent->IsKeyOn()->Channel; - startkey = pEvent->IsKeyOn()->mKey; + startkey = pEvent->IsKeyOn()->GetKey(); previouspitch = pEvent->GetPitch(); } pitchdiff = pEvent->GetPitch()-previouspitch; @@ -636,10 +636,18 @@ pTrack->Kill(pEvent); //remove the old event - pTrack->Put(new tControl(pEvent->GetClock(), channel, 0x07, pEvent->IsKeyOn()->mVelocity)); - pTrack->Put(new tControl(pEvent->GetClock() + pEvent->IsKeyOn()->mLength, channel, 0x07, 0)); + pTrack->Put(new tControl( + pEvent->GetClock(), + channel, + 0x07, + pEvent->IsKeyOn()->GetVelocity())); + pTrack->Put(new tControl( + pEvent->GetClock() + pEvent->IsKeyOn()->GetEventLength(), + channel, + 0x07, + 0)); - lastlength = pEvent->IsKeyOn()->mLength; + lastlength = pEvent->IsKeyOn()->GetEventLength(); endclock = pEvent->GetClock(); previouspitch = pEvent->GetPitch(); } @@ -685,7 +693,8 @@ // only echo note events pKeyOn = (tKeyOn *)pEvent->Copy(); pKeyOn->SetClock(pKeyOn->GetClock()+ clockDelay * i); - pKeyOn->mVelocity = (unsigned char)(pow(scale, i) * pKeyOn->mVelocity); + pKeyOn->SetVelocity( + (unsigned char)(pow(scale, i) * pKeyOn->GetVelocity())); pTrack->Put(pKeyOn); } } @@ -715,24 +724,28 @@ tKeyOn* pKeyOn; if ((pKeyOn = pEvent->IsKeyOn()) != 0) { - if (pKeyOn->mLength < lengthLimit) + if (pKeyOn->GetEventLength() < lengthLimit) { - // remove short notes + // Remove short notes. pTrack->Kill(pEvent); } else if (shortenOverlaps) { - // shorten length of overlapping notes - tKeyOn *p = prev_note[pKeyOn->Channel][pKeyOn->mKey]; - if (p && p->GetClock() + p->mLength >= pKeyOn->GetClock()) + // Shorten length of overlapping notes. + tKeyOn* pPreviousKeyOn = prev_note[pKeyOn->Channel][pKeyOn->GetKey()]; + if ( + pPreviousKeyOn && + pPreviousKeyOn->GetClock() + pPreviousKeyOn->GetEventLength() >= + pKeyOn->GetClock()) { - p->mLength = pKeyOn->GetClock() - p->GetClock() - 1; - if (p->mLength < lengthLimit) + pPreviousKeyOn->SetLength( + pKeyOn->GetClock() - pPreviousKeyOn->GetClock() - 1); + if (pPreviousKeyOn->GetEventLength() < lengthLimit) { - pTrack->Kill(p); + pTrack->Kill(pPreviousKeyOn); } } - prev_note[pKeyOn->Channel][pKeyOn->mKey] = pKeyOn; + prev_note[pKeyOn->Channel][pKeyOn->GetKey()] = pKeyOn; } } } @@ -976,7 +989,7 @@ if (mpFilter->IsSelected(pEvent) && pEvent->IsKeyOn()) { tKeyOn* pKeyOn = (tKeyOn *)pEvent; - Keys[pKeyOn->mKey] = 1; + Keys[pKeyOn->GetKey()] = 1; } pEvent = Iterator.Next(); } @@ -992,7 +1005,7 @@ int n_th = 0; // the n'th key from bottom .. - for (i = 0; i <= pKeyOn->mKey; i++) + for (i = 0; i <= pKeyOn->GetKey(); i++) { n_th += Keys[i]; } @@ -1003,7 +1016,7 @@ n_th -= Keys[i]; } - pKeyOn->mKey = i + 1; + pKeyOn->SetKey(i + 1); pTrack->Kill(pEvent); pTrack->Put(pKeyOn); @@ -1056,15 +1069,15 @@ switch (mSource) { case veloc: - sval = mRandomArray[(int)pKeyOn->mVelocity]; + sval = mRandomArray[(int)pKeyOn->GetVelocity()]; break; case length: - sval = mRandomArray[(int)pKeyOn->mLength]; + sval = mRandomArray[(int)pKeyOn->GetEventLength()]; break; case key: - sval = mRandomArray[(int)pKeyOn->mKey]; + sval = mRandomArray[(int)pKeyOn->GetKey()]; break; case rhythm: @@ -1106,7 +1119,7 @@ { if (mAdd) { - sval = pKeyOn->mVelocity + sval; + sval = pKeyOn->GetVelocity() + sval; } if (sval > 127) { @@ -1118,7 +1131,7 @@ } tKeyOn* pKeyOnCopy = (tKeyOn *)pKeyOn->Copy(); pTrack->Kill(pKeyOn); - pKeyOnCopy->mVelocity = sval; + pKeyOnCopy->SetVelocity(sval); pTrack->Put(pKeyOnCopy); } break; @@ -1127,7 +1140,7 @@ { if (mAdd) { - sval = pKeyOn->mKey + sval; + sval = pKeyOn->GetKey() + sval; } if (sval > 127) { @@ -1139,7 +1152,7 @@ } tKeyOn* pKeyOnCopy = (tKeyOn *)pKeyOn->Copy(); pTrack->Kill(pKeyOn); - pKeyOnCopy->mKey = sval; + pKeyOnCopy->SetKey(sval); pTrack->Put(pKeyOnCopy); } break; @@ -1148,7 +1161,7 @@ { if (mAdd) { - sval = pKeyOn->mLength + sval; + sval = pKeyOn->GetEventLength() + sval; } if (sval < 1) { @@ -1156,7 +1169,7 @@ } tKeyOn* pKeyOnCopy = (tKeyOn *)pKeyOn->Copy(); pTrack->Kill(pKeyOn); - pKeyOnCopy->mLength = sval; + pKeyOnCopy->SetLength(sval); pTrack->Put(pKeyOnCopy); } break; Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/ControlEdit.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -528,7 +528,7 @@ int tVelocEdit::GetValue(JZEvent* pEvent) { - return pEvent->IsKeyOn()->mVelocity; + return pEvent->IsKeyOn()->GetVelocity(); } void tVelocEdit::OnApply() @@ -568,7 +568,7 @@ tKeyOn* pKeyOnCopy = pKeyOn->Copy()->IsKeyOn(); int i = Clock2i(pKeyOnCopy->GetClock()); - pKeyOnCopy->mVelocity = array[i]; + pKeyOnCopy->SetVelocity(array[i]); track->Kill(pKeyOn); track->Put(pKeyOnCopy); } @@ -665,7 +665,7 @@ to_clk = to_clock; } tKeyPressure *k; - tKeyOn *keyon; + tKeyOn* pKeyOn; if (!ctrlmode) { @@ -699,13 +699,13 @@ !mpPianoWindow->mpSnapSel->IsSelected() || mpPianoWindow->GetFilter()->IsSelected(pEvent)) { - keyon = pEvent->IsKeyOn(); - if (keyon) + pKeyOn = pEvent->IsKeyOn(); + if (pKeyOn) { - key_clk = keyon->GetClock() + 1; - key_end = keyon->GetClock() + keyon->mLength; - key_val = keyon->mKey; - key_cha = keyon->Channel; + key_clk = pKeyOn->GetClock() + 1; + key_end = pKeyOn->GetClock() + pKeyOn->GetEventLength(); + key_val = pKeyOn->GetKey(); + key_cha = pKeyOn->Channel; } if (key_val>0) { Modified: trunk/jazz/src/Dialogs/KeyOnDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/KeyOnDialog.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Dialogs/KeyOnDialog.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -178,15 +178,15 @@ bool JZKeyOnDialog::TransferDataToWindow() { string KeyString; - KeyToString(mpEvent->mKey, KeyString); + KeyToString(mpEvent->GetKey(), KeyString); mpPitchEdit->ChangeValue(KeyString.c_str()); ostringstream Oss; - Oss << (int)mpEvent->mVelocity; + Oss << (int)mpEvent->GetVelocity(); mpVelocityValue->SetLabel(Oss.str().c_str()); - mpVelocityKnob->SetValue(mpEvent->mVelocity); + mpVelocityKnob->SetValue(mpEvent->GetVelocity()); Oss.str(""); Oss << (int)mpEvent->GetOffVelocity(); @@ -195,7 +195,7 @@ mpOffVelocityKnob->SetValue(mpEvent->GetOffVelocity()); wxString LengthString; - LengthString << mpEvent->mLength; + LengthString << mpEvent->GetEventLength(); mpLengthEdit->ChangeValue(LengthString); Oss.str(""); @@ -216,15 +216,17 @@ bool JZKeyOnDialog::TransferDataFromWindow() { wxString KeyString = mpPitchEdit->GetValue(); - mpEvent->mKey = StringToKey(KeyString.c_str()); + mpEvent->SetKey(StringToKey(KeyString.c_str())); - mpEvent->mVelocity = mpVelocityKnob->GetValue(); + mpEvent->SetVelocity(mpVelocityKnob->GetValue()); mpEvent->SetOffVelocity(mpOffVelocityKnob->GetValue()); wxString LengthString = mpLengthEdit->GetValue(); istringstream Iss(LengthString.c_str()); - Iss >> mpEvent->mLength; + unsigned short Length; + Iss >> Length; + mpEvent->SetLength(Length); mpEvent->Channel = mpChannelKnob->GetValue() - 1; Modified: trunk/jazz/src/Dialogs/KeyOnDialog.h =================================================================== --- trunk/jazz/src/Dialogs/KeyOnDialog.h 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Dialogs/KeyOnDialog.h 2008-05-19 05:56:49 UTC (rev 546) @@ -50,10 +50,6 @@ private: tKeyOn* mpEvent; -// int mPitch; -// int mVelocity; -// int mLength; -// int mOffVelocity; wxTextCtrl* mpPitchEdit; wxStaticText* mpVelocityValue; Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Dialogs.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -1367,7 +1367,9 @@ if (t->GetAudioMode()) { if (!gpMidiPlayer->IsPlaying()) - gpMidiPlayer->EditSample(e->IsKeyOn()->mKey); + { + gpMidiPlayer->EditSample(e->IsKeyOn()->GetKey()); + } break; } str = "Key On"; Modified: trunk/jazz/src/Events.h =================================================================== --- trunk/jazz/src/Events.h 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Events.h 2008-05-19 05:56:49 UTC (rev 546) @@ -550,28 +550,16 @@ { public: - unsigned char mKey; - unsigned char mVelocity; - - // Length is 0 if a corresponding tKeyOff exists. - unsigned short mLength; - - private: - - unsigned short mOffVelocity; - - public: - tKeyOn( int clk, int cha, unsigned char Key, unsigned char Velocity, - unsigned short len = 0) + unsigned short Length = 0) : tChannelEvent(clk, StatKeyOn, cha), mKey(Key), mVelocity(Velocity), - mLength(len), + mLength(Length), mOffVelocity(0) { } @@ -594,36 +582,61 @@ return new tKeyOn(*this); } - virtual unsigned short GetEventLength() const + virtual int GetValue() const { edb(); - return mLength; + return mKey; } - virtual int GetLength() const + virtual int GetPitch() const { edb(); - return mLength; + return mKey; } - virtual int GetValue() const + virtual void SetPitch(int p) { edb(); + mKey = p; + } + + unsigned char GetKey() const + { return mKey; } - virtual int GetPitch() const + void SetKey(unsigned char Key) { + mKey = Key; + } + + unsigned char GetVelocity() const + { + return mVelocity; + } + + void SetVelocity(unsigned char Velocity) + { + mVelocity = Velocity; + } + + virtual unsigned short GetEventLength() const + { edb(); - return mKey; + return mLength; } - virtual void SetPitch(int p) + virtual int GetLength() const { edb(); - mKey = p; + return mLength; } + void SetLength(unsigned short Length) + { + mLength = Length; + } + unsigned short GetOffVelocity() const { return mOffVelocity; @@ -643,6 +656,17 @@ { return wxBLACK_BRUSH; } + + private: + + unsigned char mKey; + + unsigned char mVelocity; + + // Length is 0 if a corresponding tKeyOff exists. + unsigned short mLength; + + unsigned short mOffVelocity; }; Modified: trunk/jazz/src/Harmony.cpp =================================================================== --- trunk/jazz/src/Harmony.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Harmony.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -711,7 +711,7 @@ tKeyOn* pKeyOn = buf.Events[i]->IsKeyOn(); if (pKeyOn) { - piano += pKeyOn->mKey; + piano += pKeyOn->GetKey(); } } } Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -167,18 +167,18 @@ int start = Step2Clock(i); int stop = Step2Clock(i+1); if ( - pKeyOn->GetClock() + pKeyOn->mLength >= start && + pKeyOn->GetClock() + pKeyOn->GetEventLength() >= start && pKeyOn->GetClock() < stop) { if (pKeyOn->GetClock() > start) { start = pKeyOn->GetClock(); } - if (pKeyOn->GetClock() + pKeyOn->mLength < stop) + if (pKeyOn->GetClock() + pKeyOn->GetEventLength() < stop) { - stop = pKeyOn->GetClock() + pKeyOn->mLength; + stop = pKeyOn->GetClock() + pKeyOn->GetEventLength(); } - count[i][pKeyOn->mKey % 12] += stop - start; + count[i][pKeyOn->GetKey() % 12] += stop - start; } } } @@ -191,7 +191,7 @@ int start = Step2Clock(i); int stop = Step2Clock(i+1); if ( - pKeyOn->GetClock() + pKeyOn->mLength >= start && + pKeyOn->GetClock() + pKeyOn->GetEventLength() >= start && pKeyOn->GetClock() < stop) { // key matches this step @@ -201,17 +201,17 @@ { fr = pKeyOn->GetClock(); } - if (pKeyOn->GetClock() + pKeyOn->mLength < to) + if (pKeyOn->GetClock() + pKeyOn->GetEventLength() < to) { - to = pKeyOn->GetClock() + pKeyOn->mLength; + to = pKeyOn->GetClock() + pKeyOn->GetEventLength(); } // transpose if most of key length belongs to this step // OR: it covers the whole step - if (to - fr >= pKeyOn->mLength / 2 || (fr == start && to == stop)) + if (to - fr >= pKeyOn->GetEventLength() / 2 || (fr == start && to == stop)) { tKeyOn* pKeyOnCopy = (tKeyOn *)pKeyOn->Copy(); - pKeyOnCopy->mKey += delta[i][pKeyOn->mKey % 12]; + pKeyOnCopy->SetKey(pKeyOnCopy->GetKey() + delta[i][pKeyOn->GetKey() % 12]); pTrack->Kill(pKeyOn); pTrack->Put(pKeyOnCopy); Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/PianoWindow.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -266,7 +266,7 @@ { Length = 1; } - Copy->mLength = Length; + Copy->SetLength(Length); Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1); return 0; @@ -277,16 +277,16 @@ int tKeyLengthDragger::ButtonUp(wxMouseEvent& Event) { // SN++ Key_Aftertouch - if (Copy->mLength < mpKeyOn->mLength) + if (Copy->GetEventLength() < mpKeyOn->GetEventLength()) { int key, channel; tEventIterator iter(Win->GetTrack()); tKeyPressure *a; - key = Copy->mKey; + key = Copy->GetKey(); channel = Copy->Channel; JZEvent* pEvent = iter.Range( - Copy->GetClock() + Copy->mLength, - Copy->GetClock() + mpKeyOn->mLength); + Copy->GetClock() + Copy->GetEventLength(), + Copy->GetClock() + mpKeyOn->GetEventLength()); while (pEvent) { a = pEvent->IsKeyPressure(); @@ -421,7 +421,7 @@ JZPianoWindow* pPianoWindow, JZRectangle* pRectangle, tKeyOn* pKeyOn) - : tMouseCounter(pPianoWindow, pRectangle, pKeyOn->mVelocity, 1, 127) + : tMouseCounter(pPianoWindow, pRectangle, pKeyOn->GetVelocity(), 1, 127) { Win = pPianoWindow; mpKeyOn = pKeyOn; @@ -447,7 +447,7 @@ if (tMouseCounter::Event(Event)) { tKeyOn* pKeyOnCopy = (tKeyOn *)mpKeyOn->Copy(); - pKeyOnCopy->mVelocity = Value; + pKeyOnCopy->SetVelocity(Value); Win->ApplyToTrack(mpKeyOn, pKeyOnCopy); @@ -1376,7 +1376,7 @@ // show velocity as colors if (force_color != 0 && mUseColors && pEvent->IsKeyOn()) { - int vel = pEvent->IsKeyOn()->mVelocity; + int vel = pEvent->IsKeyOn()->GetVelocity(); // Next line is "Patrick Approved." Dc.SetBrush(mpColorBrush[ vel * NUM_COLORS / 128 ]); @@ -1458,7 +1458,7 @@ // show velocity as colors if (!force_color && mUseColors && pEvent->IsKeyOn()) { - int vel = pEvent->IsKeyOn()->mVelocity; + int vel = pEvent->IsKeyOn()->GetVelocity(); Dc.SetBrush(mpColorBrush[ vel * NUM_COLORS / 128 ]); } else @@ -2410,13 +2410,15 @@ { return; } - if (pKeyOn->mLength < 2) + if (pKeyOn->GetEventLength() < 2) { return; } - key = pKeyOn->mKey; + key = pKeyOn->GetKey(); channel = pKeyOn->Channel; - pEvent = iter.Range(pKeyOn->GetClock() + 1, pKeyOn->GetClock() + pKeyOn->mLength); + pEvent = iter.Range( + pKeyOn->GetClock() + 1, + pKeyOn->GetClock() + pKeyOn->GetEventLength()); while (pEvent) { a = pEvent->IsKeyPressure(); @@ -2444,15 +2446,15 @@ return; } channel = pKeyOn->Channel; - if (pKeyOn->mLength < 2) + if (pKeyOn->GetEventLength() < 2) { return; } - key = pKeyOn->mKey; + key = pKeyOn->GetKey(); pEvent = iter.Range( pKeyOn->GetClock() + 1, - pKeyOn->GetClock() + pKeyOn->mLength); + pKeyOn->GetClock() + pKeyOn->GetEventLength()); while (pEvent) { @@ -2951,16 +2953,16 @@ kill_keys_aftertouch(pTrack, pEvent); if (pTrack->GetAudioMode()) { - gpMidiPlayer->ListenAudio(pKeyOn->mKey, 0); + gpMidiPlayer->ListenAudio(pKeyOn->GetKey(), 0); } else { mListen.KeyOn( pTrack, - pKeyOn->mKey, + pKeyOn->GetKey(), pKeyOn->Channel, - pKeyOn->mVelocity, - pKeyOn->mLength); + pKeyOn->GetVelocity(), + pKeyOn->GetEventLength()); } } @@ -3045,16 +3047,16 @@ { if (pTrack->GetAudioMode()) { - gpMidiPlayer->ListenAudio(pKeyOn->mKey, 0); + gpMidiPlayer->ListenAudio(pKeyOn->GetKey(), 0); } else { mListen.KeyOn( pTrack, - pKeyOn->mKey, + pKeyOn->GetKey(), pKeyOn->Channel, - pKeyOn->mVelocity, - pKeyOn->mLength); + pKeyOn->GetVelocity(), + pKeyOn->GetEventLength()); } } wxClientDC Dc(this); Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Player.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -520,10 +520,10 @@ tKeyOn* pKeyOn = pEvent->IsKeyOn(); if (pKeyOn) { - if (pKeyOn->GetClock() + pKeyOn->mLength >= Clock - 100) + if (pKeyOn->GetClock() + pKeyOn->GetEventLength() >= Clock - 100) { off.Channel = pKeyOn->Channel; - off.Key = pKeyOn->mKey; + off.Key = pKeyOn->GetKey(); OutNow(&off); } } @@ -1631,8 +1631,8 @@ SEQ_START_NOTE( mididev, pKeyOn->Channel, - pKeyOn->mKey, - pKeyOn->mVelocity); + pKeyOn->GetKey(), + pKeyOn->GetVelocity()); if (now) seqbuf_flush_last_event(); } break; Modified: trunk/jazz/src/Rhythm.cpp =================================================================== --- trunk/jazz/src/Rhythm.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Rhythm.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -352,10 +352,10 @@ tEventArray &src = gpTrackWindow->GetPianoWindow()->PasteBuffer; for (int ii = 0; ii < src.nEvents; ii++) { - tKeyOn *on = src.Events[ii]->IsKeyOn(); - if (on) + tKeyOn* pKeyOn = src.Events[ii]->IsKeyOn(); + if (pKeyOn) { - tKeyOn *k = new tKeyOn(clock, chan, on->Key, vel, len - clocks_per_step/2); + tKeyOn *k = new tKeyOn(clock, chan, pKeyOn->Key, vel, len - clocks_per_step / 2); track->Put(k); } } @@ -938,16 +938,16 @@ for (int ii = 0; ii < events.nEvents; ii++) { - tKeyOn *on = events.Events[ii]->IsKeyOn(); - if (on) + tKeyOn* pKeyOn = events.Events[ii]->IsKeyOn(); + if (pKeyOn) { - pRhythm->keys[pRhythm->n_keys++] = on->mKey; + pRhythm->keys[pRhythm->n_keys++] = pKeyOn->GetKey(); if (pRhythm->n_keys > 1) { Oss << ", "; } string KeyString; - KeyToString(on->mKey, KeyString); + KeyToString(pKeyOn->GetKey(), KeyString); Oss << KeyString; if (pRhythm->n_keys >= MAX_KEYS) { Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Song.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -464,7 +464,7 @@ d->SetClock(d->GetClock() + c->GetClock() + loopOffset); if (d->IsKeyOn()) { - d->IsKeyOn()->mKey += c->transpose; + d->IsKeyOn()->SetKey(d->IsKeyOn()->GetKey() + c->transpose); } if (d->IsPlayTrack()) { @@ -571,7 +571,7 @@ tKeyOn* pKeyOn = pEvent->IsKeyOn(); if (pKeyOn) { - pKeyOn->mLength = (int)(f * pKeyOn->mLength + 0.5); + pKeyOn->SetLength((int)(f * pKeyOn->GetEventLength() + 0.5)); } } } Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/Track.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -1155,20 +1155,24 @@ int n = nEvents; for (int i = 0; i < n; i++) { - tKeyOn *on; - if ((on = Events[i]->IsKeyOn()) != 0 && on->mLength != 0) + tKeyOn* pKeyOn; + if ((pKeyOn = Events[i]->IsKeyOn()) != 0 && pKeyOn->GetEventLength() != 0) { -// JZEvent *of = new tKeyOff(on->GetClock() + on->mLength, on->Channel, on->Key); +// JZEvent* pKeyOff = new tKeyOff( +// pKeyOn->GetClock() + pKeyOn->GetEventLength(), +// pKeyOn->Channel, +// pKeyOn->Key); + // SN++ added off veloc - JZEvent *of = new tKeyOff( - on->GetClock() + on->mLength, - on->Channel, - on->mKey, - on->GetOffVelocity()); + JZEvent* pKeyOff = new tKeyOff( + pKeyOn->GetClock() + pKeyOn->GetEventLength(), + pKeyOn->Channel, + pKeyOn->GetKey(), + pKeyOn->GetOffVelocity()); - on->mLength = 0; - of->SetDevice(on->GetDevice()); - Put(of); + pKeyOn->SetLength(0); + pKeyOff->SetDevice(pKeyOn->GetDevice()); + Put(pKeyOff); } } Sort(); @@ -1182,21 +1186,25 @@ int i; for (i = 1; i < nEvents; i++) { - tKeyOff *of; - if ((of = Events[i]->IsKeyOff()) != 0) + tKeyOff* pKeyOff; + if ((pKeyOff = Events[i]->IsKeyOff()) != 0) { JZEvent **e = &Events[i - 1]; while (e >= Events) { - tKeyOn *on = (*e)->IsKeyOn(); - if (on && on->Key == of->Key && on->Channel == of->Channel && on->Length == 0) + tKeyOn* pKeyOn = (*e)->IsKeyOn(); + if ( + pKeyOn && + pKeyOn->Key == pKeyOff->Key && + pKeyOn->Channel == pKeyOff->Channel && + pKeyOn->Length == 0) { - on->Length = of->GetClock() - on->GetClock(); - if (on->Length <= 0L) + pKeyOn->Length = pKeyOff->GetClock() - pKeyOn->GetClock(); + if (pKeyOn->Length <= 0L) { - on->Length = 1; + pKeyOn->Length = 1; } - of->Kill(); + pKeyOff->Kill(); break; } --e; @@ -1225,25 +1233,25 @@ int i; for (i = 0; i < nEvents; i++) { - tKeyOn* on; - if ((on = Events[i]->IsKeyOn()) != 0 && on->mLength == 0) + tKeyOn* pKeyOn; + if ((pKeyOn = Events[i]->IsKeyOn()) != 0 && pKeyOn->GetEventLength() == 0) { int j; for (j = i + 1; j < nEvents; j++) { - tKeyOff *of = Events[j]->IsKeyOff(); + tKeyOff* pKeyOff = Events[j]->IsKeyOff(); if ( - of && - !of->IsKilled() && - on->mKey == of->Key && - on->Channel == of->Channel) + pKeyOff && + !pKeyOff->IsKilled() && + pKeyOn->GetKey() == pKeyOff->Key && + pKeyOn->Channel == pKeyOff->Channel) { - on->mLength = of->GetClock() - on->GetClock(); - if (on->mLength <= 0L) + pKeyOn->SetLength(pKeyOff->GetClock() - pKeyOn->GetClock()); + if (pKeyOn->GetEventLength() <= 0) { - on->mLength = 1; + pKeyOn->SetLength(1); } - of->Kill(); + pKeyOff->Kill(); break; } } @@ -1254,15 +1262,15 @@ // and kill all remaining KeyOff's for (i = 0; i < nEvents; i++) { - tKeyOn* on = Events[i]->IsKeyOn(); - if (on && on->mLength <= 0) + tKeyOn* pKeyOn = Events[i]->IsKeyOn(); + if (pKeyOn && pKeyOn->GetEventLength() <= 0) { - on->Kill(); + pKeyOn->Kill(); } - tKeyOff *of = Events[i]->IsKeyOff(); - if (of) + tKeyOff* pKeyOff = Events[i]->IsKeyOff(); + if (pKeyOff) { - of->Kill(); + pKeyOff->Kill(); } } Cleanup(0); Modified: trunk/jazz/src/mswin/WindowsPlayer.cpp =================================================================== --- trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-05-19 03:57:57 UTC (rev 545) +++ trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-05-19 05:56:49 UTC (rev 546) @@ -267,18 +267,18 @@ { case StatKeyOn: { - tKeyOn *k = pEvent->IsKeyOn(); - u.c[0] = 0x90 | k->Channel; - u.c[1] = k->mKey; - u.c[2] = k->mVelocity; + tKeyOn* pKeyOn = pEvent->IsKeyOn(); + u.c[0] = 0x90 | pKeyOn->Channel; + u.c[1] = pKeyOn->GetKey(); + u.c[2] = pKeyOn->GetVelocity(); } break; case StatKeyOff: { - tKeyOff *k = pEvent->IsKeyOff(); - u.c[0] = 0x80 | k->Channel; - u.c[1] = k->Key; + tKeyOff* pKeyOff = pEvent->IsKeyOff(); + u.c[0] = 0x80 | pKeyOff->Channel; + u.c[1] = pKeyOff->Key; u.c[2] = 0; } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |