You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
(58) |
Apr
(100) |
May
(92) |
Jun
(12) |
Jul
|
Aug
|
Sep
(5) |
Oct
(1) |
Nov
(26) |
Dec
(29) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(31) |
Feb
(20) |
Mar
(1) |
Apr
|
May
(5) |
Jun
(10) |
Jul
|
Aug
(2) |
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
| 2010 |
Jan
(1) |
Feb
(1) |
Mar
|
Apr
(36) |
May
(10) |
Jun
|
Jul
(38) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
(6) |
Mar
(8) |
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(56) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(13) |
Dec
(2) |
| 2013 |
Jan
(30) |
Feb
|
Mar
(43) |
Apr
(28) |
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
(10) |
Nov
(2) |
Dec
|
| 2014 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <pst...@us...> - 2008-04-21 05:29:19
|
Revision: 471
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=471&view=rev
Author: pstieber
Date: 2008-04-20 22:29:17 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
Started adding a track settings dialog.
Added Paths:
-----------
trunk/jazz/src/Dialogs/TrackDialog.cpp
trunk/jazz/src/Dialogs/TrackDialog.h
Added: trunk/jazz/src/Dialogs/TrackDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/TrackDialog.cpp (rev 0)
+++ trunk/jazz/src/Dialogs/TrackDialog.cpp 2008-04-21 05:29:17 UTC (rev 471)
@@ -0,0 +1,125 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2008 Peter J. Stieber, all rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//*****************************************************************************
+
+#include "WxWidgets.h"
+
+#include "TrackDialog.h"
+#include "../Track.h"
+#include "../Configuration.h"
+#include "../Globals.h"
+
+using namespace std;
+
+//*****************************************************************************
+//*****************************************************************************
+JZTrackDialog::JZTrackDialog(JZTrack& Track, wxWindow* pParent)
+ : wxDialog(pParent, wxID_ANY, wxString("Track Settings")),
+ mTrack(Track),
+ mpTrackNameEdit(0),
+ mpPatchListBox(0)
+{
+ mpTrackNameEdit = new wxTextCtrl(this, wxID_ANY);
+
+ mpPatchListBox = new wxListBox(this, wxID_ANY);
+ if (Track.IsDrumTrack())
+ {
+ const vector<pair<string, int> >& DrumNames = gpConfig->GetDrumNames();
+ for (
+ vector<pair<string, int> >::const_iterator iDrumName =
+ DrumNames.begin();
+ iDrumName != DrumNames.end();
+ ++iDrumName)
+ {
+ const string& DrumName = iDrumName->first;
+
+ if (!DrumName.empty())
+ {
+ mpPatchListBox->Append(DrumName.c_str());
+ }
+ }
+ }
+ else
+ {
+ const vector<pair<string, int> >& VoiceNames = gpConfig->GetVoiceNames();
+ for (
+ vector<pair<string, int> >::const_iterator iVoiceName =
+ VoiceNames.begin();
+ iVoiceName != VoiceNames.end();
+ ++iVoiceName)
+ {
+ const string& VoiceName = iVoiceName->first;
+
+ if (!VoiceName.empty())
+ {
+ mpPatchListBox->Append(VoiceName.c_str());
+ }
+ }
+ }
+
+ wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK");
+ wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel");
+ wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help");
+ pOkButton->SetDefault();
+
+ wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL);
+
+ pTopSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Track Name:"),
+ 0,
+ wxALL,
+ 2);
+ pTopSizer->Add(mpTrackNameEdit, 0, wxGROW | wxALL, 2);
+
+ pTopSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Patch:"),
+ 0,
+ wxALL,
+ 2);
+ pTopSizer->Add(mpPatchListBox, 0, wxGROW | wxALL, 2);
+
+ wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL);
+ pButtonSizer->Add(pOkButton, 0, wxALL, 5);
+ pButtonSizer->Add(pCancelButton, 0, wxALL, 5);
+ pButtonSizer->Add(pHelpButton, 0, wxALL, 5);
+
+ pTopSizer->Add(pButtonSizer, 0, wxALIGN_CENTER | wxBOTTOM, 6);
+
+ SetAutoLayout(true);
+ SetSizer(pTopSizer);
+
+ pTopSizer->SetSizeHints(this);
+ pTopSizer->Fit(this);
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZTrackDialog::TransferDataToWindow()
+{
+ mpTrackNameEdit->ChangeValue(mTrack.GetName());
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZTrackDialog::TransferDataFromWindow()
+{
+ return true;
+}
Property changes on: trunk/jazz/src/Dialogs/TrackDialog.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/jazz/src/Dialogs/TrackDialog.h
===================================================================
--- trunk/jazz/src/Dialogs/TrackDialog.h (rev 0)
+++ trunk/jazz/src/Dialogs/TrackDialog.h 2008-04-21 05:29:17 UTC (rev 471)
@@ -0,0 +1,50 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2008 Peter J. Stieber, all rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//*****************************************************************************
+
+#ifndef JZ_TRACKDIALOG_H
+#define JZ_TRACKDIALOG_H
+
+class JZTrack;
+class wxTextCtrl;
+
+//*****************************************************************************
+//*****************************************************************************
+class JZTrackDialog : public wxDialog
+{
+ public:
+
+ JZTrackDialog(JZTrack& Track, wxWindow* pParent);
+
+ private:
+
+ virtual bool TransferDataToWindow();
+
+ virtual bool TransferDataFromWindow();
+
+ private:
+
+ JZTrack& mTrack;
+
+ wxTextCtrl* mpTrackNameEdit;
+
+ wxListBox* mpPatchListBox;
+};
+
+#endif // !defined(JZ_TRACKDIALOG_H)
Property changes on: trunk/jazz/src/Dialogs/TrackDialog.h
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-21 03:20:12
|
Revision: 470
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=470&view=rev
Author: pstieber
Date: 2008-04-20 20:20:07 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
Fixed a signed-unsigned comparison warning.exit
Modified Paths:
--------------
trunk/jazz/src/KeyStringConverters.cpp
Modified: trunk/jazz/src/KeyStringConverters.cpp
===================================================================
--- trunk/jazz/src/KeyStringConverters.cpp 2008-04-21 03:14:43 UTC (rev 469)
+++ trunk/jazz/src/KeyStringConverters.cpp 2008-04-21 03:20:07 UTC (rev 470)
@@ -76,7 +76,7 @@
int Key = 0;
- for (int i = 0; i < String.length(); ++i)
+ for (unsigned i = 0; i < String.length(); ++i)
{
if (String[i] == '#')
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-21 03:14:46
|
Revision: 469
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=469&view=rev
Author: pstieber
Date: 2008-04-20 20:14:43 -0700 (Sun, 20 Apr 2008)
Log Message:
-----------
Updated the Linux specific modules for the latest changes.
Modified Paths:
--------------
trunk/jazz/src/AlsaDriver.cpp
trunk/jazz/src/AlsaPlayer.cpp
trunk/jazz/src/AudioDriver.cpp
trunk/jazz/src/Player.cpp
Modified: trunk/jazz/src/AlsaDriver.cpp
===================================================================
--- trunk/jazz/src/AlsaDriver.cpp 2008-04-20 00:33:04 UTC (rev 468)
+++ trunk/jazz/src/AlsaDriver.cpp 2008-04-21 03:14:43 UTC (rev 469)
@@ -187,7 +187,7 @@
return;
}
- long ticks_per_minute = Song->TicksPerQuarter * Song->Speed();
+ long ticks_per_minute = Song->GetTicksPerQuarter() * Song->Speed();
mSamples.ResetBuffers(AudioBuffer, clock, ticks_per_minute);
last_scount = 0;
cur_pos = 0;
@@ -522,8 +522,8 @@
if (pcm[PLAYBACK])
{
snd_pcm_drop(pcm[PLAYBACK]);
- //long ticks_per_minute = Song->TicksPerQuarter * Song->Speed();
- //mSamples.ResetBuffers(AudioBuffer, clock, ticks_per_minute);
+// long ticks_per_minute = Song->GetTicksPerQuarter() * Song->Speed();
+// mSamples.ResetBuffers(AudioBuffer, clock, ticks_per_minute);
}
audio_clock_offset = clock;
cur_pos = 0;
Modified: trunk/jazz/src/AlsaPlayer.cpp
===================================================================
--- trunk/jazz/src/AlsaPlayer.cpp 2008-04-20 00:33:04 UTC (rev 468)
+++ trunk/jazz/src/AlsaPlayer.cpp 2008-04-21 03:14:43 UTC (rev 469)
@@ -322,8 +322,8 @@
tKeyOn *k = e->IsKeyOn();
set_event_header(&ev, e->GetClock(), SND_SEQ_EVENT_NOTEON);
ev.data.note.channel = k->Channel;
- ev.data.note.note = k->Key;
- ev.data.note.velocity = k->Veloc;
+ ev.data.note.note = k->mKey;
+ ev.data.note.velocity = k->mVelocity;
rc = write(&ev, now);
}
break;
@@ -592,7 +592,7 @@
//-----------------------------------------------------------------------------
int tAlsaPlayer::start_timer(long clock)
{
- int time_base = Song->TicksPerQuarter;
+ int time_base = Song->GetTicksPerQuarter();
int cur_speed = Song->GetTrack(0)->GetCurrentSpeed(clock);
init_queue_tempo(time_base, cur_speed);
start_queue_timer(clock);
Modified: trunk/jazz/src/AudioDriver.cpp
===================================================================
--- trunk/jazz/src/AudioDriver.cpp 2008-04-20 00:33:04 UTC (rev 468)
+++ trunk/jazz/src/AudioDriver.cpp 2008-04-21 03:14:43 UTC (rev 469)
@@ -193,7 +193,7 @@
return;
}
- long ticks_per_minute = Song->TicksPerQuarter * Song->Speed();
+ long ticks_per_minute = Song->GetTicksPerQuarter() * Song->Speed();
mSamples.ResetBuffers(AudioBuffer, start_clock, ticks_per_minute);
if (PlaybackMode())
{
Modified: trunk/jazz/src/Player.cpp
===================================================================
--- trunk/jazz/src/Player.cpp 2008-04-20 00:33:04 UTC (rev 468)
+++ trunk/jazz/src/Player.cpp 2008-04-21 03:14:43 UTC (rev 469)
@@ -1568,16 +1568,24 @@
{
case StatKeyOn:
{
- tKeyOn *k = e->IsKeyOn();
- SEQ_START_NOTE(mididev, k->Channel, k->Key, k->Veloc);
+ tKeyOn* pKeyOn = e->IsKeyOn();
+ SEQ_START_NOTE(
+ mididev,
+ pKeyOn->Channel,
+ pKeyOn->mKey,
+ pKeyOn->mVelocity);
if (now) seqbuf_flush_last_event();
}
break;
case StatKeyOff:
{
- tKeyOff *k = e->IsKeyOff();
- SEQ_STOP_NOTE(mididev, k->Channel, k->Key, k->OffVeloc);
+ tKeyOff* pKeyOff = e->IsKeyOff();
+ SEQ_STOP_NOTE(
+ mididev,
+ pKeyOff->Channel,
+ pKeyOff->Key,
+ pKeyOff->OffVeloc);
if (now) seqbuf_flush_last_event();
}
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-20 00:33:07
|
Revision: 468
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=468&view=rev
Author: pstieber
Date: 2008-04-19 17:33:04 -0700 (Sat, 19 Apr 2008)
Log Message:
-----------
Added the new source modules to the projects.
Modified Paths:
--------------
trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj
trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj
Modified: trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj
===================================================================
--- trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2008-04-20 00:00:32 UTC (rev 467)
+++ trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2008-04-20 00:33:04 UTC (rev 468)
@@ -733,6 +733,14 @@
>
</File>
<File
+ RelativePath="..\src\StringUtilities.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\src\StringUtilities.h"
+ >
+ </File>
+ <File
RelativePath="..\src\Synth.cpp"
>
</File>
@@ -822,6 +830,14 @@
Name="Dialog Source Files"
>
<File
+ RelativePath="..\src\Dialogs\KeyOnDialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\src\Dialogs\KeyOnDialog.h"
+ >
+ </File>
+ <File
RelativePath="..\src\Dialogs\MetronomeSettingsDialog.cpp"
>
</File>
Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj
===================================================================
--- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2008-04-20 00:00:32 UTC (rev 467)
+++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2008-04-20 00:33:04 UTC (rev 468)
@@ -732,6 +732,14 @@
>
</File>
<File
+ RelativePath="..\src\StringUtilities.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\src\StringUtilities.h"
+ >
+ </File>
+ <File
RelativePath="..\src\Synth.cpp"
>
</File>
@@ -821,6 +829,14 @@
Name="Dialog Source Files"
>
<File
+ RelativePath="..\src\Dialogs\KeyOnDialog.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\src\Dialogs\KeyOnDialog.h"
+ >
+ </File>
+ <File
RelativePath="..\src\Dialogs\MetronomeSettingsDialog.cpp"
>
</File>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-20 00:00:33
|
Revision: 467
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=467&view=rev
Author: pstieber
Date: 2008-04-19 17:00:32 -0700 (Sat, 19 Apr 2008)
Log Message:
-----------
1. Removed the old key on dialog implementation (tKeyOnDlg) and replaced its use with
JZKeyOnDialog.
2. Encapsulated the following members of JZBarInfo by making them private, renaming
them, and adding accessors:
BarNr -> mBarIndex
Clock -> mClock
CountsPerBar -> mCountsPerBar
TicksPerQuarter -> mTicksPerQuarter
TicksPerBar -> mTicksPerBar
Iterator -> mIterator
e -> mpEvent
3. Encapsulated the following members of JZSong by making them private, renaming them,
and adding accessors:
MaxQuarters -> mMaxQuarters
TicksPerQuarter -> mTicksPerQuarter
intro_length -> mIntroLength
4. Changed JZSong::Clock2String to ClockToString and changed it to fill a std::string
instead of a char*.
5. Changed JZSong::String2Clock to StringToClockand changed it to process a std::string
instead of a char*.
6. Capitalized the LAST_CLOCK and KILLED_CLOCK macros.
7. Made the edb, Copy, BarInfo, GetValue, GetEventlength, GetLength, GetPitch, GetPen,
and GetBrush constant in JZEvent.
8. Prefixed the tKeyOn event members with m.
9. Changed tKeyDlg to JZKeyDialog.
10. Changed Key2Str to KeyToString and Str2Key to StringToKey and changed the functions
to use std::string instead of char*.
11. Started fixing up the rhythm class.
12. Changed some tSysEx pointer arguments to constant in the synthesizer class.
13. Changed JZTrack::GetLastClock to const.
14. Changed the simple event array member of the event iterator class to constant.
15. Made cosmetic indentation changes.
Modified Paths:
--------------
trunk/jazz/src/Audio.cpp
trunk/jazz/src/ClockDialog.cpp
trunk/jazz/src/Command.cpp
trunk/jazz/src/Command.h
trunk/jazz/src/ControlEdit.cpp
trunk/jazz/src/Dialogs/KeyOnDialog.cpp
trunk/jazz/src/Dialogs.cpp
trunk/jazz/src/EventWindow.cpp
trunk/jazz/src/Events.cpp
trunk/jazz/src/Events.h
trunk/jazz/src/Harmony.cpp
trunk/jazz/src/HarmonyBrowserAnalyzer.cpp
trunk/jazz/src/KeyDialog.cpp
trunk/jazz/src/KeyDialog.h
trunk/jazz/src/KeyStringConverters.cpp
trunk/jazz/src/KeyStringConverters.h
trunk/jazz/src/MeasureChoice.cpp
trunk/jazz/src/PianoWindow.cpp
trunk/jazz/src/Player.cpp
trunk/jazz/src/Player.h
trunk/jazz/src/Resources.h
trunk/jazz/src/Rhythm.cpp
trunk/jazz/src/Rhythm.h
trunk/jazz/src/SampleWindow.cpp
trunk/jazz/src/Song.cpp
trunk/jazz/src/Song.h
trunk/jazz/src/Synth.cpp
trunk/jazz/src/Synth.h
trunk/jazz/src/Track.cpp
trunk/jazz/src/Track.h
trunk/jazz/src/TrackFrame.cpp
trunk/jazz/src/TrackWindow.cpp
trunk/jazz/src/mswin/WindowsPlayer.cpp
Modified: trunk/jazz/src/Audio.cpp
===================================================================
--- trunk/jazz/src/Audio.cpp 2008-04-19 23:22:59 UTC (rev 466)
+++ trunk/jazz/src/Audio.cpp 2008-04-20 00:00:32 UTC (rev 467)
@@ -424,10 +424,10 @@
}
event_index++;
- tKeyOn *k = e->IsKeyOn();
- if (k && num_voices < MAXPOLY)
+ tKeyOn* pKeyOn = e->IsKeyOn();
+ if (pKeyOn && num_voices < MAXPOLY)
{
- voices[num_voices++]->Start(samples[k->Key], k->GetClock());
+ voices[num_voices++]->Start(samples[pKeyOn->mKey], pKeyOn->GetClock());
}
}
@@ -532,12 +532,17 @@
tEventIterator it(t);
JZEvent *e = it.First();
- while (e) {
- tKeyOn *k = e->IsKeyOn();
- if (k) {
- k->Length = (int)Samples2Ticks(samples[k->Key]->GetLength());
- if (k->Length < 15) // invisble?
- k->Length = 15;
+ while (e)
+ {
+ tKeyOn* pKeyOn = e->IsKeyOn();
+ if (pKeyOn)
+ {
+ pKeyOn->mLength =
+ (int)Samples2Ticks(samples[pKeyOn->mKey]->GetLength());
+ if (pKeyOn->mLength < 15) // invisble?
+ {
+ pKeyOn->mLength = 15;
+ }
}
e = it.Next();
}
@@ -840,13 +845,13 @@
e = iter.Next();
}
// add a noteon
- tKeyOn *k = new tKeyOn(
+ tKeyOn* pKeyOn = new tKeyOn(
frc,
track->Channel - 1,
key,
64,
(unsigned short)(toc - frc));
- track->Put(k);
+ track->Put(pKeyOn);
track->Cleanup();
// repaint trackwin
@@ -1006,7 +1011,7 @@
{
char buf[500];
sprintf(buf, "%d ", i+1);
- //Key2Str(i, buf + strlen(buf));
+// KeyToString(i, buf + strlen(buf));
sprintf(buf + strlen(buf), set.samples[i]->GetLabel());
return copystring(buf);
}
Modified: trunk/jazz/src/ClockDialog.cpp
===================================================================
--- trunk/jazz/src/ClockDialog.cpp 2008-04-19 23:22:59 UTC (rev 466)
+++ trunk/jazz/src/ClockDialog.cpp 2008-04-20 00:00:32 UTC (rev 467)
@@ -28,6 +28,10 @@
#include "DeprecatedStringUtils.h"
#include "DeprecatedWx/proplist.h"
+#include <string>
+
+using namespace std;
+
//*****************************************************************************
// Description:
// This is the clock dialog class declaration.
@@ -36,9 +40,9 @@
//-----------------------------------------------------------------------------
JZClockDialog::JZClockDialog(JZSong* pSong, const char* pTitle, int Clock)
{
- char Buffer[500];
- pSong->Clock2String(Clock, Buffer);
- mpString = copystring(Buffer);
+ string ClockString;
+ pSong->ClockToString(Clock, ClockString);
+ mpString = copystring(ClockString.c_str());
mpTitle = pTitle;
mpSong = pSong;
}
@@ -64,5 +68,5 @@
//-----------------------------------------------------------------------------
int JZClockDialog::GetClock()
{
- return mpSong->String2Clock(mpString);
+ return mpSong->StringToClock(mpString);
}
Modified: trunk/jazz/src/Command.cpp
===================================================================
--- trunk/jazz/src/Command.cpp 2008-04-19 23:22:59 UTC (rev 466)
+++ trunk/jazz/src/Command.cpp 2008-04-20 00:00:32 UTC (rev 467)
@@ -137,10 +137,10 @@
//-----------------------------------------------------------------------------
void tSelectedKeys::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tKeyOn* pKey = pEvent->IsKeyOn();
- if (pKey)
+ tKeyOn* pKeyOn = pEvent->IsKeyOn();
+ if (pKeyOn)
{
- Keys[pKey->Key] += pKey->Length;
+ Keys[pKeyOn->mKey] += pKeyOn->mLength;
}
}
@@ -150,12 +150,14 @@
// c d e f g a b
static const int CMajor[12] = { 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 };
-void tScale::Init(int ScaleNr, JZFilter *f)
+void tScale::Init(int ScaleNr, JZFilter* pFilter)
{
int i;
for (i = 0; i < 12; i++)
+ {
ScaleKeys[i] = 0;
+ }
if (ScaleNr == gScaleChromatic)
{
@@ -166,7 +168,7 @@
else if (ScaleNr == gScaleSelected)
{
int found = 0;
- tSelectedKeys cmd(f);
+ tSelectedKeys cmd(pFilter);
cmd.Execute(0);
for (i = 0; i < 128; i++)
{
@@ -190,7 +192,7 @@
}
-int tScale::Analyze(JZFilter *f)
+int tScale::Analyze(JZFilter* pFilter)
{
long keys[12];
for (int i = 0; i < 12; i++)
@@ -198,7 +200,7 @@
keys[i] = 0;
}
- tSelectedKeys cmd(f);
+ tSelectedKeys cmd(pFilter);
cmd.Execute(0);
for (int i = 0; i < 128; i++)
{
@@ -289,26 +291,26 @@
// tCmdShift
// ***********************************************************************
-tCmdShift::tCmdShift(JZFilter *f, long dclk)
- : tCommand(f)
+tCmdShift::tCmdShift(JZFilter* pFilter, long dclk)
+ : tCommand(pFilter)
{
DeltaClock = dclk;
}
-void tCmdShift::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdShift::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- JZEvent *c = e->Copy();
- t->Kill(e);
+ JZEvent* c = pEvent->Copy();
+ pTrack->Kill(pEvent);
c->SetClock(c->GetClock() + DeltaClock);
- t->Put(c);
+ pTrack->Put(c);
}
// ************************************************************************
// tCmdErase
// ************************************************************************
-tCmdErase::tCmdErase(JZFilter *f, int lvsp)
- : tCommand(f)
+tCmdErase::tCmdErase(JZFilter* pFilter, int lvsp)
+ : tCommand(pFilter)
{
LeaveSpace = lvsp;
}
@@ -318,26 +320,26 @@
tCommand::Execute(NewUndo);
if (!LeaveSpace)
{
- JZFilter f(mpFilter);
- f.FromClock = mpFilter->ToClock;
- f.ToClock = mpSong->GetLastClock() + 1;
+ JZFilter Filter(mpFilter);
+ Filter.FromClock = mpFilter->ToClock;
+ Filter.ToClock = mpSong->GetLastClock() + 1;
long DeltaClock = mpFilter->FromClock - mpFilter->ToClock;
- tCmdShift shift(&f, DeltaClock);
+ tCmdShift shift(&Filter, DeltaClock);
shift.Execute(0);
}
}
-void tCmdErase::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdErase::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- t->Kill(e);
+ pTrack->Kill(pEvent);
}
// ************************************************************************
// tCmdQuantize
// ************************************************************************
-tCmdQuantize::tCmdQuantize(JZFilter *f, long clks, int grov, int dly)
- : tCommand(f)
+tCmdQuantize::tCmdQuantize(JZFilter* pFilter, long clks, int grov, int dly)
+ : tCommand(pFilter)
{
QntClocks = clks;
Groove = grov;
@@ -357,22 +359,22 @@
return Clock > minclk ? Clock : minclk;
}
-void tCmdQuantize::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdQuantize::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tKeyOn *k;
- if ((k = e->IsKeyOn()) != 0)
+ tKeyOn* pKeyOn;
+ if ((pKeyOn = pEvent->IsKeyOn()) != 0)
{
- k = (tKeyOn *)e->Copy();
+ pKeyOn = (tKeyOn *)pEvent->Copy();
if (NoteStart)
{
- k->SetClock(Quantize(k->GetClock(), 0));
+ pKeyOn->SetClock(Quantize(pKeyOn->GetClock(), 0));
}
if (NoteLength)
{
- k->Length = Quantize(k->Length, 2);
+ pKeyOn->mLength = Quantize(pKeyOn->mLength, 2);
}
- t->Kill(e);
- t->Put(k);
+ pTrack->Kill(pEvent);
+ pTrack->Put(pKeyOn);
}
}
@@ -380,35 +382,37 @@
// tCmdTranspose
// ************************************************************************
-tCmdTranspose::tCmdTranspose(JZFilter *f, int notes, int ScaleNr, int fit)
- : tCommand(f)
+tCmdTranspose::tCmdTranspose(JZFilter* pFilter, int notes, int ScaleNr, int fit)
+ : tCommand(pFilter)
{
Scale.Init(ScaleNr, mpFilter);
Notes = notes;
FitIntoScale = fit;
}
-void tCmdTranspose::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdTranspose::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tKeyOn *k;
- if (e->IsKeyOn())
+ tKeyOn* pKeyOn;
+ if (pEvent->IsKeyOn())
{
- k = (tKeyOn *)e->Copy();
+ pKeyOn = (tKeyOn *)pEvent->Copy();
if (FitIntoScale)
{
- k->Key += Notes;
- k->Key = Scale.FitInto(k->Key);
+ pKeyOn->mKey += Notes;
+ pKeyOn->mKey = Scale.FitInto(pKeyOn->mKey);
}
else if (Notes)
- k->Key = Scale.Transpose(k->Key, Notes);
- t->Kill(e);
- t->Put(k);
+ {
+ pKeyOn->mKey = Scale.Transpose(pKeyOn->mKey, Notes);
+ }
+ pTrack->Kill(pEvent);
+ pTrack->Put(pKeyOn);
}
// SN++ Aftertouch
tKeyPressure *a;
- if (e->IsKeyPressure())
+ if (pEvent->IsKeyPressure())
{
- a = (tKeyPressure *)e->Copy();
+ a = (tKeyPressure *)pEvent->Copy();
if (FitIntoScale)
{
a->Key += Notes;
@@ -416,8 +420,8 @@
}
else if (Notes)
a->Key = Scale.Transpose(a->Key, Notes);
- t->Kill(e);
- t->Put(a);
+ pTrack->Kill(pEvent);
+ pTrack->Put(a);
}
//
}
@@ -426,22 +430,22 @@
// tCmdSetChannel
// ************************************************************************
-tCmdSetChannel::tCmdSetChannel(JZFilter *f, int chan)
- : tCommand(f)
+tCmdSetChannel::tCmdSetChannel(JZFilter* pFilter, int chan)
+ : tCommand(pFilter)
{
NewChannel = chan;
}
-void tCmdSetChannel::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdSetChannel::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tChannelEvent *c;
+ tChannelEvent* c;
- if ((c = e->IsChannelEvent()) != 0)
+ if ((c = pEvent->IsChannelEvent()) != 0)
{
- c = (tChannelEvent *)e->Copy();
+ c = (tChannelEvent *)pEvent->Copy();
c->Channel = NewChannel;
- t->Kill(e);
- t->Put(c);
+ pTrack->Kill(pEvent);
+ pTrack->Put(c);
}
}
@@ -449,34 +453,40 @@
// tCmdVelocity
// ************************************************************************
-tCmdVelocity::tCmdVelocity(JZFilter *f, int from, int to, int m)
- : tCommand(f)
+tCmdVelocity::tCmdVelocity(JZFilter* pFilter, int from, int to, int m)
+ : tCommand(pFilter)
{
FromValue = from;
ToValue = to;
Mode = m;
}
-void tCmdVelocity::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdVelocity::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tKeyOn *k;
+ tKeyOn* pKeyOn;
- if (e->IsKeyOn() != 0)
+ if (pEvent->IsKeyOn() != 0)
{
- k = (tKeyOn *)e->Copy();
+ pKeyOn = (tKeyOn *)pEvent->Copy();
long val = 0;
if (ToValue <= 0)
val = FromValue;
else
- val = Interpolate(k->GetClock(), FromValue, ToValue);
- switch (Mode) {
- case 0: break;
- case 1: val = k->Veloc + val; break;
- case 2: val = k->Veloc - val; break;
+ val = Interpolate(pKeyOn->GetClock(), FromValue, ToValue);
+ switch (Mode)
+ {
+ case 0:
+ break;
+ case 1:
+ val = pKeyOn->mVelocity + val;
+ break;
+ case 2:
+ val = pKeyOn->mVelocity - val;
+ break;
}
- k->Veloc = val < 1 ? 1 : (val > 127 ? 127 : val);
- t->Kill(e);
- t->Put(k);
+ pKeyOn->mVelocity = val < 1 ? 1 : (val > 127 ? 127 : val);
+ pTrack->Kill(pEvent);
+ pTrack->Put(pKeyOn);
}
}
@@ -484,35 +494,41 @@
// tCmdLength
// ************************************************************************
-tCmdLength::tCmdLength(JZFilter *f, int from, int to, int m)
- : tCommand(f)
+tCmdLength::tCmdLength(JZFilter* pFilter, int from, int to, int m)
+ : tCommand(pFilter)
{
FromValue = from;
ToValue = to;
Mode = m;
}
-void tCmdLength::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdLength::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tKeyOn *k;
+ tKeyOn* pKeyOn;
- if (e->IsKeyOn() != 0)
+ if (pEvent->IsKeyOn() != 0)
{
- k = (tKeyOn *)e->Copy();
+ pKeyOn = (tKeyOn *)pEvent->Copy();
long val = 0;
if (ToValue <= 0)
val = FromValue;
else
- val = Interpolate(k->GetClock(), FromValue, ToValue);
- switch (Mode) {
- case 0: break;
- case 1: val = k->Length + val; break;
- case 2: val = k->Length - val; break;
+ val = Interpolate(pKeyOn->GetClock(), FromValue, ToValue);
+ switch (Mode)
+ {
+ case 0:
+ break;
+ case 1:
+ val = pKeyOn->mLength + val;
+ break;
+ case 2:
+ val = pKeyOn->mLength - val;
+ break;
}
- k->Length = val < 1 ? 1 : val;
- t->Kill(e);
- t->Put(k);
+ pKeyOn->mLength = val < 1 ? 1 : val;
+ pTrack->Kill(pEvent);
+ pTrack->Put(pKeyOn);
}
}
@@ -524,8 +540,8 @@
// by factor "scale" from starting point "startClock"
// ************************************************************************
-tCmdSeqLength::tCmdSeqLength(JZFilter *f, double scale)
- : tCommand(f)
+tCmdSeqLength::tCmdSeqLength(JZFilter* pFilter, double scale)
+ : tCommand(pFilter)
{
this->scale=scale;
this->startClock=-1000;
@@ -533,21 +549,22 @@
/** move an event according to startclock and scale
*/
-void tCmdSeqLength::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdSeqLength::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
// Make a copy of the current event.
- JZEvent *k;
- k = (tKeyOn *)e->Copy();
+ JZEvent* k;
+ k = (tKeyOn *)pEvent->Copy();
//little hack, if clock is -1000 it means set startclock from the first event.
- if(startClock==-1000){
- startClock=k->GetClock();
+ if(startClock==-1000)
+ {
+ startClock = k->GetClock();
}
//calculate the new start clock, move the new event and kill the old one
- k->SetClock((long int)(((k->GetClock()-startClock)*scale) + startClock ) );
- t->Kill(e);
- t->Put(k);
+ k->SetClock((long int)(((k->GetClock() - startClock) * scale) + startClock));
+ pTrack->Kill(pEvent);
+ pTrack->Put(k);
}
@@ -558,20 +575,20 @@
// to a pitch bend/volume control sequence instead
// ************************************************************************
-tCmdConvertToModulation::tCmdConvertToModulation(JZFilter *f)
- : tCommand(f)
+tCmdConvertToModulation::tCmdConvertToModulation(JZFilter* pFilter)
+ : tCommand(pFilter)
{
}
//need to override executetrack, since we have begin/end behaviour in this filter
-void tCmdConvertToModulation::ExecuteTrack(JZTrack *t)
+void tCmdConvertToModulation::ExecuteTrack(JZTrack* pTrack)
{
//JAVE:iterate over all events, make a long event from start until stop of the sequence,
//convert all note-on messages to a pitch bend/volume controller pair, velocity -> volume
//make a volume off controller at the end of the current event
- tEventIterator Iterator(t);
- JZEvent *e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
+ tEventIterator Iterator(pTrack);
+ JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
long startclock=-1;
long endclock=-1;
unsigned char channel=0;
@@ -595,42 +612,49 @@
long startvelocity=0;
long startkey=0;
- while (e)
+ while (pEvent)
{
- if (mpFilter->IsSelected(e) && e->IsKeyOn())
+ if (mpFilter->IsSelected(pEvent) && pEvent->IsKeyOn())
+ {
+ if (startclock == -1)
{
- if (startclock == -1)
- {
- startclock=e->IsKeyOn()->GetClock();
- startvelocity=e->IsKeyOn()->Veloc;
- channel=e->IsKeyOn()->Channel;
- startkey=e->IsKeyOn()->Key;
- previouspitch=e->GetPitch();
- }
- pitchdiff=e->GetPitch()-previouspitch;
+ startclock = pEvent->IsKeyOn()->GetClock();
+ startvelocity = pEvent->IsKeyOn()->mVelocity;
+ channel = pEvent->IsKeyOn()->Channel;
+ startkey = pEvent->IsKeyOn()->mKey;
+ previouspitch = pEvent->GetPitch();
+ }
+ pitchdiff = pEvent->GetPitch()-previouspitch;
- tPitch* pitchmodulation=0;
- pitchmodulation = new tPitch(e->GetClock(), channel, pitchsteparray[pitchdiff+4]);
+ tPitch* pitchmodulation=0;
+ pitchmodulation = new tPitch(
+ pEvent->GetClock(),
+ channel,
+ pitchsteparray[pitchdiff + 4]);
- t->Put(pitchmodulation);
+ pTrack->Put(pitchmodulation);
+ pTrack->Kill(pEvent); //remove the old event
- t->Kill(e); //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));
- t->Put(new tControl(e->GetClock(), channel, 0x07, e->IsKeyOn()->Veloc));
- t->Put(new tControl(e->GetClock()+e->IsKeyOn()->Length, channel, 0x07,0));
-
- lastlength=e->IsKeyOn()->Length;
- endclock=e->GetClock();
- previouspitch=e->GetPitch();
- }
- //ExecuteEvent(t, e);
- e = Iterator.Next();
+ lastlength = pEvent->IsKeyOn()->mLength;
+ endclock = pEvent->GetClock();
+ previouspitch = pEvent->GetPitch();
+ }
+ //ExecuteEvent(pTrack, pEvent);
+ pEvent = Iterator.Next();
}
//now insert the new long event
- tKeyOn* longevent = new tKeyOn(startclock, channel, startkey, startvelocity, endclock-startclock+lastlength );
- t->Put(longevent);
- t->Cleanup();
+ tKeyOn* longevent = new tKeyOn(
+ startclock,
+ channel,
+ startkey,
+ startvelocity,
+ endclock - startclock + lastlength);
+ pTrack->Put(longevent);
+ pTrack->Cleanup();
}
// ************************************************************************
@@ -638,27 +662,31 @@
// JAVE this is a simple midi delay line
// ************************************************************************
-tCmdMidiDelay::tCmdMidiDelay(JZFilter *f, double scale, long clockDelay, int repeat)
- : tCommand(f)
+tCmdMidiDelay::tCmdMidiDelay(
+ JZFilter* pFilter,
+ double scale,
+ long clockDelay,
+ int repeat)
+ : tCommand(pFilter)
{
this->scale=scale;
this->clockDelay=clockDelay;
this->repeat=repeat;
}
-void tCmdMidiDelay::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdMidiDelay::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tKeyOn *k;
+ tKeyOn* pKeyOn;
for (int i = 1; i < repeat; ++i)
{
- if (e->IsKeyOn())
+ if (pEvent->IsKeyOn())
{
- //only echo note events
- k = (tKeyOn *)e->Copy();
- k->SetClock(k->GetClock()+ clockDelay * i);
- k->Veloc = (unsigned char)(pow(scale, i) * k->Veloc);
- t->Put(k);
+ // only echo note events
+ pKeyOn = (tKeyOn *)pEvent->Copy();
+ pKeyOn->SetClock(pKeyOn->GetClock()+ clockDelay * i);
+ pKeyOn->mVelocity = (unsigned char)(pow(scale, i) * pKeyOn->mVelocity);
+ pTrack->Put(pKeyOn);
}
}
}
@@ -669,40 +697,42 @@
// tCmdCleanup
// ************************************************************************
-tCmdCleanup::tCmdCleanup(JZFilter *f, long clks, int so)
- : tCommand(f)
+tCmdCleanup::tCmdCleanup(JZFilter* pFilter, long clks, int so)
+ : tCommand(pFilter)
{
lengthLimit = clks;
shortenOverlaps = so;
}
-void tCmdCleanup::ExecuteTrack(JZTrack *t)
+void tCmdCleanup::ExecuteTrack(JZTrack* pTrack)
{
memset(prev_note, 0, sizeof(prev_note));
- tCommand::ExecuteTrack(t);
+ tCommand::ExecuteTrack(pTrack);
}
-void tCmdCleanup::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdCleanup::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tKeyOn *k;
- if ((k = e->IsKeyOn()) != 0)
+ tKeyOn* pKeyOn;
+ if ((pKeyOn = pEvent->IsKeyOn()) != 0)
{
- if (k->Length < lengthLimit) {
+ if (pKeyOn->mLength < lengthLimit)
+ {
// remove short notes
- t->Kill(e);
+ pTrack->Kill(pEvent);
}
- else if (shortenOverlaps) {
+ else if (shortenOverlaps)
+ {
// shorten length of overlapping notes
- tKeyOn *p = prev_note[k->Channel][k->Key];
- if (p && p->GetClock() + p->Length >= k->GetClock())
+ tKeyOn *p = prev_note[pKeyOn->Channel][pKeyOn->mKey];
+ if (p && p->GetClock() + p->mLength >= pKeyOn->GetClock())
{
- p->Length = k->GetClock() - p->GetClock() - 1;
- if (p->Length < lengthLimit)
+ p->mLength = pKeyOn->GetClock() - p->GetClock() - 1;
+ if (p->mLength < lengthLimit)
{
- t->Kill(p);
+ pTrack->Kill(p);
}
}
- prev_note[k->Channel][k->Key] = k;
+ prev_note[pKeyOn->Channel][pKeyOn->mKey] = pKeyOn;
}
}
}
@@ -711,24 +741,24 @@
// tCmdSearchReplace
// ************************************************************************
-tCmdSearchReplace::tCmdSearchReplace(JZFilter *f, short sf, short st)
- : tCommand(f)
+tCmdSearchReplace::tCmdSearchReplace(JZFilter* pFilter, short sf, short st)
+ : tCommand(pFilter)
{
fr = sf;
to = st;
}
-void tCmdSearchReplace::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdSearchReplace::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
tControl *ctrl;
- if ((ctrl = e->IsControl()) != 0)
+ if ((ctrl = pEvent->IsControl()) != 0)
{
if (ctrl->Control == fr)
{
tControl *copy = (tControl *)ctrl->Copy();
copy->Control = to;
- t->Kill(ctrl);
- t->Put(copy);
+ pTrack->Kill(ctrl);
+ pTrack->Put(copy);
}
}
}
@@ -756,8 +786,8 @@
-tCmdCopy::tCmdCopy(JZFilter *f, long dt, long dc)
- : tCommand(f)
+tCmdCopy::tCmdCopy(JZFilter* pFilter, long dt, long dc)
+ : tCommand(pFilter)
{
DestTrack = dt;
DestClock = dc;
@@ -808,24 +838,24 @@
{
tEventIterator Iterator(s);
long DeltaClock = StartClock - mpFilter->FromClock;
- JZEvent *e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
- while (e)
+ JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
+ while (pEvent)
{
- long NewClock = e->GetClock() + DeltaClock;
+ long NewClock = pEvent->GetClock() + DeltaClock;
if (NewClock >= StopClock)
break;
- if (mpFilter->IsSelected(e))
+ if (mpFilter->IsSelected(pEvent))
{
- JZEvent* cpy = e->Copy();
+ JZEvent* cpy = pEvent->Copy();
cpy->SetClock(NewClock);
tmp.Put(cpy);
}
- e = Iterator.Next();
- if (!e)
+ pEvent = Iterator.Next();
+ if (!pEvent)
{
- e = Iterator.First();
+ pEvent = Iterator.First();
DeltaClock += mpFilter->ToClock - mpFilter->FromClock;
}
}
@@ -836,18 +866,18 @@
if (InsertSpace && d->GetLastClock() > StartClock)
{
tEventIterator Iterator(d);
- JZEvent *e = Iterator.Range(StartClock, d->GetLastClock() + 1);
+ JZEvent* pEvent = Iterator.Range(StartClock, d->GetLastClock() + 1);
long DeltaClock = StopClock - StartClock;
- while (e)
+ while (pEvent)
{
- if (mpFilter->IsSelected(e))
+ if (mpFilter->IsSelected(pEvent))
{
- JZEvent *c = e->Copy();
+ JZEvent* c = pEvent->Copy();
c->SetClock(c->GetClock() + DeltaClock);
- d->Kill(e);
+ d->Kill(pEvent);
d->Put(c);
}
- e = Iterator.Next();
+ pEvent = Iterator.Next();
}
d->Cleanup();
}
@@ -857,12 +887,14 @@
if (EraseSource)
{
tEventIterator Iterator(s);
- JZEvent *e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
- while (e)
+ JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
+ while (pEvent)
{
- if (mpFilter->IsSelected(e))
- s->Kill(e);
- e = Iterator.Next();
+ if (mpFilter->IsSelected(pEvent))
+ {
+ s->Kill(pEvent);
+ }
+ pEvent = Iterator.Next();
}
s->Cleanup();
}
@@ -872,12 +904,14 @@
if (EraseDestin)
{
tEventIterator Iterator(d);
- JZEvent *e = Iterator.Range(StartClock, StopClock);
- while (e)
+ JZEvent* pEvent = Iterator.Range(StartClock, StopClock);
+ while (pEvent)
{
- if (mpFilter->IsSelected(e))
- d->Kill(e);
- e = Iterator.Next();
+ if (mpFilter->IsSelected(pEvent))
+ {
+ d->Kill(pEvent);
+ }
+ pEvent = Iterator.Next();
}
d->Cleanup();
}
@@ -893,19 +927,20 @@
// tCmdExchLeftRight
// ************************************************************************
-tCmdExchLeftRight::tCmdExchLeftRight(JZFilter *f)
- : tCommand(f)
+tCmdExchLeftRight::tCmdExchLeftRight(JZFilter* pFilter)
+ : tCommand(pFilter)
{
}
-void tCmdExchLeftRight::ExecuteEvent(JZTrack *t, JZEvent *e)
+void tCmdExchLeftRight::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- if (e->IsKeyOn())
+ if (pEvent->IsKeyOn())
{
- tKeyOn *k = (tKeyOn *)e->Copy();
- k->SetClock(mpFilter->FromClock + mpFilter->ToClock - k->GetClock());
- t->Kill(e);
- t->Put(k);
+ tKeyOn* pKeyOn = (tKeyOn *)pEvent->Copy();
+ pKeyOn->SetClock(
+ mpFilter->FromClock + mpFilter->ToClock - pKeyOn->GetClock());
+ pTrack->Kill(pEvent);
+ pTrack->Put(pKeyOn);
}
}
@@ -914,176 +949,226 @@
// tCmdExchUpDown
// ************************************************************************
-tCmdExchUpDown::tCmdExchUpDown(JZFilter *f)
- : tCommand(f)
+tCmdExchUpDown::tCmdExchUpDown(JZFilter* pFilter)
+ : tCommand(pFilter)
{
}
-void tCmdExchUpDown::ExecuteTrack(JZTrack *t)
+void tCmdExchUpDown::ExecuteTrack(JZTrack* pTrack)
{
int i;
int Keys[128];
- JZEvent *e;
+ JZEvent* pEvent;
// find all Key's selected
for (i = 0; i < 128; i++)
+ {
Keys[i] = 0;
+ }
- tEventIterator Iterator(t);
- e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
- while (e)
+ tEventIterator Iterator(pTrack);
+ pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
+ while (pEvent)
{
- if (mpFilter->IsSelected(e) && e->IsKeyOn())
+ if (mpFilter->IsSelected(pEvent) && pEvent->IsKeyOn())
{
- tKeyOn *k = (tKeyOn *)e;
- Keys[k->Key] = 1;
+ tKeyOn* pKeyOn = (tKeyOn *)pEvent;
+ Keys[pKeyOn->mKey] = 1;
}
- e = Iterator.Next();
+ pEvent = Iterator.Next();
}
// reverse Key's
- e = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
- while(e)
+ pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock);
+ while (pEvent)
{
- if (mpFilter->IsSelected(e) && e->IsKeyOn())
+ if (mpFilter->IsSelected(pEvent) && pEvent->IsKeyOn())
{
- tKeyOn *k = (tKeyOn *)e->Copy();
+ tKeyOn* pKeyOn = (tKeyOn *)pEvent->Copy();
int n_th = 0;
+
// the n'th key from bottom ..
- for (i = 0; i <= k->Key; i++)
+ for (i = 0; i <= pKeyOn->mKey; i++)
+ {
n_th += Keys[i];
+ }
+
// .. becomes the n'th key from top
for (i = 127; i > 0 && n_th; --i)
+ {
n_th -= Keys[i];
- k->Key = i + 1;
+ }
- t->Kill(e);
- t->Put(k);
+ pKeyOn->mKey = i + 1;
+
+ pTrack->Kill(pEvent);
+ pTrack->Put(pKeyOn);
}
- e = Iterator.Next();
+ pEvent = Iterator.Next();
}
- t->Cleanup();
+ pTrack->Cleanup();
}
-// ************************************************************************
-// tCmdMapper
-// ************************************************************************
-
-//enum prop { veloc, length, key, rhythm, random, pan, modul, cc1, cc2, pitch, clock };
-tCmdMapper::tCmdMapper(JZFilter *f, prop src, prop dst, JZRndArray &arr, int nb, int ad)
- : tCommand(f),
- array(arr)
+//*****************************************************************************
+//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+tCmdMapper::tCmdMapper(
+ JZFilter* pFilter,
+ prop Source,
+ prop Destination,
+ JZRndArray& RandomArray,
+ int BarCount,
+ bool Add)
+ : tCommand(pFilter),
+ mBarCount(BarCount),
+ mStartBar(0),
+ mAdd(Add),
+ mSource(Source),
+ mDestination(Destination),
+ mpBarInfo(0),
+ mRandomArray(RandomArray)
{
- n_bars = nb;
- source = src;
- destin = dst;
- add = ad;
- binfo = new JZBarInfo(mpSong);
- binfo->SetClock(mpFilter->FromClock);
- start_bar = binfo->BarNr;
+ mpBarInfo = new JZBarInfo(*mpSong);
+ mpBarInfo->SetClock(mpFilter->FromClock);
+ mStartBar = mpBarInfo->GetBarIndex();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
tCmdMapper::~tCmdMapper()
{
- delete binfo;
+ delete mpBarInfo;
}
-void tCmdMapper::ExecuteEvent(JZTrack *t, JZEvent *e)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void tCmdMapper::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent)
{
- tKeyOn *k = e->IsKeyOn();
- if (k)
+ tKeyOn* pKeyOn = pEvent->IsKeyOn();
+ if (pKeyOn)
{
int sval = 0;
- switch (source)
+ switch (mSource)
{
case veloc:
- sval = array[(int)k->Veloc];
+ sval = mRandomArray[(int)pKeyOn->mVelocity];
break;
case length:
- sval = array[(int)k->Length];
+ sval = mRandomArray[(int)pKeyOn->mLength];
break;
case key:
- sval = array[(int)k->Key];
+ sval = mRandomArray[(int)pKeyOn->mKey];
break;
- case rhythm: {
- binfo->SetClock(k->GetClock());
-// long sng_tpb = binfo->TicksPerBar;
- long arr_tpb = array.Size() / n_bars;
- long arr_bar = (binfo->BarNr - start_bar) % n_bars;
- long i = arr_tpb * arr_bar + arr_tpb * (k->GetClock() - binfo->Clock) / binfo->TicksPerBar;
-// printf("sng_tpb %ld, arr_tpb %ld, k->GetClock() %ld, binfo->Clock %ld,\n arr.Size() %ld, n_bars %ld, i %ld\n",
-// sng_tpb, arr_tpb, k->GetClock(), binfo->Clock, array.Size(), n_bars, i);
-// fflush(stdout);
- sval = array[(int)i];
+ case rhythm:
+ {
+ mpBarInfo->SetClock(pKeyOn->GetClock());
+ long arr_tpb = mRandomArray.Size() / mBarCount;
+ long arr_bar = (mpBarInfo->GetBarIndex() - mStartBar) % mBarCount;
+ long i = arr_tpb * arr_bar + arr_tpb *
+ (pKeyOn->GetClock() - mpBarInfo->GetClock()) / mpBarInfo->GetTicksPerBar();
+// cout
+// << "mpBarInfo->GetTicksPerBar() " << mpBarInfo->GetTicksPerBar()
+// << ", arr_tpb " << arr_tpb
+// << ", pKeyOn->GetClock() " << pKeyOn->GetClock()
+// << ", mpBarInfo->GetClock() " << mpBarInfo->GetClock()
+// << '\n'
+// << "mRandomArray.Size() " << mRandomArray.Size()
+// << ", mBarCount " << mBarCount
+// << ", i " << i
+// << endl;
+ sval = mRandomArray[(int)i];
}
break;
case random:
- sval = array.Random();
- if (add)
- sval -= array.Size()/2;
+ sval = mRandomArray.Random();
+ if (mAdd)
+ {
+ sval -= mRandomArray.Size()/2;
+ }
break;
default:
break;
}
- switch (destin)
+ switch (mDestination)
{
- case veloc: {
- if (add)
- sval = k->Veloc + sval;
+ case veloc:
+ {
+ if (mAdd)
+ {
+ sval = pKeyOn->mVelocity + sval;
+ }
if (sval > 127)
+ {
sval = 127;
+ }
if (sval < 1)
+ {
sval = 1;
- tKeyOn *c = (tKeyOn *)k->Copy();
- t->Kill(k);
- c->Veloc = sval;
- t->Put(c);
+ }
+ tKeyOn* pKeyOnCopy = (tKeyOn *)pKeyOn->Copy();
+ pTrack->Kill(pKeyOn);
+ pKeyOnCopy->mVelocity = sval;
+ pTrack->Put(pKeyOnCopy);
}
break;
- case key: {
- if (add)
- sval = k->Key + sval;
+ case key:
+ {
+ if (mAdd)
+ {
+ sval = pKeyOn->mKey + sval;
+ }
if (sval > 127)
+ {
sval = 127;
+ }
if (sval < 1)
+ {
sval = 1;
- tKeyOn *c = (tKeyOn *)k->Copy();
- t->Kill(k);
- c->Key = sval;
- t->Put(c);
+ }
+ tKeyOn* pKeyOnCopy = (tKeyOn *)pKeyOn->Copy();
+ pTrack->Kill(pKeyOn);
+ pKeyOnCopy->mKey = sval;
+ pTrack->Put(pKeyOnCopy);
}
break;
- case length: {
- if (add)
- sval = k->Length + sval;
+ case length:
+ {
+ if (mAdd)
+ {
+ sval = pKeyOn->mLength + sval;
+ }
if (sval < 1)
+ {
sval = 1;
- tKeyOn *c = (tKeyOn *)k->Copy();
- t->Kill(k);
- c->Length = sval;
- t->Put(c);
+ }
+ tKeyOn* pKeyOnCopy = (tKeyOn *)pKeyOn->Copy();
+ pTrack->Kill(pKeyOn);
+ pKeyOnCopy->mLength = sval;
+ pTrack->Put(pKeyOnCopy);
}
break;
- case clock: {
- tKeyOn *c = (tKeyOn *)k->Copy();
- c->SetClock(c->GetClock() + sval);
- if (c->GetClock() < 0)
+ case clock:
+ {
+ tKeyOn* pKeyOnCopy = (tKeyOn *)pKeyOn->Copy();
+ pKeyOnCopy->SetClock(pKeyOnCopy->GetClock() + sval);
+ if (pKeyOnCopy->GetClock() < 0)
{
- c->SetClock(0);
+ pKeyOnCopy->SetClock(0);
}
- t->Kill(k);
- t->Put(c);
+ pTrack->Kill(pKeyOn);
+ pTrack->Put(pKeyOnCopy);
}
break;
@@ -1097,4 +1182,3 @@
}
}
}
-
Modified: trunk/jazz/src/Command.h
===================================================================
--- trunk/jazz/src/Command.h 2008-04-19 23:22:59 UTC (rev 466)
+++ trunk/jazz/src/Command.h 2008-04-20 00:00:32 UTC (rev 467)
@@ -35,7 +35,7 @@
class tScale
{
public:
- void Init(int ScaleNr, JZFilter *f = 0);
+ void Init(int ScaleNr, JZFilter* pFilter = 0);
int ScaleKeys[12];
int Member(int Key)
@@ -47,7 +47,7 @@
int Prev(int Key);
int Transpose(int Key, int Steps);
int FitInto(int Key);
- static int Analyze(JZFilter *f); // returns ScaleNr
+ static int Analyze(JZFilter* pFilter); // returns ScaleNr
};
@@ -79,8 +79,8 @@
{
long DeltaClock;
public:
- tCmdShift(JZFilter *f, long DeltaClock);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdShift(JZFilter* pFilter, long DeltaClock);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -88,17 +88,17 @@
{
public:
int LeaveSpace;
- tCmdErase(JZFilter *f, int LeaveSpace = 1);
+ tCmdErase(JZFilter* pFilter, int LeaveSpace = 1);
virtual void Execute(int NewUndo = 1);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
class tCmdVelocity : public tCommand
{
public:
int FromValue, ToValue, Mode;
- tCmdVelocity(JZFilter *f, int From, int To, int Mode);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdVelocity(JZFilter* pFilter, int From, int To, int Mode);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -106,8 +106,8 @@
{
public:
int FromValue, ToValue, Mode;
- tCmdLength(JZFilter *f, int From, int To, int Mode);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdLength(JZFilter* pFilter, int From, int To, int Mode);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -116,8 +116,8 @@
public:
double scale;
long startClock;
- tCmdSeqLength(JZFilter *f, double scale);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdSeqLength(JZFilter* pFilter, double scale);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -129,16 +129,20 @@
long clockDelay;
int repeat;
- tCmdMidiDelay(JZFilter *f, double scale, long clockDelay, int repeat);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdMidiDelay(
+ JZFilter* pFilter,
+ double scale,
+ long clockDelay,
+ int repeat);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
class tCmdConvertToModulation : public tCommand
{
public:
- tCmdConvertToModulation(JZFilter *f);
- virtual void ExecuteTrack(JZTrack *t);
+ tCmdConvertToModulation(JZFilter* pFilter);
+ virtual void ExecuteTrack(JZTrack* pTrack);
};
@@ -151,9 +155,9 @@
int shortenOverlaps;
tKeyOn *prev_note[16][128];
public:
- tCmdCleanup(JZFilter *f, long limitClocks, int shortenOverlaps);
- virtual void ExecuteTrack(JZTrack *t);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdCleanup(JZFilter* pFilter, long limitClocks, int shortenOverlaps);
+ virtual void ExecuteTrack(JZTrack* pTrack);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -161,8 +165,8 @@
{
short fr, to;
public:
- tCmdSearchReplace(JZFilter *f, short fr, short to);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdSearchReplace(JZFilter* pFilter, short fr, short to);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -171,12 +175,12 @@
long Quantize(long Clock, int islen);
public:
long QntClocks;
- int NoteStart; // yes
- int NoteLength; // no
+ int NoteStart; // yes
+ int NoteLength; // no
int Delay; // zero
- int Groove; // zero
- tCmdQuantize(JZFilter *f, long QntClocks, int groove, int delay);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ int Groove; // zero
+ tCmdQuantize(JZFilter* pFilter, long QntClocks, int groove, int delay);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -186,8 +190,12 @@
int Notes;
int FitIntoScale;
tScale Scale;
- tCmdTranspose(JZFilter *f, int Notes, int ScaleNr = 0, int FitIntoScale = 0);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdTranspose(
+ JZFilter* pFilter,
+ int Notes,
+ int ScaleNr = 0,
+ int FitIntoScale = 0);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -195,8 +203,8 @@
{
public:
int NewChannel; // 0
- tCmdSetChannel(JZFilter *f, int NewChannel);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdSetChannel(JZFilter* pFilter, int NewChannel);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
@@ -206,7 +214,7 @@
tCmdCopyToBuffer(JZFilter* pFilter, tEventArray *Buffer);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
private:
@@ -226,8 +234,8 @@
int InsertSpace; // no
long RepeatClock; // -1L
- tCmdCopy(JZFilter *f, long DestTrack, long DestClock);
- virtual void ExecuteTrack(JZTrack *t);
+ tCmdCopy(JZFilter* pFilter, long DestTrack, long DestClock);
+ virtual void ExecuteTrack(JZTrack* pTrack);
};
@@ -235,32 +243,56 @@
class tCmdExchLeftRight : public tCommand
{
public:
- tCmdExchLeftRight(JZFilter *f);
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+ tCmdExchLeftRight(JZFilter* pFilter);
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
};
class tCmdExchUpDown : public tCommand
{
public:
- tCmdExchUpDown(JZFilter *f);
- virtual void ExecuteTrack(JZTrack *t);
+ tCmdExchUpDown(JZFilter* pFilter);
+ virtual void ExecuteTrack(JZTrack* pTrack);
};
class tCmdMapper : public tCommand
{
public:
- enum prop { veloc, length, key, rhythm, random, pan, modul, cc1, cc2, pitch, clock };
- tCmdMapper(JZFilter *f, prop src, prop dst, JZRndArray &array, int nbars, int add);
- ~tCmdMapper();
- virtual void ExecuteEvent(JZTrack *t, JZEvent *e);
+
+ enum prop
+ {
+ veloc,
+ length,
+ key,
+ rhythm,
+ random,
+ pan,
+ modul,
+ cc1,
+ cc2,
+ pitch,
+ clock
+ };
+
+ tCmdMapper(
+ JZFilter* pFilter,
+ prop Destination,
+ prop dst,
+ JZRndArray& RandomArray,
+ int BarCount,
+ bool Add);
+
+ virtual ~tCmdMapper();
+
+ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent);
+
private:
- int n_bars;
- int start_bar;
- int add;
- prop source;
- prop destin;
- JZBarInfo *binfo;
- JZRndArray &array;
+ int mBarCount;
+ int mStartBar;
+ bool mAdd;
+ prop mSource;
+ prop mDestination;
+ JZBarInfo* mpBarInfo;
+ JZRndArray& mRandomArray;
};
#endif // !defined(JZ_COMMAND_H)
Modified: trunk/jazz/src/ControlEdit.cpp
===================================================================
--- trunk/jazz/src/ControlEdit.cpp 2008-04-19 23:22:59 UTC (rev 466)
+++ trunk/jazz/src/ControlEdit.cpp 2008-04-20 00:00:32 UTC (rev 467)
@@ -77,17 +77,20 @@
wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL );
- if (!ctrlmode) {
- topsizer->Add(new wxButton(panel, -1, "Apply")) ;
+ if (!ctrlmode)
+ {
+ topsizer->Add(new wxButton(panel, wxID_ANY, "Apply")) ;
//(wxFunction)Apply,
- topsizer->Add(new wxButton(panel, -1, "Revert")) ;
+ topsizer->Add(new wxButton(panel, wxID_ANY, "Revert")) ;
//(wxFunction)Revert,
//(void)new wxButton(panel, (wxFunction)Bars, "Bars");
- } else {
- topsizer->Add(new wxButton(panel, -1, "Create")); // create new events (wxFunction)Apply,
- topsizer->Add(new wxButton(panel, -1, "Change")); // change existing events (wxFunction)Edit,
- topsizer->Add(new wxButton(panel, -1, "Revert")); //(wxFunction)Revert,
+ }
+ else
+ {
+ topsizer->Add(new wxButton(panel, wxID_ANY, "Create")); // create new events (wxFunction)Apply,
+ topsizer->Add(new wxButton(panel, wxID_ANY,"Change")); // change existing events (wxFunction)Edit,
+ topsizer->Add(new wxButton(panel, wxID_ANY, "Revert")); //(wxFunction)Revert,
//(void)new wxButton(panel, (wxFunction)Bars, "Bars");
}
ctrlmode = 0;
@@ -115,7 +118,10 @@
// SN++
void tCtrlEditBase::UpDate()
{
- if (!selectable) return;
+ if (!selectable)
+ {
+ return;
+ }
OnRevert();
}
//
@@ -157,16 +163,21 @@
{
long i = Clock2i(clock);
if (i >= i_max-1)
- /* PAT - The following ifdef was removed due to changes in gcc 3.x. If it
- needs to be put back for compatibility purposes, it will need to return
- in an alternate form. */
- /*#ifdef FOR_MSW*/
- return array[(int)(i_max-1)];
+ {
+ //* PAT - The following ifdef was removed due to changes in gcc 3.x. If
+ // it needs to be put back for compatibility purposes, it will need to
+ // return in an alternate form.
+// #ifdef FOR_MSW
+ return array[(int)(i_max - 1)];
+ }
return array[(int)i];
- /*#else
- return array[i_max-1];
- return array[i];
- #endif*/
+//#else
+// {
+// return array[i_max-1];
+// }
+// return array[i];
+//#endif
+
#if 0
long v1 = array[i];
long v2 = array[i+1];
@@ -186,28 +197,30 @@
if (sticky && !selectable)
{
- JZEvent *e = iter.Range(0, from_clock);
- while (e)
+ JZEvent* pEvent = iter.Range(0, from_clock);
+ while (pEvent)
{
- if (IsCtrlEdit(e))
+ if (IsCtrlEdit(pEvent))
{
- val = GetValue(e);
+ val = GetValue(pEvent);
}
- e = iter.Next();
+ pEvent = iter.Next();
}
}
- JZEvent *e = iter.Range(from_clock, to_clock);
+ JZEvent* pEvent = iter.Range(from_clock, to_clock);
for (i = 0; i < array.Size(); i++)
+ {
array[i] = val;
+ }
i = 0;
- while (e)
+ while (pEvent)
{
- if (IsCtrlEdit(e))
+ if (IsCtrlEdit(pEvent))
{
- int k = Clock2i(e->GetClock());
+ int k = Clock2i(pEvent->GetClock());
if (sticky)
{
while (i < k)
@@ -215,14 +228,18 @@
array[i++] = val;
}
}
- val = GetValue(e);
+ val = GetValue(pEvent);
array[k] = val;
}
- e = iter.Next();
+ pEvent = iter.Next();
}
if (sticky && !selectable)
+ {
while (i < array.Size())
+ {
array[i++] = val;
+ }
+ }
edit->Refresh();
}
@@ -243,30 +260,32 @@
// delete old events, but skip clock 0 to preserve track defaults:
// (dirty but might work...)
tEventIterator iter(track);
- JZEvent *e = iter.Range(std::max(1L, from_clock), to_clock);
+ JZEvent* pEvent = iter.Range(std::max(1L, from_clock), to_clock);
int old_val = Missing();
// SN++ events nur im apply-mode loeschen!
if (!ctrlmode)
{
- while (e)
+ while (pEvent)
{
- if (IsCtrlEdit(e))
- track->Kill(e);
- e = iter.Next();
+ if (IsCtrlEdit(pEvent))
+ {
+ track->Kill(pEvent);
+ }
+ pEvent = iter.Next();
}
// find any previous events
if (sticky)
{
- e = iter.Range(0, from_clock - 1);
- while (e)
+ pEvent = iter.Range(0, from_clock - 1);
+ while (pEvent)
{
- if (IsCtrlEdit(e))
+ if (IsCtrlEdit(pEvent))
{
- old_val = GetValue(e);
+ old_val = GetValue(pEvent);
}
- e = iter.Next();
+ pEvent = iter.Next();
}
}
@@ -279,8 +298,8 @@
if (old_val != new_val)
{
- e = NewEvent(clock, new_val);
- track->Put(e);
+ pEvent = NewEvent(clock, new_val);
+ track->Put(pEvent);
old_val = new_val;
}
}
@@ -290,20 +309,20 @@
// edit mode: Erzeugt keine neuen Events sondern aendert den Wert
// bestehender Events.
// SN++
- tControl *cpy;
- while (e)
+ tControl* pControlCopy;
+ while (pEvent)
{
- if(IsCtrlEdit(e))
+ if (IsCtrlEdit(pEvent))
{
- if (Clock2Val(e->GetClock()) != e->IsControl()->Value)
+ if (Clock2Val(pEvent->GetClock()) != pEvent->IsControl()->Value)
{
- cpy = e->Copy()->IsControl();
- cpy->Value = Clock2Val(e->GetClock());
- track->Kill(e);
- track->Put(cpy);
+ pControlCopy = pEvent->Copy()->IsControl();
+ pControlCopy->Value = Clock2Val(pEvent->GetClock());
+ track->Kill(pEvent);
+ track->Put(pControlCopy);
}
}
- e = iter.Next();
+ pEvent = iter.Next();
}
}
@@ -359,25 +378,27 @@
// av: called by tArrayEdit::OnPaint
void tCtrlEditBase::DrawBars(wxDC* dc)
{
- JZBarInfo BarInfo(mpPianoWindow->GetSong());
+ JZBarInfo BarInfo(*mpPianoWindow->GetSong());
BarInfo.SetClock(from_clock);
long gclk,x;
int ii;
if (bars_state > 0)
{
- gclk = BarInfo.Clock;
+ gclk = BarInfo.GetClock();
while (gclk < to_clock)
{
- gclk = BarInfo.Clock;
+ gclk = BarInfo.GetClock();
x = mpPianoWindow->Clock2x(gclk-from_clock);
edit->DrawBarLine(dc, x - x_off);
if (bars_state == 2)
- for (ii = 0; ii < BarInfo.CountsPerBar; ii++)
+ {
+ for (ii = 0; ii < BarInfo.GetCountsPerBar(); ++ii)
{
- gclk += BarInfo.TicksPerBar / BarInfo.CountsPerBar;
+ gclk += BarInfo.GetTicksPerBar() / BarInfo.GetCountsPerBar();
x = mpPianoWindow->Clock2x(gclk-from_clock);
edit->DrawBarLine(dc, x - x_off);
}
+ }
BarInfo.Next();
}
}
@@ -403,14 +424,14 @@
return 0;
}
-int tPitchEdit::IsCtrlEdit(JZEvent *e)
+int tPitchEdit::IsCtrlEdit(JZEvent* pEvent)
{
- return e->IsPitch() != 0;
+ return pEvent->IsPitch() != 0;
}
-int tPitchEdit::GetValue(JZEvent *e)
+int tPitchEdit::GetValue(JZEvent* pEvent)
{
- return e->IsPitch()->Value;
+ return pEvent->IsPitch()->Value;
}
JZEvent * tPitchEdit::NewEvent(long clock, int val)
@@ -440,21 +461,22 @@
int tCtrlEdit::Missing()
{
-
if (ctrl_num == 10)
+ {
return 64;
+ }
return 0;
}
-int tCtrlEdit::IsCtrlEdit(JZEvent *e)
+int tCtrlEdit::IsCtrlEdit(JZEvent* pEvent)
{
- tControl *c = e->IsControl();
+ tControl *c = pEvent->IsControl();
return (c && c->Control == ctrl_num);
}
-int tCtrlEdit::GetValue(JZEvent *e)
+int tCtrlEdit::GetValue(JZEvent* pEvent)
{
- return e->IsControl()->Value;
+ return pEvent->IsControl()->Value;
}
JZEvent * tCtrlEdit::NewEvent(long clock, int val)
@@ -483,30 +505,30 @@
return 1;
}
-int tVelocEdit::IsCtrlEdit(JZEvent *e)
+int tVelocEdit::IsCtrlEdit(JZEvent* pEvent)
{
// SN++ Falls im PianoWin Events selektiert sind, werden nur diese
// Events geaendert
if (!mpPianoWindow->mpSnapSel->Selected)
{
- return (e->IsKeyOn() != 0);
+ return (pEvent->IsKeyOn() != 0);
}
else
{
- if (e->IsKeyOn())
+ if (pEvent->IsKeyOn())
{
return (
- mpPianoWindow->GetFilter()->IsSelected(e) &&
- (e->GetClock() >= mpPianoWindow->GetFilter()->FromClock &&
- e->GetClock() <= mpPianoWindow->GetFilter()->ToClock));
+ mpPianoWindow->GetFilter()->IsSelected(pEvent) &&
+ (pEvent->GetClock() >= mpPianoWindow->GetFilter()->FromClock &&
+ pEvent->GetClock() <= mpPianoWindow->GetFilter()->ToClock));
}
}
return 0;
}
-int tVelocEdit::GetValue(JZEvent *e)
+int tVelocEdit::GetValue(JZEvent* pEvent)
{
- return e->IsKeyOn()->Veloc;
+ return pEvent->IsKeyOn()->mVelocity;
}
void tVelocEdit::OnApply()
@@ -522,31 +544,36 @@
{
from_clk = mpPianoWindow->GetFilter()->FromClock;
to_clk = mpPianoWindow->GetFilter()->ToClock;
- } else {
+ }
+ else
+ {
from_clk = from_clock;
to_clk = to_clock;
}
- JZEvent *e = iter.Range(from_clk, to_clk);
+ JZEvent* pEvent = iter.Range(from_clk, to_clk);
- while (e) {
+ while (pEvent)
+ {
// SN++ Falls im PianoWin Events selektiert sind, werden nur diese
// Events geaendert
- if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) )
- {
-
- tKeyOn *k = e->IsKeyOn();
- if (k)
+ if (
+ !mpPianoWindow->mpSnapSel->Selected ||
+ mpPianoWindow->GetFilter()->IsSelected(pEvent))
{
- tKeyOn *cpy = k->Copy()->IsKeyOn();
- int i = Clock2i(cpy->GetClock());
- cpy->Veloc = array[i];
- track->Kill(k);
- track->Put(cpy);
+ tKeyOn* pKeyOn = pEvent->IsKeyOn();
+ if (pKeyOn)
+ {
+ tKeyOn* pKeyOnCopy = pKeyOn->Copy()->IsKeyOn();
+
+ int i = Clock2i(pKeyOnCopy->GetClock());
+ pKeyOnCopy->mVelocity = array[i];
+ track->Kill(pKeyOn);
+ track->Put(pKeyOnCopy);
+ }
}
- }
- e = iter.Next();
+ pEvent = iter.Next();
}
track->Cleanup();
wxEndBusyCursor();
@@ -578,28 +605,34 @@
return 0;
}
-int tPolyAfterEdit::IsCtrlEdit(JZEvent *e)
+int tPolyAfterEdit::IsCtrlEdit(JZEvent* pEvent)
{
// SN++ Falls im PianoWin Events selektiert sind, werden nur diese
// Events geaendert
if (!mpPianoWindow->mpSnapSel->Selected)
- return e->IsKeyPressure() != 0;
+ {
+ return pEvent->IsKeyPressure() != 0;
+ }
else
- if (e->IsKeyPressure())
- {
- return (
- mpPianoWindow->GetFilter()->IsSelected(e) &&
- (e->GetClock() >= mpPianoWindow->GetFilter()->FromClock &&
- e->GetClock() <= mpPianoWindow->GetFilter()->ToClock));
- }
+ {
+ if (pEvent->IsKeyPressure())
+ {
+ return (
+ mpPianoWindow->GetFilter()->IsSelected(pEvent) &&
+ (pEvent->GetClock() >= mpPianoWindow->GetFilter()->FromClock &&
+ pEvent->GetClock() <= mpPianoWindow->GetFilter()->ToClock));
+ }
+ }
return 0;
}
-int tPolyAfterEdit::GetValue(JZEvent *e)
+int tPolyAfterEdit::GetValue(JZEvent* pEvent)
{
- if (e->IsKeyPressure())
- return e->IsKeyPressure()->Value;
+ if (pEvent->IsKeyPressure())
+ {
+ return pEvent->IsKeyPressure()->Value;
+ }
return -1;
}
@@ -607,7 +640,7 @@
void tPolyAfterEdit::OnApply()
{
static long from_clk, to_clk;
- JZEvent *e;
+ JZEvent* pEvent;
// SN++ Apply works only if some events are selected !!
if (!mpPianoWindow->mpSnapSel->Selected)
@@ -634,36 +667,44 @@
tKeyPressure *k;
tKeyOn *keyon;
- if (!ctrlmode) { // OnApply
- // SN++ Alle selektierten AfterTouch events loeschen
- e = iter.Range(from_clk, to_clk);
- while (e) {
- if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) )
+ if (!ctrlmode)
+ {
+ // OnApply
+
+ // SN++ Alle selektierten AfterTouch events loeschen
+ pEvent = iter.Range(from_clk, to_clk);
+ while (pEvent)
+ {
+ if (
+ !mpPianoWindow->mpSnapSel->Selected ||
+ mpPianoWindow->GetFilter()->IsSelected(pEvent))
{
- k = e->IsKeyPressure();
+ k = pEvent->IsKeyPressure();
if (k)
{
track->Kill(k);
}
}
- e = iter.Next();
+ pEvent = iter.Next();
}
// SN++ Neue Aftertouch's von KeyOn bis KeyLength einfuehgen;
long key_end(-1), key_clk(-1);
int key_val = -1;
int key_cha(-1);
JZEvent *after;
- e = iter.Range(from_clk, to_clk);
- while (e)
+ pEvent = iter.Range(from_clk, to_clk);
+ while (pEvent)
{
- if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) )
+ if (
+ !mpPianoWindow->mpSnapSel->Selected ||
+ mpPianoWindow->GetFilter()->IsSelected(pEvent))
{
- keyon = e->IsKeyOn();
+ keyon = pEvent->IsKeyOn();
if (keyon)
{
key_clk = keyon->GetClock() + 1;
- key_end = keyon->GetClock() + keyon->Length;
- key_val = keyon->Key;
+ key_end = keyon->GetClock() + keyon->mLength;
+ key_val = keyon->mKey;
key_cha = keyon->Channel;
}
if (key_val>0)
@@ -685,7 +726,7 @@
key_val = -1;
}
}
- e = iter.Next();
+ pEvent = iter.Next();
}
}
else
@@ -694,24 +735,26 @@
// edit mode: Erzeugt keine neuen Events sondern aendert den Wert
// bestehender Events.
// SN++
- e = iter.Range(from_clk, to_clk);
- tKeyPressure *cpy;
- while (e)
+ pEvent = iter.Range(from_clk, to_clk);
+ tKeyPressure* pKeyPressureCopy;
+ while (pEvent)
{
- if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e))
+ if (
+ !mpPianoWindow->mpSnapSel->Selected ||
+ mpPianoWindow->GetFilter()->IsSelected(pEvent))
{
- if(e->IsKeyPressure())
+ if (pEvent->IsKeyPressure())
{
- if (Clock2Val(e->GetClock()) != e->IsKeyPressure()->Value)
+ if (Clock2Val(pEvent->GetClock()) != pEvent->IsKeyPressure()->Value)
{
- cpy = e->Copy()->IsKeyPressure();
- cpy->Value = Clock2Val(e->GetClock());
- track->Kill(e);
- track->Put(cpy);
+ pKeyPressureCopy = pEvent->Copy()->IsKeyPressure();
+ pKeyPressureCopy->Value = Clock2Val(pEvent->GetClock());
+ track->Kill(pEvent);
+ track->Put(pKeyPressureCopy);
}
}
}
- e = iter.Next();
+ pEvent = iter.Next();
}
}
@@ -742,14 +785,14 @@
return 0;
}
-int tChannelAfterEdit::IsCtrlEdit(JZEvent *e)
+int tChannelAfterEdit::IsCtrlEdit(JZEvent* pEvent)
{
- return e->IsChnPressure() != 0;
+ return pEvent->IsChnPressure() != 0;
}
-int tChannelAfterEdit::GetValue(JZEvent *e)
+int tChannelAfterEdit::GetValue(JZEvent* pEvent)
{
- return e->IsChnPressure()->Value;
+ return pEvent->IsChnPressure()->Value;
}
@@ -772,32 +815,32 @@
// delete old events, but skip clock 0 to preserve track defaults:
// (dirty but might work...)
tEventIterator iter(track);
- JZEvent *e = iter.Range(std::max(1L, from_clock), to_clock);
+ JZEvent* pEvent = iter.Range(std::max(1L, from_clock), to_clock);
int old_val = Missing();
// SN++ events nur im apply-mode loeschen!
if (!ctrlmode)
{
- while (e)
+ while (pEvent)
{
- if (IsCtrlEdit(e))
+ if (IsCtrlEdit(pEvent))
{
- track->Kill(e);
+ track->Kill(pEvent);
}
- e = iter.Next();
+ pEvent = iter.Next();
}
// find any previous events
if (sticky)
{
- e = iter.Range(0, from_clock - 1);
- while (e)
+ pEvent = iter.Range(0, from_clock - 1);
+ while (pEvent)
{
- if (IsCtrlEdit(e))
+ if (IsCtrlEdit(pEvent))
{
- old_val = GetValue(e);
+ old_val = GetValue(pEvent);
}
- e = iter.Next();
+ pEvent = iter.Next();
}
}
@@ -810,8 +853,8 @@
if (old_val != new_val)
{
- e = NewEvent(clock, new_val);
- track->Put(e);
+ pEvent = NewEvent(clock, new_val);
+ track->Put(pEvent);
old_val = new_val;
}
}
@@ -821,20 +864,20 @@
// edit mode: Erzeugt keine neuen Events sondern aendert den Wert
// bestehender Events.
// SN++
- tChnPressure *cpy;
- while (e)
+ tChnPressure* pChnPressureCopy;
+ while (pEvent)
{
- if(IsCtrlEdit(e))
+ if (IsCtrlEdit(pEvent))
{
- if (Clock2Val(e->GetClock()) != GetValue(e))
+ if (Clock2Val(pEvent->GetClock()) != GetValue(pEvent))
{
- cpy = e->Copy()->IsChnPressure();
- cpy->Value = Clock2Val(e->GetClock());
- track->Kill(e);
- track->Put(cpy);
+ pChnPressureCopy = pEvent->Copy()->IsChnPressure();
+ pChnPressureCopy->Value = Clock2Val(pEvent->GetClock());
+ track->Kill(pEvent);
+ track->Put(pChnPressureCopy);
}
}
- e = iter.Next();
+ pEvent = iter.Next();
}
}
@@ -867,14 +910,14 @@
return track->GetDefaultSpeed();
}
-int tTempoEdit::IsCtrlEdit(JZEvent *e)
+int tTempoEdit::IsCtrlEdit(JZEvent* pEvent)
{
- return e->IsSetTempo() != 0;
+ return pEvent->IsSetTempo() != 0;
}
-int tTempoEdit::GetValue(JZEvent *e)
+int tTempoEdit::GetValue(JZEvent* pEvent)
{
- return e->IsSetTempo()->GetBPM();
+ return pEvent->IsSetTempo()->GetBPM();
}
JZEvent * tTempoEdit::NewEvent(long clock, int val)
Modified: trunk/jazz/src/Dialogs/KeyOnDialog.cpp
=============================================================...
[truncated message content] |
|
From: <pst...@us...> - 2008-04-19 23:23:04
|
Revision: 466
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=466&view=rev
Author: pstieber
Date: 2008-04-19 16:22:59 -0700 (Sat, 19 Apr 2008)
Log Message:
-----------
Added KeyOnDialog.cpp/.h and StringUtilities.cpp/.h and fixed a typo by replacing
cpp with h.
Modified Paths:
--------------
trunk/jazz/src/Makefile.am
Modified: trunk/jazz/src/Makefile.am
===================================================================
--- trunk/jazz/src/Makefile.am 2008-04-19 23:21:32 UTC (rev 465)
+++ trunk/jazz/src/Makefile.am 2008-04-19 23:22:59 UTC (rev 466)
@@ -18,6 +18,7 @@
DeprecatedWx/prop.cpp \
DeprecatedWx/propform.cpp \
DeprecatedWx/proplist.cpp \
+Dialogs/KeyOnDialog.cpp \
Dialogs/MetronomeSettingsDialog.cpp \
Dialogs/SynthesizerSettingsDialog.cpp \
Dialogs.cpp \
@@ -72,6 +73,7 @@
Song.cpp \
StandardFile.cpp \
StringReadWrite.cpp \
+StringUtilities.cpp \
Synth.cpp \
ToolBar.cpp \
Track.cpp \
@@ -94,7 +96,8 @@
DeprecatedWx/propform.h \
DeprecatedWx/proplist.h \
DeprecatedStringUtils.h \
-Dialogs/MetronomeSettingsDialog.cpp \
+Dialogs/KeyOnDialog.h \
+Dialogs/MetronomeSettingsDialog.h \
Dialogs/SynthesizerSettingsDialog.h \
Dialogs.h \
DynamicArray.h \
@@ -150,6 +153,7 @@
Song.h \
StandardFile.h \
StringReadWrite.h \
+StringUtilities.h \
Synth.h \
ToolBar.h \
TrackFrame.h \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-19 23:21:38
|
Revision: 465
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=465&view=rev
Author: pstieber
Date: 2008-04-19 16:21:32 -0700 (Sat, 19 Apr 2008)
Log Message:
-----------
Added a new version of the key on dialog.
Added Paths:
-----------
trunk/jazz/src/Dialogs/KeyOnDialog.cpp
trunk/jazz/src/Dialogs/KeyOnDialog.h
Added: trunk/jazz/src/Dialogs/KeyOnDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/KeyOnDialog.cpp (rev 0)
+++ trunk/jazz/src/Dialogs/KeyOnDialog.cpp 2008-04-19 23:21:32 UTC (rev 465)
@@ -0,0 +1,273 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2008 Peter J. Stieber, all rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//*****************************************************************************
+
+#include "WxWidgets.h"
+
+#include "KeyOnDialog.h"
+
+#include "../Globals.h"
+#include "../Project.h"
+#include "../Events.h"
+#include "../Knob.h"
+#include "../KeyStringConverters.h"
+#include "../Resources.h"
+
+#include <sstream>
+
+using namespace std;
+
+//*****************************************************************************
+//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+BEGIN_EVENT_TABLE(JZKeyOnDialog, wxDialog)
+
+ EVT_KNOB_CHANGED(IDC_KB_VELOCITY, JZKeyOnDialog::OnVelocityChange)
+
+ EVT_KNOB_CHANGED(IDC_KB_OFF_VELOCITY, JZKeyOnDialog::OnOffVelocityChange)
+
+ EVT_KNOB_CHANGED(IDC_KB_CHANNEL, JZKeyOnDialog::OnChannelChange)
+
+ EVT_BUTTON(wxID_HELP, JZKeyOnDialog::OnHelp)
+
+END_EVENT_TABLE()
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZKeyOnDialog::JZKeyOnDialog(tKeyOn* pEvent, wxWindow* pParent)
+ : wxDialog(pParent, wxID_ANY, wxString("Key On")),
+ mpEvent(pEvent),
+ mpPitchEdit(0),
+ mpVelocityValue(0),
+ mpVelocityKnob(0),
+ mpOffVelocityValue(0),
+ mpOffVelocityKnob(0),
+ mpLengthEdit(0),
+ mpChannelValue(0),
+ mpChannelKnob(0),
+ mpClockEdit(0)
+{
+ mpPitchEdit = new wxTextCtrl(this, wxID_ANY);
+
+ mpVelocityValue = new wxStaticText(this, wxID_ANY, "000");
+
+ mpVelocityKnob = new JZKnob(this, IDC_KB_VELOCITY, 0, 0, 127);
+
+ mpOffVelocityValue = new wxStaticText(this, wxID_ANY, "000");
+
+ mpOffVelocityKnob = new JZKnob(this, IDC_KB_OFF_VELOCITY, 0, 0, 127);
+
+ mpLengthEdit = new wxTextCtrl(this, wxID_ANY);
+
+ mpChannelValue = new wxStaticText(this, wxID_ANY, "00");
+
+ mpChannelKnob = new JZKnob(this, IDC_KB_CHANNEL, 0, 1, 16);
+
+ mpClockEdit = new wxTextCtrl(this, wxID_ANY);
+
+ wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK");
+ wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel");
+ wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help");
+ pOkButton->SetDefault();
+
+ wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL);
+
+ wxFlexGridSizer* pFlexGridSizer;
+
+ pFlexGridSizer = new wxFlexGridSizer(1, 2, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Pitch:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(mpPitchEdit, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 2);
+
+ pFlexGridSizer = new wxFlexGridSizer(2, 3, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Velocity:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(
+ mpVelocityValue,
+ 0,
+ wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE);
+ pFlexGridSizer->Add(mpVelocityKnob, 0, wxALIGN_CENTER_VERTICAL);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Off Velocity:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(
+ mpOffVelocityValue,
+ 0,
+ wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE);
+ pFlexGridSizer->Add(mpOffVelocityKnob, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxALIGN_CENTER);
+
+ pFlexGridSizer = new wxFlexGridSizer(1, 2, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Length:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(mpLengthEdit, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 2);
+
+ pFlexGridSizer = new wxFlexGridSizer(1, 3, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Channel:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(
+ mpChannelValue,
+ 0,
+ wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE);
+ pFlexGridSizer->Add(mpChannelKnob, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 2);
+
+ pFlexGridSizer = new wxFlexGridSizer(1, 2, 4, 2);
+
+ pFlexGridSizer->Add(
+ new wxStaticText(this, wxID_ANY, "Clock:"),
+ 0,
+ wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL);
+ pFlexGridSizer->Add(mpClockEdit, 0, wxALIGN_CENTER_VERTICAL);
+
+ pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 2);
+
+ wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL);
+ pButtonSizer->Add(pOkButton, 0, wxALL, 5);
+ pButtonSizer->Add(pCancelButton, 0, wxALL, 5);
+ pButtonSizer->Add(pHelpButton, 0, wxALL, 5);
+
+ pTopSizer->Add(pButtonSizer, 0, wxALIGN_CENTER | wxBOTTOM, 6);
+
+ SetAutoLayout(true);
+ SetSizer(pTopSizer);
+
+ pTopSizer->SetSizeHints(this);
+ pTopSizer->Fit(this);
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZKeyOnDialog::TransferDataToWindow()
+{
+ string KeyString;
+ KeyToString(mpEvent->mKey, KeyString);
+ mpPitchEdit->ChangeValue(KeyString.c_str());
+
+ ostringstream Oss;
+
+ Oss << (int)mpEvent->mVelocity;
+ mpVelocityValue->SetLabel(Oss.str().c_str());
+
+ mpVelocityKnob->SetValue(mpEvent->mVelocity);
+
+ Oss.str("");
+ Oss << (int)mpEvent->GetOffVelocity();
+ mpOffVelocityValue->SetLabel(Oss.str().c_str());
+
+ mpOffVelocityKnob->SetValue(mpEvent->GetOffVelocity());
+
+ wxString LengthString;
+ LengthString << mpEvent->Length;
+ mpLengthEdit->ChangeValue(LengthString);
+
+ Oss.str("");
+ Oss << (int)mpEvent->Channel + 1;
+ mpChannelValue->SetLabel(Oss.str().c_str());
+
+ mpChannelKnob->SetValue(mpEvent->Channel + 1);
+
+ string ClockString;
+ gpProject->ClockToString(mpEvent->GetClock(), ClockString);
+ mpClockEdit->ChangeValue(ClockString.c_str());
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZKeyOnDialog::TransferDataFromWindow()
+{
+ wxString KeyString = mpPitchEdit->GetValue();
+ mpEvent->mKey = StringToKey(KeyString.c_str());
+
+ mpEvent->mVelocity = mpVelocityKnob->GetValue();
+
+ mpEvent->SetOffVelocity(mpOffVelocityKnob->GetValue());
+
+ wxString LengthString = mpLengthEdit->GetValue();
+ istringstream Iss(LengthString.c_str());
+ Iss >> mpEvent->Length;
+
+ mpEvent->Channel = mpChannelKnob->GetValue() - 1;
+
+ wxString ClockString = mpClockEdit->GetValue();
+ int Clock = gpProject->StringToClock(ClockString.c_str());
+ mpEvent->SetClock(Clock);
+
+ return true;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZKeyOnDialog::OnVelocityChange(JZKnobEvent& Event)
+{
+ int Value = Event.GetValue();
+ ostringstream Oss;
+ Oss << Value;
+ mpVelocityValue->SetLabel(Oss.str().c_str());
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZKeyOnDialog::OnOffVelocityChange(JZKnobEvent& Event)
+{
+ int Value = Event.GetValue();
+ ostringstream Oss;
+ Oss << Value;
+ mpOffVelocityValue->SetLabel(Oss.str().c_str());
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZKeyOnDialog::OnChannelChange(JZKnobEvent& Event)
+{
+ int Value = Event.GetValue();
+ ostringstream Oss;
+ Oss << Value;
+ mpChannelValue->SetLabel(Oss.str().c_str());
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZKeyOnDialog::OnHelp(wxCommandEvent& Event)
+{
+// gpHelpInstance->ShowTopic("Key On Dialog");
+}
Property changes on: trunk/jazz/src/Dialogs/KeyOnDialog.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/jazz/src/Dialogs/KeyOnDialog.h
===================================================================
--- trunk/jazz/src/Dialogs/KeyOnDialog.h (rev 0)
+++ trunk/jazz/src/Dialogs/KeyOnDialog.h 2008-04-19 23:21:32 UTC (rev 465)
@@ -0,0 +1,71 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2008 Peter J. Stieber, all rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//*****************************************************************************
+
+#ifndef JZ_KEYONDIALOG_H
+#define JZ_KEYONDIALOG_H
+
+class tKeyOn;
+class JZKnobEvent;
+class JZKnob;
+
+//*****************************************************************************
+//*****************************************************************************
+class JZKeyOnDialog : public wxDialog
+{
+ public:
+
+ JZKeyOnDialog(tKeyOn* pEvent, wxWindow* pParent);
+
+ private:
+
+ virtual bool TransferDataToWindow();
+
+ virtual bool TransferDataFromWindow();
+
+ void OnVelocityChange(JZKnobEvent& Event);
+
+ void OnOffVelocityChange(JZKnobEvent& Event);
+
+ void OnChannelChange(JZKnobEvent& Event);
+
+ void OnHelp(wxCommandEvent& Event);
+
+ private:
+
+ tKeyOn* mpEvent;
+// int mPitch;
+// int mVelocity;
+// int mLength;
+// int mOffVelocity;
+
+ wxTextCtrl* mpPitchEdit;
+ wxStaticText* mpVelocityValue;
+ JZKnob* mpVelocityKnob;
+ wxStaticText* mpOffVelocityValue;
+ JZKnob* mpOffVelocityKnob;
+ wxTextCtrl* mpLengthEdit;
+ wxStaticText* mpChannelValue;
+ JZKnob* mpChannelKnob;
+ wxTextCtrl* mpClockEdit;
+
+ DECLARE_EVENT_TABLE();
+};
+
+#endif // !defined(JZ_KEYONDIALOG_H)
Property changes on: trunk/jazz/src/Dialogs/KeyOnDialog.h
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-19 23:20:22
|
Revision: 464
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=464&view=rev
Author: pstieber
Date: 2008-04-19 16:20:18 -0700 (Sat, 19 Apr 2008)
Log Message:
-----------
Added a string utility function that tokenizes a std::string based on the passed
delimiters.
Added Paths:
-----------
trunk/jazz/src/StringUtilities.cpp
trunk/jazz/src/StringUtilities.h
Added: trunk/jazz/src/StringUtilities.cpp
===================================================================
--- trunk/jazz/src/StringUtilities.cpp (rev 0)
+++ trunk/jazz/src/StringUtilities.cpp 2008-04-19 23:20:18 UTC (rev 464)
@@ -0,0 +1,63 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2008 Peter J. Stieber, all rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//*****************************************************************************
+
+#include "StringUtilities.h"
+
+using namespace std;
+
+//-----------------------------------------------------------------------------
+// Decsription:
+// This function tokenizes the input string.
+//-----------------------------------------------------------------------------
+unsigned TNStringUtilities::Tokenize(
+ const string& Delimiters,
+ const string& InputString,
+ vector<string>& Tokens)
+{
+ // make sure the vector of tokens is empty.
+ Tokens.clear();
+
+ string::size_type Begin, End;
+
+ // Initialize the token index.
+ unsigned TokenIndex = 0;
+
+ // Search the beginning of the string for the first token.
+ Begin = InputString.find_first_not_of(Delimiters);
+
+ // While at the beginning of a word found.
+ while (Begin != string::npos)
+ {
+ // Search for the end of the actual token.
+ End = InputString.find_first_of(Delimiters, Begin);
+
+ if (End == string::npos)
+ {
+ End = InputString.length();
+ }
+
+ Tokens.push_back(InputString.substr(Begin, End - Begin));
+
+ ++TokenIndex;
+
+ Begin = InputString.find_first_not_of(Delimiters, End);
+ }
+ return TokenIndex;
+}
Property changes on: trunk/jazz/src/StringUtilities.cpp
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/jazz/src/StringUtilities.h
===================================================================
--- trunk/jazz/src/StringUtilities.h (rev 0)
+++ trunk/jazz/src/StringUtilities.h 2008-04-19 23:20:18 UTC (rev 464)
@@ -0,0 +1,41 @@
+//*****************************************************************************
+// The JAZZ++ Midi Sequencer
+//
+// Copyright (C) 2008 Peter J. Stieber, all rights reserved.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+//*****************************************************************************
+
+#ifndef TRC_STRINGUTILITIES_H
+#define TRC_STRINGUTILITIES_H
+
+#include <string>
+#include <vector>
+
+namespace TNStringUtilities
+{
+
+//-----------------------------------------------------------------------------
+// Decsription:
+// This function tokenizes the input string.
+//-----------------------------------------------------------------------------
+unsigned Tokenize(
+ const std::string& Delimiters,
+ const std::string& InputString,
+ std::vector<std::string>& Tokens);
+
+};
+
+#endif // !defined(TRC_STRINGUTILITIES_H)
Property changes on: trunk/jazz/src/StringUtilities.h
___________________________________________________________________
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-14 17:19:49
|
Revision: 463
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=463&view=rev
Author: pstieber
Date: 2008-04-14 10:19:46 -0700 (Mon, 14 Apr 2008)
Log Message:
-----------
Commented an unused variable.
Modified Paths:
--------------
trunk/jazz/src/TrackWindow.cpp
Modified: trunk/jazz/src/TrackWindow.cpp
===================================================================
--- trunk/jazz/src/TrackWindow.cpp 2008-04-14 17:19:13 UTC (rev 462)
+++ trunk/jazz/src/TrackWindow.cpp 2008-04-14 17:19:46 UTC (rev 463)
@@ -184,7 +184,7 @@
{
if (mPlayClock != Clock)
{
- int OldPlayClock = mPlayClock;
+// int OldPlayClock = mPlayClock;
mPlayClock = Clock;
// wxRect InvalidateRect;
// InvalidateRect.x = Clock2x(OldPlayClock) - 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-14 17:19:16
|
Revision: 462
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=462&view=rev
Author: pstieber
Date: 2008-04-14 10:19:13 -0700 (Mon, 14 Apr 2008)
Log Message:
-----------
Added the Linux version of setting the MIDI device.
Modified Paths:
--------------
trunk/jazz/src/TrackFrame.cpp
Modified: trunk/jazz/src/TrackFrame.cpp
===================================================================
--- trunk/jazz/src/TrackFrame.cpp 2008-04-14 17:18:22 UTC (rev 461)
+++ trunk/jazz/src/TrackFrame.cpp 2008-04-14 17:19:13 UTC (rev 462)
@@ -570,8 +570,8 @@
//-----------------------------------------------------------------------------
void JZTrackFrame::OnSettingsMidiDevice(wxCommandEvent& Event)
{
- long InputDevice, OutputDevice;
#ifdef __WXMSW__
+ long InputDevice, OutputDevice;
gpConfig->Get(C_WinInputDevice, InputDevice);
gpConfig->Get(C_WinOutputDevice, OutputDevice);
JZWindowsPlayer::SettingsDlg(InputDevice, OutputDevice);
@@ -580,13 +580,12 @@
"Info",
wxOK);
#else
-/*
if (gpConfig->GetValue(C_MidiDriver) == eMidiDriverOss)
{
- int Device = mpMidiPlayer->FindMidiDevice();
+ int Device = gpMidiPlayer->FindMidiDevice();
if (Device >= 0)
{
- SaveMidiDeviceSettings(Device);
+ gpConfig->Put(C_Seq2Device, Device);
::wxMessageBox(
"Restart Jazz++ to activate changes in device settings",
"Info",
@@ -597,7 +596,6 @@
::wxMessageBox("No midi device found", "Info", wxOK);
}
}
-*/
#endif
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-14 17:18:29
|
Revision: 461
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=461&view=rev
Author: pstieber
Date: 2008-04-14 10:18:22 -0700 (Mon, 14 Apr 2008)
Log Message:
-----------
Fixed OnPaint versions, and commented out an unused variable.
Modified Paths:
--------------
trunk/jazz/src/PianoWindow.cpp
trunk/jazz/src/PianoWindow.h
Modified: trunk/jazz/src/PianoWindow.cpp
===================================================================
--- trunk/jazz/src/PianoWindow.cpp 2008-04-14 16:55:24 UTC (rev 460)
+++ trunk/jazz/src/PianoWindow.cpp 2008-04-14 17:18:22 UTC (rev 461)
@@ -1922,7 +1922,7 @@
{
if (mPlayClock != Clock)
{
- int OldPlayClock = mPlayClock;
+// int OldPlayClock = mPlayClock;
mPlayClock = Clock;
// wxRect InvalidateRect;
// InvalidateRect.x = Clock2x(OldPlayClock) - 1;
Modified: trunk/jazz/src/PianoWindow.h
===================================================================
--- trunk/jazz/src/PianoWindow.h 2008-04-14 16:55:24 UTC (rev 460)
+++ trunk/jazz/src/PianoWindow.h 2008-04-14 17:18:22 UTC (rev 461)
@@ -265,7 +265,7 @@
void OnDraw(wxDC& Dc);
- void OnPaint(wxMouseEvent& Event);
+ void OnPaint(wxPaintEvent& Event);
void OnMouseEvent(wxMouseEvent& Event);
@@ -283,8 +283,6 @@
bool OnCharHook(wxKeyEvent& Event);
- void OnPaint(wxPaintEvent& Event);
-
void OnChar(wxKeyEvent& Event);
bool OnKeyEvent(wxKeyEvent& Event);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-14 16:55:42
|
Revision: 460
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=460&view=rev
Author: pstieber
Date: 2008-04-14 09:55:24 -0700 (Mon, 14 Apr 2008)
Log Message:
-----------
Changed WAVEHDR typedef for non MSW code, made cosmetic changes, and changed post-decrement to pre-decrement.
Modified Paths:
--------------
trunk/jazz/src/Audio.h
Modified: trunk/jazz/src/Audio.h
===================================================================
--- trunk/jazz/src/Audio.h 2008-04-14 14:39:29 UTC (rev 459)
+++ trunk/jazz/src/Audio.h 2008-04-14 16:55:24 UTC (rev 460)
@@ -77,7 +77,7 @@
// =============================================================
#ifndef __WXMSW__
-#define WAVEHDR void
+#define WAVEHDR char
#endif
struct tAudioBuffer
@@ -87,8 +87,9 @@
short* data;
tAudioBuffer(int dummy)
+ : hdr(0),
+ data(0)
{
- hdr = 0;
data = new short [BUFSHORTS];
// in case recording stops inside a buffer
memset(data, 0, BUFBYTES);
@@ -137,12 +138,12 @@
}
}
- int Count() const
+ int Count() const
{
return written - read;
}
- int Empty() const
+ int Empty() const
{
return written == read;
}
@@ -196,7 +197,7 @@
tAudioBuffer * RequestBuffer();
void UndoRequest()
{
- num_buffers--;
+ --num_buffers;
}
void ResetBufferSize(int size)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-14 14:39:37
|
Revision: 459
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=459&view=rev
Author: pstieber
Date: 2008-04-14 07:39:29 -0700 (Mon, 14 Apr 2008)
Log Message:
-----------
1. Started putting window management in the hands of a new project manager class.
This include creation and updating. The code uses the observer pattern to some extent,
but is a partial implementation at this point. This should prevent windows from holding
pointers to other windows.
2. Fixed scrolling for the track and piano windows.
3. Fixed some leaks in the windows device code.
Modified Paths:
--------------
trunk/jazz/src/AlsaPlayer.cpp
trunk/jazz/src/Audio.h
trunk/jazz/src/Dialogs.cpp
trunk/jazz/src/Dialogs.h
trunk/jazz/src/EventWindow.cpp
trunk/jazz/src/EventWindow.h
trunk/jazz/src/GuitarFrame.cpp
trunk/jazz/src/GuitarFrame.h
trunk/jazz/src/Harmony.cpp
trunk/jazz/src/JazzPlusPlusApplication.cpp
trunk/jazz/src/Makefile.am
trunk/jazz/src/MouseAction.cpp
trunk/jazz/src/MouseAction.h
trunk/jazz/src/PianoFrame.cpp
trunk/jazz/src/PianoFrame.h
trunk/jazz/src/PianoWindow.cpp
trunk/jazz/src/PianoWindow.h
trunk/jazz/src/Player.cpp
trunk/jazz/src/Project.cpp
trunk/jazz/src/TrackFrame.cpp
trunk/jazz/src/TrackFrame.h
trunk/jazz/src/TrackWindow.cpp
trunk/jazz/src/TrackWindow.h
trunk/jazz/src/mswin/WindowsPlayer.cpp
trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj
trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj
Added Paths:
-----------
trunk/jazz/src/ProjectManager.cpp
trunk/jazz/src/ProjectManager.h
Modified: trunk/jazz/src/AlsaPlayer.cpp
===================================================================
--- trunk/jazz/src/AlsaPlayer.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/AlsaPlayer.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -32,6 +32,7 @@
#include "WxWidgets.h"
#include "AlsaPlayer.h"
+#include "ProjectManager.h"
#include "TrackFrame.h"
#include "TrackWindow.h"
#include "Dialogs.h"
@@ -715,7 +716,7 @@
flush_output();
stop_queue_timer();
clear_input_queue();
- gpTrackWindow->NewPlayPosition(-1L);
+ JZProjectManager::Instance()->NewPlayPosition(-1);
RecdBuffer.Keyoff2Length();
}
@@ -849,7 +850,8 @@
}
if (recd_clock != old_recd_clock)
{
- gpTrackWindow->NewPlayPosition(PlayLoop->Ext2IntClock(recd_clock/48 * 48));
+ JZProjectManager::Instance()->NewPlayPosition(
+ PlayLoop->Ext2IntClock(recd_clock / 48 * 48));
}
return recd_clock;
}
Modified: trunk/jazz/src/Audio.h
===================================================================
--- trunk/jazz/src/Audio.h 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/Audio.h 2008-04-14 14:39:29 UTC (rev 459)
@@ -96,6 +96,7 @@
~tAudioBuffer()
{
+ delete hdr;
delete [] data;
}
Modified: trunk/jazz/src/Dialogs.cpp
===================================================================
--- trunk/jazz/src/Dialogs.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/Dialogs.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -27,6 +27,7 @@
#include "Synth.h"
#include "Command.h"
#include "EventWindow.h"
+#include "ProjectManager.h"
#include "Track.h"
#include "Events.h"
#include "Player.h"
@@ -54,7 +55,6 @@
: tPropertyListDlg("Shift events left/right"),
mSteps(0),
mUnit(unit),
- mpEventWindow(pEventWindow),
mpFilter(pFilter),
mpSong(pFilter->mpSong)
{
@@ -67,12 +67,9 @@
cout << "tShiftDlg::OnClose " << mSteps << endl;
tCmdShift cmd(mpFilter, mSteps * mUnit);
cmd.Execute();
- mpEventWindow->Refresh();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
+
// wxForm::OnOk();
return false;
}
@@ -110,7 +107,6 @@
{
Filter = f;
Song = f->mpSong;
- mpEventWindow = w;
}
@@ -123,12 +119,9 @@
<< endl;
tCmdCleanup cln(Filter, limit, shortenOverlaps);
cln.Execute();
- mpEventWindow->Refresh();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
+
//wxForm::OnOk();
return false;
}
@@ -194,19 +187,15 @@
{
Filter = f;
Song = f->mpSong;
- mpEventWindow = w;
}
bool tSearchReplaceDlg::OnClose()
{
tCmdSearchReplace sr(Filter, frCtrl - 1, toCtrl-1);
sr.Execute();
- mpEventWindow->Refresh();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
+
return false;
}
@@ -244,7 +233,6 @@
tTransposeDlg::tTransposeDlg(JZEventFrame *w, JZFilter *f)
: tPropertyListDlg("Transpose")
{
- mpEventWindow = w;
Filter = f;
Song = f->mpSong;
}
@@ -254,15 +242,9 @@
{
tCmdTranspose trn(Filter, Notes, Scale, FitIntoScale);
trn.Execute();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
- else
- {
- mpEventWindow->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
+
return false;
}
@@ -404,7 +386,6 @@
{
Filter = f;
Song = f->mpSong;
- mpEventWindow = w;
}
@@ -413,11 +394,7 @@
tCmdLength cmd(Filter, FromValue, ToValue, Mode);
cmd.Execute();
- mpEventWindow->Refresh();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
//tPropertyListDlg::OnClose();
return false;
@@ -469,7 +446,6 @@
{
Filter = f;
Song = f->mpSong;
- mpEventWindow = w;
}
@@ -477,12 +453,9 @@
{
tCmdSeqLength cmd(Filter, scale);
cmd.Execute();
- mpEventWindow->Refresh();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
+
//tPropertyListDlg::OnClose();
return false;
}
@@ -516,7 +489,6 @@
{
Filter = f;
Song = f->mpSong;
- mpEventWindow = w;
}
@@ -525,12 +497,9 @@
tCmdMidiDelay cmd(Filter, scale,clockDelay,repeat);
cmd.Execute();
- mpEventWindow->Refresh();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
+
//tPropertyListDlg::OnClose();
return false;
}
@@ -579,7 +548,6 @@
: tPropertyListDlg("Delete" )
{
Filter = f;
- mpEventWindow = w;
}
@@ -587,12 +555,9 @@
{
tCmdErase cmd(Filter, LeaveSpace);
cmd.Execute();
- mpEventWindow->Refresh();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
+
// tPropertyListDlg::OnClose();
return false;
}
@@ -674,7 +639,6 @@
{
Filter = f;
Song = f->mpSong;
- mpEventWindow = w;
}
@@ -687,26 +651,23 @@
qnt.NoteStart = NoteStart;
qnt.NoteLength = NoteLength;
qnt.Execute();
- mpEventWindow->Refresh();
- if (mpEventWindow->NextWin)
- {
- mpEventWindow->NextWin->Refresh();
- }
+ JZProjectManager::Instance()->UpdateAllViews();
+
//tPropertyListDlg::OnClose();
return false;
}
void tQuantizeDlg::OnHelp()
{
- if (mpEventWindow->NextWin)
- {
- gpHelpInstance->ShowTopic("Quantize");
- }
- else
- {
- gpHelpInstance->ShowTopic("Pianowin Quantize");
- }
+// if (mpEventWindow->NextWin)
+// {
+// gpHelpInstance->ShowTopic("Quantize");
+// }
+// else
+// {
+// gpHelpInstance->ShowTopic("Pianowin Quantize");
+// }
}
void tQuantizeDlg::AddProperties()
Modified: trunk/jazz/src/Dialogs.h
===================================================================
--- trunk/jazz/src/Dialogs.h 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/Dialogs.h 2008-04-14 14:39:29 UTC (rev 459)
@@ -40,7 +40,6 @@
long mSteps; // 0 was static
long mUnit;
- JZEventFrame* mpEventWindow;
JZFilter* mpFilter;
JZSong* mpSong;
@@ -59,7 +58,6 @@
JZFilter *Filter;
JZSong *Song;
- JZEventFrame* mpEventWindow;
tCleanupDlg(JZEventFrame *w, JZFilter *f);
void AddProperties();
@@ -79,7 +77,6 @@
JZFilter *Filter;
JZSong *Song;
- JZEventFrame* mpEventWindow;
tSearchReplaceDlg(JZEventFrame *w, JZFilter *f);
void AddProperties();
@@ -96,7 +93,6 @@
static bool FitIntoScale;
static int Scale;
- JZEventFrame* mpEventWindow;
JZFilter *Filter;
JZSong *Song;
@@ -150,7 +146,6 @@
JZFilter *Filter;
JZSong *Song;
- JZEventFrame* mpEventWindow;
tLengthDlg(JZEventFrame *win, JZFilter *f);
void AddProperties();
@@ -168,7 +163,6 @@
JZFilter *Filter;
JZSong *Song;
- JZEventFrame* mpEventWindow;
tSeqLengthDlg(JZEventFrame *win, JZFilter *f);
void AddProperties();
@@ -187,7 +181,6 @@
JZFilter *Filter;
JZSong *Song;
- JZEventFrame* mpEventWindow;
tMidiDelayDlg(JZEventFrame *win, JZFilter *f);
void AddProperties();
@@ -198,7 +191,6 @@
class tDeleteDlg : public tPropertyListDlg
{
JZFilter *Filter;
- JZEventFrame* mpEventWindow;
public:
static bool LeaveSpace; // 1
@@ -243,7 +235,6 @@
JZFilter *Filter;
JZSong *Song;
- JZEventFrame* mpEventWindow;
long Quantize(long);
Modified: trunk/jazz/src/EventWindow.cpp
===================================================================
--- trunk/jazz/src/EventWindow.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/EventWindow.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -45,16 +45,12 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-const int JZEventWindow::mScrollSize = 50;
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
JZEventWindow::JZEventWindow(
wxFrame* pParent,
JZSong* pSong,
const wxPoint& Position,
const wxSize& Size)
- : wxScrolledWindow(
+ : wxWindow(
pParent,
wxID_ANY,
Position,
@@ -65,9 +61,23 @@
mpSong(pSong),
mpGreyColor(0),
mpGreyBrush(0),
+ mClockTicsPerPixel(36),
mTopInfoHeight(40),
+ mLeftInfoWidth(100),
mTrackHeight(10),
- mLittleBit(2)
+ mLittleBit(2),
+ mEventsX(0),
+ mEventsY(mTopInfoHeight),
+ mEventsWidth(),
+ mEventsHeight(),
+ mCanvasWidth(0),
+ mCanvasHeight(0),
+ mFromClock(0),
+ mToClock(0),
+ mFromLine(0),
+ mToLine(0),
+ mScrolledX(0),
+ mScrolledY(0)
{
mpSnapSel = new tSnapSelection(this);
@@ -105,30 +115,98 @@
}
//-----------------------------------------------------------------------------
+// Description:
+// Only consider the event portion of the window when computing the virtual
+// size. Do not consider the static information of the left or top portion of
+// the screen.
//-----------------------------------------------------------------------------
-//void JZEventWindow::SetScrollRanges()
-//{
-// int Width, Height;
-// GetVirtualEventSize(Width, Height);
-// SetScrollbars(
-// mScrollSize,
-// mScrollSize,
-// Width / mScrollSize,
-// Height / mScrollSize);
-// EnableScrolling(false, false);
-//}
+void JZEventWindow::GetVirtualEventSize(
+ int& EventWidth,
+ int& EventHeight) const
+{
+ int TotalClockTics = mpSong->MaxQuarters * mpSong->TicksPerQuarter;
+ EventWidth = TotalClockTics / mClockTicsPerPixel;
+ EventHeight = 127 * mTrackHeight;
+}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void JZEventWindow::SetScrollPosition(int x, int y)
+void JZEventWindow::SetXScrollPosition(int x)
{
- x /= mScrollSize;
- y /= mScrollSize;
- Scroll(x, y);
+ // The following line converts an x position in window coordinates to an
+ // x position in scrolled coordinates.
+ int ScrolledX = x - mEventsX + mScrolledX;
+
+ if (mScrolledX != ScrolledX)
+ {
+ mScrolledX = ScrolledX;
+
+ // Set the new from clock and to clock positions based on the new scroll
+ // position.
+ mFromClock = mScrolledX * mClockTicsPerPixel;
+ mToClock = x2Clock(mCanvasWidth);
+
+ SetScrollPos(wxHORIZONTAL, mScrolledX);
+ }
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+void JZEventWindow::SetYScrollPosition(int y)
+{
+ // The following line converts a y position in window coordinates to a
+ // y position in scrolled coordinates.
+ int ScrolledY = y - mEventsY + mScrolledY;
+
+ if (mScrolledY != y)
+ {
+ mScrolledY = ScrolledY;
+
+ // Set the new from line and to line positions based on the new scroll
+ // position.
+ mFromLine = mScrolledY / mTrackHeight;
+ mToLine = 1 + (mScrolledY + mCanvasHeight - mTopInfoHeight) / mTrackHeight;
+
+ SetScrollPos(wxVERTICAL, mScrolledY);
+ }
+}
+
+//-----------------------------------------------------------------------------
+// Description:
+// This function takes an x-pixel value in window coordinates and converts
+// it to clock tics.
+//-----------------------------------------------------------------------------
+int JZEventWindow::x2Clock(int x)
+{
+ return (x - mEventsX) * mClockTicsPerPixel + mFromClock;
+}
+
+//-----------------------------------------------------------------------------
+// Description:
+// This function takes clock tics and converts the value into an x-pixel
+// location on the screen in window coordinates.
+//-----------------------------------------------------------------------------
+int JZEventWindow::Clock2x(int Clock)
+{
+ return mEventsX + (Clock - mFromClock) / mClockTicsPerPixel;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+int JZEventWindow::x2BarClock(int x, int Next)
+{
+ int Clock = x2Clock(x);
+ JZBarInfo BarInfo(mpSong);
+ BarInfo.SetClock(Clock);
+ while (Next--)
+ {
+ BarInfo.Next();
+ }
+ return BarInfo.Clock;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZEventWindow::y2yLine(int y, int Up)
{
if (Up)
@@ -142,7 +220,23 @@
}
//-----------------------------------------------------------------------------
+// Was the VLine macro
//-----------------------------------------------------------------------------
+void JZEventWindow::DrawVerticalLine(wxDC& Dc, int XPosition) const
+{
+ Dc.DrawLine(XPosition, 0, XPosition, mEventsY + mEventsHeight);
+}
+
+//-----------------------------------------------------------------------------
+// Was the HLine macro
+//-----------------------------------------------------------------------------
+void JZEventWindow::DrawHorizontalLine(wxDC& Dc, int YPosition) const
+{
+ Dc.DrawLine(0, YPosition, mCanvasWidth, YPosition);
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZEventWindow::LineText(
wxDC& Dc,
int x,
@@ -210,21 +304,6 @@
}
//-----------------------------------------------------------------------------
-// JAVE seems to want to clip the paint area
-// calls the subclass paint routine
-//
-// OnPaint seems never to get called
-//-----------------------------------------------------------------------------
-//void JZEventWindow::OnDraw(wxDC& Dc)
-//{
-// //onpaint never seems to get called, but ondraw does get called
-// int x = 0, y = 0;
-// GetViewStart(&x, &y);
-// EventWin->OnPaintSub(Dc, x * mScrollSize, y * mScrollSize);
-// cout << "JZEventWindow::OnDraw << endl;
-//}
-
-//-----------------------------------------------------------------------------
// This mouse handler delegates to the subclased event window.
//-----------------------------------------------------------------------------
//void JZEventWindow::OnMouseEvent(wxMouseEvent& MouseEvent)
@@ -284,19 +363,13 @@
: wxFrame(pParent, wxID_ANY, Title, Position, Size),
Song(pSong),
mpFilter(0),
- NextWin(0),
-// mpEventWindow(0),
- mpFont(0),
mpFixedFont(0),
hFixedFont(0),
- LittleBit(1),
mTrackHeight(0),
mTopInfoHeight(40),
- mLeftInfoWidth(100),
FontSize(12),
ClocksPerPixel(36),
- UseColors(true),
- mEventsX(mLeftInfoWidth),
+ mEventsX(),
mEventsY(mTopInfoHeight),
mEventsWidth(0),
mEventsHeight(0),
@@ -337,7 +410,6 @@
delete mpFilter;
- delete mpFont;
delete mpFixedFont;
delete mpToolBar;
@@ -373,16 +445,9 @@
*/
void JZEventFrame::Create()
{
- cout <<"JZEventFrame::Create\n";
CreateMenu();
-// CreateCanvas();
-// SnapSel = new tSnapSelection(mpEventWindow);
-
-
Setup();
-// mpEventWindow->SetScrollRanges();
-// mpEventWindow->SetScrollPosition(0, 0); //this wasnt here before wx2, why?
}
@@ -405,10 +470,10 @@
Dc.SetFont(*mpFont);
Dc.GetTextExtent("M", &x, &y);
- LittleBit = (int)(x/2);
+ mLittleBit = (int)(x/2);
Dc.GetTextExtent("HXWjgi", &x, &y);
- mTrackHeight = (int)y + LittleBit;
+ mTrackHeight = (int)y + mLittleBit;
*/
}
@@ -474,30 +539,6 @@
// *******************************************************************
-int JZEventFrame::x2Clock(int x)
-{
- return (x - mEventsX) * ClocksPerPixel + FromClock;
-}
-
-
-int JZEventFrame::Clock2x(int clk)
-{
- return mEventsX + (clk - FromClock) / ClocksPerPixel;
-}
-
-int JZEventFrame::x2BarClock(int x, int next)
-{
- int clk = x2Clock(x);
- JZBarInfo b(Song);
- b.SetClock(clk);
- while (next--)
- {
- b.Next();
- }
- return b.Clock;
-}
-
-
int JZEventFrame::y2yLine(int y, int up)
{
if (up)
@@ -571,7 +612,7 @@
y -= 2;
}
dc->SetTextBackground(*mpGreyColor);
- dc->DrawText((char *)str, x + LittleBit, y + LittleBit);
+ dc->DrawText((char *)str, x + mLittleBit, y + mLittleBit);
dc->SetTextBackground(*wxWHITE);
}
*/
@@ -595,42 +636,6 @@
}
-/**
- JAVE this was originally called OnPaint(x,y), but i renamed it because i confused it with the OnPaint() framework routine
- the call graph feels odd: the canvas is a member of the eventwin, with a pointer to the parent. the child calss the parent to redraw itself
-
- it doesnt do any real drawing, instead it sets up some member vars, to be used by other parts of the class
-
- it is now normally called from OnDraw in the mpEventWindow class,and also overridden in the subclass.
- so this one here just sets up constants
-
-
- dc is the device context to draw in, normally generated from the framework from ondraw
- x and y is the coordinates of the start of the view
-
-*/
-void JZEventFrame::OnPaintSub(wxDC *dc, int x, int y)
-{
- //printf("EventWin::OnPaintSub: x %ld, y %ld, w %ld, h %ld\n", x, y, w, h);
- CanvasX = x;
- CanvasY = y;
-// wxCanvas::GetClientSize returns huge values, at least in wx_xt
- int xc, yc;
- GetClientSize(&xc, &yc);
- CanvasW = xc;
- CanvasH = yc;
-
- mEventsX = CanvasX + mLeftInfoWidth;
- mEventsY = CanvasY + mTopInfoHeight;
- mEventsWidth = CanvasW - mLeftInfoWidth;
- mEventsHeight = CanvasH - mTopInfoHeight;
-
- FromLine = CanvasY / mTrackHeight;
- ToLine = (CanvasY + CanvasH - mTopInfoHeight) / mTrackHeight;
- FromClock = CanvasX * ClocksPerPixel;
- ToClock = x2Clock(CanvasX + CanvasW);
-}
-
// ******************************************************************
// Mouse
// ******************************************************************
@@ -712,83 +717,9 @@
}
//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::GetVirtualEventSize(int& Width, int& Height)
-{
- int TotalClockTics = Song->MaxQuarters * Song->TicksPerQuarter;
- Width = TotalClockTics / ClocksPerPixel + mLeftInfoWidth;
- Height = 127 * mTrackHeight + mTopInfoHeight;
-}
-
-//-----------------------------------------------------------------------------
// PlayPosition
//-----------------------------------------------------------------------------
-// Update the play position to the clock argument, and trigger a redraw so
-// the play bar will be drawn.
-void JZEventFrame::NewPlayPosition(int Clock)
-{
- int scroll_clock = (FromClock + 5 * ToClock) / 6;
-
- if (!SnapSel->Active && ((Clock > scroll_clock) || (Clock < FromClock)) && (Clock >= 0))
- {
- // avoid permenent redraws when end of scroll range is reached
- if (Clock > FromClock && ToClock >= Song->MaxQuarters * Song->TicksPerQuarter)
- return;
-// int x = Clock2x(Clock);
-// mpEventWindow->SetScrollPosition(x - mLeftInfoWidth, CanvasY);
- }
-
- if (!SnapSel->Active) // sets clipping
- {
- if (PlayClock != Clock)
- {
-// int oldplayclock=PlayClock;
-// PlayClock = Clock;
-// wxRect invalidateRect;
-// invalidateRect.x=Clock2x(oldplayclock)-1;
-// invalidateRect.y=CanvasY;
-// invalidateRect.width=3;
-// invalidateRect.height= 100000000;
-// //DrawPlayPosition();
-// mpEventWindow->Refresh(TRUE,&invalidateRect);
-
-// invalidateRect.x=Clock2x(PlayClock)-1;
-// mpEventWindow->Refresh(TRUE,&invalidateRect);
- //DrawPlayPosition();
-
-// mpEventWindow->Refresh();
- }
- }
- if (NextWin)
- {
- NextWin->NewPlayPosition(Clock);
- }
-}
-
-/** draw the "play position", by placing a vertical line where the "play clock" is */
-void JZEventFrame::DrawPlayPosition(wxDC* dc)
-{
- if (!SnapSel->Active && PlayClock >= FromClock && PlayClock < ToClock)
- {
-// wxDC* dc = new wxClientDC(this);
-// dc->SetLogicalFunction(wxXOR);
- dc->SetBrush(*wxBLACK_BRUSH);
- dc->SetPen(*wxBLACK_PEN);
- int x = Clock2x(PlayClock);
-
- //cout<<"JZEventFrame::DrawPlayPosition play pos x "<<x<<" "<<FromClock<<" "<<ToClock<<endl;
- //dc->DrawRectangle(x, CanvasY, 2*LittleBit, mTopInfoHeight);
- dc->DrawLine(x, CanvasY, x, mEventsY + mEventsHeight); //draw a line, 2 pixwels wide
- dc->DrawLine(x + 1, CanvasY, x + 1, mEventsY + mEventsHeight);
- dc->SetLogicalFunction(wxCOPY);
- }
-//OLD if (NextWin)
-//OLD {
-//OLD NextWin->DrawPlayPosition(dc);
-//OLD }
-}
-
// **************************************************************************
// EventsSelected
// **************************************************************************
@@ -964,10 +895,6 @@
tCmdConvertToModulation cmd(mpFilter);
cmd.Execute();
Redraw();
- if (NextWin)
- NextWin->Redraw();
-
-
}
@@ -1065,44 +992,4 @@
// mpSettingsDialog = new wxDialogBox(this, "MeterChange", FALSE );
dlg = new tMeterChangeDlg(this);
dlg->Create();
-
}
-
-
-void JZEventFrame::ZoomIn()
-{
-
-// if (ClocksPerPixel >= 2)
-// {
-// ClocksPerPixel /= 2;
-// int x = CanvasX * 2;
-// int y = CanvasY;
-
-// wxDC* dc=new wxClientDC(mpEventWindow);
-// JZEventFrame::OnPaintSub(dc, x, y);
-// mpEventWindow->SetScrollRanges();
-// mpEventWindow->SetScrollPosition(x, y);
-// if (x == 0)
-// Redraw();
-
-// }
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZEventFrame::ZoomOut()
-{
-// if (ClocksPerPixel <= 120)
-// {
-// ClocksPerPixel *= 2;
-// int x = CanvasX / 2;
-// int y = CanvasY;
-
- //wxClientDC Dc(mpEventWindow);
- //JZEventFrame::OnPaintSub(Dc, x, y);
-// mpEventWindow->SetScrollRanges();
-// mpEventWindow->SetScrollPosition(x, y);
- //if (x == 0)
- // Redraw();
-// }
-}
Modified: trunk/jazz/src/EventWindow.h
===================================================================
--- trunk/jazz/src/EventWindow.h 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/EventWindow.h 2008-04-14 14:39:29 UTC (rev 459)
@@ -36,7 +36,7 @@
// This class is derived from a wxWidgets scrolled window, and acts as the
// common base class for JZTrackWindow and JSPianoWindow.
//*****************************************************************************
-class JZEventWindow : public wxScrolledWindow
+class JZEventWindow : public wxWindow
{
public:
@@ -66,36 +66,50 @@
int Height = -1,
bool Down = false);
-// void SetScrollRanges();
+ //========================================
+ // Coordinate conversion member functions.
+ //========================================
- void SetScrollPosition(int x, int y);
+ int x2Clock(int x);
+ int Clock2x(int Clock);
+
+ int x2BarClock(int x, int Next = 0);
+
protected:
-// void OnPaint(wxPaintEvent& Event);
-// void OnMouseEvent(wxMouseEvent& Event);
-// void OnChar(wxKeyEvent& Event);
-// bool OnCharHook(wxKeyEvent& Event);
-// void OnDraw(wxDC& Dc);
+ void DrawVerticalLine(wxDC& Dc, int XPosition) const;
+ void DrawHorizontalLine(wxDC& Dc, int YPosition) const;
+
+ virtual void GetVirtualEventSize(int& EventWidth, int& EventHeight) const;
+
+ virtual void SetXScrollPosition(int x);
+
+ virtual void SetYScrollPosition(int y);
+
int y2yLine(int y, int Up = 0);
protected:
- static const int mScrollSize;
-
JZSong* mpSong;
-// JZEventFrame* mpEventFrame;
-
wxColor* mpGreyColor;
wxBrush* mpGreyBrush;
+ int mClockTicsPerPixel;
int mTopInfoHeight;
+ int mLeftInfoWidth;
int mTrackHeight;
int mLittleBit;
+ int mEventsX, mEventsY, mEventsWidth, mEventsHeight;
+ int mCanvasWidth, mCanvasHeight;
+ int mFromClock, mToClock;
+ int mFromLine, mToLine;
+ int mScrolledX, mScrolledY;
+
// DECLARE_EVENT_TABLE()
};
@@ -143,9 +157,6 @@
JZFilter* mpFilter;
- JZPianoFrame* NextWin;
-
-
// 2) Create():
virtual void Create();
virtual void CreateMenu();
@@ -153,24 +164,18 @@
// JZEventWindow* mpEventWindow;
// Setup()
- wxFont* mpFont;
wxFont* mpFixedFont; // remains with 12pt
int hFixedFont; // Height of letters
- int LittleBit;
int mTrackHeight;
int mTopInfoHeight;
- int mLeftInfoWidth;
int FontSize;
int ClocksPerPixel;
- bool UseColors;
// Parameters changed, e.g. Song loaded
virtual void Setup();
- // filled by OnPaint()
- //wxDC *dc;
int mEventsX, mEventsY, mEventsWidth, mEventsHeight;
int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords
int FromClock, ToClock;
@@ -187,21 +192,10 @@
int y2yLine(int y, int up = 0);
int Line2y(int line);
// void LineText(wxDC *dc, int x, int y, int w, const char *str, int h = -1, bool down = false);
- int x2Clock(int x);
- int Clock2x(int clk);
- int x2BarClock(int x, int Next = 0);
int PlayClock;
- virtual void NewPlayPosition(int Clock);
- virtual void DrawPlayPosition(wxDC* dc);
- // sent by trackwin: scroll to Position
- virtual void NewPosition(int TrackNr, int Clock)
- {
- }
-
// Events
- virtual void OnPaintSub(wxDC *dc, int x, int y);
virtual int OnMouseEvent(wxMouseEvent& Event);
virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin
virtual void OnSize(wxSizeEvent& Event);
@@ -218,8 +212,6 @@
// Mixer-Dialog
wxDialog* MixerForm;
- virtual void GetVirtualEventSize(int& Width, int& Height);
-
// Edit-Menu
// if selection active: TRUE, else: Errormessage + FALSE
@@ -239,9 +231,6 @@
void MenSearchReplace();
void MenMeterChange();
- void ZoomIn();
- void ZoomOut();
-
protected:
JZToolBar* mpToolBar;
Modified: trunk/jazz/src/GuitarFrame.cpp
===================================================================
--- trunk/jazz/src/GuitarFrame.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/GuitarFrame.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -27,6 +27,7 @@
#include "GuitarFrame.h"
#include "GuitarWindow.h"
#include "GuitarSettingsDialog.h"
+#include "ProjectManager.h"
//*****************************************************************************
// Description:
@@ -84,6 +85,13 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+JZGuitarFrame::~JZGuitarFrame()
+{
+ JZProjectManager::Instance()->Detach(this);
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZGuitarFrame::PrepareDC(wxDC& Dc)
{
}
Modified: trunk/jazz/src/GuitarFrame.h
===================================================================
--- trunk/jazz/src/GuitarFrame.h 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/GuitarFrame.h 2008-04-14 14:39:29 UTC (rev 459)
@@ -25,13 +25,18 @@
class JZGuitarWindow;
-// Define a new frame type: this is going to be our main frame
+//*****************************************************************************
+// Description:
+// This is the guitar frame class declaration.
+//*****************************************************************************
class JZGuitarFrame : public wxFrame
{
public:
JZGuitarFrame(wxWindow* pParent = 0);
+ ~JZGuitarFrame();
+
void PrepareDC(wxDC& Dc);
void ShowPitch(int Pitch);
Modified: trunk/jazz/src/Harmony.cpp
===================================================================
--- trunk/jazz/src/Harmony.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/Harmony.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -24,6 +24,7 @@
#include "Harmony.h"
#include "HarmonyP.h"
+#include "ProjectManager.h"
#include "Player.h"
#include "TrackFrame.h"
#include "TrackWindow.h"
@@ -1356,16 +1357,8 @@
if (gpTrackFrame->GetPianoWindow())
{
- // Show in GuitarWin
- JZGuitarFrame* pGuitarFrame =
- gpTrackFrame->GetPianoWindow()->GetGuitarFrame();
- if (pGuitarFrame)
- {
- // Remove actual pianowin/mouse position
- pGuitarFrame->ShowPitch(0);
-// pGuitarFrame->Redraw();
- pGuitarFrame->Update();
- }
+ // Show in the guitar view.
+ JZProjectManager::Instance()->ShowPitch(0);
}
}
}
Modified: trunk/jazz/src/JazzPlusPlusApplication.cpp
===================================================================
--- trunk/jazz/src/JazzPlusPlusApplication.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/JazzPlusPlusApplication.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -25,6 +25,7 @@
#include "JazzPlusPlusApplication.h"
#include "TrackFrame.h"
#include "Project.h"
+#include "ProjectManager.h"
#include "Globals.h"
#ifdef _MSC_VER
@@ -135,17 +136,18 @@
wxApp::OnInit();
// Create the main application window.
- mpTrackFrame = new JZTrackFrame(
- 0,
- "Jazz++",
- gpSong,
- wxPoint(10, 10),
- wxSize(600, 400));
+ mpTrackFrame = JZProjectManager::Instance()->CreateTrackView();
+// new JZTrackFrame(
+// 0,
+// "Jazz++",
+// gpSong,
+// wxPoint(10, 10),
+// wxSize(600, 400));
gpTrackFrame = mpTrackFrame;
// Show it and tell the application that it's our main window
- mpTrackFrame->Show(true);
+// mpTrackFrame->Show(true);
SetTopWindow(mpTrackFrame);
return true;
@@ -167,6 +169,8 @@
// Prevent reported leaks from the configuration class.
delete wxConfigBase::Set(0);
+ JZProjectManager::Destroy();
+
return 0;
}
Modified: trunk/jazz/src/Makefile.am
===================================================================
--- trunk/jazz/src/Makefile.am 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/Makefile.am 2008-04-14 14:39:29 UTC (rev 459)
@@ -55,6 +55,7 @@
PianoWindow.cpp \
Player.cpp \
Project.cpp \
+ProjectManager.cpp \
PropertyListDialog.cpp \
Random.cpp \
RecordingInfo.cpp \
@@ -130,6 +131,7 @@
PianoWindow.h \
Player.h \
Project.h \
+ProjectManager.h \
PropertyListDialog.h \
Random.h \
RecordingInfo.h \
Modified: trunk/jazz/src/MouseAction.cpp
===================================================================
--- trunk/jazz/src/MouseAction.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/MouseAction.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -92,7 +92,7 @@
//////////////////////////////////////////////////////////
//tSelection implementation
-tSelection::tSelection(wxScrolledWindow* pWindow)
+tSelection::tSelection(wxWindow* pWindow)
: win(pWindow),
mpBackgroundBrush(0)
{
@@ -343,7 +343,7 @@
}
-tSnapSelection::tSnapSelection(wxScrolledWindow *c)
+tSnapSelection::tSnapSelection(wxWindow *c)
: tSelection(c)
{
xCoords = 0;
@@ -471,7 +471,7 @@
// -------------------------------------------------------------------------
-tMarkDestin::tMarkDestin(wxScrolledWindow* canvas, wxFrame *frame, int left)
+tMarkDestin::tMarkDestin(wxWindow* canvas, wxFrame *frame, int left)
{
wxCursor c;
Canvas = canvas;
Modified: trunk/jazz/src/MouseAction.h
===================================================================
--- trunk/jazz/src/MouseAction.h 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/MouseAction.h 2008-04-14 14:39:29 UTC (rev 459)
@@ -149,7 +149,7 @@
{
public:
- tSelection(wxScrolledWindow* w);//wxCanvas *canvas);
+ tSelection(wxWindow* w);//wxCanvas *canvas);
virtual ~tSelection();
int Active;
@@ -168,7 +168,7 @@
private:
- wxScrolledWindow* win;
+ wxWindow* win;
// wxCanvas *Canvas;
wxBrush* mpBackgroundBrush;
@@ -179,7 +179,7 @@
class tSnapSelection : public tSelection
{
public:
- tSnapSelection(wxScrolledWindow *c);
+ tSnapSelection(wxWindow *c);
virtual void Snap(float &x, float &y, int up);
void SetXSnap(int ny, int *cx);
void SetYSnap(int ny, int *cy);
@@ -194,15 +194,13 @@
//*****************************************************************************
-/**
- tButtonLabelInterface
-
- Specifies an interface for displaying a text string within another widget.
- The other widget would inherit from this interface and implement the Display
- method to print the string somewhere appropriate. The down argument
- indicates if the text should be displayed in a depressed button or a normal
- button.
-*/
+// tButtonLabelInterface
+//
+// Specifies an interface for displaying a text string within another widget.
+// The other widget would inherit from this interface and implement the Display
+// method to print the string somewhere appropriate. The down argument
+// indicates if the text should be displayed in a depressed button or a normal
+// button.
//*****************************************************************************
class tButtonLabelInterface
{
@@ -219,13 +217,26 @@
//*****************************************************************************
-/**
- MouseCounter - let you enter numbers with left/right mouse button
-
-*/
+// MouseCounter - let you enter numbers with left/right mouse button
//*****************************************************************************
class tMouseCounter : public wxTimer, public tMouseAction
{
+ public:
+
+ JZRectangle r;
+
+ int Value;
+
+ tMouseCounter(
+ tButtonLabelInterface *win,
+ JZRectangle *rec,
+ int val,
+ int min,
+ int max,
+ int wait = 0);
+
+ private:
+
int Min, Max, Delta;
int Timeout;
int Wait; // don't inc/dec at Init
@@ -237,10 +248,6 @@
virtual int RightUp(wxMouseEvent &);
virtual void Notify();
virtual void ShowValue(bool down);
- public:
- JZRectangle r;
- int Value;
- tMouseCounter(tButtonLabelInterface *win, JZRectangle *rec, int val, int min, int max, int wait = 0);
};
@@ -249,7 +256,7 @@
//*****************************************************************************
class tMarkDestin : public tMouseAction
{
- wxScrolledWindow *Canvas;
+ wxWindow *Canvas;
wxFrame *Frame;
int ButtonDown(wxMouseEvent &);
@@ -259,7 +266,7 @@
virtual int LeftDown(wxMouseEvent &);
virtual int RightDown(wxMouseEvent &);
- tMarkDestin(wxScrolledWindow *canvas, wxFrame *frame, int left);
+ tMarkDestin(wxWindow *canvas, wxFrame *frame, int left);
};
//*****************************************************************************
Modified: trunk/jazz/src/PianoFrame.cpp
===================================================================
--- trunk/jazz/src/PianoFrame.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/PianoFrame.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -26,6 +26,7 @@
#include "PianoFrame.h"
#include "PianoWindow.h"
+#include "ProjectManager.h"
#include "Song.h"
#include "Track.h"
#include "Synth.h"
@@ -87,8 +88,6 @@
#define MEN_CTRL_TEMPO 42
#define MEN_REDO 47
-#define MEN_ZOOMIN 48
-#define MEN_ZOOMOUT 49
#define MEN_CTRL_POLY_AFTER 50
#define MEN_CTRL_CHANNEL_AFTER 51
@@ -117,8 +116,8 @@
{ MEN_SHIFTR, FALSE, shiftr_xpm, "shift selection right"},
{ MEN_VIS_ALL_TRK, TRUE, evnts_xpm, "show events from all tracks"},
{ JZToolBar::eToolBarSeparator },
- { MEN_ZOOMIN, FALSE, zoomin_xpm, "zoom in"},
- { MEN_ZOOMOUT, FALSE, zoomout_xpm, "zoom out"},
+ { wxID_ZOOM_IN, FALSE, zoomin_xpm, "zoom in"},
+ { wxID_ZOOM_OUT, FALSE, zoomout_xpm, "zoom out"},
{ wxID_UNDO, FALSE, undo_xpm, "undo"},
{ MEN_REDO, FALSE, redo_xpm, "redo"},
{ MEN_RESET, FALSE, panic_xpm, "all notes off"},
@@ -156,8 +155,8 @@
//*****************************************************************************
BEGIN_EVENT_TABLE(JZPianoFrame, wxFrame)
- EVT_MENU(MEN_ZOOMIN, JZPianoFrame::OnZoomIn)
- EVT_MENU(MEN_ZOOMOUT, JZPianoFrame::OnZoomOut)
+ EVT_MENU(wxID_ZOOM_IN, JZPianoFrame::OnZoomIn)
+ EVT_MENU(wxID_ZOOM_OUT, JZPianoFrame::OnZoomOut)
EVT_MENU(ID_SNAP_8, JZPianoFrame::OnSnap8)
EVT_MENU(ID_SNAP_8D, JZPianoFrame::OnSnap8D)
EVT_MENU(ID_SNAP_16, JZPianoFrame::OnSnap16)
@@ -268,6 +267,8 @@
delete MixerForm;
delete mpToolBar;
+
+ JZProjectManager::Instance()->Detach(this);
}
//-----------------------------------------------------------------------------
@@ -308,7 +309,7 @@
// show the guitar edit window.
void JZPianoFrame::OnGuitar(wxCommandEvent& Event)
{
- mpPianoWindow->CreateGuitarWindow();
+ JZProjectManager::Instance()->CreateGuitarView();
}
@@ -376,13 +377,6 @@
SetMenuBar(menu_bar);
}
-
-
-JZGuitarFrame* JZPianoFrame::GetGuitarFrame()
-{
- return mpPianoWindow->GetGuitarFrame();
-}
-
void JZPianoFrame::OnFilter(wxCommandEvent& Event)
{
mpPianoWindow->EditFilter();
@@ -747,6 +741,11 @@
mpPianoWindow->NewPlayPosition(Clock);
}
+void JZPianoFrame::ShowPitch(int Pitch)
+{
+ mpPianoWindow->ShowPitch(Pitch);
+}
+
void JZPianoFrame::Redraw()
{
mpPianoWindow->Refresh();
Modified: trunk/jazz/src/PianoFrame.h
===================================================================
--- trunk/jazz/src/PianoFrame.h 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/PianoFrame.h 2008-04-14 14:39:29 UTC (rev 459)
@@ -59,8 +59,6 @@
void OnMDialog(wxCommandEvent& Event);
void OnMCutPaste(wxCommandEvent& Event);
- void OnZoomIn(wxCommandEvent& Event);
- void OnZoomOut(wxCommandEvent& Event);
void OnSnap8(wxCommandEvent& Event);
void OnSnap8D(wxCommandEvent& Event);
void OnSnap16(wxCommandEvent& Event);
@@ -68,11 +66,8 @@
void VisibleDialog();
-
void CreateMenu();
- void OnPaintSub(wxDC* dc, int x, int y);
-
void OnSnapDlg(wxCommandEvent& Event);
// Current track.
@@ -81,8 +76,6 @@
void MouseCutPaste(wxMouseEvent &e, bool cut);
- JZGuitarFrame* GetGuitarFrame();
-
bool OnClose();
void PressRadio(int id = 0);
@@ -121,14 +114,20 @@
void OnCut(wxCommandEvent& Event);
void OnCopy(wxCommandEvent& Event);
void OnErase(wxCommandEvent& Event);
- void OnVisibleAllTracks(wxCommandEvent& Event);
void OnReset(wxCommandEvent& Event);
- public:
+ //==============================================
+ // These are facades for piano window functions.
+ //==============================================
void NewPlayPosition(int Clock);
+
+ void ShowPitch(int Pitch);
+
void Redraw();
+ public:
+
JZPianoWindow* mpPianoWindow;
int mClockTicsPerPixel;
@@ -138,6 +137,11 @@
private:
+ void OnZoomIn(wxCommandEvent& Event);
+ void OnZoomOut(wxCommandEvent& Event);
+
+ void OnVisibleAllTracks(wxCommandEvent& Event);
+
void OnGuitar(wxCommandEvent& Event);
private:
Modified: trunk/jazz/src/PianoWindow.cpp
===================================================================
--- trunk/jazz/src/PianoWindow.cpp 2008-04-13 00:18:54 UTC (rev 458)
+++ trunk/jazz/src/PianoWindow.cpp 2008-04-14 14:39:29 UTC (rev 459)
@@ -26,6 +26,7 @@
#include "PianoWindow.h"
#include "PianoFrame.h"
+#include "ProjectManager.h"
#include "ControlEdit.h"
#include "Song.h"
#include "Filter.h"
@@ -124,9 +125,9 @@
int tMousePlay::ProcessEvent(wxMouseEvent& Event)
{
int x, y;
+ Event.GetPosition(&x, &y);
int OldPitch = mPitch;
- mpPianoWindow->LogicalMousePosition(Event, x, y);
if (Event.LeftDown())
{
@@ -227,7 +228,7 @@
wxClientDC Dc(Win);
// to translate scrolled coordinates
- Win->DoPrepareDC(Dc);
+ Win->PrepareDC(Dc);
Win->DrawEvent(Dc, Copy, wxWHITE_BRUSH, 0);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
@@ -253,10 +254,10 @@
int tKeyLengthDragger::Dragging(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
- Win->DoPrepareDC(Dc); //to translate scrolled coordinates
+ Win->PrepareDC(Dc); //to translate scrolled coordinates
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
int fx, fy;
- Win->LogicalMousePosition(Event, fx, fy);
+ Event.GetPosition(&fx, &fy);
int Clock = Win->x2Clock(fx);
int Length = Clock - Copy->GetClock();
if (Length <= 0)
@@ -346,7 +347,7 @@
Win->GetSong()->NewUndoBuffer();
//
wxClientDC Dc(Win);
- Win->DoPrepareDC(Dc);
+ Win->PrepareDC(Dc);
Win->DrawEvent(Dc, Copy, wxWHITE_BRUSH, 0);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
}
@@ -371,10 +372,10 @@
int tPlayTrackLengthDragger::Dragging(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
- Win->DoPrepareDC(Dc);
+ Win->PrepareDC(Dc);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
int fx, fy;
- Win->LogicalMousePosition(Event, fx, fy);
+ Event.GetPosition(&fx, &fy);
int Clock = Win->x2Clock(fx);
int Length = Clock - Copy->GetClock();
if (Length <= 0)
@@ -390,7 +391,7 @@
int tPlayTrackLengthDragger::ButtonUp(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
- Win->DoPrepareDC(Dc);
+ Win->PrepareDC(Dc);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 0, 1);
@@ -449,7 +450,7 @@
Win->ApplyToTrack(mpKeyOn, Copy);
wxClientDC Dc(Win);
- Win->DoPrepareDC(Dc);
+ Win->PrepareDC(Dc);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 0, 1);
Win->UpdateControl();
@@ -504,7 +505,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-#define IsBlack(Key) isBlack[(Key) % 12]
+#define IsBlack(Key) isBlack[(Key) % 12]
//-----------------------------------------------------------------------------
// Mouse Actions Mapping
@@ -556,8 +557,14 @@
EVT_SIZE(JZPianoWindow::OnSize)
+ EVT_ERASE_BACKGROUND(JZPianoWindow::OnEraseBackground)
+
+ EVT_PAINT(JZPianoWindow::OnPaint)
+
EVT_MOUSE_EVENTS(JZPianoWindow::OnMouseEvent)
+ EVT_SCROLLWIN(JZPianoWindow::OnScroll)
+
END_EVENT_TABLE()
//-----------------------------------------------------------------------------
@@ -581,19 +588,6 @@
mpCtrlEdit(0),
mMousePlay(play_actions),
mMouseEvent(evnt_actions),
- mLittleBit(1),
- mClockTicsPerPixel(4),
- mTopInfoHeight(40),
- mLeftInfoWidth(100),
- mFromClock(0),
- mToClock(0),
- mFromLine(0),
- mToLine(0),
- mCanvasX(0),
- mCanvasY(0),
- mCanvasWidth(0),
- mCanvasHeight(0),
- mTrackHeight(0),
mUseColors(true),
mMouseLine(-1),
mFontSize(12),
@@ -603,18 +597,22 @@
mpDrumFont(0),
mSnapDenomiator(16),
mVisibleKeyOn(true),
- mVisiblePitch(false),
- mVisibleController(false),
- mVisibleProgram(false),
- mVisibleTempo(false),
- mVisibleSysex(false),
- mVisiblePlayTrack(false),
+ mVisiblePitch(true),
+ mVisibleController(true),
+ mVisibleProgram(true),
+ mVisibleTempo(true),
+ mVisibleSysex(true),
+ mVisiblePlayTrack(true),
mVisibleDrumNames(true),
- mVisibleAllTracks(false),
+ mVisibleAllTracks(true),
mVisibleHBChord(true),
- mVisibleMono(false),
- mpGuitarFrame(0)
+ mVisibleMono(true),
+ mDrawing(false),
+ mpFrameBuffer(0)
{
+ // This is more appropriate than the value in the event window constructor.
+ mClockTicsPerPixel = 4;
+
InitColors();
mpTrack = mpSong->GetTrack(mTrackIndex);
@@ -628,6 +626,8 @@
mMouseEvent.SetLeftAction(MA_SELECT);
+ mpFrameBuffer = new wxBitmap;
+
Setup();
}
@@ -639,7 +639,7 @@
delete mpFont;
delete mpFixedFont;
delete mpDrumFont;
- delete mpGuitarFrame;
+ delete mpFrameBuffer;
}
//-----------------------------------------------------------------------------
@@ -694,30 +694,61 @@
mPianoWidth = Width + mLittleBit;
mLeftInfoWidth = mPianoWidth;
+
+ SetScrollRanges();
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void JZPianoWindow::OnDraw(wxDC& Dc)
{
- // OnPaint never seems to get called, but OnDraw does get called.
- int x = 0, y = 0;
- GetViewStart(&x, &y);
- OnPaintSub(Dc, x * mScrollSize, y * mScrollSize);
+ Draw(Dc);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void JZPianoWindow::OnPaintSub(wxDC& Dc, int x, int y)
+void JZPianoWindow::Draw(wxDC& Dc)
{
+ if (!mpFrameBuffer->Ok() || mDrawing)
+ {
+ return;
+ }
+
+ mDrawing = true;
+
+ // Create a memory device context and select the frame bitmap into it.
+ wxMemoryDC LocalDc;
+ LocalDc.SelectObject(*mpFrameBuffer);
+
+ LocalDc.SetFont(*mpFont);
+
+ // Setup the brush that is used to clear the background.
+ LocalDc.SetBackground(*wxWHITE_BRUSH);
+
+ // Clear the background using the brush that was just setup,
+ // in case the following drawing calls fail.
+ LocalDc.Clear();
+
// int OldFromClock = mFromClock;
- OnEventWinPaintSub(x, y);
+ GetClientSize(&mCanvasWidth, &mCanvasHeight);
-// SN++ Da Jazz nun eine ReDo Funktion hat. Behebt gleichzeitig ein kleines
-// Update Problem beim mehrfachen ZoomOut.
-// Aktives Ctrl-Fenster neu zeichnen bzw. reinitialisieren.
+ mEventsX = mLeftInfoWidth;
+ mEventsY = mTopInfoHeight;
+ mEventsWidth = mCanvasWidth - mLeftInfoWidth;
+ mEventsHeight = mCanvasHeight - mTopInfoHeight;
+
+ mFromLine = mScrolledY / mTrackHeight;
+ mToLine = 1 + (mScrolledY + mCanvasHeight - mTopInfoHeight) / mTrackHeight;
+
+ mFromClock = mScrolledX * mClockTicsPerPixel;
+ mToClock = x2Clock(mCanvasWidth);
+
+ // SN++ Because jazz has a ReDo function. Fixes simultaneously update a
+ // small problem when multiple ZoomOut. Active Ctrl draw new windows or
+ // reinitialize.
+
// if (mpCtrlEdit && OldFromClock != mFromClock)
// mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel);
@@ -726,46 +757,50 @@
mpCtrlEdit->ReInit(mpTrack, mFromClock, mClockTicsPerPixel);
}
- mPianoX = mCanvasX;
+ mPianoX = 0;
- int StopClk;
JZBarInfo BarInfo(mpSong);
- char buf[20];
- Dc.DestroyClippingRegion();
- Dc.SetBackground(*wxWHITE_BRUSH);
- DrawPlayPosition(Dc);
- mpSnapSel->Draw(Dc, mEventsX, mEventsY, mEventsWidth, mEventsHeight);
- Dc.Clear();
+//DEBUG cout
+//DEBUG << "mLeftInfoWidth: " << mLeftInfoWidth << '\n'
+//DEBUG << "mCanvasWidth - mLeftInfoWidth: " << mCanvasWidth - mLeftInfoWidth << '\n'
+//DEBUG << "BarInfo.TicksPerBar " << BarInfo.TicksPerBar << '\n'
+//DEBUG << "From Clock: " << mFromClock << '\n'
+//DEBUG << "To Clock: " << mToClock << '\n'
+//DEBUG << "Clocks/Pixel: " << mClockTicsPerPixel << '\n'
+//DEBUG << "From Measure: " << mFromClock / BarInfo.TicksPerBar << '\n'
+//DEBUG << "To Measure: " << mToClock / BarInfo.TicksPerBar << '\n'
+//DEBUG << "From X: " << Clock2x(mFromClock) << '\n'
+//DEBUG << "To X: " << Clock2x(mToClock) << '\n'
+//DEBUG << endl;
-
///////////////////////////////////////////////////////////////
// horizontal lines(ripped from drawpianoroll code)
-// for (y = Line2y(mFromLine); y < mEventsY + mEventsHeight; y += mTrackHeight)
+// for (y = TrackIndex2y(mFromLine); y < mEventsY + mEventsHeight; y += mTrackHeight)
// if (y > mEventsY) // cheaper than clipping
-// Dc.DrawLine(mEventsX+1, y, mEventsX + mEventsWidth, y);
+// LocalDc.DrawLine(mEventsX+1, y, mEventsX + mEventsWidth, y);
- Dc.SetPen(*wxGREY_PEN);
- wxBrush blackKeysBrush=wxBrush(wxColor(250,240,240),wxSOLID);
+ LocalDc.SetPen(*wxGREY_PEN);
+ wxBrush blackKeysBrush = wxBrush(wxColor(250, 240, 240), wxSOLID);
int Pitch = 127 - mFromLine;
- y = Line2y(mFromLine);
+ int y = TrackIndex2y(mFromLine);
while (Pitch >= 0 && y < mEventsY + mEventsHeight)
{
if (IsBlack(Pitch))
{
- Dc.SetBrush(blackKeysBrush);//*wxLIGHT_GREY_PEN
- Dc.DrawRectangle(mCanvasX, y, 2000, mTrackHeight);
+ LocalDc.SetBrush(blackKeysBrush);
+ LocalDc.DrawRectangle(0, y, 2000, mTrackHeight);
}
else if ((Pitch % 12) == 0)
{
- Dc.SetPen(*wxCYAN_PEN);
- Dc.DrawLine(mCanvasX, y + mTrackHeight, 2000, y + mTrackHeight);
+ LocalDc.SetPen(*wxCYAN_PEN);
+ LocalDc.DrawLine(0, y + mTrackHeight, 2000, y + mTrackHeight);
}
else if (!IsBlack(Pitch - 1))
{
- Dc.SetPen(*wxGREEN_PEN);
- Dc.DrawLine(mCanvasX, y + mTrackHeight, 2000, y + mTrackHeight);
+ LocalDc.SetPen(*wxGREEN_PEN);
+ LocalDc.DrawLine(0, y + mTrackHeight, 2000, y + mTrackHeight);
}
y += mTrackHeight;
@@ -775,62 +810,58 @@
///////////////////////////////////////////////////////////////
-
mMouseLine = -1;
- #define VLine(x) DrawLine(x, mCanvasY, x, mEventsY + mEventsHeight)
- #define HLine(y) DrawLine(mCanvasX, y, mCanvasX + mCanvasWidth, y)
+ LocalDc.SetPen(*wxBLACK_PEN);
- Dc.SetPen(*wxBLACK_PEN);
+ DrawVerticalLine(LocalDc, 0);
+ DrawVerticalLine(LocalDc, mEventsX);
+ DrawVerticalLine(LocalDc, mEventsX - 1);
- // vertical lines
+ DrawHorizontalLine(LocalDc, mEventsY);
+ DrawHorizontalLine(LocalDc, mEventsY - 1);
+ DrawHorizontalLine(LocalDc, mEventsY + mEventsHeight);
- Dc.VLine(mPianoX);
- Dc.VLine(mEventsX);
- Dc.VLine(mEventsX - 1);
- Dc.HLine(mEventsY);
- Dc.HLine(mEventsY - 1);
- Dc.HLine(mEventsY + mEventsHeight);
-
// draw vlines and bar numbers
- Dc.SetFont(*mpFixedFont);
+ LocalDc.SetFont(*mpFixedFont);
BarInfo.SetClock(mFromClock);
- StopClk = x2Clock(mCanvasX + mCanvasWidth);
+ int StopClk = x2Clock(mCanvasWidth);
int clk = BarInfo.Clock;
int intro = mpSong->GetIntroLength();
while (clk < StopClk)
{
clk = BarInfo.Clock;
- x = Clock2x(clk);
+ int x = Clock2x(clk);
// vertical lines and bar numbers
int i;
- Dc.SetPen(*wxBLACK_PEN);
- sprintf(buf, "%d", BarInfo.BarNr + 1 - intro);
+ LocalDc.SetPen(*wxBLACK_PEN);
+ ostringstream Oss;
+ Oss << BarInfo.BarNr + 1 - intro;
if (x > mEventsX)
{
- Dc.DrawText(buf, x + mLittleBit, mEventsY - mFixedFontHeight - 2);
- Dc.SetPen(*wxGREY_PEN);
- Dc.DrawLine(x, mEventsY - mFixedFontHeight, x, mEventsY + mEventsHeight);
+ LocalDc.DrawText(Oss.str().c_str(), x + mLittleBit, mEventsY - mFixedFontHeight - 2);
+ LocalDc.SetPen(*wxGREY_PEN);
+ LocalDc.DrawLine(x, mEventsY - mFixedFontHeight, x, mEventsY + mEventsHeight);
}
- Dc.SetPen(*wxLIGHT_GREY_PEN);
+ LocalDc.SetPen(*wxLIGHT_GREY_PEN);
for (i = 0; i < BarInfo.CountsPerBar; i++)
{
clk += BarInfo.TicksPerBar / BarInfo.CountsPerBar;
x = Clock2x(clk);
if (x > mEventsX)
{
- Dc.DrawLine(x, mEventsY + 1, x, mEventsY + mEventsHeight);
+ LocalDc.DrawLine(x, mEventsY + 1, x, mEventsY + mEventsHeight);
}
}
BarInfo.Next();
}
- LineText(Dc, mCanvasX, mCanvasY, mPianoWidth, mTopInfoHeight);
+ LineText(LocalDc, 0, 0, mPianoWidth, mTopInfoHeight);
- Dc.SetPen(*wxBLACK_PEN);
- DrawPianoRoll(Dc);
+ LocalDc.SetPen(*wxBLACK_PEN);
+ DrawPianoRoll(LocalDc);
// Draw chords from harmony-browser.
if (mVisibleHBChord && gpHarmonyBrowser && !mpTrack->IsDrumTrack())
@@ -848,9 +879,9 @@
sbrush.SetColour(230,255,230);
#endif
- //Dc.SetClippingRegion(mEventsX, mEventsY, mEventsWidth, mEventsHeight);
- Dc.SetLogicalFunction(wxXOR);
- Dc.SetPen(*wxTRANSPARENT_PEN);
+// LocalDc.SetClippingRegion(mEventsX, mEventsY, mEventsWidth, mEventsHeight);
+ LocalDc.SetLogicalFunction(wxXOR);
+ LocalDc.SetPen(*wxTRANSPARENT_PEN);
int steps = pAnalyzer->Steps();
for (int step = 0; step < steps; step ++)
@@ -890,13 +921,13 @@
}
if (brush)
{
- Dc.SetBrush(*brush);
+ LocalDc.SetBrush(*brush);
while (pitch < 127)
{
int y = Pitch2y(pitch);
if (y >= mEventsY && y <= mEventsY + mEventsHeight - h) // y-clipping
{
- Dc.DrawRectangle(x, y, w, h);
+ LocalDc.DrawRectangle(x, y, w, h);
}
pitch += 12;
}
@@ -905,52 +936,81 @@
}
}
- //Dc.DestroyClippingRegion();
- Dc.SetLogicalFunction(wxCOPY);
- Dc.SetPen(*wxBLACK_PEN);
- Dc.SetBrush(*wxBLACK_BRUSH);
+// LocalDc.DestroyClippingRegion();
+ LocalDc.SetLogicalFunction(wxCOPY);
+ LocalDc.SetPen(*wxBLACK_PEN);
+ LocalDc.SetBrush(*wxBLACK_BRUSH);
}
}
/////////end draw choords
if (mVisibleAllTracks)
{
- int i;
- for (i = 0; i < mpSong->nTracks; i++)
+ for (int i = 0; i < mpSong->nTracks; ++i)
{
- JZTrack *t = mpSong->GetTrack(i);
- if (t != mpTrack && IsVisible(t))
+ JZTrack* pTrack = mpSong->GetTrack(i);
+ if (pTrack != mpTrack && IsVisible(pTrack))
{
- DrawEvents(Dc, t, StatKeyOn, wxLIGHT_GREY_BRUSH, TRUE);
+ DrawEvents(LocalDc, pTrack, StatKeyOn, wxLIGHT_GREY_BRUSH, TRUE);
}
}
}
if (mVisibleKeyOn)
- DrawEvents(Dc, mpTrack, StatKeyOn, wxRED_BRUSH, FALSE);
+ {
+ DrawEvents(LocalDc, mpTrack, StatKeyOn, wxRED_BRUSH, FALSE);
+ }
if (mVisiblePitch)
- DrawEvents(Dc, mpTrack, StatPitch, wxBLUE_BRUSH, FALSE);
+ {
+ DrawEvents(LocalDc, mpTrack, StatPitch, wxBLUE_BRUSH, FALSE);
+ }
if (mVisibleController)
- DrawEvents(Dc, mpTrack, StatControl, wxCYAN_BRUSH, FALSE);
+ {
+ DrawEvents(LocalDc, mpTrack, StatControl, wxCYAN_BRUSH, FALSE);
+ }
if (mVisibleProgram)
- DrawEvents(Dc, mpTrack, StatProgram, wxGREEN_BRUSH, FALSE);
+ {
+ DrawEvents(LocalDc, mpTrack, StatProgram, wxGREEN_BRUSH, FALSE);
+ }
if (mVisibleTempo)
- DrawEvents(Dc, mpTrack, StatSetTempo, wxGREEN_BRUSH, FALSE);
+ {
+ DrawEvents(LocalDc, mpTrack, StatSetTempo, wxGREEN_BRUSH, FALSE);
+ }
if (mVisibleSysex)
- DrawEvents(Dc, mpTrack, StatSysEx, wxGREEN_BRUSH, FALSE);
+ {
+ DrawEvents(LocalDc, mpTrack, StatSysEx, wxGREEN_BRUSH, FALSE);
+ }
if (mVisiblePlayTrack)
- DrawEvents(Dc, mpTrack, StatPlayTrack, wxLIGHT_GREY_BRUSH, FALSE);
+ {
+ DrawEvents(LocalDc, mpTrack, StatPlayTrack, wxLIGHT_GREY_BRUSH, FALSE);
+ }
- DrawEvents(Dc, mpTrack, StatEndOfTrack, wxRED_BRUSH, FALSE);
- DrawEvents(Dc, mpTrack, StatText, wxBLACK_BRUSH, FALSE);
+ DrawEvents(LocalDc, mpTrack, StatEndOfTrack, wxRED_BRUSH, FALSE);
+ DrawEvents(LocalDc, mpTrack, StatText, wxBLACK_BRUSH, FALSE);
- Dc.SetPen(*wxBLACK_PEN);
- Dc.SetBrush(*wxBLACK_BRUSH);
- Dc.SetBackground(*wxWHITE_BRUSH); // xor-bug
+// LocalDc.SetPen(*wxBLACK_PEN);
+// LocalDc.SetBrush(*wxBLACK_BRUSH);
+// LocalDc.SetBackground(*wxWHITE_BRUSH); // xor-bug
- mpSnapSel->Draw(Dc, mEventsX, mEventsY, mEventsWidth, mEventsHeight);
+ DrawPlayPosition(LocalDc);
- DrawPlayPosition(Dc);
+ // Draw the selection box.
+ mpSnapSel->Draw(LocalDc, mEventsX, mEventsY, mEventsWidth, mEventsHeight);
+
+ Dc.Blit(
+ 0,
+ 0,
+ mCanvasWidth,
+ mCanvasHeight,
+ &LocalDc,
+ 0,
+ 0,
+ wxCOPY);
+
+ LocalDc.SetFont(wxNullFont);
+ LocalDc.SelectObject(wxNullBitmap);
+
+ mDrawing = false;
}
//-----------------------------------------------------------------------------
@@ -964,49 +1024,24 @@
{
Dc.SetBrush(*wxBLACK_BRUSH);
Dc.SetPen(*wxBLACK_PEN);
+
int x = Clock2x(mPlayClock);
-// Dc.SetLogicalFunction(wxXOR);
-
// Draw a line, 2 pixels wide.
- Dc.DrawLine(x, mCanvasY,x, mEventsY + mEventsHeight);
- Dc.DrawLine(x+1,mCanvasY,x+1,mEventsY + mEventsHeight);
-
-// Dc.SetLogicalFunction(wxCOPY);
+ Dc.DrawLine(x, 0, x, mEventsY + mEventsHeight);
+ Dc.DrawLine(x + 1, 0, x + 1, mEventsY + mEventsHeight);
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void JZPianoWindow::OnEventWinPaintSub(int x, int y)
-{
- mCanvasX = x;
- mCanvasY = y;
- int xc, yc;
- GetClientSize(&xc, &yc);
- mCanvasWidth = xc;
- mCanvasHeight = yc;
-
- mEventsX = mCanvasX + mLeftInfoWidth;
- mEventsY = mCanvasY + mTopInfoHeight;
- mEventsWidth = mCanvasWidth - mLeftInfoWidth;
- mEventsHeight = mCanvasHeight - mTopInfoHeight;
-
- mFromLine = mCanvasY / mTrackHeight;
- mToLine = (mCanvasY + mCanvasHeight - mTopInfoHeight) / mTrackHeight;
- mFromClock = mCanvasX * mClockTicsPerPixel;
- mToClock = x2Clock(mCanvasX + mCanvasWidth);
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
void JZPianoWindow::OnSize(wxSizeEvent& Event)
{
GetClientSize(&mCanvasWidth, &mCanvasHeight);
if (mCanvasWidth > 0 && mCanvasHeight > 0)
{
- SetScrollRanges(mCanvasX, mCanvasY);
- Refresh(false);
+ mpFrameBuffer->Create(mCanvasWidth, mCanvasHeight);
+ SetScrollRanges();
}
}
@@ -1097,16 +1132,19 @@
mTrackIndex = TrackIndex;
mpTrack = mpSong->GetTrack(mTrackIndex);
mpPianoFrame->SetTitle(mpTrack->GetName());
+
+ SetYScrollPosition(TrackIndex2y(mFromLines[mTrackIndex]));
}
// change position
if (Clock >= 0)
{
int x = Clock2x(Clock);
- SetScrollPosition(x - mLeftInfoWidth, Line2y(mFromLines[mTrackIndex]));
+//OLD SetScrollPosition(x, TrackIndex2y(mFromLines[mTrackIndex]));
+ SetXScrollPosition(x);
}
-// SN++ Ist geaendert. OnPaint zeichnet immer neu -> Bug Fix bei ZoomOut!
+// SN++ Is changed. OnPaint always draws new -> Bug Fix for ZoomOut!
/*
// OnPaint() redraws only if clock has changed
if (mpCtrlEdit && TrackIndex >= 0)
@@ -1117,27 +1155,36 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void JZPianoWindow::SetScrollRanges(const int& x, const int& y)
+void JZPianoWindow::SetScrollRanges()
{
- int Width, Height;
- GetVirtualEventSize(Width, Height);
- SetScrollbars(
- mScrollSize,
- mScrollSize,
- Width / mScrollSize,
- Height / mScrollSize,
- x,
- y);
- EnableScrolling(false, false);
+ int EventWidth, EventHeight;
+ GetVirtualEventSize(EventWidth, EventHeight);
+
+ // Must add the thumb size to the passed range to reach the maximum
+ // desired value.
+ int ThumbSize;
+
+ ...
[truncated message content] |
|
From: <pst...@us...> - 2008-04-13 00:19:03
|
Revision: 458
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=458&view=rev
Author: pstieber
Date: 2008-04-12 17:18:54 -0700 (Sat, 12 Apr 2008)
Log Message:
-----------
1. Added code to allow the setting of the MIDI device in Windows.
2. Changed wx_msw macro to __WXMSW__.
3. Changed tWinMtcPlayer to JZWindowsMtcPlayer.
4. Changed tWinMidiPlayer to JZWindowsMidiPlayer.
5. Changed tWinPlayer to JZWindowsPlayer.
6. Changed tWinMtcPlayer to JZWindowsMtcPlayer.
7. Changed tWinIntPlayer to JZWindowsIntPlayer.
8. Changed tWinAudioPlayer to JZWindowsAudioPlayer.
9. Changed ID_SETTINGS_SYNTH to ID_SETTINGS_SYNTHESIZER.
Modified Paths:
--------------
trunk/jazz/src/Audio.h
trunk/jazz/src/Dialogs/midiTiming.cpp
trunk/jazz/src/Project.cpp
trunk/jazz/src/Resources.h
trunk/jazz/src/TrackFrame.cpp
trunk/jazz/src/TrackFrame.h
trunk/jazz/src/gui/trackwinEnum.h
trunk/jazz/src/mswin/WindowsAudioInterface.cpp
trunk/jazz/src/mswin/WindowsAudioInterface.h
trunk/jazz/src/mswin/WindowsMidiInterface.h
trunk/jazz/src/mswin/WindowsPlayer.cpp
trunk/jazz/src/mswin/WindowsPlayer.h
Modified: trunk/jazz/src/Audio.h
===================================================================
--- trunk/jazz/src/Audio.h 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/Audio.h 2008-04-13 00:18:54 UTC (rev 458)
@@ -177,7 +177,7 @@
class tAudioRecordBuffer
{
friend class tSampleSet;
- friend class tWinAudioPlayer;
+ friend class JZWindowsAudioPlayer;
public:
@@ -224,7 +224,7 @@
friend class tSample;
friend class tAudioGloblForm;
friend class tSamplesDlg;
- friend class tWinAudioPlayer;
+ friend class JZWindowsAudioPlayer;
friend class tAudioPlayer;
friend class tAlsaAudioPlayer;
Modified: trunk/jazz/src/Dialogs/midiTiming.cpp
===================================================================
--- trunk/jazz/src/Dialogs/midiTiming.cpp 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/Dialogs/midiTiming.cpp 2008-04-13 00:18:54 UTC (rev 458)
@@ -55,13 +55,13 @@
void tTimingDlg::MtcInitRec()
{
-#ifdef wx_msw
+#ifdef __WXMSW__
if (Config(C_ClockSource) != CsMtc)
{
delete Midi;
Config(C_ClockSource) = CsMtc;
ClkSrcListBox->SetStringSelection( ClkSrcArray[ Config(C_ClockSource) ] );
- Midi = new tWinMtcPlayer(EventWin->Song);
+ Midi = new JZWindowsMtcPlayer(EventWin->Song);
if (!Midi->Installed())
{
wxMessageBox("no midi driver installed", "Error", wxOK);
@@ -130,7 +130,7 @@
if (i != Config(C_ClockSource))
{
Config(C_ClockSource) = (tClockSource) i;
-#ifdef wx_msw
+#ifdef __WXMSW__
// Re-install the midi device
delete Midi;
@@ -138,10 +138,10 @@
switch (Config(C_ClockSource))
{
case CsMidi:
- Midi = new tWinMidiPlayer(EventWin->Song);
+ Midi = new JZWindowsMidiPlayer(EventWin->Song);
break;
case CsMtc:
- Midi = new tWinMtcPlayer(EventWin->Song);
+ Midi = new JZWindowsMtcPlayer(EventWin->Song);
break;
case CsFsk:
case CsInt:
@@ -205,7 +205,7 @@
-1,
-1);
-#ifdef wx_msw
+#ifdef __WXMSW__
ClkSrcListBox->Append( ClkSrcArray[CsInt] );
ClkSrcListBox->Append( ClkSrcArray[CsMidi] );
ClkSrcListBox->Append( ClkSrcArray[CsMtc] );
@@ -240,7 +240,7 @@
panel->NewLine();
-#ifdef wx_msw
+#ifdef __WXMSW__
(void) new wxMessage( panel, "Record MTC offset: " );
(void) new tMidiButton( this, panel, (wxFunction) MtcRecFunc, "Start" );
panel->NewLine();
Modified: trunk/jazz/src/Project.cpp
===================================================================
--- trunk/jazz/src/Project.cpp 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/Project.cpp 2008-04-13 00:18:54 UTC (rev 458)
@@ -255,20 +255,20 @@
switch (mpConfig->GetValue(C_ClockSource))
{
case CsMidi:
- mpMidiPlayer = new tWinMidiPlayer(this);
+ mpMidiPlayer = new JZWindowsMidiPlayer(this);
break;
case CsMtc:
- mpMidiPlayer = new tWinMtcPlayer(this);
+ mpMidiPlayer = new JZWindowsMtcPlayer(this);
break;
case CsFsk:
case CsInt:
default:
- mpMidiPlayer = new tWinAudioPlayer(this);
+ mpMidiPlayer = new JZWindowsAudioPlayer(this);
if (!mpMidiPlayer->Installed())
{
mpMidiPlayer->ShowError();
delete mpMidiPlayer;
- mpMidiPlayer = new tWinIntPlayer(this);
+ mpMidiPlayer = new JZWindowsIntPlayer(this);
}
break;
}
Modified: trunk/jazz/src/Resources.h
===================================================================
--- trunk/jazz/src/Resources.h 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/Resources.h 2008-04-13 00:18:54 UTC (rev 458)
@@ -34,7 +34,8 @@
#define ID_EXPORT_SELECTION_AS_MIDI wxID_HIGHEST + 2
#define ID_SETTINGS_METRONOME wxID_HIGHEST + 10
-#define ID_SETTINGS_SYNTH wxID_HIGHEST + 11
+#define ID_SETTINGS_SYNTHESIZER wxID_HIGHEST + 11
+#define ID_SETTINGS_MIDI_DEVICE wxID_HIGHEST + 12
#define ID_TRIM wxID_HIGHEST + 30
#define ID_QUANTIZE wxID_HIGHEST + 31
Modified: trunk/jazz/src/TrackFrame.cpp
===================================================================
--- trunk/jazz/src/TrackFrame.cpp 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/TrackFrame.cpp 2008-04-13 00:18:54 UTC (rev 458)
@@ -39,6 +39,10 @@
#include "Dialogs/SynthesizerSettingsDialog.h"
#include "AboutDialog.h"
+#ifdef __WXMSW__
+#include "mswin/WindowsPlayer.h"
+#endif
+
// These are the tool bar icons.
#include "Bitmaps/open.xpm"
#include "Bitmaps/save.xpm"
@@ -93,8 +97,10 @@
EVT_MENU(ID_SETTINGS_METRONOME, JZTrackFrame::OnSettingsMetronome)
- EVT_MENU(ID_SETTINGS_SYNTH, JZTrackFrame::OnSettingsSynthesizerType)
+ EVT_MENU(ID_SETTINGS_SYNTHESIZER, JZTrackFrame::OnSettingsSynthesizerType)
+ EVT_MENU(ID_SETTINGS_MIDI_DEVICE, JZTrackFrame::OnSettingsMidiDevice)
+
EVT_MENU(wxID_HELP_CONTENTS, JZTrackFrame::OnHelpContents)
EVT_MENU(wxID_ABOUT, JZTrackFrame::OnHelpAbout)
@@ -334,19 +340,21 @@
pSettingMenu->Append(MEN_TIMING, "&Timing...");
pSettingMenu->Append(MEN_MIDI_THRU, "&Midi Thru...");
#endif
- pSettingMenu->Append(ID_SETTINGS_SYNTH, "&Synthesizer Type...");
+ pSettingMenu->Append(ID_SETTINGS_SYNTHESIZER, "&Synthesizer Type...");
-#if 0
#ifdef __WXMSW__
- pSettingMenu->Append(MEN_DEVICE, "&Midi Device...");
+ pSettingMenu->Append(ID_SETTINGS_MIDI_DEVICE, "&Midi Device...");
#else
if (
gpConfig->GetValue(C_MidiDriver) == eMidiDriverOss ||
gpConfig->GetValue(C_MidiDriver) == eMidiDriverAlsa)
{
- pSettingMenu->Append(MEN_DEVICE, "&Midi Device...");
+ pSettingMenu->Append(ID_SETTINGS_MIDI_DEVICE, "&Midi Device...");
}
#endif
+
+#if 0
+
save_settings_menu = new wxMenu;
save_settings_menu->Append( MEN_SAVE_THRU, "&Midi Thru" );
save_settings_menu->Append( MEN_SAVE_TIM, "&Timing" );
@@ -567,6 +575,41 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+void JZTrackFrame::OnSettingsMidiDevice(wxCommandEvent& Event)
+{
+ long InputDevice, OutputDevice;
+#ifdef __WXMSW__
+ gpConfig->Get(C_WinInputDevice, InputDevice);
+ gpConfig->Get(C_WinOutputDevice, OutputDevice);
+ JZWindowsPlayer::SettingsDlg(InputDevice, OutputDevice);
+ ::wxMessageBox(
+ "Restart Jazz++ to activate changes in device settings",
+ "Info",
+ wxOK);
+#else
+/*
+ if (gpConfig->GetValue(C_MidiDriver) == eMidiDriverOss)
+ {
+ int Device = mpMidiPlayer->FindMidiDevice();
+ if (Device >= 0)
+ {
+ SaveMidiDeviceSettings(Device);
+ ::wxMessageBox(
+ "Restart Jazz++ to activate changes in device settings",
+ "Info",
+ wxOK);
+ }
+ else
+ {
+ ::wxMessageBox("No midi device found", "Info", wxOK);
+ }
+ }
+*/
+#endif
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZTrackFrame::OnHelpContents(wxCommandEvent& Event)
{
::wxGetApp().DisplayHelpContents();
Modified: trunk/jazz/src/TrackFrame.h
===================================================================
--- trunk/jazz/src/TrackFrame.h 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/TrackFrame.h 2008-04-13 00:18:54 UTC (rev 458)
@@ -88,6 +88,8 @@
void OnSettingsSynthesizerType(wxCommandEvent& Event);
+ void OnSettingsMidiDevice(wxCommandEvent& Event);
+
void OnHelpContents(wxCommandEvent& Event);
void OnHelpAbout(wxCommandEvent& Event);
Modified: trunk/jazz/src/gui/trackwinEnum.h
===================================================================
--- trunk/jazz/src/gui/trackwinEnum.h 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/gui/trackwinEnum.h 2008-04-13 00:18:54 UTC (rev 458)
@@ -84,7 +84,6 @@
MEN_SUB_CC1=61,
MEN_SUB_CC2=62,
MEN_CLEANUP=63,
- MEN_DEVICE=64,
MEN_SAVE_SET=65,
MEN_MIDI_THRU=66,
MEN_COPYRIGHT=67,
Modified: trunk/jazz/src/mswin/WindowsAudioInterface.cpp
===================================================================
--- trunk/jazz/src/mswin/WindowsAudioInterface.cpp 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/mswin/WindowsAudioInterface.cpp 2008-04-13 00:18:54 UTC (rev 458)
@@ -50,7 +50,7 @@
public:
- tAudioListener(tWinAudioPlayer* pPlayer, int key)
+ tAudioListener(JZWindowsAudioPlayer* pPlayer, int key)
: wxTimer(),
mpPlayer(pPlayer),
mCount(0),
@@ -74,7 +74,7 @@
}
tAudioListener(
- tWinAudioPlayer* pPlayer,
+ JZWindowsAudioPlayer* pPlayer,
tSample& spl,
long fr_smpl,
long to_smpl)
@@ -133,7 +133,7 @@
private:
- tWinAudioPlayer* mpPlayer;
+ JZWindowsAudioPlayer* mpPlayer;
long mCount;
@@ -144,8 +144,8 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-tWinAudioPlayer::tWinAudioPlayer(JZSong* pSong)
- : tWinIntPlayer(pSong),
+JZWindowsAudioPlayer::JZWindowsAudioPlayer(JZSong* pSong)
+ : JZWindowsIntPlayer(pSong),
mErrorCode(NoError),
mCanDuplex(false),
mCanSynchronize(true),
@@ -197,7 +197,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-tWinAudioPlayer::~tWinAudioPlayer()
+JZWindowsAudioPlayer::~JZWindowsAudioPlayer()
{
delete mpListener;
delete AudioBuffer;
@@ -211,7 +211,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::ShowError()
+void JZWindowsAudioPlayer::ShowError()
{
const char* pMessage = 0;
switch (mErrorCode)
@@ -249,14 +249,14 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int tWinAudioPlayer::LoadSamples(const char *filename)
+int JZWindowsAudioPlayer::LoadSamples(const char *filename)
{
return mSamples.Load(filename);
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int tWinAudioPlayer::OpenDsp()
+int JZWindowsAudioPlayer::OpenDsp()
{
int i;
MMRESULT res;
@@ -369,7 +369,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int tWinAudioPlayer::CloseDsp()
+int JZWindowsAudioPlayer::CloseDsp()
{
// todo: close the device immediately if open
@@ -441,13 +441,13 @@
{
if (wMsg == MM_WOM_DONE || wMsg == MM_WIM_DATA)
{
- ((tWinAudioPlayer *)dwUser)->AudioCallback(wMsg);
+ ((JZWindowsAudioPlayer *)dwUser)->AudioCallback(wMsg);
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::AudioCallback(UINT wMsg)
+void JZWindowsAudioPlayer::AudioCallback(UINT wMsg)
{
// async called by driver when the driver has processed a buffer completely
EnterCriticalSection(&mutex);
@@ -468,7 +468,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::StartAudio()
+void JZWindowsAudioPlayer::StartAudio()
{
// async called by driver to start audio in sync with midi
if (hout_open)
@@ -487,7 +487,7 @@
// Description:
// Send the sample set to driver.
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::WriteBuffers()
+void JZWindowsAudioPlayer::WriteBuffers()
{
if (audio_enabled && hout_open)
{
@@ -514,7 +514,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::Notify()
+void JZWindowsAudioPlayer::Notify()
{
if (audio_enabled)
{
@@ -599,15 +599,15 @@
LeaveCriticalSection(&mutex);
} // if (audio_enabled)
- tWinIntPlayer::Notify();
+ JZWindowsIntPlayer::Notify();
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::StartPlay(long Clock, long LoopClock, int Continue)
+void JZWindowsAudioPlayer::StartPlay(long Clock, long LoopClock, int Continue)
{
mSamples.StartPlay(Clock);
- tWinIntPlayer::StartPlay(Clock, LoopClock, Continue);
+ JZWindowsIntPlayer::StartPlay(Clock, LoopClock, Continue);
if (!audio_enabled)
return;
@@ -625,9 +625,9 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::StopPlay()
+void JZWindowsAudioPlayer::StopPlay()
{
- tWinIntPlayer::StopPlay();
+ JZWindowsIntPlayer::StopPlay();
CloseDsp();
mSamples.StopPlay();
if (RecordMode())
@@ -646,7 +646,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::ListenAudio(int key, int start_stop_mode)
+void JZWindowsAudioPlayer::ListenAudio(int key, int start_stop_mode)
{
if (!audio_enabled)
{
@@ -677,7 +677,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinAudioPlayer::ListenAudio(tSample &spl, long fr_smpl, long to_smpl)
+void JZWindowsAudioPlayer::ListenAudio(tSample &spl, long fr_smpl, long to_smpl)
{
if (!audio_enabled)
return;
@@ -694,7 +694,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-long tWinAudioPlayer::GetListenerPlayPosition()
+long JZWindowsAudioPlayer::GetListenerPlayPosition()
{
if (!mpListener)
{
@@ -705,7 +705,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int tWinAudioPlayer::RecordMode() const
+int JZWindowsAudioPlayer::RecordMode() const
{
return rec_info != 0 && rec_info->mpTrack->GetAudioMode();
}
Modified: trunk/jazz/src/mswin/WindowsAudioInterface.h
===================================================================
--- trunk/jazz/src/mswin/WindowsAudioInterface.h 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/mswin/WindowsAudioInterface.h 2008-04-13 00:18:54 UTC (rev 458)
@@ -29,10 +29,11 @@
#include "Audio.h"
#include "WindowsMidiInterface.h"
-
class tSample;
-class tWinAudioPlayer : public tWinIntPlayer
+//*****************************************************************************
+//*****************************************************************************
+class JZWindowsAudioPlayer : public JZWindowsIntPlayer
{
friend class tAudioListener;
@@ -51,9 +52,9 @@
ErrCapSync
};
- tWinAudioPlayer(JZSong* pSong);
+ JZWindowsAudioPlayer(JZSong* pSong);
- virtual ~tWinAudioPlayer();
+ virtual ~JZWindowsAudioPlayer();
int LoadSamples(const char *filename);
@@ -67,7 +68,7 @@
virtual int Installed()
{
- return installed && tWinIntPlayer::Installed();
+ return installed && JZWindowsIntPlayer::Installed();
}
virtual int GetAudioEnabled() const
@@ -134,8 +135,8 @@
int CloseDsp(); // 0 = ok
int installed;
- int audio_enabled; // 0 means midi only
- long blocks_played; // # of blocks written to device
+ int audio_enabled; // 0 means midi only
+ long blocks_played; // # of blocks written to device
int play_buffers_needed; // driver requests more output buffers
long start_clock; // when did play start
Modified: trunk/jazz/src/mswin/WindowsMidiInterface.h
===================================================================
--- trunk/jazz/src/mswin/WindowsMidiInterface.h 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/mswin/WindowsMidiInterface.h 2008-04-13 00:18:54 UTC (rev 458)
@@ -48,7 +48,7 @@
);
}
-class tWinAudioPlayer;
+class JZWindowsAudioPlayer;
// pseudo data word of struct midi_event, values must be less
// than 128 to be distinguished from a midi status
@@ -348,7 +348,7 @@
tMidiQueue play_buffer;
tMidiQueue thru_buffer;
- tWinAudioPlayer* audio_player;
+ JZWindowsAudioPlayer* audio_player;
long time_correction;
tWinSysexBufferArray* isx_buffers;
Modified: trunk/jazz/src/mswin/WindowsPlayer.cpp
===================================================================
--- trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-04-13 00:18:54 UTC (rev 458)
@@ -45,7 +45,7 @@
//*****************************************************************************
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-tWinPlayer::tWinPlayer(JZSong* pSong)
+JZWindowsPlayer::JZWindowsPlayer(JZSong* pSong)
: JZPlayer(pSong)
{
poll_millisec = 25;
@@ -161,14 +161,14 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int tWinPlayer::Installed()
+int JZWindowsPlayer::Installed()
{
return timer_installed && state->hout;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-tWinPlayer::~tWinPlayer()
+JZWindowsPlayer::~JZWindowsPlayer()
{
if (state->hinp)
{
@@ -193,14 +193,14 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::SetSoftThru(int on, int InputDevice, int OutputDevice)
+void JZWindowsPlayer::SetSoftThru(int on, int InputDevice, int OutputDevice)
{
state->soft_thru = on;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-JZEvent *tWinPlayer::Dword2Event(DWORD dw)
+JZEvent *JZWindowsPlayer::Dword2Event(DWORD dw)
{
union
{
@@ -250,7 +250,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-DWORD tWinPlayer::Event2Dword(JZEvent *e)
+DWORD JZWindowsPlayer::Event2Dword(JZEvent *e)
{
union
{
@@ -355,7 +355,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-long tWinPlayer::Clock2Time(long clock)
+long JZWindowsPlayer::Clock2Time(long clock)
{
if (clock < state->start_clock)
return state->start_time;
@@ -365,7 +365,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-long tWinPlayer::Time2Clock(long time)
+long JZWindowsPlayer::Time2Clock(long time)
{
if (time < state->start_time)
return state->start_clock;
@@ -376,7 +376,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::SetTempo(long bpm, long clock)
+void JZWindowsPlayer::SetTempo(long bpm, long clock)
{
long t1 = Clock2Time(clock);
state->ticks_per_minute = (long)bpm * (long)Song->TicksPerQuarter;
@@ -386,7 +386,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-long tWinPlayer::RealTimeClock2Time(long clock)
+long JZWindowsPlayer::RealTimeClock2Time(long clock)
{
if (clock < state->start_clock)
return real_start_time;
@@ -395,7 +395,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-long tWinPlayer::Time2RealTimeClock(long time)
+long JZWindowsPlayer::Time2RealTimeClock(long time)
{
if (time < real_start_time)
return state->start_clock;
@@ -404,7 +404,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::SetRealTimeTempo(long bpm, long clock)
+void JZWindowsPlayer::SetRealTimeTempo(long bpm, long clock)
{
long t1 = RealTimeClock2Time(clock);
real_ticks_per_minute = (long)bpm * (long)Song->TicksPerQuarter;
@@ -414,7 +414,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int tWinPlayer::OutSysex(JZEvent *e, DWORD time)
+int JZWindowsPlayer::OutSysex(JZEvent *e, DWORD time)
{
tSysEx *sx = e->IsSysEx();
if (sx == 0)
@@ -433,7 +433,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int tWinPlayer::OutEvent(JZEvent *e)
+int JZWindowsPlayer::OutEvent(JZEvent *e)
{
DWORD d = Event2Dword(e);
if (d)
@@ -449,7 +449,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-int tWinMidiPlayer::OutEvent(JZEvent *e)
+int JZWindowsMidiPlayer::OutEvent(JZEvent *e)
{
DWORD d = Event2Dword(e);
if (d)
@@ -466,7 +466,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::OutNow(JZEvent* pEvent)
+void JZWindowsPlayer::OutNow(JZEvent* pEvent)
{
DWORD d = Event2Dword(pEvent);
if (d)
@@ -503,7 +503,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::OutNow(tParam *r)
+void JZWindowsPlayer::OutNow(tParam *r)
{
OutNow(&r->Msb);
OutNow(&r->Lsb);
@@ -512,7 +512,9 @@
OutNow(&r->ResetLsb);
}
-void tWinPlayer::FillMidiClocks(long to)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZWindowsPlayer::FillMidiClocks(long to)
{
while (midiClockOut <= to)
{
@@ -525,7 +527,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::OutBreak(long clock)
+void JZWindowsPlayer::OutBreak(long clock)
{
if (gpConfig->GetValue(C_RealTimeOut))
{
@@ -540,7 +542,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinMidiPlayer::OutBreak(long clock)
+void JZWindowsMidiPlayer::OutBreak(long clock)
{
if (gpConfig->GetValue(C_RealTimeOut))
{
@@ -555,7 +557,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::OutBreak()
+void JZWindowsPlayer::OutBreak()
{
OutBreak(OutClock);
}
@@ -587,7 +589,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::StartPlay(long Clock, long LoopClock, int Continue)
+void JZWindowsPlayer::StartPlay(long Clock, long LoopClock, int Continue)
{
state->play_buffer.clear();
state->recd_buffer.clear();
@@ -696,7 +698,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::StopPlay()
+void JZWindowsPlayer::StopPlay()
{
wxBeginBusyCursor();
state->playing = FALSE;
@@ -750,7 +752,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::FlushToDevice()
+void JZWindowsPlayer::FlushToDevice()
// try to send all events up to OutClock to device
{
if (gpConfig->GetValue(C_RealTimeOut))
@@ -763,7 +765,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::FlushToDevice(long clock)
+void JZWindowsPlayer::FlushToDevice(long clock)
{
tEventIterator Iterator(&mPlayBuffer);
JZEvent* pEvent = Iterator.Range(0, clock);
@@ -782,7 +784,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-long tWinIntPlayer::GetRealTimeClock()
+long JZWindowsIntPlayer::GetRealTimeClock()
{
while (!state->recd_buffer.empty())
{
@@ -826,7 +828,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-long tWinMidiPlayer::GetRealTimeClock()
+long JZWindowsMidiPlayer::GetRealTimeClock()
{
long clock;
@@ -880,7 +882,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-long tWinMtcPlayer::GetRealTimeClock()
+long JZWindowsMtcPlayer::GetRealTimeClock()
{
long clock;
@@ -960,7 +962,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinMtcPlayer::InitMtcRec()
+void JZWindowsMtcPlayer::InitMtcRec()
{
state->doing_mtc_rec = TRUE;
StartPlay( 0, 0, 0 );
@@ -968,7 +970,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-tMtcTime* tWinMtcPlayer::FreezeMtcRec()
+tMtcTime* JZWindowsMtcPlayer::FreezeMtcRec()
{
StopPlay();
state->doing_mtc_rec = FALSE;
@@ -979,7 +981,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-void tWinPlayer::SettingsDlg(long& InputDevice, long& OutputDevice)
+void JZWindowsPlayer::SettingsDlg(long& InputDevice, long& OutputDevice)
{
vector<pair<string, int> > MidiDevices;
Modified: trunk/jazz/src/mswin/WindowsPlayer.h
===================================================================
--- trunk/jazz/src/mswin/WindowsPlayer.h 2008-04-11 17:26:33 UTC (rev 457)
+++ trunk/jazz/src/mswin/WindowsPlayer.h 2008-04-13 00:18:54 UTC (rev 458)
@@ -34,14 +34,14 @@
//*****************************************************************************
//*****************************************************************************
-class tWinPlayer : public JZPlayer
+class JZWindowsPlayer : public JZPlayer
{
public:
- tWinPlayer(JZSong* pSong);
+ JZWindowsPlayer(JZSong* pSong);
int Installed();
- virtual ~tWinPlayer();
+ virtual ~JZWindowsPlayer();
virtual int OutEvent(JZEvent* e);
virtual int OutSysex(JZEvent* e, DWORD time);
void OutNow(JZEvent *e);
@@ -98,12 +98,12 @@
//*****************************************************************************
//*****************************************************************************
-class tWinIntPlayer : public tWinPlayer
+class JZWindowsIntPlayer : public JZWindowsPlayer
{
public:
- tWinIntPlayer(JZSong* pSong)
- : tWinPlayer(pSong)
+ JZWindowsIntPlayer(JZSong* pSong)
+ : JZWindowsPlayer(pSong)
{
}
@@ -112,27 +112,27 @@
//*****************************************************************************
//*****************************************************************************
-class tWinMidiPlayer : public tWinPlayer
+class JZWindowsMidiPlayer : public JZWindowsPlayer
{
public:
- tWinMidiPlayer(JZSong* pSong)
- : tWinPlayer(pSong)
+ JZWindowsMidiPlayer(JZSong* pSong)
+ : JZWindowsPlayer(pSong)
{
}
virtual long GetRealTimeClock();
- virtual int OutEvent(JZEvent *e);
+ virtual int OutEvent(JZEvent* pEvent);
virtual void OutBreak(long clock);
};
//*****************************************************************************
//*****************************************************************************
-class tWinMtcPlayer : public tWinPlayer
+class JZWindowsMtcPlayer : public JZWindowsPlayer
{
public:
- tWinMtcPlayer(JZSong* pSong)
- : tWinPlayer(pSong)
+ JZWindowsMtcPlayer(JZSong* pSong)
+ : JZWindowsPlayer(pSong)
{
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-11 17:26:45
|
Revision: 457
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=457&view=rev
Author: pstieber
Date: 2008-04-11 10:26:33 -0700 (Fri, 11 Apr 2008)
Log Message:
-----------
1. Changed JZConfigurationEntry::GetStrValue to return a constant std::string reference
instead of a constant character pointer.
2. Changed JZConfiguration::GetStrValue to return a constant std::string reference
instead of a constant character pointer.
3. Changed some debug output when reading an included file.
4. Updated other code to deal with #2 above.
5. Fixed a comparison bug in NewSynth that resulted in the wrong synthesizer type
being used.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
trunk/jazz/src/Configuration.h
trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp
trunk/jazz/src/Project.cpp
trunk/jazz/src/Synth.cpp
trunk/jazz/src/Synth.h
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Configuration.cpp 2008-04-11 17:26:33 UTC (rev 457)
@@ -785,17 +785,27 @@
case C_SynthConfig:
case C_Include:
{
- // include file
- wxString pathname = FindFile(GetStrValue(entry));
- cout << "include " << entry << endl;
- if (pathname)
+ if (entry == C_SynthConfig)
{
- FileDescriptors.push(fopen(pathname, "r"));
+ cout << "Include synthesizer configuration file \"";
}
else
{
+ cout << "Include file \"";
+ }
+ cout << GetStrValue(entry) << '"' << endl;
+
+ // Get the name of the include file.
+ wxString IncludeFileName = FindFile(GetStrValue(entry));
+
+ if (IncludeFileName.empty())
+ {
FileDescriptors.push(NULL);
}
+ else
+ {
+ FileDescriptors.push(fopen(IncludeFileName, "r"));
+ }
if (FileDescriptors.top() == NULL)
{
Modified: trunk/jazz/src/Configuration.h
===================================================================
--- trunk/jazz/src/Configuration.h 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Configuration.h 2008-04-11 17:26:33 UTC (rev 457)
@@ -150,7 +150,7 @@
void SetValue(const int& Value);
- const char* GetStrValue() const;
+ const std::string& GetStrValue() const;
void SetStrValue(const char* pStringValue);
@@ -201,9 +201,9 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
inline
-const char* JZConfigurationEntry::GetStrValue() const
+const std::string& JZConfigurationEntry::GetStrValue() const
{
- return mStrValue.c_str();
+ return mStrValue;
}
//*****************************************************************************
@@ -231,7 +231,7 @@
const char* GetName(int entry) const;
- const char* GetStrValue(int entry) const;
+ const std::string& GetStrValue(int entry) const;
const int& GetValue(const char* pName) const;
const int& GetValue(int Index) const;
@@ -291,7 +291,7 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
inline
-const char* JZConfiguration::GetStrValue(int entry) const
+const std::string& JZConfiguration::GetStrValue(int entry) const
{
assert((entry >= 0) && (entry < NumConfigNames));
return mNames[entry]->GetStrValue();
Modified: trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp 2008-04-11 17:26:33 UTC (rev 457)
@@ -115,7 +115,7 @@
iPair != gSynthesizerTypes.end();
++iPair, ++Index)
{
- if (strcmp(iPair->first.c_str(), gpConfig->GetStrValue(C_SynthType)) == 0)
+ if (iPair->first == gpConfig->GetStrValue(C_SynthType))
{
mOldSynthTypeName = iPair->first;
Selection = Index;
Modified: trunk/jazz/src/Project.cpp
===================================================================
--- trunk/jazz/src/Project.cpp 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Project.cpp 2008-04-11 17:26:33 UTC (rev 457)
@@ -143,13 +143,13 @@
mMetronomeInfo.ReadFromConfiguration();
- if (mpConfig->GetStrValue(C_SynthType))
+ if (mpConfig->GetStrValue(C_SynthType).empty())
{
- mpSynth = NewSynth(mpConfig->GetStrValue(C_SynthType));
+ mpSynth = NewSynth("GM");
}
else
{
- mpSynth = NewSynth("GM");
+ mpSynth = NewSynth(mpConfig->GetStrValue(C_SynthType));
}
gpSynth = mpSynth;
Modified: trunk/jazz/src/Synth.cpp
===================================================================
--- trunk/jazz/src/Synth.cpp 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Synth.cpp 2008-04-11 17:26:33 UTC (rev 457)
@@ -53,12 +53,12 @@
#define XG_NAT 0x43,0x10,0x4c
#define XG_NAT_LEN 8 // no command ID or checksum for XG native!
-JZSynth* NewSynth(const char* pType)
+JZSynth* NewSynth(const string& Type)
{
int i;
for (i = 0; i < NumSynthTypes; i++)
{
- if (gSynthesizerTypes[i].first != string(pType))
+ if (gSynthesizerTypes[i].first == Type)
{
break;
}
Modified: trunk/jazz/src/Synth.h
===================================================================
--- trunk/jazz/src/Synth.h 2008-04-11 17:22:07 UTC (rev 456)
+++ trunk/jazz/src/Synth.h 2008-04-11 17:26:33 UTC (rev 457)
@@ -364,7 +364,7 @@
};
-JZSynth* NewSynth(const char* pType);
+JZSynth* NewSynth(const std::string& Type);
class tGM : public JZSynth
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-11 17:22:15
|
Revision: 456
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=456&view=rev
Author: pstieber
Date: 2008-04-11 10:22:07 -0700 (Fri, 11 Apr 2008)
Log Message:
-----------
Changed dev to mDeviceNames and converted them from const char* to std::string.
Modified Paths:
--------------
trunk/jazz/src/AlsaDriver.cpp
trunk/jazz/src/AlsaDriver.h
Modified: trunk/jazz/src/AlsaDriver.cpp
===================================================================
--- trunk/jazz/src/AlsaDriver.cpp 2008-04-11 17:18:24 UTC (rev 455)
+++ trunk/jazz/src/AlsaDriver.cpp 2008-04-11 17:22:07 UTC (rev 456)
@@ -134,8 +134,8 @@
pcm[PLAYBACK] = NULL;
pcm[CAPTURE] = NULL;
- dev[PLAYBACK] = gpConfig->GetStrValue(C_AlsaAudioOutputDevice);
- dev[CAPTURE] = gpConfig->GetStrValue(C_AlsaAudioInputDevice);
+ mDeviceNames[PLAYBACK] = gpConfig->GetStrValue(C_AlsaAudioOutputDevice);
+ mDeviceNames[CAPTURE] = gpConfig->GetStrValue(C_AlsaAudioInputDevice);
// FIXME
mCanDuplex = 1;
@@ -202,7 +202,10 @@
recbuffers.ResetBufferSize(frag_byte_size[CAPTURE]);
}
- if (dev[CAPTURE] != dev[PLAYBACK] || mCanDuplex || running_mode == 0)
+ if (
+ mDeviceNames[CAPTURE] != mDeviceNames[PLAYBACK] ||
+ mCanDuplex ||
+ running_mode == 0)
{
OpenDsp(PLAYBACK, 1);
mSamples.ResetBufferSize(frag_byte_size[PLAYBACK]);
@@ -266,7 +269,12 @@
snd_pcm_stream_t stream = (mode == PLAYBACK) ?
SND_PCM_STREAM_PLAYBACK : SND_PCM_STREAM_CAPTURE;
- if (snd_pcm_open(&pcm[mode], dev[mode], stream, SND_PCM_NONBLOCK) < 0)
+ if (
+ snd_pcm_open(
+ &pcm[mode],
+ mDeviceNames[mode].c_str(),
+ stream,
+ SND_PCM_NONBLOCK) < 0)
{
perror("snd_pcm_open");
audio_enabled = 0;
Modified: trunk/jazz/src/AlsaDriver.h
===================================================================
--- trunk/jazz/src/AlsaDriver.h 2008-04-11 17:18:24 UTC (rev 455)
+++ trunk/jazz/src/AlsaDriver.h 2008-04-11 17:22:07 UTC (rev 456)
@@ -94,7 +94,7 @@
int audio_enabled; // 0 means midi only
int card; // card number in config
- const char *dev[2]; // device names
+ std::string mDeviceNames[2]; // device names
long frag_size[2];
long frag_byte_size[2];
int frame_shift[2];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-11 17:18:27
|
Revision: 455
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=455&view=rev
Author: pstieber
Date: 2008-04-11 10:18:24 -0700 (Fri, 11 Apr 2008)
Log Message:
-----------
Changed the format of some debug output.
Modified Paths:
--------------
trunk/jazz/src/FindFile.cpp
Modified: trunk/jazz/src/FindFile.cpp
===================================================================
--- trunk/jazz/src/FindFile.cpp 2008-04-11 14:04:39 UTC (rev 454)
+++ trunk/jazz/src/FindFile.cpp 2008-04-11 17:18:24 UTC (rev 455)
@@ -37,7 +37,7 @@
// environment variable, if it exists
// 3. appending the passed file name to the path specified by the JAZZ
// environment variable, if it exists
-// 4. appending the passed file name to the location of the jazz executable
+// 4. appending the passed file name to the location of the Jazz++ executable
//
// Returns:
// wxString:
@@ -48,7 +48,7 @@
{
if (::wxFileExists(FileName))
{
- cout << "imediate hit " << FileName << endl;
+ cout << "FindFile: Immediate hit on file \"" << FileName << '"' << endl;
return FileName;
}
@@ -61,7 +61,7 @@
FoundFileName << Home << wxFileName::GetPathSeparator() << FileName;
if (wxFileExists(FoundFileName))
{
- cout << "home " << FoundFileName << endl;
+ cout << "FindFile: HOME: \"" << FoundFileName << '"' << endl;
return FoundFileName;
}
}
@@ -73,7 +73,7 @@
FoundFileName << Home << wxFileName::GetPathSeparator() << FileName;
if (wxFileExists(FoundFileName))
{
- cout << "jazz " << FoundFileName <<endl;
+ cout << "FindFile: JAZZ: \"" << FoundFileName << '"' << endl;
return FoundFileName;
}
}
@@ -84,9 +84,11 @@
FoundFileName << Home << wxFileName::GetPathSeparator() << FileName;
if (wxFileExists(FoundFileName))
{
- cout << "startup " << FoundFileName << endl;
+ cout << "FindFile: Startup directory: \"" << FoundFileName << '"' << endl;
return FoundFileName;
}
+ cout << "FindFile: File not found: \"" << FileName << '"' << endl;
+
return wxEmptyString;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-11 14:04:50
|
Revision: 454
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=454&view=rev
Author: pstieber
Date: 2008-04-11 07:04:39 -0700 (Fri, 11 Apr 2008)
Log Message:
-----------
1. Changed to use an std::stack so that an arbitrary number of include files could be
handled.
2. Changed some warning messages.
3. Made come comment changes.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-11 02:49:02 UTC (rev 453)
+++ trunk/jazz/src/Configuration.cpp 2008-04-11 14:04:39 UTC (rev 454)
@@ -29,6 +29,7 @@
#include "FindFile.h"
#include "Globals.h"
+#include <stack>
#include <iostream>
#include <sstream>
@@ -676,6 +677,8 @@
mFileName = FileName;
+ // Get the current working directory so the code can return to this
+ // directory when it is done reading the configuration file.
wxString OriginalCurrentWorkingDirectory = ::wxGetCwd();
wxFileName FileNameObject(mFileName);
@@ -689,50 +692,46 @@
vector<pair<string, int> >* pVector = 0;
- const int MaxIncs = 10;
+ stack<FILE*> FileDescriptors;
- FILE *FdArr[MaxIncs];
- int IncLevel = 0;
-
- for (i = 0; i < MaxIncs; ++i)
- {
- FdArr[i] = NULL;
- }
-
cout
<< "JZConfiguration::LoadConfig:" << '\n'
<< " \"" << mFileName << '"'
<< endl;
- FdArr[IncLevel] = fopen(mFileName.c_str(), "r");
- if (FdArr[IncLevel] == NULL)
+ FileDescriptors.push(fopen(mFileName.c_str(), "r"));
+ if (FileDescriptors.top() == NULL)
{
- wxMessageBox(
- "Error reading config file.\n"
- "Please check permissions and set the environment variable\n"
- "JAZZ to the installation directory",
- "Warning",
- wxOK);
+ wxString String;
+ String
+ << "Error reading config file..." << '\n'
+ << '"' << mFileName << '"' << '\n'
+ << "Please check permissions and set the environment variable" << '\n'
+ << "JAZZ to the installation directory";
+ ::wxMessageBox(String, "Warning", wxOK);
+
+ // Return to the original working directory.
::wxSetWorkingDirectory(OriginalCurrentWorkingDirectory);
+
return;
}
while (1)
{
- // Read a line from the current file
- if (fgets(buf, sizeof(buf), FdArr[IncLevel]) == NULL)
+ // Read a line from the current file.
+ if (fgets(buf, sizeof(buf), FileDescriptors.top()) == NULL)
{
- fclose(FdArr[IncLevel]);
- FdArr[IncLevel] = NULL;
- --IncLevel;
- if (IncLevel < 0)
+ fclose(FileDescriptors.top());
+ FileDescriptors.pop();
+ if (FileDescriptors.empty())
{
- // Last line of jazz.cfg (.jazz)
+ // The code has reached the last line of the Jazz++ configuration file
+ // (jazz.cfg or .jazz).
break;
}
else
{
- // Last line of current include-file
+ // The code has reached the last line of current include-file.
continue;
}
}
@@ -789,24 +788,23 @@
// include file
wxString pathname = FindFile(GetStrValue(entry));
cout << "include " << entry << endl;
- IncLevel++;
- assert(IncLevel < MaxIncs);
if (pathname)
{
- FdArr[IncLevel] = fopen(pathname, "r");
+ FileDescriptors.push(fopen(pathname, "r"));
}
else
{
- FdArr[IncLevel] = NULL;
+ FileDescriptors.push(NULL);
}
- if (FdArr[IncLevel] == NULL)
+ if (FileDescriptors.top() == NULL)
{
wxString String;
String
- << "Could not open config include file \"" << buf << "\"";
- wxMessageBox(String, "Warning", wxOK);
- --IncLevel;
+ << "Could not open configuration include file:" << '\n'
+ << '"' << buf << '"';
+ ::wxMessageBox(String, "Warning", wxOK);
+ FileDescriptors.pop();
}
}
break;
@@ -838,7 +836,7 @@
mVoiceNames[VoiceIndex + 1].second = Value + 1;
- // Remove the off \n.
+ // Remove the \n.
buf[strlen(buf) - 1] = 0;
mVoiceNames[VoiceIndex + 1].first = buf + j;
@@ -870,7 +868,9 @@
}
mDrumSets[DrumsetIndex + 1].second = Value + 1;
- buf[strlen(buf) - 1] = 0; // cut off \n
+ // Remove the \n.
+ buf[strlen(buf) - 1] = 0;
+
mDrumSets[DrumsetIndex + 1].first = buf + j;
++DrumsetIndex;
@@ -888,8 +888,10 @@
{
sscanf(buf, " %d %n", &i, &j);
assert(0 <= i && i <= 127);
- buf[strlen(buf) - 1] = 0; // cut off \n
+ // Remove the \n.
+ buf[strlen(buf) - 1] = 0;
+
mCtrlNames[i + 1].first = buf + j;
}
@@ -898,17 +900,19 @@
{
sscanf(buf, " %d %n", &i, &j);
assert(0 <= i && i <= 127);
- buf[strlen(buf) - 1] = 0; // cut off \n
+ // Remove the \n.
+ buf[strlen(buf) - 1] = 0;
+
mDrumNames[i + 1].first = buf + j;
}
else
{
wxString String;
String
- << "LoadConfig: error reading line" << "\n"
- << buf;
- wxMessageBox(String, "Warning", wxOK);
+ << "LoadConfig: error reading line" << '\n'
+ << '"' << buf << '"';
+ ::wxMessageBox(String, "Warning", wxOK);
}
}
@@ -929,5 +933,6 @@
}
}
+ // Return to the original working directory.
::wxSetWorkingDirectory(OriginalCurrentWorkingDirectory);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-11 02:49:04
|
Revision: 453
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=453&view=rev
Author: pstieber
Date: 2008-04-10 19:49:02 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
Made some style and cosmetic changes.
Modified Paths:
--------------
trunk/jazz/src/Configuration.cpp
trunk/jazz/src/Configuration.h
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-11 02:25:18 UTC (rev 452)
+++ trunk/jazz/src/Configuration.cpp 2008-04-11 02:49:02 UTC (rev 453)
@@ -40,95 +40,80 @@
//*****************************************************************************
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-JZConfigEntry::JZConfigEntry(const char* pName, int IntegerValue)
- : mType(ConfigEntryTypeInt),
- mName(0),
+JZConfigurationEntry::JZConfigurationEntry(
+ const char* pName,
+ int IntegerValue)
+ : mType(eConfigEntryTypeInt),
+ mName(),
mValue(IntegerValue),
- mStrValue(0)
+ mStrValue()
{
if (pName)
{
- mName = new char [strlen(pName) + 1];
- strcpy(mName, pName);
+ mName = pName;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-JZConfigEntry::JZConfigEntry(const char* pName, const char* pStringValue)
- : mType(ConfigEntryTypeStr),
- mName(0),
+JZConfigurationEntry::JZConfigurationEntry(
+ const char* pName,
+ const char* pStringValue)
+ : mType(eConfigEntryTypeStr),
+ mName(),
mValue(0),
- mStrValue(0)
+ mStrValue()
{
if (pName)
{
- mName = new char [strlen(pName) + 1];
- strcpy(mName, pName);
+ mName = pName;
}
if (pStringValue)
{
- mStrValue = new char[strlen(pStringValue) + 1];
- strcpy(mStrValue, pStringValue);
+ mStrValue = pStringValue;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-JZConfigEntry::JZConfigEntry(const char* pName, const string& StringValue)
+JZConfigurationEntry::JZConfigurationEntry(
+ const char* pName,
+ const string& StringValue)
{
if (pName)
{
- mName = new char [strlen(pName) + 1];
- strcpy(mName, pName);
+ mName = pName;
}
- mStrValue = new char[strlen(StringValue.c_str()) + 1];
- strcpy(mStrValue, StringValue.c_str());
+ mStrValue = StringValue;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-JZConfigEntry::JZConfigEntry(const char* pName)
- : mType(ConfigEntryTypeEmpty),
- mName(0),
+JZConfigurationEntry::JZConfigurationEntry(const char* pName)
+ : mType(eConfigEntryTypeEmpty),
+ mName(),
mValue(0),
- mStrValue(0)
+ mStrValue()
{
if (pName)
{
- mName = new char [strlen(pName) + 1];
- strcpy(mName, pName);
+ mName = pName;
}
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-JZConfigEntry::~JZConfigEntry()
+void JZConfigurationEntry::SetStrValue(const char* pStringValue)
{
- delete [] mName;
- delete [] mStrValue;
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-void JZConfigEntry::SetStrValue(const char* pStringValue)
-{
- delete [] mStrValue;
if (pStringValue)
{
- mStrValue = new char[strlen(pStringValue) + 1];
- strcpy(mStrValue, pStringValue);
+ mStrValue = pStringValue;
}
}
-
-
-
-
-
//*****************************************************************************
// Description:
// This is the configuration class definition.
@@ -151,150 +136,198 @@
const char* pNoneString = "None";
// search for midi device
- mNames[C_Seq2Device] = new JZConfigEntry(".device", -1);
+ mNames[C_Seq2Device] = new JZConfigurationEntry(".device", -1);
// use /dev/music
- mNames[C_MidiDriver] = new JZConfigEntry(".driver", 1);
+ mNames[C_MidiDriver] = new JZConfigurationEntry(".driver", 1);
// Enable audio at startup.
- mNames[C_EnableAudio] = new JZConfigEntry(".enable_audio", 1);
+ mNames[C_EnableAudio] = new JZConfigurationEntry(".enable_audio", 1);
// Windows midi devices.
- mNames[C_WinInputDevice] = new JZConfigEntry(".win_input_device", -1);
- mNames[C_WinOutputDevice] = new JZConfigEntry(".win_output_device", -1);
+ mNames[C_WinInputDevice] = new JZConfigurationEntry(
+ ".win_input_device",
+ -1);
+ mNames[C_WinOutputDevice] = new JZConfigurationEntry(
+ ".win_output_device",
+ -1);
// ALSA midi devices.
- mNames[C_AlsaInputDevice] = new JZConfigEntry(".alsa_input_device", -1);
- mNames[C_AlsaOutputDevice] = new JZConfigEntry(".alsa_output_device", -1);
+ mNames[C_AlsaInputDevice] = new JZConfigurationEntry(
+ ".alsa_input_device",
+ -1);
+ mNames[C_AlsaOutputDevice] = new JZConfigurationEntry(
+ ".alsa_output_device",
+ -1);
// ALSA audio devices.
- mNames[C_AlsaAudioInputDevice] = new JZConfigEntry(
+ mNames[C_AlsaAudioInputDevice] = new JZConfigurationEntry(
".alsa_audio_input_device",
"hw:0,0");
- mNames[C_AlsaAudioOutputDevice] = new JZConfigEntry(
+ mNames[C_AlsaAudioOutputDevice] = new JZConfigurationEntry(
".alsa_audio_output_device",
"hw:0,0");
// Emulate MIDI thru.
- mNames[C_SoftThru] = new JZConfigEntry(".softthru", 1);
+ mNames[C_SoftThru] = new JZConfigurationEntry(".softthru", 1);
// mpu401 hardware MIDI thru.
- mNames[C_HardThru] = new JZConfigEntry(".hardthru", 1);
+ mNames[C_HardThru] = new JZConfigurationEntry(".hardthru", 1);
// MIDI clock source (0 = internal).
- mNames[C_ClockSource] = new JZConfigEntry(".clocksource", 0);
+ mNames[C_ClockSource] = new JZConfigurationEntry(".clocksource", 0);
// Send realtime MIDI messages to MIDI out.
- mNames[C_RealTimeOut] = new JZConfigEntry(".realtime_out", 0);
+ mNames[C_RealTimeOut] = new JZConfigurationEntry(".realtime_out", 0);
// Use the GS reverb macro.
- mNames[C_UseReverbMacro] = new JZConfigEntry(".use_reverb_macro", 1);
+ mNames[C_UseReverbMacro] = new JZConfigurationEntry(".use_reverb_macro", 1);
// Use the GS chorus macro.
- mNames[C_UseChorusMacro] = new JZConfigEntry(".use_chorus_macro", 1);
+ mNames[C_UseChorusMacro] = new JZConfigurationEntry(".use_chorus_macro", 1);
// Default drum channel is 10.
- mNames[C_DrumChannel] = new JZConfigEntry(".drumchannel", 10);
+ mNames[C_DrumChannel] = new JZConfigurationEntry(".drumchannel", 10);
// Controller for bank select.
- mNames[C_BankControlNumber] = new JZConfigEntry(".bank_control_number", 0);
+ mNames[C_BankControlNumber] = new JZConfigurationEntry(
+ ".bank_control_number",
+ 0);
// Controller2 for bank select with two commands.
- mNames[C_BankControlNumber2] = new JZConfigEntry(
+ mNames[C_BankControlNumber2] = new JZConfigurationEntry(
".bank_2nd_control_number",
32);
// Maximum number of entries in bank table (two commands).
- mNames[C_MaxBankTableEntries] = new JZConfigEntry(
+ mNames[C_MaxBankTableEntries] = new JZConfigurationEntry(
".max_bank_table_entries",
256);
// Number of columns to draw in Parts dialogs.
- mNames[C_PartsColumnsMax] = new JZConfigEntry(".parts_columns_max", 4);
+ mNames[C_PartsColumnsMax] = new JZConfigurationEntry(
+ ".parts_columns_max",
+ 4);
// Draw tracknames on the right too?
- mNames[C_PartsTracknamesRight] = new JZConfigEntry(
+ mNames[C_PartsTracknamesRight] = new JZConfigurationEntry(
".parts_tracknames_right",
1);
// Maximum number of voice names in .jazz.
- mNames[C_MaxVoiceNames] = new JZConfigEntry(".max_voice_names", 317);
+ mNames[C_MaxVoiceNames] = new JZConfigurationEntry(".max_voice_names", 317);
// Use two-command bank select?
- mNames[C_UseTwoCommandBankSelect] = new JZConfigEntry(
+ mNames[C_UseTwoCommandBankSelect] = new JZConfigurationEntry(
".use_two_command_bank_select",
0);
// Metronome settings.
- mNames[C_MetroIsAccented] = new JZConfigEntry(
+ mNames[C_MetroIsAccented] = new JZConfigurationEntry(
".metronome_is_accented",
1);
- mNames[C_MetroVelocity] = new JZConfigEntry(
+ mNames[C_MetroVelocity] = new JZConfigurationEntry(
".metronome_velocity",
127);
- mNames[C_MetroNormalClick] = new JZConfigEntry(
+ mNames[C_MetroNormalClick] = new JZConfigurationEntry(
".metronome_normal_click",
37);
- mNames[C_MetroAccentedClick] = new JZConfigEntry(
+ mNames[C_MetroAccentedClick] = new JZConfigurationEntry(
".metronome_accented_click",
36);
+ //--------------------------
// Window geometry settings.
- mNames[C_TrackWinXpos] = new JZConfigEntry(".trackwin_xpos", 10);
- mNames[C_TrackWinYpos] = new JZConfigEntry(".trackwin_ypos", 10);
- mNames[C_TrackWinWidth] = new JZConfigEntry(".trackwin_width", 600);
- mNames[C_TrackWinHeight] = new JZConfigEntry(".trackwin_height", 400);
- mNames[C_PianoWinXpos] = new JZConfigEntry(".pianowin_xpos", 30);
- mNames[C_PianoWinYpos] = new JZConfigEntry(".pianowin_ypos", 30);
- mNames[C_PianoWinWidth] = new JZConfigEntry(".pianowin_width", 600);
- mNames[C_PianoWinHeight] = new JZConfigEntry(".pianowin_height", 400);
- mNames[C_PartsDlgXpos] = new JZConfigEntry(".partsdialog_xpos", 50);
- mNames[C_PartsDlgYpos] = new JZConfigEntry(".partsdialog_ypos", 50);
- mNames[C_TrackDlgXpos] = new JZConfigEntry(".trackdialog_xpos", 50);
- mNames[C_TrackDlgYpos] = new JZConfigEntry(".trackdialog_ypos", 50);
- mNames[C_HarmonyXpos] = new JZConfigEntry(".harmonybrowser_xpos", 100);
- mNames[C_HarmonyYpos] = new JZConfigEntry(".harmonybrowser_ypos", 100);
- mNames[C_RhythmXpos] = new JZConfigEntry(".randomrhythm_xpos", 150);
- mNames[C_RhythmYpos] = new JZConfigEntry(".randomrhythm_ypos", 150);
+ //--------------------------
+ // Track window.
+ mNames[C_TrackWinXpos] = new JZConfigurationEntry(
+ ".trackwin_xpos",
+ 10);
+ mNames[C_TrackWinYpos] = new JZConfigurationEntry(
+ ".trackwin_ypos",
+ 10);
+ mNames[C_TrackWinWidth] = new JZConfigurationEntry(
+ ".trackwin_width",
+ 600);
+ mNames[C_TrackWinHeight] = new JZConfigurationEntry(
+ ".trackwin_height",
+ 400);
+
+ // Piano window.
+ mNames[C_PianoWinXpos] = new JZConfigurationEntry(
+ ".pianowin_xpos",
+ 30);
+ mNames[C_PianoWinYpos] = new JZConfigurationEntry(
+ ".pianowin_ypos",
+ 30);
+ mNames[C_PianoWinWidth] = new JZConfigurationEntry(
+ ".pianowin_width",
+ 600);
+ mNames[C_PianoWinHeight] = new JZConfigurationEntry(
+ ".pianowin_height",
+ 400);
+
+ // Parts dialog.
+ mNames[C_PartsDlgXpos] = new JZConfigurationEntry(".partsdialog_xpos", 50);
+ mNames[C_PartsDlgYpos] = new JZConfigurationEntry(".partsdialog_ypos", 50);
+
+ // Track dialog.
+ mNames[C_TrackDlgXpos] = new JZConfigurationEntry(".trackdialog_xpos", 50);
+ mNames[C_TrackDlgYpos] = new JZConfigurationEntry(".trackdialog_ypos", 50);
+
+ // Harmony browser.
+ mNames[C_HarmonyXpos] = new JZConfigurationEntry(
+ ".harmonybrowser_xpos",
+ 100);
+ mNames[C_HarmonyYpos] = new JZConfigurationEntry(
+ ".harmonybrowser_ypos",
+ 100);
+
+ // Random rhythm.
+ mNames[C_RhythmXpos] = new JZConfigurationEntry(".randomrhythm_xpos", 150);
+ mNames[C_RhythmYpos] = new JZConfigurationEntry(".randomrhythm_ypos", 150);
+
// Show dialog unless initialized.
- mNames[C_SynthDialog] = new JZConfigEntry(".synth_dialog", 1);
+ mNames[C_SynthDialog] = new JZConfigurationEntry(".synth_dialog", 1);
// Default synthesizer type.
- mNames[C_SynthType] = new JZConfigEntry(
+ mNames[C_SynthType] = new JZConfigurationEntry(
".synth_type",
gSynthesizerTypes[SynthTypeGS].first.c_str());
// Default synthesizer configuration file.
- mNames[C_SynthConfig] = new JZConfigEntry(
+ mNames[C_SynthConfig] = new JZConfigurationEntry(
".synth_config",
gSynthesierTypeFiles[SynthTypeGS].first.c_str());
// When to send synthesizer reset (0 = never, 1 = song start,
// 2 = start play).
- mNames[C_SendSynthReset] = new JZConfigEntry(".send_synth_reset", 1);
+ mNames[C_SendSynthReset] = new JZConfigurationEntry(".send_synth_reset", 1);
// Current include file.
- mNames[C_Include] = new JZConfigEntry(".include", "");
+ mNames[C_Include] = new JZConfigurationEntry(".include", "");
// Entries with empty values.
- mNames[C_BankTable] = new JZConfigEntry(".bank_table");
- mNames[C_VoiceNames] = new JZConfigEntry(".voicenames");
- mNames[C_DrumSets] = new JZConfigEntry(".drumsets");
- mNames[C_CtrlNames] = new JZConfigEntry(".ctrlnames");
- mNames[C_DrumNames] = new JZConfigEntry(".drumnames");
+ mNames[C_BankTable] = new JZConfigurationEntry(".bank_table");
+ mNames[C_VoiceNames] = new JZConfigurationEntry(".voicenames");
+ mNames[C_DrumSets] = new JZConfigurationEntry(".drumsets");
+ mNames[C_CtrlNames] = new JZConfigurationEntry(".ctrlnames");
+ mNames[C_DrumNames] = new JZConfigurationEntry(".drumnames");
// The startup song.
- mNames[C_StartUpSong] = new JZConfigEntry(".startup_song", "jazz.mid");
+ mNames[C_StartUpSong] = new JZConfigurationEntry(
+ ".startup_song",
+ "jazz.mid");
- mNames[C_OssBug1] = new JZConfigEntry(".ossbug1", 0);
- mNames[C_OssBug2] = new JZConfigEntry(".ossbug2", 0);
- mNames[C_DuplexAudio] = new JZConfigEntry(".duplex_audio", 0);
- mNames[C_ThruInput] = new JZConfigEntry(".thru_input", 0);
- mNames[C_ThruOutput] = new JZConfigEntry(".thru_output", 0);
+ mNames[C_OssBug1] = new JZConfigurationEntry(".ossbug1", 0);
+ mNames[C_OssBug2] = new JZConfigurationEntry(".ossbug2", 0);
+ mNames[C_DuplexAudio] = new JZConfigurationEntry(".duplex_audio", 0);
+ mNames[C_ThruInput] = new JZConfigurationEntry(".thru_input", 0);
+ mNames[C_ThruOutput] = new JZConfigurationEntry(".thru_output", 0);
// Enable/disable splash dialog.
- mNames[C_EnableWelcome] = new JZConfigEntry(".enable_welcome", 1);
+ mNames[C_EnableWelcome] = new JZConfigurationEntry(".enable_welcome", 1);
// Other initialization.
@@ -422,53 +455,58 @@
//-----------------------------------------------------------------------------
int JZConfiguration::Load(char* buf)
{
- int entry = Check(buf);
+ int entry = Check(buf);
- if (entry < 0)
- return entry;
+ if (entry < 0)
+ {
+ return entry;
+ }
- char format[100];
- int result = 1;
- if (mNames[entry]->GetType() == ConfigEntryTypeInt)
- {
- sprintf(format, "%s %%d", mNames[entry]->GetName());
- int Value;
- result = sscanf(buf, format, &Value);
- mNames[entry]->SetValue(Value);
- }
- else if (mNames[entry]->GetType() == ConfigEntryTypeStr)
- {
- // allow whitespace inside entries like "C:\Program Files\JazzWare"
- int ofs = strlen(mNames[entry]->GetName());
- while (buf[ofs] == ' ' || buf[ofs] == '\t') // not \n
- ofs++;
- int end = strlen(buf) - 1;
- while (end > ofs) {
- if (!isspace(buf[end]))
- break;
- end--;
+ char format[100];
+ int result = 1;
+ if (mNames[entry]->GetType() == eConfigEntryTypeInt)
+ {
+ sprintf(format, "%s %%d", mNames[entry]->GetName());
+ int Value;
+ result = sscanf(buf, format, &Value);
+ mNames[entry]->SetValue(Value);
+ }
+ else if (mNames[entry]->GetType() == eConfigEntryTypeStr)
+ {
+ // Allow whitespace inside entries like "C:\Program Files\JazzWare".
+ int ofs = strlen(mNames[entry]->GetName());
+ while (buf[ofs] == ' ' || buf[ofs] == '\t') // not \n
+ {
+ ++ofs;
+ }
+ int end = strlen(buf) - 1;
+ while (end > ofs)
+ {
+ if (!isspace(buf[end]))
+ {
+ break;
}
- int size = end - ofs + 1;
+ --end;
+ }
+ int size = end - ofs + 1;
- char* pStringValue = new char[size + 1];
- memcpy(pStringValue, buf + ofs, size);
- pStringValue[size] = 0;
- mNames[entry]->SetStrValue(pStringValue);
- delete [] pStringValue;
- }
- else
- {
- result = 1;
- }
+ char* pStringValue = new char[size + 1];
+ memcpy(pStringValue, buf + ofs, size);
+ pStringValue[size] = 0;
+ mNames[entry]->SetStrValue(pStringValue);
+ delete [] pStringValue;
+ }
+ else
+ {
+ result = 1;
+ }
- if (result <= 0)
- {
- return -1;
- }
- else
- {
- return entry;
- }
+ if (result <= 0)
+ {
+ return -1;
+ }
+
+ return entry;
}
//-----------------------------------------------------------------------------
Modified: trunk/jazz/src/Configuration.h
===================================================================
--- trunk/jazz/src/Configuration.h 2008-04-11 02:25:18 UTC (rev 452)
+++ trunk/jazz/src/Configuration.h 2008-04-11 02:49:02 UTC (rev 453)
@@ -111,9 +111,9 @@
//*****************************************************************************
enum TEConfigEntryType
{
- ConfigEntryTypeInt = 0,
- ConfigEntryTypeStr,
- ConfigEntryTypeEmpty
+ eConfigEntryTypeInt = 0,
+ eConfigEntryTypeStr,
+ eConfigEntryTypeEmpty
};
//*****************************************************************************
@@ -127,58 +127,87 @@
};
//*****************************************************************************
+// Description:
+// This is the configuration entry class declaration.
//*****************************************************************************
-class JZConfigEntry
+class JZConfigurationEntry
{
public:
- JZConfigEntry(const char* pName, int IntegerValue);
+ JZConfigurationEntry(const char* pName, int IntegerValue);
- JZConfigEntry(const char* pName, const char* pStringValue);
+ JZConfigurationEntry(const char* pName, const char* pStringValue);
- JZConfigEntry(const char* pName, const std::string& StringValue);
+ JZConfigurationEntry(const char* pName, const std::string& StringValue);
- JZConfigEntry(const char* pName);
+ JZConfigurationEntry(const char* pName);
- ~JZConfigEntry();
+ TEConfigEntryType GetType() const;
- TEConfigEntryType GetType() const
- {
- return mType;
- }
+ const char* GetName() const;
- const char* GetName() const
- {
- return mName;
- }
+ const int& GetValue() const;
- const int& GetValue() const
- {
- return mValue;
- }
+ void SetValue(const int& Value);
- void SetValue(const int& value)
- {
- mValue = value;
- }
+ const char* GetStrValue() const;
- const char* GetStrValue() const
- {
- return mStrValue;
- }
-
void SetStrValue(const char* pStringValue);
private:
TEConfigEntryType mType;
- char* mName;
+ std::string mName;
int mValue;
- char* mStrValue;
+ std::string mStrValue;
};
//*****************************************************************************
+// Description:
+// These are the configuration entry class inline member functions.
//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+TEConfigEntryType JZConfigurationEntry::GetType() const
+{
+ return mType;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+const char* JZConfigurationEntry::GetName() const
+{
+ return mName.c_str();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+const int& JZConfigurationEntry::GetValue() const
+{
+ return mValue;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+void JZConfigurationEntry::SetValue(const int& Value)
+{
+ mValue = Value;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+const char* JZConfigurationEntry::GetStrValue() const
+{
+ return mStrValue.c_str();
+}
+
+//*****************************************************************************
+//*****************************************************************************
class JZConfiguration
{
public:
@@ -233,7 +262,7 @@
wxString mFileName;
- JZConfigEntry* mNames[NumConfigNames];
+ JZConfigurationEntry* mNames[NumConfigNames];
std::vector<std::pair<std::string, int> > mDrumNames;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-11 02:25:23
|
Revision: 452
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=452&view=rev
Author: pstieber
Date: 2008-04-10 19:25:18 -0700 (Thu, 10 Apr 2008)
Log Message:
-----------
Made some style and cosmetic changes.
Modified Paths:
--------------
trunk/jazz/src/AlsaDriver.cpp
trunk/jazz/src/Configuration.cpp
trunk/jazz/src/Configuration.h
trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp
trunk/jazz/src/Dialogs.cpp
trunk/jazz/src/Globals.cpp
trunk/jazz/src/Globals.h
trunk/jazz/src/PianoWindow.cpp
trunk/jazz/src/Project.cpp
trunk/jazz/src/Project.h
trunk/jazz/src/Rhythm.cpp
trunk/jazz/src/Track.cpp
Modified: trunk/jazz/src/AlsaDriver.cpp
===================================================================
--- trunk/jazz/src/AlsaDriver.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/AlsaDriver.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -134,8 +134,8 @@
pcm[PLAYBACK] = NULL;
pcm[CAPTURE] = NULL;
- dev[PLAYBACK] = gpConfig->StrValue(C_AlsaAudioOutputDevice);
- dev[CAPTURE] = gpConfig->StrValue(C_AlsaAudioInputDevice);
+ dev[PLAYBACK] = gpConfig->GetStrValue(C_AlsaAudioOutputDevice);
+ dev[CAPTURE] = gpConfig->GetStrValue(C_AlsaAudioInputDevice);
// FIXME
mCanDuplex = 1;
Modified: trunk/jazz/src/Configuration.cpp
===================================================================
--- trunk/jazz/src/Configuration.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Configuration.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -34,76 +34,92 @@
using namespace std;
-tConfigEntry::tConfigEntry(const char* pName, int IntegerValue)
- : Type(ConfigEntryTypeInt),
- Name(0),
- Value(IntegerValue),
- StrValue(0)
+//*****************************************************************************
+// Description:
+// This is the configuration entry class definition.
+//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZConfigEntry::JZConfigEntry(const char* pName, int IntegerValue)
+ : mType(ConfigEntryTypeInt),
+ mName(0),
+ mValue(IntegerValue),
+ mStrValue(0)
{
if (pName)
{
- Name = new char [strlen(pName) + 1];
- strcpy(Name, pName);
+ mName = new char [strlen(pName) + 1];
+ strcpy(mName, pName);
}
}
-tConfigEntry::tConfigEntry(const char* pName, const char* pStringValue)
- : Type(ConfigEntryTypeStr),
- Name(0),
- Value(0),
- StrValue(0)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZConfigEntry::JZConfigEntry(const char* pName, const char* pStringValue)
+ : mType(ConfigEntryTypeStr),
+ mName(0),
+ mValue(0),
+ mStrValue(0)
{
if (pName)
{
- Name = new char [strlen(pName) + 1];
- strcpy(Name, pName);
+ mName = new char [strlen(pName) + 1];
+ strcpy(mName, pName);
}
if (pStringValue)
{
- StrValue = new char[strlen(pStringValue) + 1];
- strcpy(StrValue, pStringValue);
+ mStrValue = new char[strlen(pStringValue) + 1];
+ strcpy(mStrValue, pStringValue);
}
}
-tConfigEntry::tConfigEntry(const char* pName, const string& StringValue)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZConfigEntry::JZConfigEntry(const char* pName, const string& StringValue)
{
if (pName)
{
- Name = new char [strlen(pName) + 1];
- strcpy(Name, pName);
+ mName = new char [strlen(pName) + 1];
+ strcpy(mName, pName);
}
- StrValue = new char[strlen(StringValue.c_str()) + 1];
- strcpy(StrValue, StringValue.c_str());
+ mStrValue = new char[strlen(StringValue.c_str()) + 1];
+ strcpy(mStrValue, StringValue.c_str());
}
-tConfigEntry::tConfigEntry(const char* pName)
- : Type(ConfigEntryTypeEmpty),
- Name(0),
- Value(0),
- StrValue(0)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZConfigEntry::JZConfigEntry(const char* pName)
+ : mType(ConfigEntryTypeEmpty),
+ mName(0),
+ mValue(0),
+ mStrValue(0)
{
if (pName)
{
- Name = new char [strlen(pName) + 1];
- strcpy(Name, pName);
+ mName = new char [strlen(pName) + 1];
+ strcpy(mName, pName);
}
}
-tConfigEntry::~tConfigEntry()
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZConfigEntry::~JZConfigEntry()
{
- delete [] Name;
- delete [] StrValue;
+ delete [] mName;
+ delete [] mStrValue;
}
-void tConfigEntry::SetStrValue(const char* pStringValue)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZConfigEntry::SetStrValue(const char* pStringValue)
{
- delete [] StrValue;
+ delete [] mStrValue;
if (pStringValue)
{
- StrValue = new char[strlen(pStringValue) + 1];
- strcpy(StrValue, pStringValue);
+ mStrValue = new char[strlen(pStringValue) + 1];
+ strcpy(mStrValue, pStringValue);
}
}
@@ -113,7 +129,13 @@
-tConfig::tConfig()
+//*****************************************************************************
+// Description:
+// This is the configuration class definition.
+//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZConfiguration::JZConfiguration()
: mFileName(),
mDrumNames(),
mDrumSets(),
@@ -123,142 +145,158 @@
{
for (int i = 0; i < NumConfigNames; ++i)
{
- Names[i] = 0;
+ mNames[i] = 0;
}
const char* pNoneString = "None";
// search for midi device
- Names[C_Seq2Device] = new tConfigEntry(".device", -1);
+ mNames[C_Seq2Device] = new JZConfigEntry(".device", -1);
// use /dev/music
- Names[C_MidiDriver] = new tConfigEntry(".driver", 1);
+ mNames[C_MidiDriver] = new JZConfigEntry(".driver", 1);
- // Enable audio at startup
- Names[C_EnableAudio] = new tConfigEntry(".enable_audio", 1);
+ // Enable audio at startup.
+ mNames[C_EnableAudio] = new JZConfigEntry(".enable_audio", 1);
- // Windows midi devices
- Names[C_WinInputDevice] = new tConfigEntry(".win_input_device", -1);
- Names[C_WinOutputDevice] = new tConfigEntry(".win_output_device", -1);
+ // Windows midi devices.
+ mNames[C_WinInputDevice] = new JZConfigEntry(".win_input_device", -1);
+ mNames[C_WinOutputDevice] = new JZConfigEntry(".win_output_device", -1);
- // ALSA midi devices
- Names[C_AlsaInputDevice] = new tConfigEntry(".alsa_input_device", -1);
- Names[C_AlsaOutputDevice] = new tConfigEntry(".alsa_output_device", -1);
+ // ALSA midi devices.
+ mNames[C_AlsaInputDevice] = new JZConfigEntry(".alsa_input_device", -1);
+ mNames[C_AlsaOutputDevice] = new JZConfigEntry(".alsa_output_device", -1);
- // ALSA audio devices
- Names[C_AlsaAudioInputDevice] = new tConfigEntry(".alsa_audio_input_device", "hw:0,0");
- Names[C_AlsaAudioOutputDevice] = new tConfigEntry(".alsa_audio_output_device", "hw:0,0");
+ // ALSA audio devices.
+ mNames[C_AlsaAudioInputDevice] = new JZConfigEntry(
+ ".alsa_audio_input_device",
+ "hw:0,0");
+ mNames[C_AlsaAudioOutputDevice] = new JZConfigEntry(
+ ".alsa_audio_output_device",
+ "hw:0,0");
- // emulate midi thru
- Names[C_SoftThru] = new tConfigEntry(".softthru", 1);
+ // Emulate MIDI thru.
+ mNames[C_SoftThru] = new JZConfigEntry(".softthru", 1);
- // mpu401 hardware midi thru
- Names[C_HardThru] = new tConfigEntry(".hardthru", 1);
+ // mpu401 hardware MIDI thru.
+ mNames[C_HardThru] = new JZConfigEntry(".hardthru", 1);
- // midi clock source (0 = internal)
- Names[C_ClockSource] = new tConfigEntry(".clocksource", 0);
+ // MIDI clock source (0 = internal).
+ mNames[C_ClockSource] = new JZConfigEntry(".clocksource", 0);
- // send realtime midi messages to midi out
- Names[C_RealTimeOut] = new tConfigEntry(".realtime_out", 0);
+ // Send realtime MIDI messages to MIDI out.
+ mNames[C_RealTimeOut] = new JZConfigEntry(".realtime_out", 0);
- // use GS reverb macro
- Names[C_UseReverbMacro] = new tConfigEntry(".use_reverb_macro", 1);
+ // Use the GS reverb macro.
+ mNames[C_UseReverbMacro] = new JZConfigEntry(".use_reverb_macro", 1);
- // use GS chorus macro
- Names[C_UseChorusMacro] = new tConfigEntry(".use_chorus_macro", 1);
+ // Use the GS chorus macro.
+ mNames[C_UseChorusMacro] = new JZConfigEntry(".use_chorus_macro", 1);
- // Default drum channel is 10
- Names[C_DrumChannel] = new tConfigEntry(".drumchannel", 10);
+ // Default drum channel is 10.
+ mNames[C_DrumChannel] = new JZConfigEntry(".drumchannel", 10);
- // Controller for bank select
- Names[C_BankControlNumber] = new tConfigEntry(".bank_control_number", 0);
+ // Controller for bank select.
+ mNames[C_BankControlNumber] = new JZConfigEntry(".bank_control_number", 0);
- // Controller2 for bank select with two commands
- Names[C_BankControlNumber2] = new tConfigEntry(".bank_2nd_control_number", 32);
+ // Controller2 for bank select with two commands.
+ mNames[C_BankControlNumber2] = new JZConfigEntry(
+ ".bank_2nd_control_number",
+ 32);
- // Max number of entries in bank table (two commands)
- Names[C_MaxBankTableEntries] = new tConfigEntry(".max_bank_table_entries", 256);
+ // Maximum number of entries in bank table (two commands).
+ mNames[C_MaxBankTableEntries] = new JZConfigEntry(
+ ".max_bank_table_entries",
+ 256);
- // Number of columns to draw in Parts dialogs
- Names[C_PartsColumnsMax] = new tConfigEntry(".parts_columns_max", 4);
+ // Number of columns to draw in Parts dialogs.
+ mNames[C_PartsColumnsMax] = new JZConfigEntry(".parts_columns_max", 4);
// Draw tracknames on the right too?
- Names[C_PartsTracknamesRight] = new tConfigEntry(
+ mNames[C_PartsTracknamesRight] = new JZConfigEntry(
".parts_tracknames_right",
1);
- // Maximum number of voice names in .jazz
- Names[C_MaxVoiceNames] = new tConfigEntry(".max_voice_names", 317);
+ // Maximum number of voice names in .jazz.
+ mNames[C_MaxVoiceNames] = new JZConfigEntry(".max_voice_names", 317);
// Use two-command bank select?
- Names[C_UseTwoCommandBankSelect] = new tConfigEntry(
+ mNames[C_UseTwoCommandBankSelect] = new JZConfigEntry(
".use_two_command_bank_select",
0);
- // Metronome settings
- Names[C_MetroIsAccented] = new tConfigEntry(".metronome_is_accented", 1);
- Names[C_MetroVelocity] = new tConfigEntry(".metronome_velocity", 127);
- Names[C_MetroNormalClick] = new tConfigEntry(".metronome_normal_click", 37);
- Names[C_MetroAccentedClick] = new tConfigEntry(
+ // Metronome settings.
+ mNames[C_MetroIsAccented] = new JZConfigEntry(
+ ".metronome_is_accented",
+ 1);
+ mNames[C_MetroVelocity] = new JZConfigEntry(
+ ".metronome_velocity",
+ 127);
+ mNames[C_MetroNormalClick] = new JZConfigEntry(
+ ".metronome_normal_click",
+ 37);
+ mNames[C_MetroAccentedClick] = new JZConfigEntry(
".metronome_accented_click",
36);
// Window geometry settings.
- Names[C_TrackWinXpos] = new tConfigEntry(".trackwin_xpos", 10);
- Names[C_TrackWinYpos] = new tConfigEntry(".trackwin_ypos", 10);
- Names[C_TrackWinWidth] = new tConfigEntry(".trackwin_width", 600);
- Names[C_TrackWinHeight] = new tConfigEntry(".trackwin_height", 400);
- Names[C_PianoWinXpos] = new tConfigEntry(".pianowin_xpos", 30);
- Names[C_PianoWinYpos] = new tConfigEntry(".pianowin_ypos", 30);
- Names[C_PianoWinWidth] = new tConfigEntry(".pianowin_width", 600);
- Names[C_PianoWinHeight] = new tConfigEntry(".pianowin_height", 400);
- Names[C_PartsDlgXpos] = new tConfigEntry(".partsdialog_xpos", 50);
- Names[C_PartsDlgYpos] = new tConfigEntry(".partsdialog_ypos", 50);
- Names[C_TrackDlgXpos] = new tConfigEntry(".trackdialog_xpos", 50);
- Names[C_TrackDlgYpos] = new tConfigEntry(".trackdialog_ypos", 50);
- Names[C_HarmonyXpos] = new tConfigEntry(".harmonybrowser_xpos", 100);
- Names[C_HarmonyYpos] = new tConfigEntry(".harmonybrowser_ypos", 100);
- Names[C_RhythmXpos] = new tConfigEntry(".randomrhythm_xpos", 150);
- Names[C_RhythmYpos] = new tConfigEntry(".randomrhythm_ypos", 150);
+ mNames[C_TrackWinXpos] = new JZConfigEntry(".trackwin_xpos", 10);
+ mNames[C_TrackWinYpos] = new JZConfigEntry(".trackwin_ypos", 10);
+ mNames[C_TrackWinWidth] = new JZConfigEntry(".trackwin_width", 600);
+ mNames[C_TrackWinHeight] = new JZConfigEntry(".trackwin_height", 400);
+ mNames[C_PianoWinXpos] = new JZConfigEntry(".pianowin_xpos", 30);
+ mNames[C_PianoWinYpos] = new JZConfigEntry(".pianowin_ypos", 30);
+ mNames[C_PianoWinWidth] = new JZConfigEntry(".pianowin_width", 600);
+ mNames[C_PianoWinHeight] = new JZConfigEntry(".pianowin_height", 400);
+ mNames[C_PartsDlgXpos] = new JZConfigEntry(".partsdialog_xpos", 50);
+ mNames[C_PartsDlgYpos] = new JZConfigEntry(".partsdialog_ypos", 50);
+ mNames[C_TrackDlgXpos] = new JZConfigEntry(".trackdialog_xpos", 50);
+ mNames[C_TrackDlgYpos] = new JZConfigEntry(".trackdialog_ypos", 50);
+ mNames[C_HarmonyXpos] = new JZConfigEntry(".harmonybrowser_xpos", 100);
+ mNames[C_HarmonyYpos] = new JZConfigEntry(".harmonybrowser_ypos", 100);
+ mNames[C_RhythmXpos] = new JZConfigEntry(".randomrhythm_xpos", 150);
+ mNames[C_RhythmYpos] = new JZConfigEntry(".randomrhythm_ypos", 150);
- // Show Dialog unless initialized
- Names[C_SynthDialog] = new tConfigEntry(".synth_dialog", 1);
+ // Show dialog unless initialized.
+ mNames[C_SynthDialog] = new JZConfigEntry(".synth_dialog", 1);
- // Default synthesizer type
- Names[C_SynthType] = new tConfigEntry(
+ // Default synthesizer type.
+ mNames[C_SynthType] = new JZConfigEntry(
".synth_type",
gSynthesizerTypes[SynthTypeGS].first.c_str());
- // Default synthesizer config file
- Names[C_SynthConfig] = new tConfigEntry(
+ // Default synthesizer configuration file.
+ mNames[C_SynthConfig] = new JZConfigEntry(
".synth_config",
gSynthesierTypeFiles[SynthTypeGS].first.c_str());
- // When to send synthesizer reset (0=never, 1=song start, 2=start play)
- Names[C_SendSynthReset] = new tConfigEntry(".send_synth_reset", 1);
+ // When to send synthesizer reset (0 = never, 1 = song start,
+ // 2 = start play).
+ mNames[C_SendSynthReset] = new JZConfigEntry(".send_synth_reset", 1);
- // Current include file
- Names[C_Include] = new tConfigEntry(".include", "");
+ // Current include file.
+ mNames[C_Include] = new JZConfigEntry(".include", "");
- // Entries with empty values
- Names[C_BankTable] = new tConfigEntry(".bank_table");
- Names[C_VoiceNames] = new tConfigEntry(".voicenames");
- Names[C_DrumSets] = new tConfigEntry(".drumsets");
- Names[C_CtrlNames] = new tConfigEntry(".ctrlnames");
- Names[C_DrumNames] = new tConfigEntry(".drumnames");
+ // Entries with empty values.
+ mNames[C_BankTable] = new JZConfigEntry(".bank_table");
+ mNames[C_VoiceNames] = new JZConfigEntry(".voicenames");
+ mNames[C_DrumSets] = new JZConfigEntry(".drumsets");
+ mNames[C_CtrlNames] = new JZConfigEntry(".ctrlnames");
+ mNames[C_DrumNames] = new JZConfigEntry(".drumnames");
- // The startup song
- Names[C_StartUpSong] = new tConfigEntry(".startup_song", "jazz.mid");
- Names[C_OssBug1] = new tConfigEntry(".ossbug1", 0);
- Names[C_OssBug2] = new tConfigEntry(".ossbug2", 0);
- Names[C_DuplexAudio] = new tConfigEntry(".duplex_audio", 0);
- Names[C_ThruInput] = new tConfigEntry(".thru_input", 0);
- Names[C_ThruOutput] = new tConfigEntry(".thru_output", 0);
+ // The startup song.
+ mNames[C_StartUpSong] = new JZConfigEntry(".startup_song", "jazz.mid");
+ mNames[C_OssBug1] = new JZConfigEntry(".ossbug1", 0);
+ mNames[C_OssBug2] = new JZConfigEntry(".ossbug2", 0);
+ mNames[C_DuplexAudio] = new JZConfigEntry(".duplex_audio", 0);
+ mNames[C_ThruInput] = new JZConfigEntry(".thru_input", 0);
+ mNames[C_ThruOutput] = new JZConfigEntry(".thru_output", 0);
+
// Enable/disable splash dialog.
- Names[C_EnableWelcome] = new tConfigEntry(".enable_welcome", 1);
+ mNames[C_EnableWelcome] = new JZConfigEntry(".enable_welcome", 1);
- // Other initialization
+ // Other initialization.
for (int i = 0; i < 130; ++i)
{
@@ -280,48 +318,62 @@
mVoiceNames.push_back(make_pair("", 0));
}
-tConfig::~tConfig()
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZConfiguration::~JZConfiguration()
{
for (int i = 0; i < NumConfigNames; ++i)
{
- if (Names[i])
+ if (mNames[i])
{
- delete Names[i];
+ delete mNames[i];
}
}
}
-pair<string, int>& tConfig::DrumName(unsigned entry)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+const pair<string, int>& JZConfiguration::GetDrumName(unsigned entry) const
{
assert((entry >= 0) && (entry < mDrumNames.size()));
return mDrumNames[entry];
}
-pair<string, int>& tConfig::DrumSet(unsigned entry)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+const pair<string, int>& JZConfiguration::GetDrumSet(unsigned entry) const
{
assert((entry >= 0) && (entry < mDrumSets.size()));
return mDrumSets[entry];
}
-pair<string, int>& tConfig::VoiceName(unsigned entry)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+const pair<string, int>& JZConfiguration::GetVoiceName(unsigned entry) const
{
assert((entry >= 0) && (entry < mVoiceNames.size()));
return mVoiceNames[entry];
}
-pair<string, int>& tConfig::CtrlName(unsigned entry)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+const pair<string, int>& JZConfiguration::GetCtrlName(unsigned entry) const
{
assert((entry >= 0) && (entry < mCtrlNames.size()));
return mCtrlNames[entry];
}
-tDoubleCommand& tConfig::BankEntry(unsigned entry)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+JZDoubleCommand& JZConfiguration::BankEntry(unsigned entry)
{
assert((entry >= 0) && (entry < mBankTable.size()));
return mBankTable[entry];
}
-int tConfig::Check(const char* pName) const
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+int JZConfiguration::Check(const char* pName) const
{
if (!pName || (pName[0] != '.'))
{
@@ -330,11 +382,11 @@
for (int i = 0; i < NumConfigNames; i++)
{
- if (!Names[i])
+ if (!mNames[i])
{
continue;
}
- if (!strncmp(pName, Names[i]->GetName(), strlen(Names[i]->GetName())))
+ if (!strncmp(pName, mNames[i]->GetName(), strlen(mNames[i]->GetName())))
{
// Found
return i;
@@ -349,7 +401,7 @@
// value has not been set by an earlier call to LoadConfig, attempt to find
// the file using FindFile().
//-----------------------------------------------------------------------------
-wxString tConfig::GetFileName()
+wxString JZConfiguration::GetFileName()
{
if (!mFileName.empty())
{
@@ -366,7 +418,9 @@
return mFileName;
}
-int tConfig::Load(char* buf)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+int JZConfiguration::Load(char* buf)
{
int entry = Check(buf);
@@ -375,17 +429,17 @@
char format[100];
int result = 1;
- if (Names[entry]->GetType() == ConfigEntryTypeInt)
+ if (mNames[entry]->GetType() == ConfigEntryTypeInt)
{
- sprintf(format, "%s %%d", Names[entry]->GetName());
+ sprintf(format, "%s %%d", mNames[entry]->GetName());
int Value;
result = sscanf(buf, format, &Value);
- Names[entry]->SetValue(Value);
+ mNames[entry]->SetValue(Value);
}
- else if (Names[entry]->GetType() == ConfigEntryTypeStr)
+ else if (mNames[entry]->GetType() == ConfigEntryTypeStr)
{
// allow whitespace inside entries like "C:\Program Files\JazzWare"
- int ofs = strlen(Names[entry]->GetName());
+ int ofs = strlen(mNames[entry]->GetName());
while (buf[ofs] == ' ' || buf[ofs] == '\t') // not \n
ofs++;
int end = strlen(buf) - 1;
@@ -399,7 +453,7 @@
char* pStringValue = new char[size + 1];
memcpy(pStringValue, buf + ofs, size);
pStringValue[size] = 0;
- Names[entry]->SetStrValue(pStringValue);
+ mNames[entry]->SetStrValue(pStringValue);
delete [] pStringValue;
}
else
@@ -417,55 +471,67 @@
}
}
-const int& tConfig::GetValue(const char* pName) const
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+const int& JZConfiguration::GetValue(const char* pName) const
{
int i = Check(pName);
assert(i >= 0);
- return Names[i]->GetValue();
+ return mNames[i]->GetValue();
}
-const int& tConfig::GetValue(int Index) const
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+const int& JZConfiguration::GetValue(int Index) const
{
assert((Index >= 0) && (Index < NumConfigNames));
- return Names[Index]->GetValue();
+ return mNames[Index]->GetValue();
}
-bool tConfig::Get(int entry, char *value)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZConfiguration::Get(int entry, char *value)
{
- assert((entry >= 0) && (entry < NumConfigNames));
+ assert((entry >= 0) && (entry < NumConfigNames));
- wxString FileName = GetFileName();
- if (FileName.IsEmpty())
- {
- return false;
- }
+ wxString FileName = GetFileName();
+ if (FileName.IsEmpty())
+ {
+ return false;
+ }
- FILE *fd = fopen(FileName.c_str(), "r");
- const char* name = Name(entry);
+ FILE *fd = fopen(FileName.c_str(), "r");
+ const char* name = GetName(entry);
- int len = strlen(name);
- char buf[1000];
- bool found = false;
- while (!found && fgets(buf, sizeof(buf), fd) != NULL)
- {
- if (strncmp(buf, name, len) == 0)
+ int len = strlen(name);
+ char buf[1000];
+ bool found = false;
+ while (!found && fgets(buf, sizeof(buf), fd) != NULL)
+ {
+ if (strncmp(buf, name, len) == 0)
+ {
+ while (isspace(buf[len]))
{
- while (isspace(buf[len]))
- len++;
- int end = strlen(buf) - 1;
- while (end > 0 && isspace(buf[end]))
- buf[end--] = 0;
- strcpy(value, buf + len);
- found = true;
+ len++;
}
- }
- fclose(fd);
- return found;
+ int end = strlen(buf) - 1;
+ while (end > 0 && isspace(buf[end]))
+ {
+ buf[end--] = 0;
+ }
+ strcpy(value, buf + len);
+ found = true;
+ }
+ }
+ fclose(fd);
+ return found;
}
-bool tConfig::Get(int entry, long &value)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZConfiguration::Get(int entry, long &value)
{
char buf[512];
if (Get(entry, buf))
@@ -482,7 +548,7 @@
// entries to there. If the name/value pair is found, replace it, otherwise
// write it. Finally copy the temp file over the old configuration file.
//-----------------------------------------------------------------------------
-bool tConfig::Put(int Index, const char *value)
+bool JZConfiguration::Put(int Index, const char *value)
{
assert((Index >= 0) && (Index < NumConfigNames));
@@ -502,7 +568,7 @@
}
FILE* inp = fopen(FileName.c_str(), "r");
- const char* name = Name(Index);
+ const char* name = GetName(Index);
int len = strlen(name);
char buf[1000];
@@ -530,26 +596,32 @@
return true;
}
-bool tConfig::Put(int Index, long Value)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZConfiguration::Put(int Index, long Value)
{
ostringstream Oss;
Oss << Value;
return Put(Index, Oss.str().c_str());
}
-bool tConfig::Put(int Index)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZConfiguration::Put(int Index)
{
assert((Index >= 0) && (Index < NumConfigNames));
- Names[Index]->SetValue(Index);
- long LongValue = Names[Index]->GetValue();
+ mNames[Index]->SetValue(Index);
+ long LongValue = mNames[Index]->GetValue();
return Put(Index, LongValue);
}
-bool tConfig::Put(int Index, int Value)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+bool JZConfiguration::Put(int Index, int Value)
{
assert((Index >= 0) && (Index < NumConfigNames));
- Names[Index]->SetValue(Value);
- long LongValue = Names[Index]->GetValue();
+ mNames[Index]->SetValue(Value);
+ long LongValue = mNames[Index]->GetValue();
return Put(Index, LongValue);
}
@@ -557,7 +629,7 @@
// Description:
// Load the configuration from a file. This code supports file inclusion.
//-----------------------------------------------------------------------------
-void tConfig::LoadConfig(const wxString& FileName)
+void JZConfiguration::LoadConfig(const wxString& FileName)
{
if (!::wxFileExists(FileName))
{
@@ -590,7 +662,7 @@
}
cout
- << "tConfig::LoadConfig:" << '\n'
+ << "JZConfiguration::LoadConfig:" << '\n'
<< " \"" << mFileName << '"'
<< endl;
@@ -642,7 +714,7 @@
if (mBankTable.empty())
{
mBankTable.clear();
- tDoubleCommand DoubleCommand;
+ JZDoubleCommand DoubleCommand;
for (i = 0; i <= GetValue(C_MaxBankTableEntries); ++i)
{
DoubleCommand.Command[0] = -1;
@@ -677,7 +749,7 @@
case C_Include:
{
// include file
- wxString pathname = FindFile(StrValue(entry));
+ wxString pathname = FindFile(GetStrValue(entry));
cout << "include " << entry << endl;
IncLevel++;
assert(IncLevel < MaxIncs);
Modified: trunk/jazz/src/Configuration.h
===================================================================
--- trunk/jazz/src/Configuration.h 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Configuration.h 2008-04-11 02:25:18 UTC (rev 452)
@@ -26,13 +26,17 @@
#include <string>
#include <vector>
-class tDoubleCommand
+//*****************************************************************************
+//*****************************************************************************
+class JZDoubleCommand
{
public:
int Command[2];
};
-enum ConfigNames
+//*****************************************************************************
+//*****************************************************************************
+enum TEConfigurationNames
{
C_Seq2Device = 0,
C_MidiDriver,
@@ -103,14 +107,18 @@
NumConfigNames
};
-enum ConfigEntryType
+//*****************************************************************************
+//*****************************************************************************
+enum TEConfigEntryType
{
ConfigEntryTypeInt = 0,
ConfigEntryTypeStr,
ConfigEntryTypeEmpty
};
+//*****************************************************************************
// values for C_MidiDriver
+//*****************************************************************************
enum TEMidiDriver
{
eMidiDriverJazz = 0, // C_DRV_JAZZ 0
@@ -120,113 +128,98 @@
//*****************************************************************************
//*****************************************************************************
-class tConfigEntry
+class JZConfigEntry
{
public:
- tConfigEntry(const char* pName, int IntegerValue);
+ JZConfigEntry(const char* pName, int IntegerValue);
- tConfigEntry(const char* pName, const char* pStringValue);
+ JZConfigEntry(const char* pName, const char* pStringValue);
- tConfigEntry(const char* pName, const std::string& StringValue);
+ JZConfigEntry(const char* pName, const std::string& StringValue);
- tConfigEntry(const char* pName);
+ JZConfigEntry(const char* pName);
- ~tConfigEntry();
+ ~JZConfigEntry();
- ConfigEntryType GetType() const
+ TEConfigEntryType GetType() const
{
- return Type;
+ return mType;
}
const char* GetName() const
{
- return Name;
+ return mName;
}
const int& GetValue() const
{
- return Value;
+ return mValue;
}
void SetValue(const int& value)
{
- Value = value;
+ mValue = value;
}
const char* GetStrValue() const
{
- return StrValue;
+ return mStrValue;
}
void SetStrValue(const char* pStringValue);
private:
- ConfigEntryType Type;
- char* Name;
- int Value;
- char* StrValue;
+ TEConfigEntryType mType;
+ char* mName;
+ int mValue;
+ char* mStrValue;
};
//*****************************************************************************
//*****************************************************************************
-class tConfig
+class JZConfiguration
{
public:
- tConfig();
+ JZConfiguration();
- ~tConfig();
+ ~JZConfiguration();
void LoadConfig(const wxString& FileName);
int Check(const char* pName) const;
+
int Load(char* buf);
- std::pair<std::string, int>& DrumName(unsigned entry);
- std::pair<std::string, int>& DrumSet(unsigned entry);
- std::pair<std::string, int>& VoiceName(unsigned entry);
- std::pair<std::string, int>& CtrlName(unsigned entry);
- tDoubleCommand& BankEntry(unsigned entry);
+ const std::pair<std::string, int>& GetDrumName(unsigned entry) const;
+ const std::pair<std::string, int>& GetDrumSet(unsigned entry) const;
+ const std::pair<std::string, int>& GetVoiceName(unsigned entry) const;
+ const std::pair<std::string, int>& GetCtrlName(unsigned entry) const;
- const char* Name(int entry)
- {
- assert((entry >= 0) && (entry < NumConfigNames));
- return Names[entry]->GetName();
- }
+ JZDoubleCommand& BankEntry(unsigned entry);
- const char* StrValue(int entry)
- {
- assert((entry >= 0) && (entry < NumConfigNames));
- return Names[entry]->GetStrValue();
- }
+ const char* GetName(int entry) const;
+ const char* GetStrValue(int entry) const;
+
const int& GetValue(const char* pName) const;
const int& GetValue(int Index) const;
- bool Get(int entry, char *value);
- bool Get(int entry, long &value);
+ bool Get(int entry, char* value);
+ bool Get(int entry, long& value);
bool Put(int entry, const char *value);
bool Put(int entry, long value);
bool Put(int entry);
bool Put(int entry, int value);
- const std::vector<std::pair<std::string, int> >& GetDrumNames()
- {
- return mDrumNames;
- }
+ const std::vector<std::pair<std::string, int> >& GetDrumNames() const;
- const std::vector<std::pair<std::string, int> >& GetControlNames()
- {
- return mCtrlNames;
- }
+ const std::vector<std::pair<std::string, int> >& GetControlNames() const;
- const std::vector<std::pair<std::string, int> >& GetVoiceNames()
- {
- return mVoiceNames;
- }
+ const std::vector<std::pair<std::string, int> >& GetVoiceNames() const;
private:
@@ -240,7 +233,7 @@
wxString mFileName;
- tConfigEntry* Names[NumConfigNames];
+ JZConfigEntry* mNames[NumConfigNames];
std::vector<std::pair<std::string, int> > mDrumNames;
@@ -250,7 +243,56 @@
std::vector<std::pair<std::string, int> > mVoiceNames;
- std::vector<tDoubleCommand> mBankTable;
+ std::vector<JZDoubleCommand> mBankTable;
};
+//*****************************************************************************
+// Description:
+// These are the configuration class inline member functions.
+//*****************************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+const char* JZConfiguration::GetName(int entry) const
+{
+ assert((entry >= 0) && (entry < NumConfigNames));
+ return mNames[entry]->GetName();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+const char* JZConfiguration::GetStrValue(int entry) const
+{
+ assert((entry >= 0) && (entry < NumConfigNames));
+ return mNames[entry]->GetStrValue();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+const std::vector<std::pair<std::string, int> >&
+JZConfiguration::GetDrumNames() const
+{
+ return mDrumNames;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+const std::vector<std::pair<std::string, int> >&
+JZConfiguration::GetControlNames() const
+{
+ return mCtrlNames;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+inline
+const std::vector<std::pair<std::string, int> >&
+JZConfiguration::GetVoiceNames() const
+{
+ return mVoiceNames;
+}
+
#endif // !defined(JZ_CONFIGURATION_H)
Modified: trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp
===================================================================
--- trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Dialogs/SynthesizerSettingsDialog.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -115,7 +115,7 @@
iPair != gSynthesizerTypes.end();
++iPair, ++Index)
{
- if (strcmp(iPair->first.c_str(), gpConfig->StrValue(C_SynthType)) == 0)
+ if (strcmp(iPair->first.c_str(), gpConfig->GetStrValue(C_SynthType)) == 0)
{
mOldSynthTypeName = iPair->first;
Selection = Index;
Modified: trunk/jazz/src/Dialogs.cpp
===================================================================
--- trunk/jazz/src/Dialogs.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Dialogs.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -962,8 +962,8 @@
tControlDlg::tControlDlg(tControl *e, JZPianoWindow* w, JZTrack *t)
- : tChEventDlg(e, w, t)
- //, Choice("Controller", &gpConfig->CtrlName(0), &Control)
+ : tChEventDlg(e, w, t)//,
+// Choice("Controller", &gpConfig->GetCtrlName(0), &Control)
{
Event = e;
Value = e->Value;
@@ -982,7 +982,7 @@
void tControlDlg::AddProperties()
{
// Add(Choice.mkFormItem(300, 300));
- //, Choice("Controller", &gpConfig->CtrlName(0), &Control)
+// Choice("Controller", &gpConfig->GetCtrlName(0), &Control)
sheet->AddProperty(new wxProperty(
"Controller",
tNamedValueListValue(&Control, gpConfig->GetControlNames()),
@@ -1168,8 +1168,8 @@
tProgramDlg::tProgramDlg(tProgram *e, JZPianoWindow* w, JZTrack *t)
: tEventDlg(e, w, t),
- Program(e->Program + 1)
- //, Choice("Program", &gpConfig->VoiceName(0), &Program)
+ Program(e->Program + 1)//,
+// Choice("Program", &gpConfig->GetVoiceName(0), &Program)
{
Event = e;
}
Modified: trunk/jazz/src/Globals.cpp
===================================================================
--- trunk/jazz/src/Globals.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Globals.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -31,7 +31,7 @@
using namespace std;
-tConfig* gpConfig = 0;
+JZConfiguration* gpConfig = 0;
JZSong* gpSong = 0;
Modified: trunk/jazz/src/Globals.h
===================================================================
--- trunk/jazz/src/Globals.h 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Globals.h 2008-04-11 02:25:18 UTC (rev 452)
@@ -29,7 +29,7 @@
// #define DEBUG(x) x
#define DEBUG(x)
-class tConfig;
+class JZConfiguration;
class JZSong;
class JZSynth;
class JZPlayer;
@@ -45,7 +45,7 @@
eMaxTrackCount = 127
};
-extern tConfig* gpConfig;
+extern JZConfiguration* gpConfig;
extern JZSong* gpSong;
extern JZSynth* gpSynth;
extern JZPlayer* gpMidiPlayer;
Modified: trunk/jazz/src/PianoWindow.cpp
===================================================================
--- trunk/jazz/src/PianoWindow.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/PianoWindow.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -1220,7 +1220,7 @@
while (Pitch >= 0 && y < mEventsY + mEventsHeight)
{
Dc.DrawText(
- gpConfig->DrumName(Pitch + 1).first.c_str(),
+ gpConfig->GetDrumName(Pitch + 1).first.c_str(),
mCanvasX + mLittleBit,
y);
@@ -1235,7 +1235,7 @@
while (Pitch >= 0 && y < mEventsY + mEventsHeight)
{
Dc.DrawText(
- gpConfig->CtrlName(Pitch + 1).first.c_str(),
+ gpConfig->GetCtrlName(Pitch + 1).first.c_str(),
mCanvasX + mLittleBit,
y);
@@ -1249,7 +1249,7 @@
while (Pitch >= 0 && y < mEventsY + mEventsHeight)
{
Dc.DrawText(
- gpConfig->VoiceName(Pitch + 1).first.c_str(),
+ gpConfig->GetVoiceName(Pitch + 1).first.c_str(),
mCanvasX + mLittleBit,
y);
@@ -2522,7 +2522,7 @@
mpCtrlEdit = new tCtrlEdit(
i - 1,
this,
- gpConfig->CtrlName(i).first.c_str(),
+ gpConfig->GetCtrlName(i).first.c_str(),
mPianoWidth,
0,
CtrlY(Height),
Modified: trunk/jazz/src/Project.cpp
===================================================================
--- trunk/jazz/src/Project.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Project.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -134,7 +134,7 @@
gSynthesierTypeFiles.push_back(make_pair("other.jzi", SynthTypeOther));
}
- mpConfig = new tConfig;
+ mpConfig = new JZConfiguration;
gpConfig = mpConfig;
ReadConfiguration();
@@ -143,9 +143,9 @@
mMetronomeInfo.ReadFromConfiguration();
- if (mpConfig->StrValue(C_SynthType))
+ if (mpConfig->GetStrValue(C_SynthType))
{
- mpSynth = NewSynth(mpConfig->StrValue(C_SynthType));
+ mpSynth = NewSynth(mpConfig->GetStrValue(C_SynthType));
}
else
{
@@ -316,7 +316,7 @@
}
else
{
- StartUpSong = mpConfig->StrValue(C_StartUpSong);
+ StartUpSong = mpConfig->GetStrValue(C_StartUpSong);
}
FILE* pFd = fopen(StartUpSong.c_str(), "r");
@@ -393,20 +393,6 @@
<< endl;
mpConfig->LoadConfig(ConfFileNameAndPath);
-
- DEBUG(
- if (BankTable != (tDoubleCommand *) NULL)
- {
- for (int i = 0; BankTable[i].Command[0] >= 0; i++)
- {
- cerr
- << "Bank " << i << ": "
- << BankTable[i].Command[0]
- << ' ' << BankTable[i].Command[1]
- << endl;
- }
- }
- )
}
else
{
Modified: trunk/jazz/src/Project.h
===================================================================
--- trunk/jazz/src/Project.h 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Project.h 2008-04-11 02:25:18 UTC (rev 452)
@@ -171,7 +171,7 @@
static wxString mConfFileName;
- tConfig* mpConfig;
+ JZConfiguration* mpConfig;
JZPlayer* mpMidiPlayer;
Modified: trunk/jazz/src/Rhythm.cpp
===================================================================
--- trunk/jazz/src/Rhythm.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Rhythm.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -891,8 +891,10 @@
{
r->parm = SelectControllerDlg();
if (r->parm < 0)
+ {
return;
- r->SetLabel(gpConfig->CtrlName(r->parm).first.c_str());
+ }
+ r->SetLabel(gpConfig->GetCtrlName(r->parm).first.c_str());
r->mode = MODE_CONTROL;
r->n_keys = 0;
}
Modified: trunk/jazz/src/Track.cpp
===================================================================
--- trunk/jazz/src/Track.cpp 2008-04-09 22:10:26 UTC (rev 451)
+++ trunk/jazz/src/Track.cpp 2008-04-11 02:25:18 UTC (rev 452)
@@ -1703,7 +1703,7 @@
: wxForm(USED_WXFORM_BUTTONS),
PatchChoice(
"Patch",
- t->IsDrumTrack() ? &gpConfig->DrumSet(0) : &gpConfig->VoiceName(0),
+ t->IsDrumTrack() ? &gpConfig->GetDrumSet(0) : &gpConfig->GetVoiceName(0),
&PatchNr),
DeviceChoice("Device", gpMidiPlayer->GetOutputDevices().AsNamedValue(), &Device)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-09 22:10:32
|
Revision: 451
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=451&view=rev
Author: pstieber
Date: 2008-04-09 15:10:26 -0700 (Wed, 09 Apr 2008)
Log Message:
-----------
Added a wxWidgets event handler for "File | Close".
Modified Paths:
--------------
trunk/jazz/src/Harmony.cpp
trunk/jazz/src/Harmony.h
Modified: trunk/jazz/src/Harmony.cpp
===================================================================
--- trunk/jazz/src/Harmony.cpp 2008-04-09 00:25:56 UTC (rev 450)
+++ trunk/jazz/src/Harmony.cpp 2008-04-09 22:10:26 UTC (rev 451)
@@ -1928,7 +1928,10 @@
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(HBFrame, wxFrame)
+ EVT_CLOSE(HBFrame::OnClose)
+ EVT_MENU(wxID_CLOSE, HBFrame::OnCloseWindow)
+
EVT_UPDATE_UI(MEN_MAJSCALE, HBFrame::OnUpdateMajorScale)
EVT_MENU(MEN_MAJSCALE, HBFrame::OnToolBarSelect)
@@ -2132,13 +2135,6 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-bool HBFrame::OnClose()
-{
- return true;
-}
-
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
bool HBFrame::IsSequenceDefined()
{
return mpHbWindow->IsSequenceDefined();
@@ -2188,6 +2184,20 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+void HBFrame::OnClose(wxCloseEvent& Event)
+{
+ Event.Skip();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void HBFrame::OnCloseWindow(wxCommandEvent& Event)
+{
+ Close();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void HBFrame::OnUpdateMajorScale(wxUpdateUIEvent& Event)
{
Event.Check(HBCanvas::GetScaleType() == Major);
Modified: trunk/jazz/src/Harmony.h
===================================================================
--- trunk/jazz/src/Harmony.h 2008-04-09 00:25:56 UTC (rev 450)
+++ trunk/jazz/src/Harmony.h 2008-04-09 22:10:26 UTC (rev 451)
@@ -80,12 +80,14 @@
HBAnalyzer* GetAnalyzer();
- virtual bool OnClose();
-
void TransposeSelection();
protected:
+ void OnClose(wxCloseEvent& Event);
+
+ void OnCloseWindow(wxCommandEvent& Event);
+
void OnUpdateMajorScale(wxUpdateUIEvent& Event);
void OnUpdateHarmonicMinorScale(wxUpdateUIEvent& Event);
void OnUpdateMelodicMinorScale(wxUpdateUIEvent& Event);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-09 00:26:00
|
Revision: 450
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=450&view=rev
Author: pstieber
Date: 2008-04-08 17:25:56 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
Removed a clear command.
Modified Paths:
--------------
trunk/jazz/src/GuitarWindow.cpp
Modified: trunk/jazz/src/GuitarWindow.cpp
===================================================================
--- trunk/jazz/src/GuitarWindow.cpp 2008-04-09 00:21:16 UTC (rev 449)
+++ trunk/jazz/src/GuitarWindow.cpp 2008-04-09 00:25:56 UTC (rev 450)
@@ -182,8 +182,6 @@
GetSize(&mWidth, &mHeight);
- Dc.Clear();
-
DrawBoard(Dc);
DrawPitch(Dc, mActivePitch, true);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-09 00:21:17
|
Revision: 449
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=449&view=rev
Author: pstieber
Date: 2008-04-08 17:21:16 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
Removed extra const qualifier.
Modified Paths:
--------------
trunk/jazz/src/HarmonyP.cpp
Modified: trunk/jazz/src/HarmonyP.cpp
===================================================================
--- trunk/jazz/src/HarmonyP.cpp 2008-04-09 00:20:13 UTC (rev 448)
+++ trunk/jazz/src/HarmonyP.cpp 2008-04-09 00:21:16 UTC (rev 449)
@@ -33,7 +33,7 @@
// HBChord
// ========================================================================
-const string const HBChord::mScaleNames[2][12] =
+const string HBChord::mScaleNames[2][12] =
{
{ "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" },
{ "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B" }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-09 00:20:14
|
Revision: 448
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=448&view=rev
Author: pstieber
Date: 2008-04-08 17:20:13 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
Made cosmetic changes.
Modified Paths:
--------------
trunk/jazz/src/PianoWindow.cpp
Modified: trunk/jazz/src/PianoWindow.cpp
===================================================================
--- trunk/jazz/src/PianoWindow.cpp 2008-04-08 23:58:16 UTC (rev 447)
+++ trunk/jazz/src/PianoWindow.cpp 2008-04-09 00:20:13 UTC (rev 448)
@@ -45,13 +45,10 @@
using namespace std;
-
-
-
-
//*****************************************************************************
//*****************************************************************************
-
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
JZListen::JZListen()
: mActive(false),
mPitch(-1),
@@ -60,6 +57,8 @@
{
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZListen::KeyOn(
JZTrack* pTrack,
int Pitch,
@@ -79,6 +78,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZListen::Notify()
{
Stop();
@@ -104,19 +105,22 @@
JZPianoWindow* mpPianoWindow;
};
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
tMousePlay::tMousePlay(JZPianoWindow* pPianoWindow, wxMouseEvent& Event)
: mPitch(0),
mVeloc(-1),
mChannel(-1),
mpPianoWindow(pPianoWindow)
{
- mChannel =
- mpPianoWindow->GetTrack()->Channel ? mpPianoWindow->GetTrack()->Channel - 1 : 0;
+ mChannel = mpPianoWindow->GetTrack()->Channel ?
+ mpPianoWindow->GetTrack()->Channel - 1 : 0;
ProcessEvent(Event);
}
-
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int tMousePlay::ProcessEvent(wxMouseEvent& Event)
{
int x, y;
@@ -185,12 +189,6 @@
return 0;
}
-
-
-
-
-
-
//*****************************************************************************
// Description:
// tKeyLengthDragger
@@ -199,7 +197,7 @@
{
public:
- tKeyLengthDragger(tKeyOn *k, JZPianoWindow *w);
+ tKeyLengthDragger(tKeyOn* k, JZPianoWindow* pPianoWindow);
int Dragging(wxMouseEvent& Event);
@@ -215,12 +213,13 @@
JZTrack* mpTrack;
};
-
-tKeyLengthDragger::tKeyLengthDragger(tKeyOn *k, JZPianoWindow *w)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+tKeyLengthDragger::tKeyLengthDragger(tKeyOn* k, JZPianoWindow* pPianoWindow)
{
mpKeyOn = k;
Copy = k->Copy() -> IsKeyOn();
- Win = w;
+ Win = pPianoWindow;
// SN++ BUG FIX: undo/redo
Win->GetSong()->NewUndoBuffer();
@@ -234,6 +233,8 @@
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int tKeyLengthDragger::Event(wxMouseEvent& Event)
{
if (Event.Dragging())
@@ -247,6 +248,8 @@
return 0;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int tKeyLengthDragger::Dragging(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
@@ -266,6 +269,8 @@
return 0;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int tKeyLengthDragger::ButtonUp(wxMouseEvent& Event)
{
// SN++ Key_Aftertouch
@@ -308,7 +313,6 @@
return 0;
}
-
//*****************************************************************************
// Description:
// tPlayTrackLengthDragger JAVE this is just copied from tKeyLengthDragger,
@@ -322,18 +326,21 @@
JZTrack* mpTrack;
public:
- tPlayTrackLengthDragger(tPlayTrack *k, JZPianoWindow *w);
+ tPlayTrackLengthDragger(tPlayTrack *k, JZPianoWindow* pPianoWindow);
int Dragging(wxMouseEvent& Event);
int ButtonUp(wxMouseEvent& Event);
int Event(wxMouseEvent& Event);
};
-
-tPlayTrackLengthDragger::tPlayTrackLengthDragger(tPlayTrack *k, JZPianoWindow *w)
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+tPlayTrackLengthDragger::tPlayTrackLengthDragger(
+ tPlayTrack* k,
+ JZPianoWindow* pPianoWindow)
{
mpKeyOn = k;
Copy = k->Copy() -> IsPlayTrack();
- Win = w;
+ Win = pPianoWindow;
// SN++ BUG FIX: undo/redo
Win->GetSong()->NewUndoBuffer();
@@ -344,6 +351,8 @@
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int tPlayTrackLengthDragger::Event(wxMouseEvent& Event)
{
if (Event.Dragging())
@@ -357,6 +366,8 @@
return 0;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int tPlayTrackLengthDragger::Dragging(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
@@ -374,6 +385,8 @@
return 0;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int tPlayTrackLengthDragger::ButtonUp(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
@@ -395,20 +408,19 @@
return 0;
}
-
-
-// --------------------------------------------------------------------
-// VelocCounter
-// --------------------------------------------------------------------
-
+//*****************************************************************************
+//*****************************************************************************
class tVelocCounter : public tMouseCounter
{
public:
int Event(wxMouseEvent& Event);
- tVelocCounter(JZPianoWindow *w, JZRectangle* r, tKeyOn* pEvent)
- : tMouseCounter(w, r, pEvent->Veloc, 1, 127)
+ tVelocCounter(
+ JZPianoWindow* pPianoWindow,
+ JZRectangle* r,
+ tKeyOn* pEvent)
+ : tMouseCounter(pPianoWindow, r, pEvent->Veloc, 1, 127)
{
- Win = w;
+ Win = pPianoWindow;
mpKeyOn = pEvent;
// SN++ BUG FIX: undo/redo
@@ -425,8 +437,8 @@
tKeyOn* mpKeyOn;
};
-
-
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int tVelocCounter::Event(wxMouseEvent& Event)
{
if (tMouseCounter::Event(Event))
@@ -460,6 +472,8 @@
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
static int mPianoFontSizes[] =
{
6, // Tiny
@@ -470,6 +484,8 @@
-1, // End of list
};
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
const int isBlack[12] =
{
0,
@@ -486,9 +502,13 @@
0
};
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
#define IsBlack(Key) isBlack[(Key) % 12]
+//-----------------------------------------------------------------------------
// Mouse Actions Mapping
+//-----------------------------------------------------------------------------
enum
{
MA_PLAY = 1, // 0 represents no action.
@@ -503,6 +523,8 @@
MA_VELOCITY
};
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
const int play_actions[12] =
{
// left middle right
@@ -512,6 +534,8 @@
0, 0, 0 // shift+ctrl
};
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
const int evnt_actions[12] =
{
// left middle right
@@ -842,10 +866,14 @@
int x = Clock2x(start);
if (x < mEventsX) // clip to left border
+ {
x = mEventsX;
+ }
int w = Clock2x(stop) - x;
if (w <= 0)
+ {
continue;
+ }
int h = mTrackHeight;
for (int i = 0; i < 12; i++)
@@ -925,9 +953,11 @@
DrawPlayPosition(Dc);
}
+//-----------------------------------------------------------------------------
// Decription:
// Draw the "play position", by placing a vertical line where the
// "play clock" is.
+//-----------------------------------------------------------------------------
void JZPianoWindow::DrawPlayPosition(wxDC& Dc)
{
if (!mpSnapSel->Active && mPlayClock >= mFromClock && mPlayClock < mToClock)
@@ -946,6 +976,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::OnEventWinPaintSub(int x, int y)
{
mCanvasX = x;
@@ -997,7 +1029,6 @@
}
}
-
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
bool JZPianoWindow::OnKeyEvent(wxKeyEvent& Event)
@@ -1054,6 +1085,8 @@
return false;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::NewPosition(int TrackIndex, int Clock)
{
mFromLines[mTrackIndex] = mFromLine;
@@ -1105,11 +1138,11 @@
return Line * mTrackHeight + mTopInfoHeight;
}
-// ********************************************************************
+//=============================================================================
// Painting
-// ********************************************************************
-
-
+//=============================================================================
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::DrawPianoRoll(wxDC& Dc)
{
// Draw the grey background for the keyboard.
@@ -1247,6 +1280,8 @@
Dc.SetFont(*mpFont);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::DrawEvent(
wxDC& Dc,
JZEvent* pEvent,
@@ -1302,6 +1337,8 @@
Dc.SetBrush(*wxBLACK_BRUSH);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::DrawEvents(
wxDC& Dc,
JZTrack *t,
@@ -1421,8 +1458,10 @@
// Dc.DestroyClippingRegion();
}
+//-----------------------------------------------------------------------------
// Draws the a 3D button with text in it. Used to draw the little area in the
// top left of the window.
+//-----------------------------------------------------------------------------
void JZPianoWindow::LineText(
wxDC& Dc,
int x,
@@ -1556,10 +1595,9 @@
}
}
-
-// ------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
// Snapper
-// ------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::SnapSelStop(wxMouseEvent& Event)
{
if (mpSnapSel->Selected)
@@ -1613,6 +1651,8 @@
mpCtrlEdit->UpDate();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::SnapSelStart(wxMouseEvent &)
{
mSnapCount = 0;
@@ -1637,6 +1677,8 @@
mTrackHeight);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::SnapClock(int Clock, int up)
{
int qnt = SnapClocks();
@@ -1648,6 +1690,8 @@
return Clock;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::NewPlayPosition(int Clock)
{
int scroll_clock = (mFromClock + 5 * mToClock) / 6L;
@@ -1689,6 +1733,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::EventsSelected(const char *msg)
{
if (!mpSnapSel->Selected)
@@ -1701,6 +1747,8 @@
return 1;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::ZoomIn()
{
if (mClockTicsPerPixel >= 2)
@@ -1722,6 +1770,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::ZoomOut()
{
if (mClockTicsPerPixel <= 120)
@@ -1743,7 +1793,8 @@
}
}
-
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::OnEventWinMouseEvent(wxMouseEvent& Event)
{
if (!mpMouseAction)
@@ -1844,11 +1895,15 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::x2Clock(int x)
{
return (x - mEventsX) * mClockTicsPerPixel + mFromClock;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::y2Line(int y, int up)
{
if (up)
@@ -1859,6 +1914,8 @@
return y / mTrackHeight;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::x2BarClock(int x, int next)
{
int clk = x2Clock(x);
@@ -1869,6 +1926,8 @@
return b.Clock;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::y2yLine(int y, int up)
{
if (up)
@@ -1881,6 +1940,8 @@
return y;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::MouseCutPaste(wxMouseEvent& Event, bool Cut)
{
wxClientDC Dc(this);
@@ -1909,6 +1970,8 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::MouseEvents(wxMouseEvent& Event)
{
int action = mMouseEvent.Action(Event);
@@ -2004,6 +2067,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::MousePiano(wxMouseEvent& Event)
{
if (Event.ButtonDown())
@@ -2042,10 +2107,11 @@
LineText(Dc, 0, 0, mPianoWidth, mTopInfoHeight, Text, IsButtonDown);
}
-//*****************************************************************************
+//=============================================================================
// Visible
-//*****************************************************************************
-
+//=============================================================================
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::IsVisible(JZEvent* pEvent)
{
switch (pEvent->Stat)
@@ -2074,6 +2140,8 @@
return 0;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::IsVisible(JZTrack* pTrack)
{
if (!mVisibleAllTracks)
@@ -2090,6 +2158,8 @@
// Utilities
// ********************************************************************
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::SnapClocks()
{
int clk = mpSong->TicksPerQuarter * 4L / mSnapDenomiator;
@@ -2098,6 +2168,8 @@
return clk;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::SetSnapDenom(int Value)
{
const int Size = 4;
@@ -2130,6 +2202,8 @@
// mMouseEvent.SetLeftAction(MA_CUTPASTE);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::y2Pitch(int y)
{
int pitch = 127 - y2Line(y);
@@ -2140,15 +2214,17 @@
return pitch;
}
-
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::Pitch2y(int Pitch)
{
return Line2y(127 - Pitch);
}
-
+//-----------------------------------------------------------------------------
+// If Pitch == -1: search for any pitches.
+//-----------------------------------------------------------------------------
JZEvent *JZPianoWindow::FindEvent(JZTrack* pTrack, int Clock, int Pitch)
-// Pitch == -1: search for any pitches
{
tEventIterator Iterator(pTrack);
JZEvent* pEvent = Iterator.First();
@@ -2172,7 +2248,8 @@
return 0;
}
-
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::kill_keys_aftertouch(JZTrack *t, JZEvent* pEvent)
{
int key,channel;
@@ -2204,6 +2281,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::paste_keys_aftertouch(JZTrack *t, JZEvent* pEvent)
{
int key,channel;
@@ -2229,12 +2308,16 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::Clock2x(int Clock)
{
return mEventsX + (Clock - mFromClock) / mClockTicsPerPixel;
}
+//-----------------------------------------------------------------------------
// show the guitar edit window.
+//-----------------------------------------------------------------------------
void JZPianoWindow::CreateGuitarWindow()
{
if (!mpGuitarFrame)
@@ -2244,6 +2327,8 @@
mpGuitarFrame->Show(true);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::UpdateControl()
{
if (mpCtrlEdit)
@@ -2252,6 +2337,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::ApplyToTrack(JZEvent* pEvent1, JZEvent* pEvent2)
{
mpTrack->Kill(pEvent1);
@@ -2259,16 +2346,22 @@
mpTrack->Cleanup();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::KillTrackEvent(JZEvent* pEvent)
{
mpTrack->Kill(pEvent);
}
+//-----------------------------------------------------------------------------
// positions for controller editor
+//-----------------------------------------------------------------------------
#define CtrlH(h) ((h)/4)
#define CtrlY(h) (h - CtrlH(h))
+//-----------------------------------------------------------------------------
// Activate velocity edit.
+//-----------------------------------------------------------------------------
void JZPianoWindow::CtrlVelocity()
{
int Width, Height;
@@ -2290,6 +2383,8 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::CtrlChannelAftertouchEdit()
{
int Width, Height;
@@ -2310,6 +2405,8 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::CtrlPolyAftertouchEdit()
{
int Width, Height;
@@ -2330,6 +2427,8 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::CtrlNone()
{
delete mpCtrlEdit;
@@ -2337,6 +2436,8 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::CtrlTempo()
{
tEventIterator Iterator(mpTrack);
@@ -2399,11 +2500,15 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::EditFilter()
{
mpFilter->Dialog(0);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::SelectController()
{
int i = SelectControllerDlg();
@@ -2429,6 +2534,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::CtrlModulation()
{
int Width, Height;
@@ -2450,6 +2557,8 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::CtrlPitch()
{
int Width, Height;
@@ -2470,6 +2579,8 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::Redo()
{
mpSong->Redo();
@@ -2480,7 +2591,9 @@
}
}
+//-----------------------------------------------------------------------------
// Undo actions
+//-----------------------------------------------------------------------------
void JZPianoWindow::Undo()
{
mpSong->Undo();
@@ -2491,7 +2604,9 @@
}
}
+//-----------------------------------------------------------------------------
// Quantize selected events.
+//-----------------------------------------------------------------------------
void JZPianoWindow::Quantize()
{
if (EventsSelected())
@@ -2502,7 +2617,9 @@
}
}
+//-----------------------------------------------------------------------------
// Flip events up and down.
+//-----------------------------------------------------------------------------
void JZPianoWindow::ExchangeUpDown()
{
if (EventsSelected())
@@ -2513,7 +2630,9 @@
}
}
+//-----------------------------------------------------------------------------
// Flip events left to right.
+//-----------------------------------------------------------------------------
void JZPianoWindow::ExchangeLeftRight()
{
if (EventsSelected())
@@ -2524,7 +2643,9 @@
}
}
+//-----------------------------------------------------------------------------
// Shift events snapclock clocks to left.
+//-----------------------------------------------------------------------------
void JZPianoWindow::ShiftLeft()
{
if (EventsSelected())
@@ -2536,7 +2657,9 @@
}
}
+//-----------------------------------------------------------------------------
// Shift events snapclock clocks to right.
+//-----------------------------------------------------------------------------
void JZPianoWindow::ShiftRight()
{
if (EventsSelected())
@@ -2548,7 +2671,9 @@
}
}
+//-----------------------------------------------------------------------------
// helper for cut and copy events
+//-----------------------------------------------------------------------------
void JZPianoWindow::CutOrCopy(int Id)
{
if (EventsSelected())
@@ -2572,6 +2697,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::Erase()
{
if (EventsSelected())
@@ -2582,6 +2709,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::ToggleVisibleAllTracks()
{
mVisibleAllTracks = !mVisibleAllTracks;
@@ -2589,54 +2718,72 @@
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::MSelect()
{
mpPianoFrame->PressRadio(ID_SELECT);
mMouseEvent.SetLeftAction(MA_SELECT);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::MLength()
{
mpPianoFrame->PressRadio(ID_CHANGE_LENGTH);
mMouseEvent.SetLeftAction(MA_LENGTH);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::MDialog()
{
mpPianoFrame->PressRadio(ID_EVENT_DIALOG);
mMouseEvent.SetLeftAction(MA_DIALOG);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::MCutPaste()
{
mpPianoFrame->PressRadio(ID_CUT_PASTE_EVENTS);
mMouseEvent.SetLeftAction(MA_CUTPASTE);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::Snap8()
{
mPasteBuffer.Clear();
SetSnapDenom(8);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::Snap8D()
{
mPasteBuffer.Clear();
SetSnapDenom(12);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::Snap16()
{
mPasteBuffer.Clear();
SetSnapDenom(16);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::Snap16D()
{
mPasteBuffer.Clear();
SetSnapDenom(24);
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::Copy(JZTrack* pTrack, JZEvent* pEvent, int Kill)
{
if (!pEvent)
@@ -2689,7 +2836,8 @@
}
}
-
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::Paste(JZTrack* pTrack, int Clock, int Pitch)
{
if (mPasteBuffer.nEvents == 0)
@@ -2769,6 +2917,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::GetKeyOnEventCount()
{
int Count = 0;
@@ -2786,23 +2936,31 @@
return Count;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
int JZPianoWindow::Channel()
{
return mpTrack->Channel ? mpTrack->Channel - 1 : 0;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::SnapDialog()
{
tSnapDlg* pSnapDialog = new tSnapDlg(this, &mSnapDenomiator);
pSnapDialog->Create();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::SetVisibleAllTracks(bool Value)
{
mVisibleAllTracks = Value;
Refresh();
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::ActivateSettingsDialog()
{
jppResourceDialog Dialog(this, "windowSettings");
@@ -2818,8 +2976,10 @@
}
}
+//-----------------------------------------------------------------------------
// This is a test to see how to implement a dialog with Patrick's system.
// It replaces tMidiDelayDlg, which isnt necesarily a good idea.
+//-----------------------------------------------------------------------------
void JZPianoWindow::ActivateMidiDelayDialog()
{
if (!EventsSelected())
@@ -2847,6 +3007,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::ActivateSequenceLengthDialog()
{
if (!EventsSelected())
@@ -2870,6 +3032,8 @@
}
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZPianoWindow::ActivateVelocityDialog()
{
int FromValue = 64;
@@ -2890,9 +3054,9 @@
}
jppResourceDialog dialog(this, "velocity");
- dialog.Attach("start",&FromValue);
- dialog.Attach("stop",&ToValue);
- dialog.Attach("mode",&Mode,modes);
+ dialog.Attach("start" ,&FromValue);
+ dialog.Attach("stop", &ToValue);
+ dialog.Attach("mode", &Mode, modes);
if (dialog.ShowModal() == wxID_OK)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <pst...@us...> - 2008-04-08 23:58:18
|
Revision: 447
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=447&view=rev
Author: pstieber
Date: 2008-04-08 16:58:16 -0700 (Tue, 08 Apr 2008)
Log Message:
-----------
Changed PrepareDC to DoPrepareDC and made some cosmetic changes.
Modified Paths:
--------------
trunk/jazz/src/PianoWindow.cpp
Modified: trunk/jazz/src/PianoWindow.cpp
===================================================================
--- trunk/jazz/src/PianoWindow.cpp 2008-04-08 23:56:56 UTC (rev 446)
+++ trunk/jazz/src/PianoWindow.cpp 2008-04-08 23:58:16 UTC (rev 447)
@@ -228,7 +228,7 @@
wxClientDC Dc(Win);
// to translate scrolled coordinates
- Win->PrepareDC(Dc);
+ Win->DoPrepareDC(Dc);
Win->DrawEvent(Dc, Copy, wxWHITE_BRUSH, 0);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
@@ -250,7 +250,7 @@
int tKeyLengthDragger::Dragging(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
- Win->PrepareDC(Dc); //to translate scrolled coordinates
+ Win->DoPrepareDC(Dc); //to translate scrolled coordinates
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
int fx, fy;
Win->LogicalMousePosition(Event, fx, fy);
@@ -339,7 +339,7 @@
Win->GetSong()->NewUndoBuffer();
//
wxClientDC Dc(Win);
- Win->PrepareDC(Dc);
+ Win->DoPrepareDC(Dc);
Win->DrawEvent(Dc, Copy, wxWHITE_BRUSH, 0);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
}
@@ -360,7 +360,7 @@
int tPlayTrackLengthDragger::Dragging(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
- Win->PrepareDC(Dc);
+ Win->DoPrepareDC(Dc);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
int fx, fy;
Win->LogicalMousePosition(Event, fx, fy);
@@ -377,7 +377,7 @@
int tPlayTrackLengthDragger::ButtonUp(wxMouseEvent& Event)
{
wxClientDC Dc(Win);
- Win->PrepareDC(Dc);
+ Win->DoPrepareDC(Dc);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 1, 1);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 0, 1);
@@ -437,7 +437,7 @@
Win->ApplyToTrack(mpKeyOn, Copy);
wxClientDC Dc(Win);
- Win->PrepareDC(Dc);
+ Win->DoPrepareDC(Dc);
Win->DrawEvent(Dc, Copy, Copy->GetBrush(), 0, 1);
Win->UpdateControl();
@@ -1753,7 +1753,9 @@
int x;
int y;
LogicalMousePosition(Event, x, y);
- if (mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight)
+ if (
+ mEventsX < x && x < mEventsX + mEventsWidth &&
+ mEventsY < y && y < mEventsY + mEventsHeight)
{
if (Event.LeftDown())
{
@@ -1762,7 +1764,9 @@
if (mpSnapSel->Selected)
{
- Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect)
+ // Redraw the whole window instead (inefficient, we should rather
+ // invalidate a rect).
+ Refresh();
}
mpSnapSel->Event(Event);
mpMouseAction = mpSnapSel;
@@ -1781,7 +1785,10 @@
if (mpMouseAction == mpSnapSel)
{
SnapSelStop(Event);
- Refresh(); //ineficcient, invalidate rect first instead
+
+ // inefficient, invalidate rect first instead.
+ Refresh();
+
mpMouseAction = 0;
return 1;
}
@@ -1792,11 +1799,14 @@
return 0;
}
+//-----------------------------------------------------------------------------
+// Description:
// Indicate which key on the pianoroll that the mouse is hovering over by
// highlighting it. This function is bad because it draws directly in the dc,
// rather it should invalidate and let OnDraw do the actual painting.
// Currently the code doesn't work because it doesn't care about scrolling
// (because I get the dc the wrong way).
+//-----------------------------------------------------------------------------
void JZPianoWindow::ShowPitch(int Pitch)
{
// This is the current position of the mouse. mMouseLine is the last
@@ -1807,7 +1817,7 @@
wxClientDC Dc(this);
// Translate scrolled coordinates.
- PrepareDC(Dc);
+ DoPrepareDC(Dc);
Dc.SetLogicalFunction(wxXOR);
@@ -1875,7 +1885,7 @@
{
wxClientDC Dc(this);
- PrepareDC(Dc);
+ DoPrepareDC(Dc);
// Convert physical coordinates to logical (scrolled) coordinates.
wxPoint Point = Event.GetLogicalPosition(Dc);
@@ -2660,7 +2670,7 @@
}
wxClientDC Dc(this);
- PrepareDC(Dc);
+ DoPrepareDC(Dc);
DrawEvent(Dc, pEvent, wxWHITE_BRUSH, 0);
pTrack->Kill(pEvent);
pTrack->Cleanup();
@@ -2745,7 +2755,7 @@
}
}
wxClientDC Dc(this);
- PrepareDC(Dc);
+ DoPrepareDC(Dc);
DrawEvent(Dc, c, c->GetBrush(), 0, 1);
pTrack->Put(c);
pEvent = Iterator.Next();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|