From: <pst...@us...> - 2009-02-17 14:45:59
|
Revision: 715 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=715&view=rev Author: pstieber Date: 2009-02-17 14:45:54 +0000 (Tue, 17 Feb 2009) Log Message: ----------- 1. Replaced the old MIDI channel and quantization dialogs with new versions. 2. Replaced the global quantization steps vector with a map. This really shouldn't be global. 3. Updated the interface to the quantization command. Modified Paths: -------------- trunk/jazz/src/Command.cpp trunk/jazz/src/Command.h trunk/jazz/src/Dialogs/LengthDialog.cpp trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/Globals.cpp trunk/jazz/src/Globals.h trunk/jazz/src/Makefile.am trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/Project.cpp trunk/jazz/src/Resources.h trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj Added Paths: ----------- trunk/jazz/src/Dialogs/MidiChannelDialog.cpp trunk/jazz/src/Dialogs/MidiChannelDialog.h trunk/jazz/src/Dialogs/QuantizeDialog.cpp trunk/jazz/src/Dialogs/QuantizeDialog.h Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Command.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -359,25 +359,33 @@ // tCmdQuantize // ************************************************************************ -tCmdQuantize::tCmdQuantize(JZFilter* pFilter, long clks, int grov, int dly) - : tCommand(pFilter) +tCmdQuantize::tCmdQuantize( + JZFilter* pFilter, + int QntClocks, + bool NoteStart, + bool NoteLength, + int Groove, + int Delay) + : tCommand(pFilter), + mQntClocks(QntClocks), + mNoteStart(NoteStart), + mNoteLength(NoteLength), + mGroove(Groove), + mDelay(Delay) { - QntClocks = clks; - Groove = grov; - Delay = dly; - NoteStart = 1; - NoteLength = 0; } -long tCmdQuantize::Quantize(long Clock, int islen) +long tCmdQuantize::Quantize(int Clock, int islen) { - Clock += QntClocks / 2; - Clock -= Clock % QntClocks; - if (!islen && (Clock % (2 * QntClocks) != 0)) - Clock += Groove; - Clock += Delay; - long minclk = islen ? 2 : 0; - return Clock > minclk ? Clock : minclk; + Clock += mQntClocks / 2; + Clock -= Clock % mQntClocks; + if (!islen && (Clock % (2 * mQntClocks) != 0)) + { + Clock += mGroove; + } + Clock += mDelay; + int MinClock = islen ? 2 : 0; + return Clock > MinClock ? Clock : MinClock; } void tCmdQuantize::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent) @@ -386,11 +394,11 @@ if ((pKeyOn = pEvent->IsKeyOn()) != 0) { pKeyOn = (tKeyOn *)pEvent->Copy(); - if (NoteStart) + if (mNoteStart) { pKeyOn->SetClock(Quantize(pKeyOn->GetClock(), 0)); } - if (NoteLength) + if (mNoteLength) { pKeyOn->SetLength(Quantize(pKeyOn->GetEventLength(), 2)); } @@ -452,22 +460,22 @@ // tCmdSetChannel // ************************************************************************ -tCmdSetChannel::tCmdSetChannel(JZFilter* pFilter, int chan) - : tCommand(pFilter) +tCmdSetChannel::tCmdSetChannel(JZFilter* pFilter, int NewChannel) + : tCommand(pFilter), + mNewChannel(NewChannel) { - NewChannel = chan; } void tCmdSetChannel::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent) { - tChannelEvent* c; + tChannelEvent* pChannelEvent; - if ((c = pEvent->IsChannelEvent()) != 0) + if ((pChannelEvent = pEvent->IsChannelEvent()) != 0) { - c = (tChannelEvent *)pEvent->Copy(); - c->SetChannel(NewChannel); + pChannelEvent = (tChannelEvent *)pEvent->Copy(); + pChannelEvent->SetChannel(mNewChannel); pTrack->Kill(pEvent); - pTrack->Put(c); + pTrack->Put(pChannelEvent); } } Modified: trunk/jazz/src/Command.h =================================================================== --- trunk/jazz/src/Command.h 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Command.h 2009-02-17 14:45:54 UTC (rev 715) @@ -209,15 +209,29 @@ //***************************************************************************** class tCmdQuantize : public tCommand { - long Quantize(long Clock, int islen); public: - long QntClocks; - int NoteStart; // yes - int NoteLength; // no - int Delay; // zero - int Groove; // zero - tCmdQuantize(JZFilter* pFilter, long QntClocks, int groove, int delay); + + tCmdQuantize( + JZFilter* pFilter, + int QntClocks, + bool NoteStart, + bool NoteLength, + int Groove, + int Delay); + virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); + + private: + + long Quantize(int Clock, int islen); + + private: + + int mQntClocks; + bool mNoteStart; + bool mNoteLength; + int mDelay; + int mGroove; }; //***************************************************************************** @@ -241,9 +255,14 @@ class tCmdSetChannel : public tCommand { public: - int NewChannel; // 0 + tCmdSetChannel(JZFilter* pFilter, int NewChannel); + virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); + + private: + + int mNewChannel; }; //***************************************************************************** Modified: trunk/jazz/src/Dialogs/LengthDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/LengthDialog.cpp 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Dialogs/LengthDialog.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -142,7 +142,7 @@ wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE); pFlexGridSizer->Add(mpLengthStopKnob, 0, wxALIGN_CENTER_VERTICAL); - pTopSizer->Add(pFlexGridSizer, 0, wxALIGN_CENTER); + pTopSizer->Add(pFlexGridSizer, 0, wxALIGN_CENTER | wxALL, 5); pTopSizer->Add( mpModeRadioBox, Added: trunk/jazz/src/Dialogs/MidiChannelDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/MidiChannelDialog.cpp (rev 0) +++ trunk/jazz/src/Dialogs/MidiChannelDialog.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -0,0 +1,139 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2009 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 "MidiChannelDialog.h" + +#include "../Globals.h" +#include "../Help.h" +#include "../Knob.h" +#include "../Resources.h" + +#include <wx/button.h> +#include <wx/sizer.h> +#include <wx/stattext.h> + +#include <sstream> + +using namespace std; + +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZMidiChannelDialog, wxDialog) + + EVT_KNOB_CHANGED( + IDC_KB_MIDI_CHANNEL, + JZMidiChannelDialog::OnMidiChannelChange) + + EVT_BUTTON(wxID_HELP, JZMidiChannelDialog::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZMidiChannelDialog::JZMidiChannelDialog(int& MidiChannel, wxWindow* pParent) + : wxDialog(pParent, wxID_ANY, wxString("Set MIDI Channel")), + mMidiChannel(MidiChannel), + mpMidiChannelKnob(0), + mpMidiChannelValue(0) +{ + mpMidiChannelKnob = new JZKnob( + this, + IDC_KB_MIDI_CHANNEL, + 0, + 0, + 16); + mpMidiChannelValue = new wxStaticText(this, wxID_ANY, "00"); + + 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 = new wxFlexGridSizer(1, 3, 4, 2); + + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "MIDI Channel:"), + 0, + wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpMidiChannelValue, + 0, + wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE); + pFlexGridSizer->Add(mpMidiChannelKnob, 0, wxALIGN_CENTER_VERTICAL); + + pTopSizer->Add(pFlexGridSizer, 0, wxALIGN_CENTER); + + 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 JZMidiChannelDialog::TransferDataToWindow() +{ + ostringstream Oss; + + Oss << mMidiChannel; + mpMidiChannelValue->SetLabel(Oss.str().c_str()); + + mpMidiChannelKnob->SetValue(mMidiChannel); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZMidiChannelDialog::TransferDataFromWindow() +{ + mMidiChannel = mpMidiChannelKnob->GetValue(); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZMidiChannelDialog::OnMidiChannelChange(JZKnobEvent& Event) +{ + int Value = Event.GetValue(); + ostringstream Oss; + Oss << Value; + mpMidiChannelValue->SetLabel(Oss.str().c_str()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZMidiChannelDialog::OnHelp(wxCommandEvent& Event) +{ + gpHelpInstance->ShowTopic("Set MIDI Channel"); +} Property changes on: trunk/jazz/src/Dialogs/MidiChannelDialog.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/jazz/src/Dialogs/MidiChannelDialog.h =================================================================== --- trunk/jazz/src/Dialogs/MidiChannelDialog.h (rev 0) +++ trunk/jazz/src/Dialogs/MidiChannelDialog.h 2009-02-17 14:45:54 UTC (rev 715) @@ -0,0 +1,58 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2009 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_MIDICHANNELDIALOG_H +#define JZ_MIDICHANNELDIALOG_H + +#include <wx/dialog.h> + +class JZKnob; +class JZKnobEvent; +class wxStaticText; + +//***************************************************************************** +//***************************************************************************** +class JZMidiChannelDialog : public wxDialog +{ + public: + + JZMidiChannelDialog(int& MidiChannel, wxWindow* pParent); + + private: + + virtual bool TransferDataToWindow(); + + virtual bool TransferDataFromWindow(); + + void OnMidiChannelChange(JZKnobEvent& Event); + + void OnHelp(wxCommandEvent& Event); + + private: + + int& mMidiChannel; + + JZKnob* mpMidiChannelKnob; + wxStaticText* mpMidiChannelValue; + + DECLARE_EVENT_TABLE(); +}; + +#endif // !defined(JZ_MIDICHANNELDIALOG_H) Property changes on: trunk/jazz/src/Dialogs/MidiChannelDialog.h ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/jazz/src/Dialogs/QuantizeDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/QuantizeDialog.cpp (rev 0) +++ trunk/jazz/src/Dialogs/QuantizeDialog.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -0,0 +1,236 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2009 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 "QuantizeDialog.h" + +#include "../Globals.h" +#include "../Help.h" +#include "../Knob.h" +#include "../Resources.h" + +#include <wx/button.h> +#include <wx/checkbox.h> +#include <wx/combobox.h> +#include <wx/sizer.h> +#include <wx/stattext.h> + +#include <sstream> + +using namespace std; + +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZQuantizeDialog, wxDialog) + + EVT_KNOB_CHANGED( + IDC_KB_GROOVE, + JZQuantizeDialog::OnGrooveChange) + + EVT_KNOB_CHANGED( + IDC_KB_DELAY, + JZQuantizeDialog::OnDelayChange) + + EVT_BUTTON(wxID_HELP, JZQuantizeDialog::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZQuantizeDialog::JZQuantizeDialog( + int& QuantizationStep, + bool& NoteStart, + bool& NoteLength, + int& Groove, + int& Delay, + wxWindow* pParent) + : wxDialog(pParent, wxID_ANY, wxString("Length")), + mQuantizationStep(QuantizationStep), + mNoteStart(NoteStart), + mNoteLength(NoteLength), + mGroove(Groove), + mDelay(Delay), + mpStepSizeComboBox(0), + mpNoteStartCheckBox(0), + mpNoteLengthCheckBox(0), + mpGrooveKnob(0), + mpGrooveValue(0), + mpDelayKnob(0), + mpDelayValue(0) +{ + mpStepSizeComboBox = new wxComboBox(this, wxID_ANY); + + for ( + map<int, string>::const_iterator iPair = gQntSteps.begin(); + iPair != gQntSteps.end(); + ++iPair) + { + const string& String = iPair->second; + mpStepSizeComboBox->Append(String.c_str()); + } + + mpNoteStartCheckBox = new wxCheckBox(this, wxID_ANY, "Note Start"); + mpNoteLengthCheckBox = new wxCheckBox(this, wxID_ANY, "Note Length"); + mpGrooveKnob = new JZKnob(this, IDC_KB_GROOVE, 0, -100, 100); + mpGrooveValue = new wxStaticText(this, wxID_ANY, "-000"); + mpDelayKnob = new JZKnob(this, IDC_KB_DELAY, 0, -100, 100); + mpDelayValue = new wxStaticText(this, wxID_ANY, "-000"); + + 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); + + 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(mpStepSizeComboBox, 0, wxALIGN_CENTER | wxALL, 6); + + pTopSizer->Add(mpNoteStartCheckBox, 0, wxALIGN_CENTER | wxALL, 6); + + pTopSizer->Add(mpNoteLengthCheckBox, 0, wxALIGN_CENTER | wxALL, 6); + + wxFlexGridSizer* pFlexGridSizer = new wxFlexGridSizer(2, 3, 4, 2); + + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Groove:"), + 0, + wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpGrooveValue, + 0, + wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE); + pFlexGridSizer->Add(mpGrooveKnob, 0, wxALIGN_CENTER_VERTICAL); + + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Delay:"), + 0, + wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpDelayValue, + 0, + wxALIGN_CENTER_VERTICAL | wxFIXED_MINSIZE); + pFlexGridSizer->Add(mpDelayKnob, 0, wxALIGN_CENTER_VERTICAL); + + pTopSizer->Add(pFlexGridSizer, 0, wxALIGN_CENTER | wxALL, 5); + + pTopSizer->Add(pButtonSizer, 0, wxALIGN_CENTER | wxBOTTOM, 6); + + SetAutoLayout(true); + SetSizer(pTopSizer); + + pTopSizer->SetSizeHints(this); + pTopSizer->Fit(this); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZQuantizeDialog::TransferDataToWindow() +{ + int Selection = 0; + for ( + map<int, string>::const_iterator iPair = gQntSteps.begin(); + iPair != gQntSteps.end(); + ++iPair) + { + const int& Value = iPair->first; + if (Value <= mQuantizationStep) + { + break; + } + ++Selection; + } + mpStepSizeComboBox->SetSelection(Selection); + + mpNoteStartCheckBox->SetValue(mNoteStart); + mpNoteLengthCheckBox->SetValue(mNoteLength); + + ostringstream Oss; + + Oss << mGroove; + mpGrooveValue->SetLabel(Oss.str().c_str()); + mpGrooveKnob->SetValue(mGroove); + + Oss.str(""); + Oss << mDelay; + mpDelayValue->SetLabel(Oss.str().c_str()); + mpDelayKnob->SetValue(mDelay); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZQuantizeDialog::TransferDataFromWindow() +{ + wxString SelectedValue = mpStepSizeComboBox->GetValue(); + string SelectedString = SelectedValue.c_str(); + for ( + map<int, string>::const_iterator iPair = gQntSteps.begin(); + iPair != gQntSteps.end(); + ++iPair) + { + const string& String = iPair->second; + if (SelectedString == String) + { + mQuantizationStep = iPair->first; + break; + } + } + + mNoteStart = mpNoteStartCheckBox->GetValue(); + mNoteLength = mpNoteLengthCheckBox->GetValue(); + mGroove = mpGrooveKnob->GetValue(); + mDelay = mpDelayKnob->GetValue(); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZQuantizeDialog::OnGrooveChange(JZKnobEvent& Event) +{ + int Value = Event.GetValue(); + ostringstream Oss; + Oss << Value; + mpGrooveValue->SetLabel(Oss.str().c_str()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZQuantizeDialog::OnDelayChange(JZKnobEvent& Event) +{ + int Value = Event.GetValue(); + ostringstream Oss; + Oss << Value; + mpDelayValue->SetLabel(Oss.str().c_str()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZQuantizeDialog::OnHelp(wxCommandEvent& Event) +{ + gpHelpInstance->ShowTopic("Quantize"); +} Property changes on: trunk/jazz/src/Dialogs/QuantizeDialog.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/jazz/src/Dialogs/QuantizeDialog.h =================================================================== --- trunk/jazz/src/Dialogs/QuantizeDialog.h (rev 0) +++ trunk/jazz/src/Dialogs/QuantizeDialog.h 2009-02-17 14:45:54 UTC (rev 715) @@ -0,0 +1,77 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2009 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_QUANTIZEDIALOG_H +#define JZ_QUANTIZEDIALOG_H + +#include <wx/dialog.h> + +class JZKnob; +class JZKnobEvent; +class wxComboBox; +class wxCheckBox; +class wxStaticText; + +//***************************************************************************** +//***************************************************************************** +class JZQuantizeDialog : public wxDialog +{ + public: + + JZQuantizeDialog( + int& QuantizationStep, + bool& NoteStart, + bool& NoteLength, + int& Groove, + int& Delay, + wxWindow* pParent); + + private: + + virtual bool TransferDataToWindow(); + + virtual bool TransferDataFromWindow(); + + void OnGrooveChange(JZKnobEvent& Event); + + void OnDelayChange(JZKnobEvent& Event); + + void OnHelp(wxCommandEvent& Event); + + private: + + int& mQuantizationStep; + bool& mNoteStart; + bool& mNoteLength; + int& mGroove; + int& mDelay; + + wxComboBox* mpStepSizeComboBox; + wxCheckBox* mpNoteStartCheckBox; + wxCheckBox* mpNoteLengthCheckBox; + JZKnob* mpGrooveKnob; + wxStaticText* mpGrooveValue; + JZKnob* mpDelayKnob; + wxStaticText* mpDelayValue; + + DECLARE_EVENT_TABLE(); +}; + +#endif // !defined(JZ_QUANTIZEDIALOG_H) Property changes on: trunk/jazz/src/Dialogs/QuantizeDialog.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Dialogs.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -282,54 +282,12 @@ "bool")); } -//***************************************************************************** -// SetChannel -//***************************************************************************** -int tSetChannelDlg::NewChannel = 1; -tSetChannelDlg::tSetChannelDlg(JZFilter *f) -: tPropertyListDlg("Set MIDI Channel") -{ - Filter = f; - Song = f->GetSong(); -} -bool tSetChannelDlg::OnClose() -{ - if (NewChannel) - { - tCmdSetChannel exe(Filter, NewChannel - 1); - exe.Execute(); - } - //tPropertyListDlg::OnClose(); - return false; -} -void tSetChannelDlg::OnHelp() -{ - gpHelpInstance->ShowTopic("Set MIDI Channel"); -} - - -void tSetChannelDlg::AddProperties() -{ - // Add(wxMakeFormShort("new Channel", &NewChannel, wxFORM_DEFAULT, -// new wxList(wxMakeConstraintRange(1.0, 16.0), 0))); -// Add(wxMakeFormNewLine()); - // AssociatePanel(panel); - - sheet->AddProperty(new wxProperty( - "new Channel", - wxPropertyValue(&NewChannel), - "integer", - new wxIntegerListValidator(1, 16))); -} - - - //***************************************************************************** // seqLength //***************************************************************************** @@ -481,77 +439,7 @@ } -//***************************************************************************** -// Quantize -//***************************************************************************** -bool tQuantizeDlg::NoteStart = 1; -bool tQuantizeDlg::NoteLength = 0; -int tQuantizeDlg::QntStep = 16; -int tQuantizeDlg::Delay = 0; -int tQuantizeDlg::Groove = 0; - -//tQuantizeDlg::tQuantizeDlg(JZEventFrame *w, JZFilter *f) -tQuantizeDlg::tQuantizeDlg(JZEventWindow *w, JZFilter *f) - : tPropertyListDlg("Quantize" ) - //, Steps("steps", gQntSteps, &gQntStep) -{ - Filter = f; - Song = f->GetSong(); -} - - - -bool tQuantizeDlg::OnClose() -{ - //Steps.GetValue(); - int step = Song->GetTicksPerQuarter() * 4 / QntStep; - tCmdQuantize qnt(Filter, step, Groove * step / 100, Delay * step / 100); - qnt.NoteStart = NoteStart; - qnt.NoteLength = NoteLength; - qnt.Execute(); - - JZProjectManager::Instance()->UpdateAllViews(); - - //tPropertyListDlg::OnClose(); - return false; -} - -void tQuantizeDlg::OnHelp() -{ -// if (mpEventWindow->NextWin) -// { -// gpHelpInstance->ShowTopic("Quantize"); -// } -// else -// { -// gpHelpInstance->ShowTopic("Pianowin Quantize"); -// } -} - -void tQuantizeDlg::AddProperties() -{ - sheet->AddProperty(new wxProperty( - "Note start", - wxPropertyValue((bool*)&NoteStart), - "bool")); - sheet->AddProperty(new wxProperty( - "Note length", - wxPropertyValue((bool*)&NoteLength), - "bool")); - sheet->AddProperty(new wxProperty( - "Groove", - wxPropertyValue(&Groove), - "int", - new wxRealListValidator(-100, 100))); - sheet->AddProperty(new wxProperty( - "Delay", - wxPropertyValue(&Delay), - "int", - new wxRealListValidator(-100, 100))); -} - - //***************************************************************************** // Event-Dialogue //***************************************************************************** Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Dialogs.h 2009-02-17 14:45:54 UTC (rev 715) @@ -104,22 +104,6 @@ void OnHelp(); }; -// SetChannel -class tSetChannelDlg : public tPropertyListDlg -{ - public: - - static int NewChannel; // 0 - - JZFilter *Filter; - JZSong *Song; - - tSetChannelDlg(JZFilter *f); - void AddProperties(); - bool OnClose(); - void OnHelp(); -}; - // seqLength class tSeqLengthDlg : public tPropertyListDlg { @@ -176,28 +160,6 @@ int* ptr; }; -class tQuantizeDlg : public tPropertyListDlg -{ - public: - - static bool NoteStart; // 1 - static bool NoteLength; // 0 - static int QntStep; // 1/16 - static int Groove; // -x .. +x - static int Delay; // -x .. +x - - JZFilter *Filter; - JZSong *Song; - - long Quantize(long); - - tQuantizeDlg(JZEventWindow* w, JZFilter* pFilter); - void AddProperties(); - //tNamedChoice Steps; - bool OnClose(); - void OnHelp(); -}; - void EventDialog( JZEvent*, JZPianoWindow*, Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/EventWindow.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -25,6 +25,8 @@ #include "Command.h" #include "Dialogs/DeleteDialog.h" #include "Dialogs/LengthDialog.h" +#include "Dialogs/MidiChannelDialog.h" +#include "Dialogs/QuantizeDialog.h" #include "Dialogs/ShiftDialog.h" #include "Dialogs/VelocityDialog.h" #include "Dialogs.h" @@ -161,13 +163,37 @@ { if (AreEventsSelected()) { -// wxDialogBox *panel = new wxDialogBox(this, "Quantize", FALSE ); - tQuantizeDlg* pQuantizeDlg = new tQuantizeDlg(this, mpFilter); - pQuantizeDlg->Create(); + int QuantizationStep = 16; + bool NoteStart = true; + bool NoteLength = false; + int Delay = 0; + int Groove = 0; -// tCmdQuantize QuantizeCommand(mpFilter, SnapClocks(), 0, 0); -// QuantizeCommand.Execute(1); -// JZProjectManager::Instance()->UpdateAllViews(); + JZQuantizeDialog QuantizeDialog( + QuantizationStep, + NoteStart, + NoteLength, + Groove, + Delay, + this); + + if (QuantizeDialog.ShowModal() == wxID_OK) + { + int Step = mpSong->GetTicksPerQuarter() * 4 / QuantizationStep; + + tCmdQuantize QuantizeCommand( + mpFilter, + QuantizationStep, + NoteStart, + NoteLength, + Groove * Step / 100, + Delay * Step / 100); + + QuantizeCommand.Execute(); +// QuantizeCommand.Execute(1); + + JZProjectManager::Instance()->UpdateAllViews(); + } } } @@ -175,8 +201,15 @@ //----------------------------------------------------------------------------- void JZEventWindow::SetChannel() { - tSetChannelDlg * dlg = new tSetChannelDlg(mpFilter); - dlg->Create(); + int NewChannel = 1; + + JZMidiChannelDialog MidiChannelDialog(NewChannel, this); + if (MidiChannelDialog.ShowModal() == wxID_OK) + { + tCmdSetChannel SetMidiChannelCommand(mpFilter, NewChannel - 1); + SetMidiChannelCommand.Execute(); + JZProjectManager::Instance()->UpdateAllViews(); + } } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Globals.cpp =================================================================== --- trunk/jazz/src/Globals.cpp 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Globals.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -51,7 +51,7 @@ vector<pair<string, int> > gScaleNames; -vector<pair<string, int> > gQntSteps; +map<int, string> gQntSteps; vector<pair<string, int> > gSynthesizerTypes; Modified: trunk/jazz/src/Globals.h =================================================================== --- trunk/jazz/src/Globals.h 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Globals.h 2009-02-17 14:45:54 UTC (rev 715) @@ -23,6 +23,7 @@ #ifndef JZ_GLOBALS_H #define JZ_GLOBALS_H +#include <map> #include <vector> #include <string> @@ -55,7 +56,7 @@ extern const int gScaleChromatic; extern const int gScaleSelected; extern std::vector<std::pair<std::string, int> > gScaleNames; -extern std::vector<std::pair<std::string, int> > gQntSteps; +extern std::map<int, std::string> gQntSteps; extern std::vector<std::pair<std::string, int> > gSynthesizerTypes; extern std::vector<std::pair<std::string, int> > gSynthesierTypeFiles; extern JZProject* gpProject; Modified: trunk/jazz/src/Makefile.am =================================================================== --- trunk/jazz/src/Makefile.am 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Makefile.am 2009-02-17 14:45:54 UTC (rev 715) @@ -28,6 +28,8 @@ Dialogs/LengthDialog.cpp \ Dialogs/KeyOnDialog.cpp \ Dialogs/MetronomeSettingsDialog.cpp \ +Dialogs/MidiChannelDialog.cpp \ +Dialogs/QuantizeDialog.cpp \ Dialogs/ShiftDialog.cpp \ Dialogs/SynthesizerSettingsDialog.cpp \ Dialogs/TrackDialog.cpp \ @@ -110,6 +112,8 @@ Dialogs/LengthDialog.cpp \ Dialogs/KeyOnDialog.cpp \ Dialogs/MetronomeSettingsDialog.cpp \ +Dialogs/MidiChannelDialog.cpp \ +Dialogs/QuantizeDialog.cpp \ Dialogs/ShiftDialog.cpp \ Dialogs/SynthesizerSettingsDialog.cpp \ Dialogs/TrackDialog.cpp \ @@ -197,6 +201,8 @@ Dialogs/LengthDialog.h \ Dialogs/KeyOnDialog.h \ Dialogs/MetronomeSettingsDialog.h \ +Dialogs/MidiChannelDialog.h \ +Dialogs/QuantizeDialog.h \ Dialogs/ShiftDialog.h \ Dialogs/SynthesizerSettingsDialog.h \ Dialogs/TrackDialog.h \ Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/PianoWindow.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -2762,8 +2762,8 @@ { if (EventsSelected()) { - tCmdQuantize cmd(mpFilter, SnapClocks(), 0, 0); - cmd.Execute(1); + tCmdQuantize QuantizeCommand(mpFilter, SnapClocks(), true, false, 0, 0); + QuantizeCommand.Execute(1); Refresh(); } } Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Project.cpp 2009-02-17 14:45:54 UTC (rev 715) @@ -115,13 +115,13 @@ if (gQntSteps.empty()) { - gQntSteps.push_back(make_pair("1/8", 8)); - gQntSteps.push_back(make_pair("1/12", 12)); - gQntSteps.push_back(make_pair("1/16", 16)); - gQntSteps.push_back(make_pair("1/24", 24)); - gQntSteps.push_back(make_pair("1/32", 32)); - gQntSteps.push_back(make_pair("1/48", 48)); - gQntSteps.push_back(make_pair("1/96", 96)); + gQntSteps.insert(make_pair(8, "1/8")); + gQntSteps.insert(make_pair(12, "1/12")); + gQntSteps.insert(make_pair(16, "1/16")); + gQntSteps.insert(make_pair(24, "1/24")); + gQntSteps.insert(make_pair(32, "1/32")); + gQntSteps.insert(make_pair(48, "1/48")); + gQntSteps.insert(make_pair(96, "1/96")); } if (gSynthesizerTypes.empty()) Modified: trunk/jazz/src/Resources.h =================================================================== --- trunk/jazz/src/Resources.h 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/src/Resources.h 2009-02-17 14:45:54 UTC (rev 715) @@ -91,11 +91,18 @@ #define IDC_KB_CHANNEL wxID_HIGHEST + 1102 // JZVelocityDialog resource IDs. -#define IDC_KB_VELOCITY_START wxID_HIGHEST + 1201 -#define IDC_KB_VELOCITY_STOP wxID_HIGHEST + 1202 +#define IDC_KB_VELOCITY_START wxID_HIGHEST + 1200 +#define IDC_KB_VELOCITY_STOP wxID_HIGHEST + 1201 // JZLengthDialog resource IDs. -#define IDC_KB_LENGTH_START wxID_HIGHEST + 1301 -#define IDC_KB_LENGTH_STOP wxID_HIGHEST + 1302 +#define IDC_KB_LENGTH_START wxID_HIGHEST + 1210 +#define IDC_KB_LENGTH_STOP wxID_HIGHEST + 1211 +// JZMidiChannelDialog resource IDs. +#define IDC_KB_MIDI_CHANNEL wxID_HIGHEST + 1220 + +// JZQuantizeDialog resource IDs. +#define IDC_KB_GROOVE wxID_HIGHEST + 1230 +#define IDC_KB_DELAY wxID_HIGHEST + 1231 + #endif // !defined(JZ_RESOURCES_H) Modified: trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj =================================================================== --- trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2009-02-17 14:45:54 UTC (rev 715) @@ -875,6 +875,22 @@ > </File> <File + RelativePath="..\src\Dialogs\MidiChannelDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\MidiChannelDialog.h" + > + </File> + <File + RelativePath="..\src\Dialogs\QuantizeDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\QuantizeDialog.h" + > + </File> + <File RelativePath="..\src\Dialogs\ShiftDialog.cpp" > </File> Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj =================================================================== --- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2009-02-17 02:25:11 UTC (rev 714) +++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2009-02-17 14:45:54 UTC (rev 715) @@ -893,6 +893,22 @@ > </File> <File + RelativePath="..\src\Dialogs\MidiChannelDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\MidiChannelDialog.h" + > + </File> + <File + RelativePath="..\src\Dialogs\QuantizeDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\QuantizeDialog.h" + > + </File> + <File RelativePath="..\src\Dialogs\ShiftDialog.cpp" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |