|
From: <pst...@us...> - 2008-05-24 22:00:00
|
Revision: 564
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=564&view=rev
Author: pstieber
Date: 2008-05-24 14:59:59 -0700 (Sat, 24 May 2008)
Log Message:
-----------
Encapsulated the members of tKeyPressure.
Modified Paths:
--------------
trunk/jazz/src/AlsaPlayer.cpp
trunk/jazz/src/Command.cpp
trunk/jazz/src/ControlEdit.cpp
trunk/jazz/src/Events.h
trunk/jazz/src/Filter.h
trunk/jazz/src/PianoWindow.cpp
trunk/jazz/src/Player.cpp
trunk/jazz/src/StandardFile.cpp
trunk/jazz/src/mswin/WindowsPlayer.cpp
Modified: trunk/jazz/src/AlsaPlayer.cpp
===================================================================
--- trunk/jazz/src/AlsaPlayer.cpp 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/AlsaPlayer.cpp 2008-05-24 21:59:59 UTC (rev 564)
@@ -443,11 +443,11 @@
case StatKeyPressure:
{
- tKeyPressure *k = pEvent->IsKeyPressure();
+ tKeyPressure* pKeyPressure = pEvent->IsKeyPressure();
set_event_header(&ev, pEvent->GetClock(), SND_SEQ_EVENT_KEYPRESS);
- ev.data.note.channel = k->GetChannel();
- ev.data.note.note = k->Key;
- ev.data.note.velocity = k->Value;
+ ev.data.note.channel = pKeyPressure->GetChannel();
+ ev.data.note.note = pKeyPressure->GetKey();
+ ev.data.note.velocity = pKeyPressure->GetPressureValue();
rc = write(&ev, now);
}
break;
Modified: trunk/jazz/src/Command.cpp
===================================================================
--- trunk/jazz/src/Command.cpp 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/Command.cpp 2008-05-24 21:59:59 UTC (rev 564)
@@ -408,22 +408,23 @@
pTrack->Kill(pEvent);
pTrack->Put(pKeyOn);
}
-// SN++ Aftertouch
- tKeyPressure *a;
+
+ // After touch.
if (pEvent->IsKeyPressure())
{
- a = (tKeyPressure *)pEvent->Copy();
+ tKeyPressure* pKeyPressure = (tKeyPressure *)pEvent->Copy();
if (FitIntoScale)
{
- a->Key += Notes;
- a->Key = Scale.FitInto(a->Key);
+ pKeyPressure->SetKey(pKeyPressure->GetKey() + Notes);
+ pKeyPressure->SetKey(Scale.FitInto(pKeyPressure->GetKey()));
}
else if (Notes)
- a->Key = Scale.Transpose(a->Key, Notes);
+ {
+ pKeyPressure->SetKey(Scale.Transpose(pKeyPressure->GetKey(), Notes));
+ }
pTrack->Kill(pEvent);
- pTrack->Put(a);
+ pTrack->Put(pKeyPressure);
}
-//
}
// ************************************************************************
Modified: trunk/jazz/src/ControlEdit.cpp
===================================================================
--- trunk/jazz/src/ControlEdit.cpp 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/ControlEdit.cpp 2008-05-24 21:59:59 UTC (rev 564)
@@ -631,9 +631,10 @@
int tPolyAfterEdit::GetValue(JZEvent* pEvent)
{
- if (pEvent->IsKeyPressure())
+ tKeyPressure* pKeyPressure = pEvent->IsKeyPressure();
+ if (pKeyPressure)
{
- return pEvent->IsKeyPressure()->Value;
+ return pKeyPressure->GetPressureValue();
}
return -1;
}
@@ -666,7 +667,6 @@
from_clk = from_clock;
to_clk = to_clock;
}
- tKeyPressure *k;
tKeyOn* pKeyOn;
if (!ctrlmode)
@@ -681,10 +681,10 @@
!mpPianoWindow->mpSnapSel->IsSelected() ||
mpPianoWindow->GetFilter()->IsSelected(pEvent))
{
- k = pEvent->IsKeyPressure();
- if (k)
+ tKeyPressure* pKeyPressure = pEvent->IsKeyPressure();
+ if (pKeyPressure)
{
- track->Kill(k);
+ track->Kill(pKeyPressure);
}
}
pEvent = iter.Next();
@@ -693,7 +693,7 @@
long key_end(-1), key_clk(-1);
int key_val = -1;
int key_cha(-1);
- JZEvent *after;
+ tKeyPressure* pKeyPressure;
pEvent = iter.Range(from_clk, to_clk);
while (pEvent)
{
@@ -720,8 +720,8 @@
// und der Wert groesser als 0 ist.
if (array[i] > 0 && array[i] != temp)
{
- after = new tKeyPressure(iclk, key_cha, key_val, array[i]);
- track->Put(after);
+ pKeyPressure = new tKeyPressure(iclk, key_cha, key_val, array[i]);
+ track->Put(pKeyPressure);
temp = array[i];
}
}
@@ -747,10 +747,12 @@
{
if (pEvent->IsKeyPressure())
{
- if (Clock2Val(pEvent->GetClock()) != pEvent->IsKeyPressure()->Value)
+ if (
+ Clock2Val(pEvent->GetClock()) !=
+ pEvent->IsKeyPressure()->GetPressureValue())
{
pKeyPressureCopy = pEvent->Copy()->IsKeyPressure();
- pKeyPressureCopy->Value = Clock2Val(pEvent->GetClock());
+ pKeyPressureCopy->SetPressureValue(Clock2Val(pEvent->GetClock()));
track->Kill(pEvent);
track->Put(pKeyPressureCopy);
}
Modified: trunk/jazz/src/Events.h
===================================================================
--- trunk/jazz/src/Events.h 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/Events.h 2008-05-24 21:59:59 UTC (rev 564)
@@ -1692,23 +1692,22 @@
class tKeyPressure: public tChannelEvent
{
public:
- short Value;
- short Key;
tKeyPressure(
int Clock,
unsigned short Channel,
- unsigned char key,
- unsigned char val)
- : tChannelEvent(Clock, StatKeyPressure, Channel)
+ unsigned char Key,
+ unsigned char Value)
+ : tChannelEvent(Clock, StatKeyPressure, Channel),
+ mKey(Key),
+ mValue(Value)
{
- Value = val;
- Key = key;
}
virtual int Write(JZWriteBase &io)
{
- edb(); return io.Write(this, Key, Value);
+ edb();
+ return io.Write(this, mKey, mValue);
}
virtual tKeyPressure* IsKeyPressure()
@@ -1726,20 +1725,45 @@
virtual int GetValue() const
{
edb();
- return Value;
+ return mValue;
}
virtual int GetPitch() const
{
edb();
- return Key;
+ return mKey;
}
- virtual void SetPitch(int p)
+ virtual void SetPitch(int Pitch)
{
edb();
- Key = p;
+ mKey = Pitch;
}
+
+ unsigned char GetKey() const
+ {
+ return mKey;
+ }
+
+ void SetKey(unsigned char Key)
+ {
+ mKey = Key;
+ }
+
+ short GetPressureValue() const
+ {
+ return mValue;
+ }
+
+ void SetPressureValue(short Value)
+ {
+ mValue = Value;
+ }
+
+ private:
+
+ short mKey;
+ short mValue;
};
//*****************************************************************************
Modified: trunk/jazz/src/Filter.h
===================================================================
--- trunk/jazz/src/Filter.h 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/Filter.h 2008-05-24 21:59:59 UTC (rev 564)
@@ -89,7 +89,7 @@
// SN++ Aftertouch gehoert eigendlich zu KeyOn Events.
if (pEvent->GetStat() == StatKeyPressure)
{
- int aval = pEvent->IsKeyPressure()->Key;
+ int aval = pEvent->IsKeyPressure()->GetKey();
return
FltEvents[i].Selected &&
FltEvents[i].FromValue <= aval &&
Modified: trunk/jazz/src/PianoWindow.cpp
===================================================================
--- trunk/jazz/src/PianoWindow.cpp 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/PianoWindow.cpp 2008-05-24 21:59:59 UTC (rev 564)
@@ -281,18 +281,23 @@
{
int key, channel;
tEventIterator iter(Win->GetTrack());
- tKeyPressure *a;
key = Copy->GetKey();
channel = Copy->GetChannel();
+
+ tKeyPressure* pKeyPressure;
+
JZEvent* pEvent = iter.Range(
Copy->GetClock() + Copy->GetEventLength(),
Copy->GetClock() + mpKeyOn->GetEventLength());
+
while (pEvent)
{
- a = pEvent->IsKeyPressure();
- if (a)
+ pKeyPressure = pEvent->IsKeyPressure();
+ if (pKeyPressure)
{
- if (a->Key == key && a->GetChannel() == channel)
+ if (
+ pKeyPressure->GetKey() == key &&
+ pKeyPressure->GetChannel() == channel)
{
Win->KillTrackEvent(pEvent);
}
@@ -2404,7 +2409,6 @@
{
int key,channel;
tEventIterator iter(pTrack);
- tKeyPressure *a;
tKeyOn* pKeyOn = pEvent->IsKeyOn();
if (!pKeyOn)
{
@@ -2416,15 +2420,19 @@
}
key = pKeyOn->GetKey();
channel = pKeyOn->GetChannel();
+
+ tKeyPressure* pKeyPressure;
pEvent = iter.Range(
pKeyOn->GetClock() + 1,
pKeyOn->GetClock() + pKeyOn->GetEventLength());
while (pEvent)
{
- a = pEvent->IsKeyPressure();
- if (a)
+ pKeyPressure = pEvent->IsKeyPressure();
+ if (pKeyPressure)
{
- if (a->Key == key && a->GetChannel() == channel)
+ if (
+ pKeyPressure->GetKey() == key &&
+ pKeyPressure->GetChannel() == channel)
{
pTrack->Kill(pEvent);
}
@@ -2439,7 +2447,6 @@
{
int key,channel;
tEventIterator iter(pTrack);
- tKeyPressure *a;
tKeyOn* pKeyOn = pEvent->IsKeyOn();
if (!pKeyOn)
{
@@ -2452,16 +2459,20 @@
}
key = pKeyOn->GetKey();
+ tKeyPressure* pKeyPressure;
+
pEvent = iter.Range(
pKeyOn->GetClock() + 1,
pKeyOn->GetClock() + pKeyOn->GetEventLength());
while (pEvent)
{
- a = pEvent->IsKeyPressure();
- if (a)
+ pKeyPressure = pEvent->IsKeyPressure();
+ if (pKeyPressure)
{
- if (a->Key == key && a->GetChannel() == channel)
+ if (
+ pKeyPressure->GetKey() == key &&
+ pKeyPressure->GetChannel() == channel)
{
mPasteBuffer.Put(pEvent->Copy());
}
Modified: trunk/jazz/src/Player.cpp
===================================================================
--- trunk/jazz/src/Player.cpp 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/Player.cpp 2008-05-24 21:59:59 UTC (rev 564)
@@ -1668,8 +1668,14 @@
// SN++ Aftertouch
case StatKeyPressure:
{
- tKeyPressure *k = pEvent->IsKeyPressure();
- SEQ_KEY_PRESSURE(mididev, k->GetChannel(), k->Key, k->Value);
+ tKeyPressure* pKeyPressure = pEvent->IsKeyPressure();
+
+ SEQ_KEY_PRESSURE(
+ mididev,
+ pKeyPressure->GetChannel(),
+ pKeyPressure->GetKey(),
+ pKeyPressure->GetPressureValue());
+
if (now)
{
seqbuf_flush_last_event();
Modified: trunk/jazz/src/StandardFile.cpp
===================================================================
--- trunk/jazz/src/StandardFile.cpp 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/StandardFile.cpp 2008-05-24 21:59:59 UTC (rev 564)
@@ -476,7 +476,6 @@
return pEvent;
case StatKeyPressure:
-// SN++ Aftertouch
pEvent = new tKeyPressure(Clock, Channel, cp[0], cp[1]);
cp += 2;
return pEvent;
Modified: trunk/jazz/src/mswin/WindowsPlayer.cpp
===================================================================
--- trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-05-24 19:10:41 UTC (rev 563)
+++ trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-05-24 21:59:59 UTC (rev 564)
@@ -310,10 +310,10 @@
case StatKeyPressure:
{
- tKeyPressure *k = pEvent->IsKeyPressure();
- u.c[0] = 0xA0 | k->GetChannel();
- u.c[1] = k->Key;
- u.c[2] = k->Value;
+ tKeyPressure* pKeyPressure = pEvent->IsKeyPressure();
+ u.c[0] = 0xA0 | pKeyPressure->GetChannel();
+ u.c[1] = pKeyPressure->GetKey();
+ u.c[2] = pKeyPressure->GetPressureValue();
}
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|