|
From: <pst...@us...> - 2013-04-08 05:22:27
|
Revision: 1023
http://sourceforge.net/p/jazzplusplus/code/1023
Author: pstieber
Date: 2013-04-08 05:22:24 +0000 (Mon, 08 Apr 2013)
Log Message:
-----------
Can actually generate rhythms using the new window.
Modified Paths:
--------------
trunk/jazz/src/ArrayControl.cpp
trunk/jazz/src/ArrayControl.h
trunk/jazz/src/Rhythm.cpp
trunk/jazz/src/Rhythm.h
trunk/jazz/src/RhythmArrayControl.cpp
trunk/jazz/src/RhythmArrayControl.h
trunk/jazz/src/TrackFrame.cpp
Modified: trunk/jazz/src/ArrayControl.cpp
===================================================================
--- trunk/jazz/src/ArrayControl.cpp 2013-04-08 04:30:34 UTC (rev 1022)
+++ trunk/jazz/src/ArrayControl.cpp 2013-04-08 05:22:24 UTC (rev 1023)
@@ -58,12 +58,12 @@
JZArrayControl::JZArrayControl(
wxWindow* pParent,
wxWindowID Id,
- const JZRndArray& RandomArray,
+ JZRndArray& RandomArray,
const wxPoint& Position,
const wxSize& Size,
long WindowStyle)
: wxControl(pParent, Id, Position, Size, wxNO_BORDER),
- mpRandomArray(0),
+ mRandomArray(RandomArray),
mStyleBits(ARED_GAP | ARED_XTICKS),
mEnabled(true),
mLabel(),
@@ -77,8 +77,6 @@
mXMin(0),
mXMax(RandomArray.Size())
{
- mpRandomArray = new JZRndArray(RandomArray);
-
SetInitialSize(Size);
}
@@ -86,7 +84,6 @@
//-----------------------------------------------------------------------------
JZArrayControl::~JZArrayControl()
{
- delete mpRandomArray;
}
//-----------------------------------------------------------------------------
@@ -139,8 +136,8 @@
mYNull =
mY + mHeight -
- mHeight * (mpRandomArray->GetNull() - mpRandomArray->GetMin()) /
- (mpRandomArray->GetMax() - mpRandomArray->GetMin());
+ mHeight * (mRandomArray.GetNull() - mRandomArray.GetMin()) /
+ (mRandomArray.GetMax() - mRandomArray.GetMin());
int i;
@@ -164,7 +161,7 @@
// sliders
Dc.SetBrush(*wxBLACK_BRUSH);
- for (i = 0; i < mpRandomArray->Size(); ++i)
+ for (i = 0; i < mRandomArray.Size(); ++i)
{
DrawBar(Dc, i, true);
}
@@ -237,39 +234,39 @@
wxClientDC Dc(this); // PORTING this is evil and shoud go
- int Value = mpRandomArray->GetNull();
+ int Value = mRandomArray.GetNull();
if (MouseEvent.LeftIsDown())
{
int EventX, EventY;
MouseEvent.GetPosition(&EventX, &EventY);
Value = (int)((double)(mY + mHeight - EventY) *
- (mpRandomArray->GetMax() - mpRandomArray->GetMin()) / mHeight +
- mpRandomArray->GetMin() + 0.5);
+ (mRandomArray.GetMax() - mRandomArray.GetMin()) / mHeight +
+ mRandomArray.GetMin() + 0.5);
- if (Value < mpRandomArray->GetMin())
+ if (Value < mRandomArray.GetMin())
{
- Value = mpRandomArray->GetMin();
+ Value = mRandomArray.GetMin();
}
- if (Value > mpRandomArray->GetMax())
+ if (Value > mRandomArray.GetMax())
{
- Value = mpRandomArray->GetMax();
+ Value = mRandomArray.GetMax();
}
}
if (MouseEvent.ShiftDown())
{
- for (int k = 0; k < mpRandomArray->Size(); ++k)
+ for (int k = 0; k < mRandomArray.Size(); ++k)
{
DrawBar(Dc, k, 0);
- (*mpRandomArray)[k] = Value;
+ mRandomArray[k] = Value;
DrawBar(Dc, k, 1);
}
}
else if (MouseEvent.ControlDown())
{
DrawBar(Dc, mIndex, 0);
- (*mpRandomArray)[mIndex] = Value;
+ mRandomArray[mIndex] = Value;
DrawBar(Dc, mIndex, 1);
}
else
@@ -281,7 +278,7 @@
for (; i <= mIndex; ++i)
{
DrawBar(Dc, i, 0);
- (*mpRandomArray)[i] = Value;
+ mRandomArray[i] = Value;
DrawBar(Dc, i, 1);
}
}
@@ -290,7 +287,7 @@
for (; i >= mIndex; --i)
{
DrawBar(Dc, i, 0);
- (*mpRandomArray)[i] = Value;
+ mRandomArray[i] = Value;
DrawBar(Dc, i, 1);
}
}
@@ -317,14 +314,14 @@
{
int EventX, EventY;
MouseEvent.GetPosition(&EventX, &EventY);
- int Index = (int)((EventX - mX) * mpRandomArray->Size() / mWidth);
+ int Index = (int)((EventX - mX) * mRandomArray.Size() / mWidth);
if (Index < 0)
{
Index = 0;
}
- if (Index >= mpRandomArray->Size())
+ if (Index >= mRandomArray.Size())
{
- Index = mpRandomArray->Size() - 1;
+ Index = mRandomArray.Size() - 1;
}
return Index;
}
@@ -340,24 +337,23 @@
Dc.SetPen(*wxWHITE_PEN);
}
- JZMapper XMap(0, mpRandomArray->Size(), 0, mWidth);
- JZMapper
- YMap(mpRandomArray->GetMin(), mpRandomArray->GetMax(), mHeight, 0);
+ JZMapper XMap(0, mRandomArray.Size(), 0, mWidth);
+ JZMapper YMap(mRandomArray.GetMin(), mRandomArray.GetMax(), mHeight, 0);
int x1 = (int)XMap.XToY(i + 0.5);
- int y1 = (int)YMap.XToY((*mpRandomArray)[i]);
+ int y1 = (int)YMap.XToY(mRandomArray[i]);
if (i > 0)
{
// draw line to prev position
int x0 = (int)XMap.XToY(i - 0.5);
- int y0 = (int)YMap.XToY((*mpRandomArray)[i - 1]);
+ int y0 = (int)YMap.XToY(mRandomArray[i - 1]);
Dc.DrawLine(x0, y0, x1, y1);
}
- if (i < mpRandomArray->Size() - 1)
+ if (i < mRandomArray.Size() - 1)
{
// draw line to next position
int x2 = (int)XMap.XToY(i + 1.5);
- int y2 = (int)YMap.XToY((*mpRandomArray)[i + 1]);
+ int y2 = (int)YMap.XToY(mRandomArray[i + 1]);
Dc.DrawLine(x1, y1, x2, y2);
}
@@ -371,17 +367,17 @@
int Gap = 0;
if (mStyleBits & ARED_GAP)
{
- Gap = mWidth / mpRandomArray->Size() / 6;
- if (!Gap && mWidth / mpRandomArray->Size() > 3)
+ Gap = mWidth / mRandomArray.Size() / 6;
+ if (!Gap && mWidth / mRandomArray.Size() > 3)
{
Gap = 1;
}
}
- int wbar = mWidth / mpRandomArray->Size() - 2 * Gap;
- int xbar = mX + i * mWidth / mpRandomArray->Size() + Gap;
- int hbar = mHeight * ((*mpRandomArray)[i] - mpRandomArray->GetNull()) /
- (mpRandomArray->GetMax() - mpRandomArray->GetMin());
+ int wbar = mWidth / mRandomArray.Size() - 2 * Gap;
+ int xbar = mX + i * mWidth / mRandomArray.Size() + Gap;
+ int hbar = mHeight * (mRandomArray[i] - mRandomArray.GetNull()) /
+ (mRandomArray.GetMax() - mRandomArray.GetMin());
int ybar;
if (mStyleBits & ARED_BLOCKS)
@@ -486,7 +482,7 @@
XPosition -= TextWidth / 2.0f;
// Middle of bar.
- XPosition += 0.5f * mWidth / mpRandomArray->Size();
+ XPosition += 0.5f * mWidth / mRandomArray.Size();
Dc.DrawText(String, (int)XPosition, YPosition);
}
@@ -509,23 +505,22 @@
int MaxLabels = (int)(mHeight / (TextHeight + TextHeight / 2));
if (MaxLabels > 0)
{
- int Step =
- (mpRandomArray->GetMax() - mpRandomArray->GetMin()) / MaxLabels;
+ int Step = (mRandomArray.GetMax() - mRandomArray.GetMin()) / MaxLabels;
if (Step <= 0)
{
Step = 1;
}
for (
- int Value = mpRandomArray->GetMin();
- Value < mpRandomArray->GetMax();
+ int Value = mRandomArray.GetMin();
+ Value < mRandomArray.GetMax();
Value += Step)
{
string String = GetText(Value);
Dc.GetTextExtent(String, &TextWidth, &TextHeight);
int YPosition =
mY + mHeight -
- mHeight * (Value - mpRandomArray->GetMin()) /
- (mpRandomArray->GetMax() - mpRandomArray->GetMin()) -
+ mHeight * (Value - mRandomArray.GetMin()) /
+ (mRandomArray.GetMax() - mRandomArray.GetMin()) -
TextHeight / 2;
Dc.DrawText(String, mX - TextWidth - TICK_LINE, YPosition);
}
@@ -537,13 +532,13 @@
int TextWidth, TextHeight;
ostringstream Oss;
- Oss << mpRandomArray->GetMax();
+ Oss << mRandomArray.GetMax();
Dc.GetTextExtent(Oss.str(), &TextWidth, &TextHeight);
Dc.DrawText(Oss.str(), mX - TextWidth, mY);
Oss.str("");
- Oss << mpRandomArray->GetMin();
+ Oss << mRandomArray.GetMin();
Dc.GetTextExtent(Oss.str(), &TextWidth, &TextHeight);
Dc.DrawText(Oss.str(), mX - TextWidth, mY + mHeight - TextHeight);
}
@@ -559,14 +554,14 @@
// Draw y-null line.
if (
- mpRandomArray->GetMin() < mpRandomArray->GetNull() &&
- mpRandomArray->GetNull() < mpRandomArray->GetMax())
+ mRandomArray.GetMin() < mRandomArray.GetNull() &&
+ mRandomArray.GetNull() < mRandomArray.GetMax())
{
Dc.DrawLine(
mX,
- mpRandomArray->GetNull(),
+ mRandomArray.GetNull(),
mX + mWidth,
- mpRandomArray->GetNull());
+ mRandomArray.GetNull());
}
// Draw x-null line.
Modified: trunk/jazz/src/ArrayControl.h
===================================================================
--- trunk/jazz/src/ArrayControl.h 2013-04-08 04:30:34 UTC (rev 1022)
+++ trunk/jazz/src/ArrayControl.h 2013-04-08 05:22:24 UTC (rev 1023)
@@ -35,7 +35,7 @@
JZArrayControl(
wxWindow* pParent,
wxWindowID Id,
- const JZRndArray& RandomArray,
+ JZRndArray& RandomArray,
const wxPoint& Position = wxDefaultPosition,
const wxSize& Size = wxSize(40, 40),
long WindowStyle = wxNO_BORDER);
@@ -80,7 +80,7 @@
protected:
- JZRndArray* mpRandomArray;
+ JZRndArray& mRandomArray;
long mStyleBits;
Modified: trunk/jazz/src/Rhythm.cpp
===================================================================
--- trunk/jazz/src/Rhythm.cpp 2013-04-08 04:30:34 UTC (rev 1022)
+++ trunk/jazz/src/Rhythm.cpp 2013-04-08 05:22:24 UTC (rev 1023)
@@ -468,6 +468,42 @@
JZRndArray& out,
int grp,
const JZBarInfo& BarInfo,
+ const vector<JZRhythm*>& Rhythms)
+{
+ out.Clear();
+
+ int ClocksPerStep = GetClocksPerStep(BarInfo);
+
+ for (
+ vector<JZRhythm*>::const_iterator iRhythm = Rhythms.begin();
+ iRhythm != Rhythms.end();
+ ++iRhythm)
+ {
+ const JZRhythm* pRhythm = *iRhythm;
+ int fuzz = pRhythm->GetRhythmGroup(grp).GetContrib();
+ if (fuzz && pRhythm != this)
+ {
+ JZRndArray tmp(mRhythmArray);
+ tmp.Clear();
+ int Clock = BarInfo.GetClock();
+ while (Clock < BarInfo.GetClock() + BarInfo.GetTicksPerBar())
+ {
+ int i = Clock2i(Clock, BarInfo);
+ int j = pRhythm->Clock2i(Clock, BarInfo);
+ tmp[i] = pRhythm->mHistoryArray[j];
+ Clock += ClocksPerStep;
+ }
+ out.SetUnion(tmp, fuzz);
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZRhythm::GenGroup(
+ JZRndArray& out,
+ int grp,
+ const JZBarInfo& BarInfo,
JZRhythm* rhy[],
int RhythmCount)
{
@@ -565,6 +601,74 @@
mNextClock = Clock;
}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+void JZRhythm::Generate(
+ JZTrack* pTrack,
+ const JZBarInfo& BarInfo,
+ const std::vector<JZRhythm*>& Instruments)
+{
+ JZRndArray rrg(mRhythmArray);
+
+ // Add groups to the rhythm array.
+ JZRndArray tmp(mRhythmArray);
+ for (int gi = 0; gi < MAX_GROUPS; ++gi)
+ {
+ if (mRhythmGroups[gi].mListen)
+ {
+ GenGroup(tmp, gi, BarInfo, Instruments);
+ if (mRhythmGroups[gi].mListen > 0)
+ {
+ rrg.SetIntersection(tmp, mRhythmGroups[gi].mListen);
+ }
+ else
+ {
+ rrg.SetDifference(tmp, -mRhythmGroups[gi].mListen);
+ }
+ }
+ }
+
+ // Clear part of the history.
+ int Clock = BarInfo.GetClock();
+ int ClocksPerStep = GetClocksPerStep(BarInfo);
+ while (Clock < BarInfo.GetClock() + BarInfo.GetTicksPerBar())
+ {
+ int i = Clock2i(Clock, BarInfo);
+ mHistoryArray[i] = 0;
+ Clock += ClocksPerStep;
+ }
+
+ // generate the events
+ Clock = mNextClock;
+ while (Clock < BarInfo.GetClock() + BarInfo.GetTicksPerBar())
+ {
+ int i = Clock2i(Clock, BarInfo);
+ if ((!mRandomizeFlag && rrg[i] > 0) || rrg.Random(i))
+ {
+ // put event here
+ mHistoryArray[i] = mRhythmArray.GetMax();
+
+ short vel = 0;
+ if (mRandomizeFlag)
+ {
+ vel = mVelocityArray.Random() * 127 / mVelocityArray.Size() + 1;
+ }
+ else
+ {
+ vel = rrg[i] * 126 / rrg.GetMax() + 1;
+ }
+ short len = (mLengthArray.Random() + 1) * ClocksPerStep;
+ GenerateEvent(pTrack, Clock, vel, len - ClocksPerStep / 2);
+ Clock += len;
+ }
+ else
+ {
+ Clock += ClocksPerStep;
+ }
+ }
+ mNextClock = Clock;
+}
+
//*****************************************************************************
//*****************************************************************************
//-----------------------------------------------------------------------------
@@ -1426,11 +1530,15 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
JZRhythmGeneratorWindow::JZRhythmGeneratorWindow(
+ JZEventWindow* pEventWindow,
+ JZSong* pSong,
wxFrame* pParent,
const wxPoint& Position,
const wxSize& Size)
: wxPanel(pParent, wxID_ANY, Position, Size),
mRhythm(0),
+ mpEventWindow(pEventWindow),
+ mpSong(pSong),
mInstruments(),
mpStepsPerCountSlider(0),
mpCountsPerBarSlider(0),
@@ -1440,7 +1548,7 @@
mpGroupContribSlider(0),
mpGroupListenSlider(0),
mpGroupListBox(0),
- mActiveGroup(-1),
+ mActiveGroup(0),
mpRandomCheckBox(0),
mpLengthEdit(0),
mpVelocityEdit(0),
@@ -1813,6 +1921,16 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+void JZRhythmGeneratorWindow::Generate()
+{
+ wxBeginBusyCursor();
+ Win2Instrument();
+ GenerateRhythm();
+ wxEndBusyCursor();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZRhythmGeneratorWindow::Instrument2Win()
{
if (
@@ -1895,6 +2013,80 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+void JZRhythmGeneratorWindow::GenerateRhythm()
+{
+ if (
+ !mpEventWindow->EventsSelected(
+ "Please mark the destination track in the track window"))
+ {
+ return;
+ }
+
+ JZFilter* pFilter = mpEventWindow->mpFilter;
+
+ if (pFilter->GetFromTrack() != pFilter->GetToTrack())
+ {
+ wxMessageBox("you must select exacty 1 track", "Error", wxOK);
+ return;
+ }
+
+ int FromClock = pFilter->GetFromClock();
+ int ToClock = pFilter->GetToClock();
+ JZTrack* pTrack = mpSong->GetTrack(pFilter->GetFromTrack());
+ mpSong->NewUndoBuffer();
+
+ // remove selection
+// if (
+// wxMessageBox(
+// "Erase destination before generating?",
+// "Replace",
+// wxYES_NO) == wxYES)
+ {
+ JZCommandErase erase(pFilter, 1);
+ erase.Execute(0);
+ }
+
+ for (
+ vector<JZRhythm*>::iterator iInstrument = mInstruments.begin();
+ iInstrument != mInstruments.end();
+ ++iInstrument)
+ {
+ JZRhythm& Instrument = **iInstrument;
+ Instrument.GenInit(FromClock);
+ }
+
+ JZBarInfo BarInfo(*mpSong);
+ BarInfo.SetClock(FromClock);
+
+// for (int i = 0; i < mInstrumentCount; ++i)
+// {
+// mpInstruments[i]->Generate(
+// pTrack,
+// FromClock,
+// ToClock,
+// BarInfo.GetTicksPerBar());
+// }
+
+ while (BarInfo.GetClock() < ToClock)
+ {
+ for (
+ vector<JZRhythm*>::iterator iInstrument = mInstruments.begin();
+ iInstrument != mInstruments.end();
+ ++iInstrument)
+ {
+ JZRhythm& Instrument = **iInstrument;
+ Instrument.Generate(pTrack, BarInfo, mInstruments);
+ }
+ BarInfo.Next();
+ }
+
+ pTrack->Cleanup();
+
+ mpEventWindow->Refresh();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZRhythmGeneratorWindow::OnSliderUpdate(wxCommandEvent&)
{
Win2Instrument();
@@ -1926,6 +2118,8 @@
EVT_MENU(ID_INSTRUMENT_DELETE, JZRhythmGeneratorFrame::OnDeleteInstrument)
+ EVT_MENU(ID_INSTRUMENT_GENERATE, JZRhythmGeneratorFrame::OnGenerate)
+
EVT_MENU(wxID_HELP, JZRhythmGeneratorFrame::OnHelp)
EVT_MENU(wxID_HELP_CONTENTS, JZRhythmGeneratorFrame::OnHelpContents)
@@ -1938,7 +2132,9 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-JZRhythmGeneratorFrame::JZRhythmGeneratorFrame()
+JZRhythmGeneratorFrame::JZRhythmGeneratorFrame(
+ JZEventWindow* pEventWindow,
+ JZSong* pSong)
: wxFrame(
0,
wxID_ANY,
@@ -1977,8 +2173,12 @@
int Width, Height;
GetClientSize(&Width, &Height);
- mpRhythmGeneratorWindow =
- new JZRhythmGeneratorWindow(this, wxPoint(0, 0), wxSize(Width, Height));
+ mpRhythmGeneratorWindow = new JZRhythmGeneratorWindow(
+ pEventWindow,
+ pSong,
+ this,
+ wxPoint(0, 0),
+ wxSize(Width, Height));
}
//-----------------------------------------------------------------------------
@@ -2075,6 +2275,13 @@
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
+void JZRhythmGeneratorFrame::OnGenerate(wxCommandEvent&)
+{
+ mpRhythmGeneratorWindow->Generate();
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
void JZRhythmGeneratorFrame::OnHelp(wxCommandEvent&)
{
JZHelp::Instance().ShowTopic("Random rhythm generator");
@@ -2089,11 +2296,11 @@
//*****************************************************************************
//*****************************************************************************
-void CreateRhythmGenerator()
+void CreateRhythmGenerator(JZEventWindow* pEventWindow, JZSong* pSong)
{
if (!gpRhythmGeneratorFrame)
{
- gpRhythmGeneratorFrame = new JZRhythmGeneratorFrame();
+ gpRhythmGeneratorFrame = new JZRhythmGeneratorFrame(pEventWindow, pSong);
}
gpRhythmGeneratorFrame->Show(true);
}
Modified: trunk/jazz/src/Rhythm.h
===================================================================
--- trunk/jazz/src/Rhythm.h 2013-04-08 04:30:34 UTC (rev 1022)
+++ trunk/jazz/src/Rhythm.h 2013-04-08 05:22:24 UTC (rev 1023)
@@ -58,6 +58,16 @@
void Write(std::ostream& Os) const;
void Read(std::istream& Is, int Version);
+ int GetContrib() const
+ {
+ return mContrib;
+ }
+
+ int GetListen() const
+ {
+ return mListen;
+ }
+
public:
int mListen;
@@ -70,6 +80,11 @@
{
public:
+ const JZRhythmGroup& operator [] (int i) const
+ {
+ return mRhythmGroups[i];
+ }
+
JZRhythmGroup& operator [] (int i)
{
return mRhythmGroups[i];
@@ -116,6 +131,11 @@
JZRhythm* rhy[],
int RhythmCount);
+ void Generate(
+ JZTrack* pTrack,
+ const JZBarInfo& BarInfo,
+ const std::vector<JZRhythm*>& Instruments);
+
void GenInit(int StartClock);
void GenerateEvent(
@@ -128,6 +148,11 @@
void Read(std::istream& Is, int Version);
+ const JZRhythmGroup& GetRhythmGroup(int Index) const
+ {
+ return mRhythmGroups[Index];
+ }
+
protected:
void GenGroup(
@@ -137,6 +162,12 @@
JZRhythm* rhy[],
int RhythmCount);
+ void JZRhythm::GenGroup(
+ JZRndArray& out,
+ int grp,
+ const JZBarInfo& BarInfo,
+ const std::vector<JZRhythm*>& Rhythms);
+
int Clock2i(int Clock, const JZBarInfo& BarInfo) const;
int GetClocksPerStep(const JZBarInfo& BarInfo) const;
@@ -260,6 +291,8 @@
public:
JZRhythmGeneratorWindow(
+ JZEventWindow* pEventWindow,
+ JZSong* pSong,
wxFrame* pParent,
const wxPoint& Position,
const wxSize& Size);
@@ -274,6 +307,8 @@
void DeleteInstrument();
+ void Generate();
+
private:
void ClearInstruments();
@@ -286,6 +321,8 @@
void RandomEnable();
+ void GenerateRhythm();
+
void OnSliderUpdate(wxCommandEvent& Event);
void OnListBox(wxCommandEvent& Event);
@@ -294,6 +331,9 @@
JZRhythm mRhythm;
+ JZEventWindow* mpEventWindow;
+ JZSong* mpSong;
+
std::vector<JZRhythm*> mInstruments;
wxSlider* mpStepsPerCountSlider;
@@ -320,7 +360,7 @@
{
public:
- JZRhythmGeneratorFrame();
+ JZRhythmGeneratorFrame(JZEventWindow* pEventWindow, JZSong* pSong);
~JZRhythmGeneratorFrame();
@@ -336,6 +376,8 @@
void OnDeleteInstrument(wxCommandEvent& Event);
+ void OnGenerate(wxCommandEvent& Event);
+
void OnHelp(wxCommandEvent& Event);
void OnHelpContents(wxCommandEvent& Event);
@@ -353,4 +395,4 @@
//*****************************************************************************
//*****************************************************************************
-extern void CreateRhythmGenerator();
+extern void CreateRhythmGenerator(JZEventWindow* pEventWindow, JZSong* pSong);
Modified: trunk/jazz/src/RhythmArrayControl.cpp
===================================================================
--- trunk/jazz/src/RhythmArrayControl.cpp 2013-04-08 04:30:34 UTC (rev 1022)
+++ trunk/jazz/src/RhythmArrayControl.cpp 2013-04-08 05:22:24 UTC (rev 1023)
@@ -35,7 +35,7 @@
JZRhythmArrayControl::JZRhythmArrayControl(
wxWindow* pParent,
wxWindowID Id,
- const JZRndArray& RandomArray,
+ JZRndArray& RandomArray,
const wxPoint& Position,
const wxSize& Size,
long WindowStyle)
@@ -57,7 +57,7 @@
{
mStepsPerCount = StepsPerCount;
mCountPerBar = CountPerBar;
- mpRandomArray->Resize(StepsPerCount * CountPerBar * BarCount);
+ mRandomArray.Resize(StepsPerCount * CountPerBar * BarCount);
SetXMinMax(1, StepsPerCount * CountPerBar * BarCount);
}
@@ -76,13 +76,13 @@
Dc.SetFont(*wxSMALL_FONT);
int TextWidth, TextHeight;
- for (int i = 0; i < mpRandomArray->Size(); i += mStepsPerCount)
+ for (int i = 0; i < mRandomArray.Size(); i += mStepsPerCount)
{
int Mark = (i / mStepsPerCount) % mCountPerBar + 1;
ostringstream Oss;
Oss << Mark;
int YPosition = mY + mHeight;
- int XPosition = (int)(mX + (i + 0.5) * mWidth / mpRandomArray->Size());
+ int XPosition = (int)(mX + (i + 0.5) * mWidth / mRandomArray.Size());
Dc.GetTextExtent(Oss.str(), &TextWidth, &TextHeight);
XPosition -= (int)(TextWidth / 2.0);
Dc.DrawText(Oss.str(), XPosition, YPosition);
Modified: trunk/jazz/src/RhythmArrayControl.h
===================================================================
--- trunk/jazz/src/RhythmArrayControl.h 2013-04-08 04:30:34 UTC (rev 1022)
+++ trunk/jazz/src/RhythmArrayControl.h 2013-04-08 05:22:24 UTC (rev 1023)
@@ -31,7 +31,7 @@
JZRhythmArrayControl(
wxWindow* pParent,
wxWindowID Id,
- const JZRndArray& RandomArray,
+ JZRndArray& RandomArray,
const wxPoint& Position = wxDefaultPosition,
const wxSize& Size = wxSize(40, 40),
long WindowStyle = wxNO_BORDER);
Modified: trunk/jazz/src/TrackFrame.cpp
===================================================================
--- trunk/jazz/src/TrackFrame.cpp 2013-04-08 04:30:34 UTC (rev 1022)
+++ trunk/jazz/src/TrackFrame.cpp 2013-04-08 05:22:24 UTC (rev 1023)
@@ -709,7 +709,7 @@
//-----------------------------------------------------------------------------
void JZTrackFrame::OnToolsRhythmGenerator(wxCommandEvent& Event)
{
- CreateRhythmGenerator();
+ CreateRhythmGenerator(mpTrackWindow, mpProject);
}
//-----------------------------------------------------------------------------
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|