|
From: <pst...@us...> - 2008-05-21 01:47:08
|
Revision: 549
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=549&view=rev
Author: pstieber
Date: 2008-05-20 18:47:00 -0700 (Tue, 20 May 2008)
Log Message:
-----------
Encapsulated the channel member.
Modified Paths:
--------------
trunk/jazz/src/AsciiMidiFile.cpp
trunk/jazz/src/Command.cpp
trunk/jazz/src/ControlEdit.cpp
trunk/jazz/src/Dialogs/KeyOnDialog.cpp
trunk/jazz/src/Dialogs.cpp
trunk/jazz/src/Events.cpp
trunk/jazz/src/Events.h
trunk/jazz/src/PianoWindow.cpp
trunk/jazz/src/Player.cpp
trunk/jazz/src/StandardFile.cpp
trunk/jazz/src/Track.cpp
trunk/jazz/src/mswin/WindowsPlayer.cpp
Modified: trunk/jazz/src/AsciiMidiFile.cpp
===================================================================
--- trunk/jazz/src/AsciiMidiFile.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/AsciiMidiFile.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -162,12 +162,12 @@
//-----------------------------------------------------------------------------
int JZAsciiWrite::Write(JZEvent* pEvent, unsigned char* pData, int Length)
{
- tChannelEvent *ce;
+ tChannelEvent* pChannelEvent;
fprintf(mpFd, "%6d %02x ", pEvent->GetClock(), pEvent->GetStat());
- if ((ce = pEvent->IsChannelEvent()) != 0)
+ if ((pChannelEvent = pEvent->IsChannelEvent()) != 0)
{
- fprintf(mpFd, "%2d ", ce->Channel);
+ fprintf(mpFd, "%2d ", pChannelEvent->GetChannel());
}
else
{
Modified: trunk/jazz/src/Command.cpp
===================================================================
--- trunk/jazz/src/Command.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/Command.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -443,7 +443,7 @@
if ((c = pEvent->IsChannelEvent()) != 0)
{
c = (tChannelEvent *)pEvent->Copy();
- c->Channel = NewChannel;
+ c->SetChannel(NewChannel);
pTrack->Kill(pEvent);
pTrack->Put(c);
}
@@ -620,7 +620,7 @@
{
startclock = pEvent->IsKeyOn()->GetClock();
startvelocity = pEvent->IsKeyOn()->GetVelocity();
- channel = pEvent->IsKeyOn()->Channel;
+ channel = pEvent->IsKeyOn()->GetChannel();
startkey = pEvent->IsKeyOn()->GetKey();
previouspitch = pEvent->GetPitch();
}
@@ -732,7 +732,7 @@
else if (shortenOverlaps)
{
// Shorten length of overlapping notes.
- tKeyOn* pPreviousKeyOn = prev_note[pKeyOn->Channel][pKeyOn->GetKey()];
+ tKeyOn* pPreviousKeyOn = prev_note[pKeyOn->GetChannel()][pKeyOn->GetKey()];
if (
pPreviousKeyOn &&
pPreviousKeyOn->GetClock() + pPreviousKeyOn->GetEventLength() >=
@@ -745,7 +745,7 @@
pTrack->Kill(pPreviousKeyOn);
}
}
- prev_note[pKeyOn->Channel][pKeyOn->GetKey()] = pKeyOn;
+ prev_note[pKeyOn->GetChannel()][pKeyOn->GetKey()] = pKeyOn;
}
}
}
Modified: trunk/jazz/src/ControlEdit.cpp
===================================================================
--- trunk/jazz/src/ControlEdit.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/ControlEdit.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -705,7 +705,7 @@
key_clk = pKeyOn->GetClock() + 1;
key_end = pKeyOn->GetClock() + pKeyOn->GetEventLength();
key_val = pKeyOn->GetKey();
- key_cha = pKeyOn->Channel;
+ key_cha = pKeyOn->GetChannel();
}
if (key_val>0)
{
Modified: trunk/jazz/src/Dialogs/KeyOnDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/KeyOnDialog.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/Dialogs/KeyOnDialog.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -199,10 +199,10 @@
mpLengthEdit->ChangeValue(LengthString);
Oss.str("");
- Oss << (int)mpEvent->Channel + 1;
+ Oss << (int)mpEvent->GetChannel() + 1;
mpChannelValue->SetLabel(Oss.str().c_str());
- mpChannelKnob->SetValue(mpEvent->Channel + 1);
+ mpChannelKnob->SetValue(mpEvent->GetChannel() + 1);
string ClockString;
gpProject->ClockToString(mpEvent->GetClock(), ClockString);
@@ -228,7 +228,7 @@
Iss >> Length;
mpEvent->SetLength(Length);
- mpEvent->Channel = mpChannelKnob->GetValue() - 1;
+ mpEvent->SetChannel(mpChannelKnob->GetValue() - 1);
wxString ClockString = mpClockEdit->GetValue();
int Clock = gpProject->StringToClock(ClockString.c_str());
Modified: trunk/jazz/src/Dialogs.cpp
===================================================================
--- trunk/jazz/src/Dialogs.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/Dialogs.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -763,10 +763,10 @@
int Channel;
- tChEventDlg(tChannelEvent *e, JZPianoWindow* w, JZTrack *t)
- : tEventDlg(e, w, t)
+ tChEventDlg(tChannelEvent* pChannelEvent, JZPianoWindow* w, JZTrack *t)
+ : tEventDlg(pChannelEvent, w, t)
{
- Channel = e->Channel + 1; // 1..16
+ Channel = pChannelEvent->GetChannel() + 1; // 1..16
}
void AddProperties();
bool OnClose();
@@ -785,7 +785,7 @@
bool tChEventDlg::OnClose()
{
- ((tChannelEvent *)Copy)->Channel = Channel - 1;
+ ((tChannelEvent *)Copy)->SetChannel(Channel - 1);
tEventDlg::OnClose();
return false;
}
Modified: trunk/jazz/src/Events.cpp
===================================================================
--- trunk/jazz/src/Events.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/Events.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -172,7 +172,7 @@
case StatPitch:
nBytes = 0;
- Buffer[nBytes++] = Stat | ((tChannelEvent *)pEvent)->Channel;
+ Buffer[nBytes++] = Stat | ((tChannelEvent *)pEvent)->GetChannel();
while(Length--)
{
Buffer[nBytes++] = *pData++;
Modified: trunk/jazz/src/Events.h
===================================================================
--- trunk/jazz/src/Events.h 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/Events.h 2008-05-21 01:47:00 UTC (rev 549)
@@ -313,6 +313,10 @@
class tPlayTrack;
class tEndOfTrack;
+//*****************************************************************************
+// Description:
+// This is the MIDI event base class declaration.
+//*****************************************************************************
class JZEvent
{
public:
@@ -521,12 +525,10 @@
{
public:
- unsigned char Channel;
-
- tChannelEvent(int clk, unsigned char sta, int cha)
+ tChannelEvent(int clk, unsigned char sta, int Channel)
: JZEvent(clk, sta)
{
- Channel = cha;
+ mChannel = Channel;
}
virtual tChannelEvent* IsChannelEvent()
@@ -540,6 +542,20 @@
edb();
return new tChannelEvent(*this);
}
+
+ unsigned char GetChannel() const
+ {
+ return mChannel;
+ }
+
+ void SetChannel(unsigned char Channel)
+ {
+ mChannel = Channel;
+ }
+
+ private:
+
+ unsigned char mChannel;
};
Modified: trunk/jazz/src/PianoWindow.cpp
===================================================================
--- trunk/jazz/src/PianoWindow.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/PianoWindow.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -283,7 +283,7 @@
tEventIterator iter(Win->GetTrack());
tKeyPressure *a;
key = Copy->GetKey();
- channel = Copy->Channel;
+ channel = Copy->GetChannel();
JZEvent* pEvent = iter.Range(
Copy->GetClock() + Copy->GetEventLength(),
Copy->GetClock() + mpKeyOn->GetEventLength());
@@ -292,7 +292,7 @@
a = pEvent->IsKeyPressure();
if (a)
{
- if (a->Key == key && a->Channel == channel)
+ if (a->Key == key && a->GetChannel() == channel)
{
Win->KillTrackEvent(pEvent);
}
@@ -2415,7 +2415,7 @@
return;
}
key = pKeyOn->GetKey();
- channel = pKeyOn->Channel;
+ channel = pKeyOn->GetChannel();
pEvent = iter.Range(
pKeyOn->GetClock() + 1,
pKeyOn->GetClock() + pKeyOn->GetEventLength());
@@ -2424,7 +2424,7 @@
a = pEvent->IsKeyPressure();
if (a)
{
- if (a->Key == key && a->Channel == channel)
+ if (a->Key == key && a->GetChannel() == channel)
{
pTrack->Kill(pEvent);
}
@@ -2445,7 +2445,7 @@
{
return;
}
- channel = pKeyOn->Channel;
+ channel = pKeyOn->GetChannel();
if (pKeyOn->GetEventLength() < 2)
{
return;
@@ -2461,7 +2461,7 @@
a = pEvent->IsKeyPressure();
if (a)
{
- if (a->Key == key && a->Channel == channel)
+ if (a->Key == key && a->GetChannel() == channel)
{
mPasteBuffer.Put(pEvent->Copy());
}
@@ -2960,7 +2960,7 @@
mListen.KeyOn(
pTrack,
pKeyOn->GetKey(),
- pKeyOn->Channel,
+ pKeyOn->GetChannel(),
pKeyOn->GetVelocity(),
pKeyOn->GetEventLength());
}
@@ -3041,7 +3041,9 @@
c->SetPitch(c->GetPitch() + DeltaPitch);
c->SetClock(c->GetClock() + DeltaClock);
if (pTrack->ForceChannel && c->IsChannelEvent())
- c->IsChannelEvent()->Channel = pTrack->Channel - 1;
+ {
+ c->IsChannelEvent()->SetChannel(pTrack->Channel - 1);
+ }
tKeyOn* pKeyOn = c->IsKeyOn();
if (pKeyOn)
{
@@ -3054,7 +3056,7 @@
mListen.KeyOn(
pTrack,
pKeyOn->GetKey(),
- pKeyOn->Channel,
+ pKeyOn->GetChannel(),
pKeyOn->GetVelocity(),
pKeyOn->GetEventLength());
}
Modified: trunk/jazz/src/Player.cpp
===================================================================
--- trunk/jazz/src/Player.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/Player.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -522,7 +522,7 @@
{
if (pKeyOn->GetClock() + pKeyOn->GetEventLength() >= Clock - 100)
{
- off.Channel = pKeyOn->Channel;
+ off.SetChannel(pKeyOn->GetChannel());
off.Key = pKeyOn->GetKey();
OutNow(&off);
}
@@ -622,15 +622,15 @@
{
for (int c = 0; c < 16; c++)
{
- NoteOff.Channel = c;
+ NoteOff.SetChannel(c);
NoteOff.SetDevice(dev);
OutNow(&NoteOff);
- Pitch.Channel = c;
+ Pitch.SetChannel(c);
Pitch.SetDevice(dev);
OutNow(&Pitch);
- CtrlRes.Channel = c;
+ CtrlRes.SetChannel(c);
CtrlRes.SetDevice(dev);
OutNow(&CtrlRes);
}
Modified: trunk/jazz/src/StandardFile.cpp
===================================================================
--- trunk/jazz/src/StandardFile.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/StandardFile.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -249,7 +249,7 @@
// SN-- only if KeyOff veloc is zero
if (!pEvent->IsKeyOff()->OffVeloc)
{
- Stat = StatKeyOn | pEvent->IsChannelEvent()->Channel;
+ Stat = StatKeyOn | pEvent->IsChannelEvent()->GetChannel();
if (Stat != RunningStatus)
{
RunningStatus = Stat;
@@ -260,7 +260,7 @@
}
else
{
- Stat = StatKeyOff | pEvent->IsChannelEvent()->Channel;
+ Stat = StatKeyOff | pEvent->IsChannelEvent()->GetChannel();
if (Stat != RunningStatus)
{
RunningStatus = Stat;
@@ -281,7 +281,7 @@
// SN++
case StatChnPressure:
- Stat = pEvent->GetStat() | pEvent->IsChannelEvent()->Channel;
+ Stat = pEvent->GetStat() | pEvent->IsChannelEvent()->GetChannel();
if (Stat != RunningStatus)
{
RunningStatus = Stat;
Modified: trunk/jazz/src/Track.cpp
===================================================================
--- trunk/jazz/src/Track.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/Track.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -40,17 +40,17 @@
return mMsb.Write(Io) + mLsb.Write(Io) + mDataMsb.Write(Io);
}
-void tParam::SetCha(unsigned char cha)
+void tParam::SetCha(unsigned char Channel)
{
- mMsb.Channel = cha;
- mLsb.Channel = cha;
- mDataMsb.Channel = cha;
+ mMsb.SetChannel(Channel);
+ mLsb.SetChannel(Channel);
+ mDataMsb.SetChannel(Channel);
#ifdef OBSOLETE
- mResetMb.Channel = cha; //???? JAVE commented out this while porting
+ mResetMb.SetChannel(Channel); //???? JAVE commented out this while porting
#endif // OBSOLETE
- mResetLsb.Channel = cha;
+ mResetLsb.SetChannel(Channel);
}
/*
@@ -1166,7 +1166,7 @@
// SN++ added off veloc
JZEvent* pKeyOff = new tKeyOff(
pKeyOn->GetClock() + pKeyOn->GetEventLength(),
- pKeyOn->Channel,
+ pKeyOn->GetChannel(),
pKeyOn->GetKey(),
pKeyOn->GetOffVelocity());
@@ -1244,7 +1244,7 @@
pKeyOff &&
!pKeyOff->IsKilled() &&
pKeyOn->GetKey() == pKeyOff->Key &&
- pKeyOn->Channel == pKeyOff->Channel)
+ pKeyOn->GetChannel() == pKeyOff->GetChannel())
{
pKeyOn->SetLength(pKeyOff->GetClock() - pKeyOn->GetClock());
if (pKeyOn->GetEventLength() <= 0)
@@ -1476,7 +1476,7 @@
case 0x06:
Data = e->IsControl()->mValue; // Rpn/Nrpn Data
SpecialEvent = 1;
- cha = e->IsControl()->Channel;
+ cha = e->IsControl()->GetChannel();
switch (Msb)
{
case 0x01: // Nrpn
@@ -1630,7 +1630,7 @@
NeedToDelete = false;
if (!Channel && e->IsChannelEvent())
{
- Channel = e->IsChannelEvent()->Channel + 1;
+ Channel = e->IsChannelEvent()->GetChannel() + 1;
}
}
if (e->IsEndOfTrack())
@@ -1767,7 +1767,7 @@
if ((c = e->IsChannelEvent()) != 0)
{
c = (tChannelEvent *)e->Copy();
- c->Channel = trk->Channel - 1;
+ c->SetChannel(trk->Channel - 1);
trk->Kill(e);
trk->Put(c);
}
@@ -2002,10 +2002,10 @@
JZEvent *c = e->Copy();
if (ForceChannel)
{
- tChannelEvent *k = c->IsChannelEvent();
- if (k)
+ tChannelEvent* pChannelEvent = c->IsChannelEvent();
+ if (pChannelEvent)
{
- k->Channel = Channel - 1;
+ pChannelEvent->SetChannel(Channel - 1);
}
}
Put(c);
Modified: trunk/jazz/src/mswin/WindowsPlayer.cpp
===================================================================
--- trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-05-20 04:43:07 UTC (rev 548)
+++ trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-05-21 01:47:00 UTC (rev 549)
@@ -268,7 +268,7 @@
case StatKeyOn:
{
tKeyOn* pKeyOn = pEvent->IsKeyOn();
- u.c[0] = 0x90 | pKeyOn->Channel;
+ u.c[0] = 0x90 | pKeyOn->GetChannel();
u.c[1] = pKeyOn->GetKey();
u.c[2] = pKeyOn->GetVelocity();
}
@@ -277,7 +277,7 @@
case StatKeyOff:
{
tKeyOff* pKeyOff = pEvent->IsKeyOff();
- u.c[0] = 0x80 | pKeyOff->Channel;
+ u.c[0] = 0x80 | pKeyOff->GetChannel();
u.c[1] = pKeyOff->Key;
u.c[2] = 0;
}
@@ -286,7 +286,7 @@
case StatProgram:
{
tProgram *k = pEvent->IsProgram();
- u.c[0] = 0xC0 | k->Channel;
+ u.c[0] = 0xC0 | k->GetChannel();
u.c[1] = k->Program;
}
break;
@@ -294,7 +294,7 @@
case StatChnPressure:
{
tChnPressure *k = pEvent->IsChnPressure();
- u.c[0] = 0xC0 | k->Channel;
+ u.c[0] = 0xC0 | k->GetChannel();
u.c[1] = k->Value;
}
break;
@@ -302,7 +302,7 @@
case StatControl:
{
tControl* pControl = pEvent->IsControl();
- u.c[0] = 0xB0 | pControl->Channel;
+ u.c[0] = 0xB0 | pControl->GetChannel();
u.c[1] = pControl->mControl;
u.c[2] = pControl->mValue;
}
@@ -311,7 +311,7 @@
case StatKeyPressure:
{
tKeyPressure *k = pEvent->IsKeyPressure();
- u.c[0] = 0xA0 | k->Channel;
+ u.c[0] = 0xA0 | k->GetChannel();
u.c[1] = k->Key;
u.c[2] = k->Value;
}
@@ -321,7 +321,7 @@
{
tPitch *k = pEvent->IsPitch();
int v = k->Value + 8192;
- u.c[0] = 0xE0 | k->Channel;
+ u.c[0] = 0xE0 | k->GetChannel();
u.c[1] = (unsigned char)(v & 0x7F);
u.c[2] = (unsigned char)(v >> 7);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|