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-03-30 14:55:53
|
Revision: 371 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=371&view=rev Author: pstieber Date: 2008-03-30 07:55:50 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Changed tFilter to JZFilter. Modified Paths: -------------- trunk/jazz/src/Command.cpp trunk/jazz/src/Command.h trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/Filter.cpp trunk/jazz/src/Filter.h trunk/jazz/src/HarmonyBrowserAnalyzer.cpp trunk/jazz/src/HarmonyBrowserAnalyzer.h trunk/jazz/src/PianoWindow.cpp trunk/jazz/src/PianoWindow.h trunk/jazz/src/Project.h trunk/jazz/src/Rhythm.cpp trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Command.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -39,7 +39,7 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tCommand::tCommand(tFilter* pFilter) +tCommand::tCommand(JZFilter* pFilter) : mpFilter(pFilter), mpSong(pFilter->mpSong), mReverse(0) @@ -112,7 +112,7 @@ { public: - tSelectedKeys(tFilter* pFilter); + tSelectedKeys(JZFilter* pFilter); void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); @@ -123,7 +123,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tSelectedKeys::tSelectedKeys(tFilter* pFilter) +tSelectedKeys::tSelectedKeys(JZFilter* pFilter) : tCommand(pFilter) { int i; @@ -150,7 +150,7 @@ // 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, tFilter *f) +void tScale::Init(int ScaleNr, JZFilter *f) { int i; @@ -190,7 +190,7 @@ } -int tScale::Analyze(tFilter *f) +int tScale::Analyze(JZFilter *f) { long keys[12]; for (int i = 0; i < 12; i++) @@ -289,7 +289,7 @@ // tCmdShift // *********************************************************************** -tCmdShift::tCmdShift(tFilter *f, long dclk) +tCmdShift::tCmdShift(JZFilter *f, long dclk) : tCommand(f) { DeltaClock = dclk; @@ -307,7 +307,7 @@ // tCmdErase // ************************************************************************ -tCmdErase::tCmdErase(tFilter *f, int lvsp) +tCmdErase::tCmdErase(JZFilter *f, int lvsp) : tCommand(f) { LeaveSpace = lvsp; @@ -318,7 +318,7 @@ tCommand::Execute(NewUndo); if (!LeaveSpace) { - tFilter f(mpFilter); + JZFilter f(mpFilter); f.FromClock = mpFilter->ToClock; f.ToClock = mpSong->GetLastClock() + 1; long DeltaClock = mpFilter->FromClock - mpFilter->ToClock; @@ -336,7 +336,7 @@ // tCmdQuantize // ************************************************************************ -tCmdQuantize::tCmdQuantize(tFilter *f, long clks, int grov, int dly) +tCmdQuantize::tCmdQuantize(JZFilter *f, long clks, int grov, int dly) : tCommand(f) { QntClocks = clks; @@ -380,7 +380,7 @@ // tCmdTranspose // ************************************************************************ -tCmdTranspose::tCmdTranspose(tFilter *f, int notes, int ScaleNr, int fit) +tCmdTranspose::tCmdTranspose(JZFilter *f, int notes, int ScaleNr, int fit) : tCommand(f) { Scale.Init(ScaleNr, mpFilter); @@ -426,7 +426,7 @@ // tCmdSetChannel // ************************************************************************ -tCmdSetChannel::tCmdSetChannel(tFilter *f, int chan) +tCmdSetChannel::tCmdSetChannel(JZFilter *f, int chan) : tCommand(f) { NewChannel = chan; @@ -449,7 +449,7 @@ // tCmdVelocity // ************************************************************************ -tCmdVelocity::tCmdVelocity(tFilter *f, int from, int to, int m) +tCmdVelocity::tCmdVelocity(JZFilter *f, int from, int to, int m) : tCommand(f) { FromValue = from; @@ -484,7 +484,7 @@ // tCmdLength // ************************************************************************ -tCmdLength::tCmdLength(tFilter *f, int from, int to, int m) +tCmdLength::tCmdLength(JZFilter *f, int from, int to, int m) : tCommand(f) { FromValue = from; @@ -524,7 +524,7 @@ // by factor "scale" from starting point "startClock" // ************************************************************************ -tCmdSeqLength::tCmdSeqLength(tFilter *f, double scale) +tCmdSeqLength::tCmdSeqLength(JZFilter *f, double scale) : tCommand(f) { this->scale=scale; @@ -559,7 +559,7 @@ // to a pitch bend/volume control sequence instead // ************************************************************************ -tCmdConvertToModulation::tCmdConvertToModulation(tFilter *f) +tCmdConvertToModulation::tCmdConvertToModulation(JZFilter *f) : tCommand(f) { } @@ -639,7 +639,7 @@ // JAVE this is a simple midi delay line // ************************************************************************ -tCmdMidiDelay::tCmdMidiDelay(tFilter *f, double scale, long clockDelay, int repeat) +tCmdMidiDelay::tCmdMidiDelay(JZFilter *f, double scale, long clockDelay, int repeat) : tCommand(f) { this->scale=scale; @@ -669,7 +669,7 @@ // tCmdCleanup // ************************************************************************ -tCmdCleanup::tCmdCleanup(tFilter *f, long clks, int so) +tCmdCleanup::tCmdCleanup(JZFilter *f, long clks, int so) : tCommand(f) { lengthLimit = clks; @@ -711,7 +711,7 @@ // tCmdSearchReplace // ************************************************************************ -tCmdSearchReplace::tCmdSearchReplace(tFilter *f, short sf, short st) +tCmdSearchReplace::tCmdSearchReplace(JZFilter *f, short sf, short st) : tCommand(f) { fr = sf; @@ -738,7 +738,7 @@ // ************************************************************************ tCmdCopyToBuffer::tCmdCopyToBuffer( - tFilter* pFilter, + JZFilter* pFilter, tEventArray* pBuffer) : tCommand(pFilter) { @@ -756,7 +756,7 @@ -tCmdCopy::tCmdCopy(tFilter *f, long dt, long dc) +tCmdCopy::tCmdCopy(JZFilter *f, long dt, long dc) : tCommand(f) { DestTrack = dt; @@ -893,7 +893,7 @@ // tCmdExchLeftRight // ************************************************************************ -tCmdExchLeftRight::tCmdExchLeftRight(tFilter *f) +tCmdExchLeftRight::tCmdExchLeftRight(JZFilter *f) : tCommand(f) { } @@ -914,7 +914,7 @@ // tCmdExchUpDown // ************************************************************************ -tCmdExchUpDown::tCmdExchUpDown(tFilter *f) +tCmdExchUpDown::tCmdExchUpDown(JZFilter *f) : tCommand(f) { } @@ -972,7 +972,7 @@ // ************************************************************************ //enum prop { veloc, length, key, rhythm, random, pan, modul, cc1, cc2, pitch, clock }; -tCmdMapper::tCmdMapper(tFilter *f, prop src, prop dst, JZRndArray &arr, int nb, int ad) +tCmdMapper::tCmdMapper(JZFilter *f, prop src, prop dst, JZRndArray &arr, int nb, int ad) : tCommand(f), array(arr) { Modified: trunk/jazz/src/Command.h =================================================================== --- trunk/jazz/src/Command.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Command.h 2008-03-30 14:55:50 UTC (rev 371) @@ -23,7 +23,7 @@ #ifndef JZ_COMMAND_H #define JZ_COMMAND_H -class tFilter; +class JZFilter; class JZEvent; class JZTrack; class JZSong; @@ -35,7 +35,7 @@ class tScale { public: - void Init(int ScaleNr, tFilter *f = 0); + void Init(int ScaleNr, JZFilter *f = 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(tFilter *f); // returns ScaleNr + static int Analyze(JZFilter *f); // returns ScaleNr }; @@ -55,7 +55,7 @@ { public: - tCommand(tFilter* pFilter); + tCommand(JZFilter* pFilter); virtual ~tCommand(); @@ -69,7 +69,7 @@ public: - tFilter* mpFilter; + JZFilter* mpFilter; JZSong* mpSong; int mReverse; }; @@ -79,7 +79,7 @@ { long DeltaClock; public: - tCmdShift(tFilter *f, long DeltaClock); + tCmdShift(JZFilter *f, long DeltaClock); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -88,7 +88,7 @@ { public: int LeaveSpace; - tCmdErase(tFilter *f, int LeaveSpace = 1); + tCmdErase(JZFilter *f, int LeaveSpace = 1); virtual void Execute(int NewUndo = 1); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -97,7 +97,7 @@ { public: int FromValue, ToValue, Mode; - tCmdVelocity(tFilter *f, int From, int To, int Mode); + tCmdVelocity(JZFilter *f, int From, int To, int Mode); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -106,7 +106,7 @@ { public: int FromValue, ToValue, Mode; - tCmdLength(tFilter *f, int From, int To, int Mode); + tCmdLength(JZFilter *f, int From, int To, int Mode); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -116,7 +116,7 @@ public: double scale; long startClock; - tCmdSeqLength(tFilter *f, double scale); + tCmdSeqLength(JZFilter *f, double scale); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -129,7 +129,7 @@ long clockDelay; int repeat; - tCmdMidiDelay(tFilter *f, double scale, long clockDelay, int repeat); + tCmdMidiDelay(JZFilter *f, double scale, long clockDelay, int repeat); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -137,7 +137,7 @@ { public: - tCmdConvertToModulation(tFilter *f); + tCmdConvertToModulation(JZFilter *f); virtual void ExecuteTrack(JZTrack *t); }; @@ -151,7 +151,7 @@ int shortenOverlaps; tKeyOn *prev_note[16][128]; public: - tCmdCleanup(tFilter *f, long limitClocks, int shortenOverlaps); + tCmdCleanup(JZFilter *f, long limitClocks, int shortenOverlaps); virtual void ExecuteTrack(JZTrack *t); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -161,7 +161,7 @@ { short fr, to; public: - tCmdSearchReplace(tFilter *f, short fr, short to); + tCmdSearchReplace(JZFilter *f, short fr, short to); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -175,7 +175,7 @@ int NoteLength; // no int Delay; // zero int Groove; // zero - tCmdQuantize(tFilter *f, long QntClocks, int groove, int delay); + tCmdQuantize(JZFilter *f, long QntClocks, int groove, int delay); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -186,7 +186,7 @@ int Notes; int FitIntoScale; tScale Scale; - tCmdTranspose(tFilter *f, int Notes, int ScaleNr = 0, int FitIntoScale = 0); + tCmdTranspose(JZFilter *f, int Notes, int ScaleNr = 0, int FitIntoScale = 0); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -195,7 +195,7 @@ { public: int NewChannel; // 0 - tCmdSetChannel(tFilter *f, int NewChannel); + tCmdSetChannel(JZFilter *f, int NewChannel); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; @@ -204,7 +204,7 @@ { public: - tCmdCopyToBuffer(tFilter* pFilter, tEventArray *Buffer); + tCmdCopyToBuffer(JZFilter* pFilter, tEventArray *Buffer); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); @@ -226,7 +226,7 @@ int InsertSpace; // no long RepeatClock; // -1L - tCmdCopy(tFilter *f, long DestTrack, long DestClock); + tCmdCopy(JZFilter *f, long DestTrack, long DestClock); virtual void ExecuteTrack(JZTrack *t); }; @@ -235,14 +235,14 @@ class tCmdExchLeftRight : public tCommand { public: - tCmdExchLeftRight(tFilter *f); + tCmdExchLeftRight(JZFilter *f); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); }; class tCmdExchUpDown : public tCommand { public: - tCmdExchUpDown(tFilter *f); + tCmdExchUpDown(JZFilter *f); virtual void ExecuteTrack(JZTrack *t); }; @@ -250,7 +250,7 @@ { public: enum prop { veloc, length, key, rhythm, random, pan, modul, cc1, cc2, pitch, clock }; - tCmdMapper(tFilter *f, prop src, prop dst, JZRndArray &array, int nbars, int add); + tCmdMapper(JZFilter *f, prop src, prop dst, JZRndArray &array, int nbars, int add); ~tCmdMapper(); virtual void ExecuteEvent(JZTrack *t, JZEvent *e); private: Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Dialogs.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -52,7 +52,7 @@ //long tShiftDlg::Steps = 0; -tShiftDlg::tShiftDlg(JZEventFrame *w, tFilter *f, long unit) +tShiftDlg::tShiftDlg(JZEventFrame *w, JZFilter *f, long unit) : tPropertyListDlg( "Shift events left/right" ) { Filter = f; @@ -108,7 +108,7 @@ -tCleanupDlg::tCleanupDlg(JZEventFrame *w, tFilter *f) +tCleanupDlg::tCleanupDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg( "Clean up events" ) { Filter = f; @@ -192,7 +192,7 @@ int tSearchReplaceDlg::frCtrl = 1; int tSearchReplaceDlg::toCtrl = 1; -tSearchReplaceDlg::tSearchReplaceDlg(JZEventFrame *w, tFilter *f) +tSearchReplaceDlg::tSearchReplaceDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Search and replace controller types" ) { Filter = f; @@ -242,7 +242,7 @@ int tTransposeDlg::Scale = gScaleChromatic; bool tTransposeDlg::FitIntoScale = 0; -tTransposeDlg::tTransposeDlg(JZEventFrame *w, tFilter *f) +tTransposeDlg::tTransposeDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Transpose") { EventWin = w; @@ -298,7 +298,7 @@ int tSetChannelDlg::NewChannel = 1; -tSetChannelDlg::tSetChannelDlg(tFilter *f) +tSetChannelDlg::tSetChannelDlg(JZFilter *f) : tPropertyListDlg("Set MIDI Channel") { Filter = f; @@ -349,7 +349,7 @@ int tVelocityDlg::Mode = 0; -tVelocityDlg::tVelocityDlg(tFilter *f) +tVelocityDlg::tVelocityDlg(JZFilter *f) : tPropertyListDlg( "Velocity" ) { Filter = f; @@ -400,7 +400,7 @@ int tLengthDlg::Mode; -tLengthDlg::tLengthDlg(JZEventFrame *w, tFilter *f) +tLengthDlg::tLengthDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Length") { Filter = f; @@ -465,7 +465,7 @@ -tSeqLengthDlg::tSeqLengthDlg(JZEventFrame *w, tFilter *f) +tSeqLengthDlg::tSeqLengthDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("stretch/contract by scale from start of selected sequence" ) { Filter = f; @@ -511,7 +511,7 @@ long tMidiDelayDlg::clockDelay = 10; int tMidiDelayDlg::repeat = 6; -tMidiDelayDlg::tMidiDelayDlg(JZEventFrame *w, tFilter *f) +tMidiDelayDlg::tMidiDelayDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("MIDI delay line" ) { Filter = f; @@ -572,7 +572,7 @@ bool tDeleteDlg::LeaveSpace = 1; -tDeleteDlg::tDeleteDlg(JZEventFrame *w, tFilter *f) +tDeleteDlg::tDeleteDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Delete" ) { Filter = f; @@ -665,7 +665,7 @@ int tQuantizeDlg::Delay = 0; int tQuantizeDlg::Groove = 0; -tQuantizeDlg::tQuantizeDlg(JZEventFrame *w, tFilter *f) +tQuantizeDlg::tQuantizeDlg(JZEventFrame *w, JZFilter *f) : tPropertyListDlg("Quantize" ) //, Steps("steps", gQntSteps, &gQntStep) { Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Dialogs.h 2008-03-30 14:55:50 UTC (rev 371) @@ -26,7 +26,7 @@ #include "PropertyListDialog.h" class JZPianoWindow; -class tFilter; +class JZFilter; class JZSong; class JZEventFrame; class JZTrack; @@ -38,11 +38,11 @@ long Steps; // 0 was static long Unit; - tFilter* Filter; + JZFilter* Filter; JZSong* Song; JZEventFrame* EventWin; - tShiftDlg(JZEventFrame *w, tFilter *f, long Unit); + tShiftDlg(JZEventFrame *w, JZFilter *f, long Unit); void AddProperties(); bool OnClose(); void OnHelp(); @@ -55,11 +55,11 @@ static int lowLimit; // 1/32 static bool shortenOverlaps; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tCleanupDlg(JZEventFrame *w, tFilter *f); + tCleanupDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); //tNamedChoice Steps; bool OnClose(); @@ -75,11 +75,11 @@ /* tNamedChoice frList; */ /* tNamedChoice toList; */ - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tSearchReplaceDlg(JZEventFrame *w, tFilter *f); + tSearchReplaceDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -95,11 +95,11 @@ static int Scale; JZEventFrame *EventWin; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; //tNamedChoice ScaleDlg; - tTransposeDlg(JZEventFrame *w, tFilter *f); + tTransposeDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -112,10 +112,10 @@ static int NewChannel; // 0 - tFilter *Filter; + JZFilter *Filter; JZSong *Song; - tSetChannelDlg(tFilter *f); + tSetChannelDlg(JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -129,10 +129,10 @@ static int FromValue, ToValue, Mode; static char *mode_str; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; - tVelocityDlg(tFilter *f); + tVelocityDlg(JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -146,11 +146,11 @@ static int FromValue, ToValue, Mode; static char *mode_str; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tLengthDlg(JZEventFrame *win, tFilter *f); + tLengthDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -164,11 +164,11 @@ static double scale; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tSeqLengthDlg(JZEventFrame *win, tFilter *f); + tSeqLengthDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -183,11 +183,11 @@ static long clockDelay; static int repeat; - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; - tMidiDelayDlg(JZEventFrame *win, tFilter *f); + tMidiDelayDlg(JZEventFrame *win, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -195,13 +195,13 @@ class tDeleteDlg : public tPropertyListDlg { - tFilter *Filter; + JZFilter *Filter; JZEventFrame *EventWin; public: static bool LeaveSpace; // 1 - tDeleteDlg(JZEventFrame *w, tFilter *f); + tDeleteDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); bool OnClose(); void OnHelp(); @@ -239,13 +239,13 @@ static int Groove; // -x .. +x static int Delay; // -x .. +x - tFilter *Filter; + JZFilter *Filter; JZSong *Song; JZEventFrame *EventWin; long Quantize(long); - tQuantizeDlg(JZEventFrame *w, tFilter *f); + tQuantizeDlg(JZEventFrame *w, JZFilter *f); void AddProperties(); //tNamedChoice Steps; bool OnClose(); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/EventWindow.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -190,7 +190,7 @@ #endif mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID); - mpFilter = new tFilter(Song); + mpFilter = new JZFilter(Song); } Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/EventWindow.h 2008-03-30 14:55:50 UTC (rev 371) @@ -87,7 +87,7 @@ JZSong* Song; - tFilter* mpFilter; + JZFilter* mpFilter; JZPianoFrame* NextWin; Modified: trunk/jazz/src/Filter.cpp =================================================================== --- trunk/jazz/src/Filter.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Filter.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -47,7 +47,7 @@ -tFilter::tFilter(JZSong *s) +JZFilter::JZFilter(JZSong *s) { mpSong = s; FltEvents = new tFltEvent [nFltEvents]; @@ -67,24 +67,24 @@ } -tFilter::tFilter(tFilter *f) +JZFilter::JZFilter(JZFilter *f) { copy (*f); } -tFilter::tFilter(tFilter const &o) { +JZFilter::JZFilter(JZFilter const &o) { copy(o); } -tFilter& tFilter::operator=(tFilter const &o) { +JZFilter& JZFilter::operator=(JZFilter const &o) { delete FltEvents; copy(o); return *this; } -void tFilter::copy(tFilter const &o) +void JZFilter::copy(JZFilter const &o) { mpSong = o.mpSong; FromClock = o.FromClock; @@ -98,7 +98,7 @@ } -tFilter::~tFilter() +JZFilter::~JZFilter() { delete FltEvents; } @@ -112,11 +112,11 @@ class tFilterDlg : public tPropertyListDlg { - tFilter *Filter; + JZFilter *Filter; tClockDlg FromClockDlg, ToClockDlg; public: - tFilterDlg(tFilter *f, JZSong *s, int ShowEventStats); + tFilterDlg(JZFilter *f, JZSong *s, int ShowEventStats); void AddProperties(); bool OnClose(); void OnHelp(); @@ -124,7 +124,7 @@ }; -tFilterDlg::tFilterDlg(tFilter *f, JZSong *Song, int ShowEventStats) +tFilterDlg::tFilterDlg(JZFilter *f, JZSong *Song, int ShowEventStats) : tPropertyListDlg("Filter"), FromClockDlg(Song, "From Time: ", f->FromClock), ToClockDlg(Song, "To Time: ", f->ToClock) @@ -188,7 +188,7 @@ -void tFilter::Dialog(wxFrame *parent, int ShowEventStats) +void JZFilter::Dialog(wxFrame *parent, int ShowEventStats) { tFilterDlg *dlg; // DialogBox = new wxDialogBox(parent, "Event Filter", FALSE ); @@ -208,7 +208,7 @@ -tTrackIterator::tTrackIterator(tFilter *f, int rev) +tTrackIterator::tTrackIterator(JZFilter *f, int rev) { Filter = f; Song = Filter->mpSong; Modified: trunk/jazz/src/Filter.h =================================================================== --- trunk/jazz/src/Filter.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Filter.h 2008-03-30 14:55:50 UTC (rev 371) @@ -53,11 +53,11 @@ -class tFilter : public wxObject +class JZFilter : public wxObject { friend class tFilterDlg; wxDialog *DialogBox; - void copy(tFilter const &o); + void copy(JZFilter const &o); public: @@ -72,11 +72,11 @@ void Dialog(wxFrame *parent, int ShowEventStats = 1); - tFilter(JZSong* pSong); - tFilter(tFilter* pOtherFilter); - tFilter(tFilter const &o); - tFilter& operator=(tFilter const &o); - virtual ~tFilter(); + JZFilter(JZSong* pSong); + JZFilter(JZFilter* pOtherFilter); + JZFilter(JZFilter const &o); + JZFilter& operator=(JZFilter const &o); + virtual ~JZFilter(); int IsSelected(JZEvent *e) { @@ -109,7 +109,7 @@ }; -// extern tFilter *GlobalFilter; +// extern JZFilter *GlobalFilter; // void GlobalFilterDlg(wxButton& but, wxMouseEvent& event); // void GlobalFilterDlgNoStats(wxButton& but, wxMouseEvent& event); @@ -122,12 +122,12 @@ class tTrackIterator { - tFilter *Filter; + JZFilter *Filter; JZSong *Song; int TrackNr; int Reverse; public: - tTrackIterator(tFilter *f, int Reverse = 0); + tTrackIterator(JZFilter *f, int Reverse = 0); JZTrack *First(); JZTrack *Next(); int Count() const; Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -51,7 +51,7 @@ } -void HBAnalyzer::Init(tFilter* pFilter, int epc) +void HBAnalyzer::Init(JZFilter* pFilter, int epc) { Exit(); // cleanup from previous run @@ -104,7 +104,7 @@ } -int HBAnalyzer::Analyze(tFilter* pFilter, int qbc) +int HBAnalyzer::Analyze(JZFilter* pFilter, int qbc) { Init(pFilter, qbc); if (mSteps < max_seq) @@ -116,7 +116,7 @@ return 0; } -int HBAnalyzer::Transpose(tFilter* pFilter, int qbc) +int HBAnalyzer::Transpose(JZFilter* pFilter, int qbc) { pFilter->mpSong->NewUndoBuffer(); Init(pFilter, qbc); Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.h =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.h 2008-03-30 14:55:50 UTC (rev 371) @@ -23,7 +23,7 @@ #ifndef JZ_HARMONYBROWSERANALYZER_H #define JZ_HARMONYBROWSERANALYZER_H -class tFilter; +class JZFilter; class JZTrack; class HBContext; class tKeyOn; @@ -37,11 +37,11 @@ ~HBAnalyzer(); - int Analyze(tFilter *f, int eighth_per_chord = 8); + int Analyze(JZFilter *f, int eighth_per_chord = 8); - int Transpose(tFilter *f, int eighth_per_chord = 8); + int Transpose(JZFilter *f, int eighth_per_chord = 8); - void Init(tFilter *f, int steps_per_bar); + void Init(JZFilter *f, int steps_per_bar); void Exit(); @@ -69,7 +69,7 @@ int start_clock, stop_clock; int eighths_per_chord; int mSteps; - tFilter* mpFilter; + JZFilter* mpFilter; JZTrack* mpTrack; int** count; Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/PianoWindow.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -601,7 +601,7 @@ { InitColors(); - mpFilter = new tFilter(mpSong); + mpFilter = new JZFilter(mpSong); mpTrack = mpSong->GetTrack(mTrackIndex); Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/PianoWindow.h 2008-03-30 14:55:50 UTC (rev 371) @@ -31,7 +31,7 @@ class JZSong; class JZTrack; class JZEvent; -class tFilter; +class JZFilter; class tCtrlEditBase; class tSnapSelection; class JZGuitarFrame; @@ -76,7 +76,7 @@ virtual ~JZPianoWindow(); - tFilter* GetFilter(); + JZFilter* GetFilter(); void CreateGuitarWindow(); @@ -321,7 +321,7 @@ int mTrackIndex; - tFilter* mpFilter; + JZFilter* mpFilter; tCtrlEditBase* mpCtrlEdit; @@ -379,7 +379,7 @@ }; inline -tFilter* JZPianoWindow::GetFilter() +JZFilter* JZPianoWindow::GetFilter() { return mpFilter; } Modified: trunk/jazz/src/Project.h =================================================================== --- trunk/jazz/src/Project.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Project.h 2008-03-30 14:55:50 UTC (rev 371) @@ -25,7 +25,7 @@ class JZPlayer; class JZSynth; -class tFilter; +class JZFilter; #include "Song.h" #include "Metronome.h" @@ -65,7 +65,7 @@ bool mRecord; // Not yet sure what this does - tFilter *Filter; + JZFilter* Filter; // Stores metrome information tMetronomeInfo mMetronomeInfo; Modified: trunk/jazz/src/Rhythm.cpp =================================================================== --- trunk/jazz/src/Rhythm.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/Rhythm.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -1025,7 +1025,7 @@ if (!event_win->EventsSelected("please mark destination track in trackwin")) return; - tFilter* pFilter = event_win->mpFilter; + JZFilter* pFilter = event_win->mpFilter; if (pFilter->FromTrack != pFilter->ToTrack) { Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-30 14:55:50 UTC (rev 371) @@ -117,7 +117,7 @@ mpSnapSel = new tSnapSelection(this); - mpFilter = new tFilter(mpSong); + mpFilter = new JZFilter(mpSong); SetBackgroundColour(*wxWHITE); Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2008-03-30 14:48:11 UTC (rev 370) +++ trunk/jazz/src/TrackWindow.h 2008-03-30 14:55:50 UTC (rev 371) @@ -28,7 +28,7 @@ class JZSong; class JZTrack; -class tFilter; +class JZFilter; class tSnapSelection; class wxFont; @@ -54,7 +54,7 @@ { public: - tFilter* mpFilter; + JZFilter* mpFilter; tSnapSelection* mpSnapSel; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 14:48:14
|
Revision: 370 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=370&view=rev Author: pstieber Date: 2008-03-30 07:48:11 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Set the default ALSA devices to -1 to generate a prompt. 2. Removed the startup song. Modified Paths: -------------- trunk/jazz/conf/jazz.cfg Modified: trunk/jazz/conf/jazz.cfg =================================================================== --- trunk/jazz/conf/jazz.cfg 2008-03-30 14:45:43 UTC (rev 369) +++ trunk/jazz/conf/jazz.cfg 2008-03-30 14:48:11 UTC (rev 370) @@ -1,101 +1,98 @@ -# jazz config-file for General Midi setup - -# when displaying this midichannel (1..16) the Drumnames are displayed -.drumchannel 10 - -# Controls software emulation of midi thru -# If using /dev/music with a true mpu401 card -# set this to 0 to disable software emulated midi thru -# Has no effect with jazz's native mpu401 driver -.softthru 1 - -# controls source of sequencer clock (0 = internal) -.clocksource 0 - -# controls sending of real time info to midi out from sequencer when -# playing, normally off -.realtime_out 0 - -# controls use of GS reverb and chorus macros opposed to individual -# parameter control -.use_reverb_macro 1 -.use_chorus_macro 1 - -# sets controller number for selecting bank (with GS it's 0) -.bank_control_number 0 - -# controls max. number of columns to use in the "Parts" dialogs -.parts_columns_max 4 - -# controls whether to draw tracknames also on right side of "Parts" dialogs -.parts_tracknames_right 0 - -# set to 1 will enable audio support on startup, 0 will disable -.enable_audio 1 - -# Window positions/sizes -.trackwin_xpos 10 -.trackwin_ypos 10 -.trackwin_width 600 -.trackwin_height 400 - -.pianowin_xpos 30 -.pianowin_ypos 30 -.pianowin_width 600 -.pianowin_height 400 - -.enable_welcome 0 - -# ---------------- Linux configuration ----------------------------- - -# which driver to use: -# 0 = jazz's native /dev/mpu401 -# 1 = OSS /dev/music -# 2 = ALSA (experimental) - -.driver 2 - -# OSS-Device no, a value of -1 will pop up a dialog at startup -.device 0 - -# for alsa, these are the indexes of the clients:ports used -# for midi thru -# see /proc/asound/seq/clients for candidates -.thru_input 0 -.thru_output 0 - -# if using jazz's native mpu-401 driver this can be used to control -# hardware midi thru on the interface card -.hardthru 1 - -# External sync with ALSA (from Takashi Iwai <ti...@su...>) -# To activate sync mastering on jazz, one has to set .alsa_sync_output -# to 2 or 3 in config file, for midi clock or MTC, respectively. -# Edit /usr/local/jazz/jazz.cfg manually by text editor. -# Then jazz will ask you the device to sync output. Choose the raw midi -# device to output the sync signals. This can be different from the -# midi output device. - -# The time format can be selected by ".alsa_sync_output_format" in -# config file. It corresponds to SMPTE format (from 0 = 24fps to 3 = 30 -# ndp). The format is ignored, of course, on MIDI clock mode. - -# ---------------- M$-Windows configuration ------------------------ - -# device numbers for windows, -1 will prompt at startup -.win_input_device -1 -.win_output_device -1 - -##################################################################### - -# Synthesizer configuration: -.synth_config gs.jzi -.send_synth_reset 0 -.synth_dialog 0 - -# program generated configuration: - - -.alsa_input_device 1 -.alsa_output_device 2 -.startup_song /home/joakim/music/moogtest.mid +# jazz config-file for General Midi setup + +# when displaying this midichannel (1..16) the Drumnames are displayed +.drumchannel 10 + +# Controls software emulation of midi thru +# If using /dev/music with a true mpu401 card +# set this to 0 to disable software emulated midi thru +# Has no effect with jazz's native mpu401 driver +.softthru 1 + +# controls source of sequencer clock (0 = internal) +.clocksource 0 + +# controls sending of real time info to midi out from sequencer when +# playing, normally off +.realtime_out 0 + +# controls use of GS reverb and chorus macros opposed to individual +# parameter control +.use_reverb_macro 1 +.use_chorus_macro 1 + +# sets controller number for selecting bank (with GS it's 0) +.bank_control_number 0 + +# controls max. number of columns to use in the "Parts" dialogs +.parts_columns_max 4 + +# controls whether to draw tracknames also on right side of "Parts" dialogs +.parts_tracknames_right 0 + +# set to 1 will enable audio support on startup, 0 will disable +.enable_audio 1 + +# Window positions/sizes +.trackwin_xpos 10 +.trackwin_ypos 10 +.trackwin_width 600 +.trackwin_height 400 + +.pianowin_xpos 30 +.pianowin_ypos 30 +.pianowin_width 600 +.pianowin_height 400 + +.enable_welcome 0 + +# ---------------- Linux configuration ----------------------------- + +# which driver to use: +# 0 = jazz's native /dev/mpu401 +# 1 = OSS /dev/music +# 2 = ALSA (experimental) + +.driver 2 + +# OSS-Device no, a value of -1 will pop up a dialog at startup +.device 0 + +# for alsa, these are the indexes of the clients:ports used +# for midi thru +# see /proc/asound/seq/clients for candidates +.thru_input 0 +.thru_output 0 + +# if using jazz's native mpu-401 driver this can be used to control +# hardware midi thru on the interface card +.hardthru 1 + +# External sync with ALSA (from Takashi Iwai <ti...@su...>) +# To activate sync mastering on jazz, one has to set .alsa_sync_output +# to 2 or 3 in config file, for midi clock or MTC, respectively. +# Edit /usr/local/jazz/jazz.cfg manually by text editor. +# Then jazz will ask you the device to sync output. Choose the raw midi +# device to output the sync signals. This can be different from the +# midi output device. + +# The time format can be selected by ".alsa_sync_output_format" in +# config file. It corresponds to SMPTE format (from 0 = 24fps to 3 = 30 +# ndp). The format is ignored, of course, on MIDI clock mode. + +# ---------------- M$-Windows configuration ------------------------ + +# device numbers for windows, -1 will prompt at startup +.win_input_device -1 +.win_output_device -1 + +##################################################################### + +# Synthesizer configuration: +.synth_config gs.jzi +.send_synth_reset 0 +.synth_dialog 0 + +# program generated configuration: +.alsa_input_device -1 +.alsa_output_device -1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 14:45:45
|
Revision: 369 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=369&view=rev Author: pstieber Date: 2008-03-30 07:45:43 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Removed the startup file name from the global variables because it was only used by the project class in one function. Modified Paths: -------------- trunk/jazz/src/Globals.cpp trunk/jazz/src/Globals.h trunk/jazz/src/Project.cpp Modified: trunk/jazz/src/Globals.cpp =================================================================== --- trunk/jazz/src/Globals.cpp 2008-03-30 14:35:30 UTC (rev 368) +++ trunk/jazz/src/Globals.cpp 2008-03-30 14:45:43 UTC (rev 369) @@ -31,8 +31,6 @@ using namespace std; -string gpStartUpSong; - tConfig* gpConfig = 0; JZSong* gpSong = 0; Modified: trunk/jazz/src/Globals.h =================================================================== --- trunk/jazz/src/Globals.h 2008-03-30 14:35:30 UTC (rev 368) +++ trunk/jazz/src/Globals.h 2008-03-30 14:45:43 UTC (rev 369) @@ -46,7 +46,6 @@ }; extern tConfig* gpConfig; -extern std::string gpStartUpSong; extern JZSong* gpSong; extern JZSynth* gpSynth; extern JZPlayer* gpMidiPlayer; Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-03-30 14:35:30 UTC (rev 368) +++ trunk/jazz/src/Project.cpp 2008-03-30 14:45:43 UTC (rev 369) @@ -294,28 +294,25 @@ } } - // Attempt to load the song given on command line or the file specified in // the configuration file. + string StartUpSong; opt = GetOptionIndex( "-f" ) + 1; if (opt && (wxTheApp->argc > opt)) { - gpStartUpSong = wxTheApp->argv[opt]; + StartUpSong = wxTheApp->argv[opt]; } else { - gpStartUpSong = mpConfig->StrValue(C_StartUpSong); + StartUpSong = mpConfig->StrValue(C_StartUpSong); } - FILE* fd = fopen(gpStartUpSong.c_str(), "r"); - if (fd) + + FILE* pFd = fopen(StartUpSong.c_str(), "r"); + if (pFd) { - fclose(fd); + fclose(pFd); JZStandardRead Io; - Read(Io, gpStartUpSong.c_str()); -// if (gpStartUpSong == string("jazz.mid")) -// { -// lasts = gpStartUpSong; -// } + Read(Io, StartUpSong.c_str()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 14:35:34
|
Revision: 368 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=368&view=rev Author: pstieber Date: 2008-03-30 07:35:30 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Renamed the following classes to match the new coding style: tReadBase -> JZReadBase tWriteBase -> JZWriteBase tStdChunk -> JZStandardChunk tStdRead -> JZStandardRead tStdWrite -> JZStandardWrite 2. Added constructors for JZReadBase and JZWriteBase so data members could be initialized. 3. Separated JZReadBase and JZWriteBase inline member function definitions from the declarations. 4. Prefixed JZReadBase and JZWriteBase data members with m to match the new coding style, and made them protected. 5. Added JZReadBase::GetTicksPerQuarter so the mTicksPerQuarter data member could be made protected instead of public. 6. Moved the JZStandardChunk declaration from the header to the source file because no other code uses it. 7. Changed the file name argument of JZStandardWrite::Open from char* to const char* to match the virtual base class version. Prior to this change the base class version was incorrectly called when used in a polymorphic manner. 8. Changed some local variable names to match the new coding style. 9. Made some cosmetic indentation changes. Modified Paths: -------------- trunk/jazz/src/Events.cpp trunk/jazz/src/Events.h trunk/jazz/src/Project.cpp trunk/jazz/src/Song.cpp trunk/jazz/src/Song.h trunk/jazz/src/StandardFile.cpp trunk/jazz/src/StandardFile.h trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h Modified: trunk/jazz/src/Events.cpp =================================================================== --- trunk/jazz/src/Events.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Events.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -41,16 +41,31 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tReadBase::Open(const char* pFileName) +JZReadBase::JZReadBase() + : mTicksPerQuarter(0), + mTrackCount(0), + mpFd(NULL) { +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZReadBase::~JZReadBase() +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZReadBase::Open(const char* pFileName) +{ if (pFileName == NULL) { - fd = stdin; + mpFd = stdin; } else { - fd = fopen(pFileName, "rb"); - if (fd == NULL) + mpFd = fopen(pFileName, "rb"); + if (mpFd == NULL) { ostringstream Oss; Oss << "Error opening file " << pFileName; @@ -63,11 +78,11 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void tReadBase::Close() +void JZReadBase::Close() { - if (fd != stdin) + if (mpFd != stdin) { - fclose(fd); + fclose(mpFd); } } @@ -75,11 +90,27 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int tWriteBase::Open(const char* pFileName, int nTracks, int TicksPerQuarter) +JZWriteBase::JZWriteBase() + : mpFd(NULL) { +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZWriteBase::~JZWriteBase() +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZWriteBase::Open( + const char* pFileName, + int TrackCount, + int TicksPerQuarter) +{ if (pFileName == NULL) { - fd = stdout; + mpFd = stdout; } else { @@ -98,8 +129,8 @@ delete syscmd; } #endif - fd = fopen(pFileName, "wb"); - if (fd == NULL) + mpFd = fopen(pFileName, "wb"); + if (mpFd == NULL) { ostringstream Oss; Oss << "Error opening file " << pFileName; @@ -107,16 +138,16 @@ return 0; } } - return nTracks; + return TrackCount; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void tWriteBase::Close() +void JZWriteBase::Close() { - if (fd != stdout) + if (mpFd != stdout) { - fclose(fd); + fclose(mpFd); } } Modified: trunk/jazz/src/Events.h =================================================================== --- trunk/jazz/src/Events.h 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Events.h 2008-03-30 14:35:30 UTC (rev 368) @@ -33,113 +33,183 @@ // - Ascii-File // - Midi-Port //***************************************************************************** - -class tReadBase +class JZReadBase { public: - virtual ~tReadBase() - { - } + JZReadBase(); - // Ths value is known after a call to Open. - int TicksPerQuarter; + virtual ~JZReadBase(); - int nTracks; - virtual int Open(const char* pFileName); virtual void Close(); + int GetTicksPerQuarter() const; + virtual JZEvent* Read() = 0; virtual int NextTrack() = 0; protected: - FILE* fd; + // Ths value is known after a call to Open. + int mTicksPerQuarter; + + int mTrackCount; + + FILE* mpFd; }; +//***************************************************************************** +// Description: +// These are the read base class inline member functions. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZReadBase::GetTicksPerQuarter() const +{ + return mTicksPerQuarter; +} -class tWriteBase +//***************************************************************************** +//***************************************************************************** +class JZWriteBase { public: - virtual ~tWriteBase() - { - } + JZWriteBase(); - virtual int Open(const char* pFileName, int nTracks, int TicksPerQuarter); + virtual ~JZWriteBase(); + virtual int Open( + const char* pFileName, + int TrackCount, + int TicksPerQuarter); + virtual void Close(); - virtual int Write(JZEvent* pEvent) - { - return Write(pEvent, 0, 0); - } + virtual int Write(JZEvent* pEvent); - virtual int Write(JZEvent* pEvent, unsigned char Character) - { - return Write(pEvent, &Character, 1); - } + virtual int Write(JZEvent* pEvent, unsigned char Character); virtual int Write( JZEvent* pEvent, unsigned char Character1, - unsigned char Character2) - { - unsigned char Array[2]; - Array[0] = Character1; - Array[1] = Character2; - return Write(pEvent, Array, 2); - } + unsigned char Character2); virtual int Write( JZEvent* pEvent, unsigned char Character1, unsigned char Character2, - unsigned char Character3) - { - unsigned char Array[3]; - Array[0] = Character1; - Array[1] = Character2; - Array[2] = Character3; - return Write(pEvent, Array, 3); - } + unsigned char Character3); virtual int Write( JZEvent* pEvent, unsigned char Character1, unsigned char Character2, unsigned char Character3, - unsigned char Character4) - { - unsigned char Array[4]; - Array[0] = Character1; - Array[1] = Character2; - Array[2] = Character3; - Array[3] = Character4; - return Write(pEvent, Array, 4); - } + unsigned char Character4); - virtual int Write(JZEvent* pEvent, unsigned char* pString, int Length) = 0; + virtual int Write( + JZEvent* pEvent, + unsigned char* pString, + int Length) = 0; - virtual void NextTrack() - { - } + virtual void NextTrack(); protected: - FILE* fd; + FILE* mpFd; }; +//***************************************************************************** +// Description: +// These are the write base class inline member functions. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write(JZEvent* pEvent) +{ + return Write(pEvent, 0, 0); +} -// -------------------------------------------------------------------------- -// tGetMidiBytes -// -------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write(JZEvent* pEvent, unsigned char Character) +{ + return Write(pEvent, &Character, 1); +} -class tGetMidiBytes : public tWriteBase +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write( + JZEvent* pEvent, + unsigned char Character1, + unsigned char Character2) { + unsigned char Array[2]; + + Array[0] = Character1; + Array[1] = Character2; + + return Write(pEvent, Array, 2); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write( + JZEvent* pEvent, + unsigned char Character1, + unsigned char Character2, + unsigned char Character3) +{ + unsigned char Array[3]; + + Array[0] = Character1; + Array[1] = Character2; + Array[2] = Character3; + + return Write(pEvent, Array, 3); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZWriteBase::Write( + JZEvent* pEvent, + unsigned char Character1, + unsigned char Character2, + unsigned char Character3, + unsigned char Character4) +{ + unsigned char Array[4]; + + Array[0] = Character1; + Array[1] = Character2; + Array[2] = Character3; + Array[3] = Character4; + + return Write(pEvent, Array, 4); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZWriteBase::NextTrack() +{ +} + +//***************************************************************************** +// tGetMidiBytes +//***************************************************************************** +class tGetMidiBytes : public JZWriteBase +{ public: int Open(const char* pFileName, int nTracks, int TicksPerQuarter) @@ -348,7 +418,7 @@ virtual tEndOfTrack* IsEndOfTrack() { edb(); return 0; } virtual tChnPressure* IsChnPressure() { edb(); return 0; } - virtual int Write(tWriteBase& io) + virtual int Write(JZWriteBase& io) { edb(); return io.Write(this); @@ -470,7 +540,7 @@ OffVeloc = 0; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Key, Veloc); } @@ -500,7 +570,7 @@ OffVeloc = veloc; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Key, OffVeloc); } @@ -528,7 +598,7 @@ Value = val; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { int v = Value + 8192; edb(); return io.Write(this, (unsigned char)(v & 0x7F), (unsigned char)(v >> 7)); @@ -559,7 +629,7 @@ Value = val; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Control, Value); } @@ -584,7 +654,7 @@ Program = prg; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Program); } @@ -621,7 +691,7 @@ delete [] Data; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Data, Length); } @@ -931,7 +1001,7 @@ this->eventlength=eventlength; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { Data = new unsigned char [Length + 1]; @@ -997,7 +1067,7 @@ virtual int GetPitch() { edb(); return GetBPM() / 2; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, (char)(uSec >> 16), (char)(uSec >> 8), (char)uSec); } @@ -1042,7 +1112,7 @@ Quarter = Character4; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Numerator, Denomiator, Clocks, Quarter); } @@ -1068,7 +1138,7 @@ { } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this); } @@ -1092,7 +1162,7 @@ Minor = Character2; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Sharps, Minor); } @@ -1114,7 +1184,7 @@ Key = key; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Key, Value); } @@ -1139,7 +1209,7 @@ Value = val; } - virtual int Write(tWriteBase &io) + virtual int Write(JZWriteBase &io) { edb(); return io.Write(this, Value); } Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Project.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -310,8 +310,8 @@ if (fd) { fclose(fd); - tStdRead io; - Read(io, gpStartUpSong.c_str()); + JZStandardRead Io; + Read(Io, gpStartUpSong.c_str()); // if (gpStartUpSong == string("jazz.mid")) // { // lasts = gpStartUpSong; @@ -505,7 +505,7 @@ //----------------------------------------------------------------------------- void JZProject::OpenSong(const wxString& SongFileName) { - tStdRead Io; + JZStandardRead Io; Clear(); Read(Io, SongFileName); mpConfig->Put(C_StartUpSong, SongFileName.c_str()); @@ -522,7 +522,7 @@ //----------------------------------------------------------------------------- void JZProject::Save(const wxString& SongFileName) { - tStdWrite Io; + JZStandardWrite Io; Write(Io, SongFileName); mpConfig->Put(C_StartUpSong, SongFileName.c_str()); } Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Song.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -61,7 +61,7 @@ return mTracks[0].GetDefaultSpeed(); } -void JZSong::Read(tReadBase& Io, const char* pFileName) +void JZSong::Read(JZReadBase& Io, const char* pFileName) { int i; wxBeginBusyCursor(); @@ -75,7 +75,7 @@ mTracks[i].Read(Io); } Io.Close(); - TicksPerQuarter = Io.TicksPerQuarter; + TicksPerQuarter = Io.GetTicksPerQuarter(); if (TicksPerQuarter < 48) { @@ -97,7 +97,7 @@ } -void JZSong::Write(tWriteBase& Io, const char* pFileName) +void JZSong::Write(JZWriteBase& Io, const char* pFileName) { // Make sure track 0 has a synth reset if (!mTracks[0].Reset) Modified: trunk/jazz/src/Song.h =================================================================== --- trunk/jazz/src/Song.h 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Song.h 2008-03-30 14:35:30 UTC (rev 368) @@ -83,8 +83,8 @@ virtual ~JZSong(); void Clear(); - void Read(tReadBase& Io, const char* pFileName = 0); - void Write(tWriteBase& Io, const char* pFileName = 0); + void Read(JZReadBase& Io, const char* pFileName = 0); + void Write(JZWriteBase& Io, const char* pFileName = 0); JZTrack *GetTrack(int Nr); int GetLastClock(); Modified: trunk/jazz/src/StandardFile.cpp =================================================================== --- trunk/jazz/src/StandardFile.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/StandardFile.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -35,22 +35,24 @@ using namespace std; -// ---------------------------------------------------------------------- -// StdFile-Util -// ---------------------------------------------------------------------- - #ifdef sparc +//***************************************************************************** +//***************************************************************************** static void SwapW(void *p) { } +//***************************************************************************** +//***************************************************************************** static void SwapL(void *p) { } #else +//***************************************************************************** +//***************************************************************************** static void SwapW(void* p) { char *cp = (char *)p; @@ -59,7 +61,8 @@ cp[1] = tmp; } - +//***************************************************************************** +//***************************************************************************** static void SwapL(void* p) { short tmp, *sp = (short *)p; @@ -72,11 +75,50 @@ #endif -// -------------------------------------------------------------- +//***************************************************************************** +//***************************************************************************** +class JZStandardChunk +{ + public: + + JZStandardChunk(); + + ~JZStandardChunk(); + + int IsEof(); // Only after Load, Save never has Eof. + + void Load(FILE* fd); + + void Save(FILE* fd); // Depends on EndOfTrack + + void Put(JZEvent* pEvent, unsigned char* pData, int Length); + + // A return value of NULL indicates we are at the end of the track. + JZEvent* Get(); + + void Rewind(); + + private: + + long Size; // Size of base + long nRead; // Number of bytes read from the file + unsigned char* mpBase; // Buffer for data. + unsigned char* cp; // Aktueller Schreib/Lese pointer + long Clock; // Absolute Clock + int EofSeen; // endoftrack meta-event read + int RunningStatus; + + void Resize(int SizeNeeded); + void PutVar(unsigned long val); + unsigned long GetVar(); +}; + +//***************************************************************************** // StdChunk -// -------------------------------------------------------------- - -tStdChunk::tStdChunk() +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardChunk::JZStandardChunk() : mpBase(0) { Size = 128; @@ -85,12 +127,16 @@ Rewind(); } -tStdChunk::~tStdChunk() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardChunk::~JZStandardChunk() { delete [] mpBase; } -void tStdChunk::Rewind() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::Rewind() { RunningStatus = 0; cp = mpBase; @@ -98,14 +144,17 @@ Clock = 0; } - -inline void tStdChunk::Resize(int Needed) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZStandardChunk::Resize(int Needed) { long Used = cp - mpBase; long i, n = Size; if (Size - Used < Needed) { - do { + do + { Size *= 2; //mpBase = (unsigned char *)realloc(mpBase, Size); } while (Size - Used < Needed); @@ -120,14 +169,17 @@ } } - -inline int tStdChunk::IsEof() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZStandardChunk::IsEof() { return EofSeen || ((cp - mpBase) >= nRead); } - -void tStdChunk::PutVar(unsigned long val) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::PutVar(unsigned long val) { unsigned long buf; buf = val & 0x7f; @@ -148,8 +200,9 @@ } } - -unsigned long tStdChunk::GetVar() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +unsigned long JZStandardChunk::GetVar() { unsigned long val; char c; @@ -163,38 +216,40 @@ return val; } - - -void tStdChunk::Put(JZEvent *e, unsigned char* Data, int Length) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::Put(JZEvent* pEvent, unsigned char* Data, int Length) { unsigned char Stat; long dif; Resize(Length + 20); - dif = e->GetClock() - Clock; + dif = pEvent->GetClock() - Clock; PutVar(dif); Clock += dif; #if 0 -printfxxo("%02X %02X ", e->Clock, dif); -if (e->Stat != 0x90) -{ - int i; - printf("%02X ", e->Stat); - for (i = 0; i < Length; i++) - printf("%02X ", Data[i]); - putchar('\n'); -} + printfxxo("%02X %02X ", pEvent->Clock, dif); + if (pEvent->Stat != 0x90) + { + int i; + printf("%02X ", pEvent->Stat); + for (i = 0; i < Length; i++) + { + printf("%02X ", Data[i]); + } + putchar('\n'); + } #endif - switch (e->Stat) + switch (pEvent->Stat) { // KeyOff -> KeyOn mit Vel=0. Gives better Runningstatus! case StatKeyOff: // SN-- only if KeyOff veloc is zero - if (!e->IsKeyOff()->OffVeloc) + if (!pEvent->IsKeyOff()->OffVeloc) { - Stat = StatKeyOn | e->IsChannelEvent()->Channel; + Stat = StatKeyOn | pEvent->IsChannelEvent()->Channel; if (Stat != RunningStatus) { RunningStatus = Stat; @@ -205,7 +260,7 @@ } else { - Stat = StatKeyOff | e->IsChannelEvent()->Channel; + Stat = StatKeyOff | pEvent->IsChannelEvent()->Channel; if (Stat != RunningStatus) { RunningStatus = Stat; @@ -226,7 +281,7 @@ // SN++ case StatChnPressure: - Stat = e->Stat | e->IsChannelEvent()->Channel; + Stat = pEvent->Stat | pEvent->IsChannelEvent()->Channel; if (Stat != RunningStatus) { RunningStatus = Stat; @@ -268,14 +323,14 @@ if (1) { int i; - printf("%02X ", e->Stat); + printf("%02X ", pEvent->Stat); for (i = 0; i < Length; i++) printf("%02X ", Data[i]); putchar('\n'); } #endif - Stat = e->Stat; + Stat = pEvent->Stat; RunningStatus = 0; *cp++ = 0xff; *cp++ = Stat; @@ -288,15 +343,14 @@ } } - - - -JZEvent* tStdChunk::Get() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZEvent* JZStandardChunk::Get() { int len; unsigned char Stat; unsigned char Channel; - JZEvent *e = 0; + JZEvent* pEvent = 0; while (!IsEof()) { @@ -307,10 +361,10 @@ case StatSysEx: // Sysex ++ cp; len = GetVar(); - e = new tSysEx(Clock, cp, len); + pEvent = new tSysEx(Clock, cp, len); cp += len; //RunningStatus = 0; - return e; + return pEvent; case 0xff: // Meta-Event ++cp; @@ -327,75 +381,75 @@ { case StatText: // Text-Event len = GetVar(); - e = new tText(Clock, cp, len); + pEvent = new tText(Clock, cp, len); cp += len; - return e; + return pEvent; case StatTrackName: // Track-Name len = GetVar(); - e = new tTrackName(Clock, cp, len); + pEvent = new tTrackName(Clock, cp, len); cp += len; - return e; + return pEvent; case StatPlayTrack: // JAVE playtrack event len = GetVar(); fprintf(stderr, "reading playtrack event\n"); - e = new tPlayTrack(Clock, cp, len); + pEvent = new tPlayTrack(Clock, cp, len); cp += len; - return e; + return pEvent; case StatJazzMeta: // Jazz Meta Event len = GetVar(); if (memcmp(cp, "JAZ2", 4) == 0) - e = new tJazzMeta(Clock, cp, len); + pEvent = new tJazzMeta(Clock, cp, len); else - e = new tMetaEvent(Clock, Stat, cp, len); + pEvent = new tMetaEvent(Clock, Stat, cp, len); cp += len; - return e; + return pEvent; case StatCopyright: // Copyright notice len = GetVar(); - e = new tCopyright(Clock, cp, len); + pEvent = new tCopyright(Clock, cp, len); cp += len; - return e; + return pEvent; case StatMarker: len = GetVar(); - e = new tMarker(Clock, cp, len); + pEvent = new tMarker(Clock, cp, len); cp += len; - return e; + return pEvent; case StatEndOfTrack: EofSeen = 1; cp += GetVar(); - e = new tEndOfTrack(Clock); //JAVE return an explicit event rather than 0 - return e; + pEvent = new tEndOfTrack(Clock); //JAVE return an explicit event rather than 0 + return pEvent; //return 0; // EOF case StatSetTempo: len = GetVar(); - e = new tSetTempo(Clock, cp[0], cp[1], cp[2]); + pEvent = new tSetTempo(Clock, cp[0], cp[1], cp[2]); cp += len; - return e; + return pEvent; case StatTimeSignat: len = GetVar(); - e = new tTimeSignat(Clock, cp[0], cp[1], cp[2], cp[3]); + pEvent = new tTimeSignat(Clock, cp[0], cp[1], cp[2], cp[3]); cp += len; - return e; + return pEvent; case StatMtcOffset: // MtcOffset len = GetVar(); - e = new tMtcOffset(Clock, cp, len); + pEvent = new tMtcOffset(Clock, cp, len); cp += len; RunningStatus = 0; - return e; + return pEvent; default: // Text und andere ignorieren len = GetVar(); - e = new tMetaEvent(Clock, Stat, cp, len); + pEvent = new tMetaEvent(Clock, Stat, cp, len); cp += len; - return e; + return pEvent; } break; @@ -409,43 +463,43 @@ switch(Stat) { case StatKeyOff: // SN++ added off veloc - e = new tKeyOff(Clock, Channel, cp[0],cp[1]); + pEvent = new tKeyOff(Clock, Channel, cp[0],cp[1]); cp += 2; - return e; + return pEvent; case StatKeyOn: if (cp[1]) - e = new tKeyOn(Clock, Channel, cp[0], cp[1]); + pEvent = new tKeyOn(Clock, Channel, cp[0], cp[1]); else - e = new tKeyOff(Clock, Channel, cp[0]); + pEvent = new tKeyOff(Clock, Channel, cp[0]); cp += 2; - return e; + return pEvent; case StatKeyPressure: // SN++ Aftertouch - e = new tKeyPressure(Clock, Channel, cp[0], cp[1]); + pEvent = new tKeyPressure(Clock, Channel, cp[0], cp[1]); cp += 2; - return e; + return pEvent; case StatControl: - e = new tControl(Clock, Channel, cp[0], cp[1]); + pEvent = new tControl(Clock, Channel, cp[0], cp[1]); cp += 2; - return e; + return pEvent; case StatPitch: - e = new tPitch(Clock, Channel, cp[0], cp[1]); + pEvent = new tPitch(Clock, Channel, cp[0], cp[1]); cp += 2; - return e; + return pEvent; case StatProgram: - e = new tProgram(Clock, Channel, cp[0]); + pEvent = new tProgram(Clock, Channel, cp[0]); cp += 1; - return e; + return pEvent; case StatChnPressure: - e = new tChnPressure(Clock, Channel, cp[0]); + pEvent = new tChnPressure(Clock, Channel, cp[0]); cp += 1; - return e; + return pEvent; default: { @@ -460,25 +514,24 @@ return 0; // eof } - -// ------------------------------------------------------------------- - - -void tStdChunk::Load(FILE *fd) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::Load(FILE* pFd) { char Type[4]; int Size; - fread(Type, 4, 1, fd); - fread(&Size, 4, 1, fd); + fread(Type, 4, 1, pFd); + fread(&Size, 4, 1, pFd); SwapL(&Size); Resize(Size); - fread(mpBase, Size, 1, fd); + fread(mpBase, Size, 1, pFd); nRead = Size; } - -void tStdChunk::Save(FILE *fd) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardChunk::Save(FILE* pFd) { int Size, hSize; @@ -487,54 +540,63 @@ *cp++ = 0xff; *cp++ = 0x2f; *cp++ = 0x00; - fwrite("MTrk", 4, 1, fd); + fwrite("MTrk", 4, 1, pFd); Size = hSize = cp - mpBase; SwapL(&hSize); - fwrite(&hSize, 4, 1, fd); - fwrite(mpBase, Size, 1, fd); + fwrite(&hSize, 4, 1, pFd); + fwrite(mpBase, Size, 1, pFd); } -// ---------------------------------------------------------------------- - -struct tFileHeader +//***************************************************************************** +//***************************************************************************** +struct JZFileHeader { short Format; - short nTracks; + short mTrackCount; short Unit; void Swap(); }; -void tFileHeader::Swap() +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFileHeader::Swap() { SwapW(&Format); - SwapW(&nTracks); + SwapW(&mTrackCount); SwapW(&Unit); } -// ---------------------------- ReadStd ----------------------------- - - -tStdRead::tStdRead() - : tReadBase(), +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardRead::JZStandardRead() + : JZReadBase(), mpTracks(0), - TrackNr(0) + mTrackIndex(0) { } -tStdRead::~tStdRead() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardRead::~JZStandardRead() { delete [] mpTracks; } -int tStdRead::Open(const char* pFileName) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZStandardRead::Open(const char* pFileName) { - tFileHeader h; + JZFileHeader FileHeader; int hSize; int i; char Type[4]; - if (!tReadBase::Open(pFileName)) + if (!JZReadBase::Open(pFileName)) { ostringstream Oss; Oss << "Can't open " << pFileName; @@ -542,7 +604,7 @@ return 0; } - fread(Type, 4, 1, fd); + fread(Type, 4, 1, mpFd); if (strncmp("MThd", Type, 4) != 0) { @@ -550,105 +612,126 @@ return 0; } - fread(&hSize, 4, 1, fd); + fread(&hSize, 4, 1, mpFd); SwapL(&hSize); - assert (hSize == sizeof(h)); + assert (hSize == sizeof(FileHeader)); - fread(&h, 6, 1, fd); - h.Swap(); - nTracks = h.nTracks; - TicksPerQuarter = h.Unit; + fread(&FileHeader, 6, 1, mpFd); + FileHeader.Swap(); + mTrackCount = FileHeader.mTrackCount; + mTicksPerQuarter = FileHeader.Unit; - mpTracks = new tStdChunk [nTracks]; - for (i = 0; i < nTracks; i++) + mpTracks = new JZStandardChunk [mTrackCount]; + for (i = 0; i < mTrackCount; i++) { - mpTracks[i].Load(fd); + mpTracks[i].Load(mpFd); } - TrackNr = -1; + mTrackIndex = -1; - return nTracks; + return mTrackCount; } -void tStdRead::Close() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardRead::Close() { - tReadBase::Close(); + JZReadBase::Close(); } -JZEvent *tStdRead::Read() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZEvent* JZStandardRead::Read() { - assert(TrackNr >= 0 && TrackNr < nTracks); - return mpTracks[TrackNr].Get(); + assert(mTrackIndex >= 0 && mTrackIndex < mTrackCount); + return mpTracks[mTrackIndex].Get(); } -int tStdRead::NextTrack() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZStandardRead::NextTrack() { - ++TrackNr; - return TrackNr < nTracks; + ++mTrackIndex; + return mTrackIndex < mTrackCount; } - -// ------------------------------ tWriteStd --------------------------------- - -tStdWrite::tStdWrite() - : tWriteBase(), +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardWrite::JZStandardWrite() + : JZWriteBase(), mpTracks(0), - TrackNr(0), - nTracks(0), - TicksPerQuarter(0) + mTrackIndex(0), + mTrackCount(0), + mTicksPerQuarter(0) { } -tStdWrite::~tStdWrite() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZStandardWrite::~JZStandardWrite() { delete [] mpTracks; } -int tStdWrite::Open(char* pFileName, int ntracks, int timebase) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZStandardWrite::Open( + const char* pFileName, + int TrackCount, + int TicksPerQuarter) { - if (!tWriteBase::Open(pFileName, ntracks, timebase)) + if (!JZWriteBase::Open(pFileName, TrackCount, TicksPerQuarter)) { return 0; } - nTracks = ntracks; - TicksPerQuarter = timebase; - mpTracks = new tStdChunk [ntracks]; - TrackNr = -1; - return nTracks; + + mTrackCount = TrackCount; + mTicksPerQuarter = TicksPerQuarter; + mpTracks = new JZStandardChunk [TrackCount]; + mTrackIndex = -1; + return mTrackCount; } -void tStdWrite::Close() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardWrite::Close() { long Size; - tFileHeader h; + JZFileHeader FileHeader; int i; - fwrite("MThd", 4, 1, fd); + fwrite("MThd", 4, 1, mpFd); Size = 6; SwapL(&Size); - fwrite(&Size, 4, 1, fd); - h.Unit = TicksPerQuarter; - h.Format = 1; - h.nTracks = nTracks; - h.Swap(); - fwrite(&h, 6, 1, fd); + fwrite(&Size, 4, 1, mpFd); + FileHeader.Unit = mTicksPerQuarter; + FileHeader.Format = 1; + FileHeader.mTrackCount = mTrackCount; + FileHeader.Swap(); + fwrite(&FileHeader, 6, 1, mpFd); - for (i = 0; i < nTracks; i++) + for (i = 0; i < mTrackCount; i++) { - mpTracks[i].Save(fd); + mpTracks[i].Save(mpFd); } - tWriteBase::Close(); + JZWriteBase::Close(); } -void tStdWrite::NextTrack() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZStandardWrite::NextTrack() { - ++TrackNr; + ++mTrackIndex; } -int tStdWrite::Write(JZEvent *e, unsigned char* data, int len) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZStandardWrite::Write(JZEvent* pEvent, unsigned char* pString, int Length) { - assert(TrackNr >= 0 && TrackNr < nTracks); - mpTracks[TrackNr].Put(e, data, len); + assert(mTrackIndex >= 0 && mTrackIndex < mTrackCount); + mpTracks[mTrackIndex].Put(pEvent, pString, Length); return 0; } Modified: trunk/jazz/src/StandardFile.h =================================================================== --- trunk/jazz/src/StandardFile.h 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/StandardFile.h 2008-03-30 14:35:30 UTC (rev 368) @@ -28,84 +28,63 @@ #include <stdio.h> class JZEvent; -class tStdChunk +class JZStandardChunk; + +//***************************************************************************** +//***************************************************************************** +class JZStandardRead : public JZReadBase { public: - tStdChunk(); + JZStandardRead(); - ~tStdChunk(); + virtual ~JZStandardRead(); - int IsEof(); // Only after Load, Save never has Eof. + virtual int Open(const char* pFileName); - void Load(FILE* fd); + virtual void Close(); - void Save(FILE* fd); // Depends on EndOfTrack + virtual JZEvent* Read(); - void Put(JZEvent* pEvent, unsigned char* pData, int Length); + virtual int NextTrack(); - // A return value of NULL indicates we are at the end of the track. - JZEvent* Get(); - - void Rewind(); - private: - long Size; // Size of base - long nRead; // Number of bytes read from the file - unsigned char* mpBase; // Buffer for data. - unsigned char* cp; // Aktueller Schreib/Lese pointer - long Clock; // Absolute Clock - int EofSeen; // endoftrack meta-event read - int RunningStatus; + JZStandardChunk* mpTracks; - void Resize(int SizeNeeded); - void PutVar(unsigned long val); - unsigned long GetVar(); + int mTrackIndex; }; - -class tStdRead : public tReadBase +//***************************************************************************** +//***************************************************************************** +class JZStandardWrite : public JZWriteBase { public: - tStdRead(); + JZStandardWrite(); - virtual ~tStdRead(); + virtual ~JZStandardWrite(); - virtual int Open(const char* pFileName); + virtual int Open( + const char* pFileName, + int TrackCount, + int TicksPerQuarter); + virtual void Close(); - virtual JZEvent* Read(); - virtual int NextTrack(); + virtual int Write(JZEvent* Event, unsigned char* pString, int Length); + virtual void NextTrack(); + private: - tStdChunk* mpTracks; - int TrackNr; -}; + JZStandardChunk* mpTracks; + int mTrackIndex; + int mTrackCount; -class tStdWrite : public tWriteBase -{ - public: - - tStdWrite(); - - virtual ~tStdWrite(); - - virtual int Open(char* pFileName, int nTracks, int TicksPerQuarter); - virtual void Close(); - virtual int Write(JZEvent* Event, unsigned char *s, int len); - virtual void NextTrack(); - - private: - - tStdChunk* mpTracks; - int TrackNr; - int nTracks; - int TicksPerQuarter; + int mTicksPerQuarter; }; #endif // !defined(JZ_STANDARDFILE_H) Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Track.cpp 2008-03-30 14:35:30 UTC (rev 368) @@ -35,9 +35,9 @@ #include <cstdlib> #include <assert.h> -int tParam::Write(tWriteBase& io) +int tParam::Write(JZWriteBase& Io) { - return(Msb.Write(io) + Lsb.Write(io) + DataMsb.Write(io)); + return Msb.Write(Io) + Lsb.Write(Io) + DataMsb.Write(Io); } void tParam::SetCha(unsigned char cha) @@ -1271,69 +1271,69 @@ #endif -void tEventArray::Write(tWriteBase &io) +void tEventArray::Write(JZWriteBase& Io) { JZEvent *e; int WrittenBefore; Length2Keyoff(); - io.NextTrack(); + Io.NextTrack(); // Write copyright notice first (according to spec): if (Copyright) { - Copyright->Write(io); + Copyright->Write(Io); } // Write MTC offset before any transmittable events (spec) if (MtcOffset) { - MtcOffset->Write(io); + MtcOffset->Write(Io); } // Synth reset if (Reset) { - Reset->Write(io); + Reset->Write(Io); } // Rpn / Nrpn: // All these must be written in order (three tControl's in a row) if (VibRate) { - VibRate->Write(io); + VibRate->Write(Io); } if (VibDepth) { - VibDepth->Write(io); + VibDepth->Write(Io); } if (VibDelay) { - VibDelay->Write(io); + VibDelay->Write(Io); } if (Cutoff) { - Cutoff->Write(io); + Cutoff->Write(Io); } if (Resonance) { - Resonance->Write(io); + Resonance->Write(Io); } if (EnvAttack) { - EnvAttack->Write(io); + EnvAttack->Write(Io); } if (EnvDecay) { - EnvDecay->Write(io); + EnvDecay->Write(Io); } if (EnvRelease) { - EnvRelease->Write(io); + EnvRelease->Write(Io); } if (BendPitchSens) { - BendPitchSens->Write(io); + BendPitchSens->Write(Io); } tDrumInstrumentParameter *dpar = DrumParams.FirstElem(); @@ -1344,7 +1344,7 @@ { if (dpar->Get(index)) { - dpar->Get(index)->Write(io); + dpar->Get(index)->Write(Io); } } dpar = DrumParams.NextElem(dpar); @@ -1353,17 +1353,17 @@ // mpBank: Must be sure bank is written before program: if (mpBank) { - mpBank->Write(io); + mpBank->Write(Io); } if (mpBank2) { - mpBank2->Write(io); + mpBank2->Write(Io); } if (mPatch) { - mPatch->Write(io); + mPatch->Write(Io); } // write jazz track info @@ -1372,7 +1372,7 @@ jazz->SetTrackState(State); jazz->SetTrackDevice(Device); jazz->SetIntroLength(gpSong->GetIntroLength()); - jazz->Write(io); + jazz->Write(Io); for (int i = 0; i < nEvents; i++) { @@ -1416,15 +1416,13 @@ } if (!WrittenBefore) { - e->Write(io); + e->Write(Io); } } Keyoff2Length(); } - - -void tEventArray::Read(tReadBase &io) +void tEventArray::Read(JZReadBase& Io) { JZEvent *e; Channel = 0; @@ -1436,8 +1434,8 @@ bool NeedToDelete; - io.NextTrack(); - while ((e = io.Read()) != 0) + Io.NextTrack(); + while ((e = Io.Read()) != 0) { NeedToDelete = false; SpecialEvent = 0; Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2008-03-30 13:41:19 UTC (rev 367) +++ trunk/jazz/src/Track.h 2008-03-30 14:35:30 UTC (rev 368) @@ -68,7 +68,7 @@ { } - virtual int Write(tWriteBase &io); + virtual int Write(JZWriteBase& Io); virtual void SetCha( unsigned char cha ); virtual int GetVal() { @@ -375,8 +375,8 @@ tEventArray(); virtual ~tEventArray(); - void Read(tReadBase &io); - void Write(tWriteBase &io); + void Read(JZReadBase& Io); + void Write(JZWriteBase& Io); int GetLastClock(); int IsEmpty(); @@ -386,9 +386,16 @@ public: - int GetAudioMode() const { return audio_mode; } - void SetAudioMode(int x) { audio_mode = x; } + int GetAudioMode() const + { + return audio_mode; + } + void SetAudioMode(int x) + { + audio_mode = x; + } + protected: int audio_mode; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 13:41:22
|
Revision: 367 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=367&view=rev Author: pstieber Date: 2008-03-30 06:41:19 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Added code to implement Save As... Modified Paths: -------------- trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-03-30 12:45:05 UTC (rev 366) +++ trunk/jazz/src/TrackFrame.cpp 2008-03-30 13:41:19 UTC (rev 367) @@ -72,6 +72,8 @@ EVT_MENU(wxID_OPEN, JZTrackFrame::OnFileOpen) + EVT_MENU(wxID_SAVEAS, JZTrackFrame::OnFileSaveAs) + EVT_MENU(wxID_EXIT, JZTrackFrame::OnFileExit) EVT_MENU(ID_PLAY, JZTrackFrame::OnPlay) @@ -452,6 +454,27 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackFrame::OnFileSaveAs(wxCommandEvent& Event) +{ + // wxFD_OVERWRITE_PROMPT - For save dialog only: prompt for a confirmation + // if a file will be overwritten. + wxFileDialog SaveAsDialog( + 0, + "Save MIDI File", + "", + "", + "*.mid", + wxFD_SAVE | wxFD_OVERWRITE_PROMPT); + if (SaveAsDialog.ShowModal() == wxID_OK) + { + wxString FileName = SaveAsDialog.GetPath(); + gpProject->Save(FileName); + SetTitle(FileName); + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackFrame::OnFileExit(wxCommandEvent& Event) { if (OnClose() == false) Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2008-03-30 12:45:05 UTC (rev 366) +++ trunk/jazz/src/TrackFrame.h 2008-03-30 13:41:19 UTC (rev 367) @@ -70,6 +70,8 @@ void OnFileOpen(wxCommandEvent& Event); + void OnFileSaveAs(wxCommandEvent& Event); + void OnFileExit(wxCommandEvent& Event); void OnZoomIn(wxCommandEvent& Event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 12:45:11
|
Revision: 366 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=366&view=rev Author: pstieber Date: 2008-03-30 05:45:05 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Added some function comment headers. 2. Changed the Save argument from wxString to const wxString& to prevent the creation of a copy. 3. Recorded the song file name passed to Save as the startup song in the configuration file. Modified Paths: -------------- trunk/jazz/src/Project.cpp trunk/jazz/src/Project.h Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-03-30 12:42:46 UTC (rev 365) +++ trunk/jazz/src/Project.cpp 2008-03-30 12:45:05 UTC (rev 366) @@ -497,26 +497,34 @@ //----------------------------------------------------------------------------- // Description: -// Open a midi file. Pass it a wxString containing the path to the file. +// Open a MIDI file. +// +// Inputs: +// const wxString& SongFileName: +// Song path and file name. //----------------------------------------------------------------------------- void JZProject::OpenSong(const wxString& SongFileName) { - tStdRead io; + tStdRead Io; Clear(); - Read(io, SongFileName); + Read(Io, SongFileName); mpConfig->Put(C_StartUpSong, SongFileName.c_str()); } -/** - * - * Save a midi file. Pass it a wxString containing the path to the file. - * Save will overwrite the file if it is already there! - * - */ -void JZProject::Save(wxString newsong) +//----------------------------------------------------------------------------- +// Description: +// Save a MIDI file. This function will overwrite the file if it already +// exists! +// +// Inputs: +// const wxString& SongFileName: +// Song path and file name. +//----------------------------------------------------------------------------- +void JZProject::Save(const wxString& SongFileName) { - tStdWrite io; - Write(io, newsong); + tStdWrite Io; + Write(Io, SongFileName); + mpConfig->Put(C_StartUpSong, SongFileName.c_str()); } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/Project.h =================================================================== --- trunk/jazz/src/Project.h 2008-03-30 12:42:46 UTC (rev 365) +++ trunk/jazz/src/Project.h 2008-03-30 12:45:05 UTC (rev 366) @@ -95,11 +95,22 @@ // Set the pattern file name. void SetPattern(const wxString& PatternFileName); - // Open the Song + // Description: + // Open a MIDI file. + // + // Inputs: + // const wxString& SongFileName: + // Song path and file name. void OpenSong(const wxString& SongFileName); - // Save the song - void Save(wxString newsong); + // Description: + // Save a MIDI file. This function will overwrite the file if it + // already exists! + // + // Inputs: + // const wxString& SongFileName: + // Song path and file name. + void Save(const wxString& SongFileName); // Here is the new play interface. For now it just acts as a layer // between the Project and the GUI. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 12:42:48
|
Revision: 365 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=365&view=rev Author: pstieber Date: 2008-03-30 05:42:46 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Made cosmetic style changes. Modified Paths: -------------- trunk/jazz/src/Song.cpp trunk/jazz/src/Song.h Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2008-03-30 12:21:10 UTC (rev 364) +++ trunk/jazz/src/Song.cpp 2008-03-30 12:42:46 UTC (rev 365) @@ -61,7 +61,7 @@ return mTracks[0].GetDefaultSpeed(); } -void JZSong::Read(tReadBase &io, const char *fname) +void JZSong::Read(tReadBase& Io, const char* pFileName) { int i; wxBeginBusyCursor(); @@ -69,13 +69,13 @@ { mTracks[i].Clear(); } - int n = io.Open(fname); + int n = Io.Open(pFileName); for (i = 0; i < n && i < eMaxTrackCount; ++i) { - mTracks[i].Read(io); + mTracks[i].Read(Io); } - io.Close(); - TicksPerQuarter = io.TicksPerQuarter; + Io.Close(); + TicksPerQuarter = Io.TicksPerQuarter; if (TicksPerQuarter < 48) { @@ -97,7 +97,7 @@ } -void JZSong::Write(tWriteBase &io, const char *fname) +void JZSong::Write(tWriteBase& Io, const char* pFileName) { // Make sure track 0 has a synth reset if (!mTracks[0].Reset) @@ -106,7 +106,7 @@ } int n = NumUsedTracks(); - if (!io.Open(fname, n, TicksPerQuarter)) + if (!Io.Open(pFileName, n, TicksPerQuarter)) { return; } @@ -114,9 +114,9 @@ wxBeginBusyCursor(); for (int i = 0; i < n; ++i) { - mTracks[i].Write(io); + mTracks[i].Write(Io); } - io.Close(); + Io.Close(); wxEndBusyCursor(); } Modified: trunk/jazz/src/Song.h =================================================================== --- trunk/jazz/src/Song.h 2008-03-30 12:21:10 UTC (rev 364) +++ trunk/jazz/src/Song.h 2008-03-30 12:42:46 UTC (rev 365) @@ -83,8 +83,8 @@ virtual ~JZSong(); void Clear(); - void Read(tReadBase &io, const char *fname = 0); - void Write(tWriteBase &io, const char *fname = 0); + void Read(tReadBase& Io, const char* pFileName = 0); + void Write(tWriteBase& Io, const char* pFileName = 0); JZTrack *GetTrack(int Nr); int GetLastClock(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 12:21:13
|
Revision: 364 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=364&view=rev Author: pstieber Date: 2008-03-30 05:21:10 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Fixed some comments. 2. Made cosmetic changes. 3. Added code to set the startup song in OpenSong. Modified Paths: -------------- trunk/jazz/src/Project.cpp Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-03-30 12:07:02 UTC (rev 363) +++ trunk/jazz/src/Project.cpp 2008-03-30 12:21:10 UTC (rev 364) @@ -295,8 +295,8 @@ } - // Attempt to load the song given on commandline or load "jazz.mid". - cout << "load song" << endl; + // Attempt to load the song given on command line or the file specified in + // the configuration file. opt = GetOptionIndex( "-f" ) + 1; if (opt && (wxTheApp->argc > opt)) { @@ -306,7 +306,7 @@ { gpStartUpSong = mpConfig->StrValue(C_StartUpSong); } - FILE *fd = fopen(gpStartUpSong.c_str(), "r"); + FILE* fd = fopen(gpStartUpSong.c_str(), "r"); if (fd) { fclose(fd); @@ -317,11 +317,6 @@ // lasts = gpStartUpSong; // } } - - - - - } //----------------------------------------------------------------------------- @@ -500,16 +495,16 @@ mPatternFileName = PatternFileName; } -/** - * - * Open a midi file. Pass it a wxString containing the path to the file. - * - */ +//----------------------------------------------------------------------------- +// Description: +// Open a midi file. Pass it a wxString containing the path to the file. +//----------------------------------------------------------------------------- void JZProject::OpenSong(const wxString& SongFileName) { tStdRead io; Clear(); Read(io, SongFileName); + mpConfig->Put(C_StartUpSong, SongFileName.c_str()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 12:07:04
|
Revision: 363 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=363&view=rev Author: pstieber Date: 2008-03-30 05:07:02 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Changed File to GetFileName and made it private. 2. Added a data member to record the name of the configuration file. If this variable is set, GetFileName can avoid calls to FindFile. Modified Paths: -------------- trunk/jazz/src/Configuration.cpp trunk/jazz/src/Configuration.h Modified: trunk/jazz/src/Configuration.cpp =================================================================== --- trunk/jazz/src/Configuration.cpp 2008-03-30 12:00:14 UTC (rev 362) +++ trunk/jazz/src/Configuration.cpp 2008-03-30 12:07:02 UTC (rev 363) @@ -114,7 +114,8 @@ tConfig::tConfig() - : mDrumNames(), + : mFileName(), + mDrumNames(), mDrumSets(), mCtrlNames(), mVoiceNames(), @@ -336,16 +337,27 @@ return -1; } -// Return the Jazz++ configuration file name, normally jazz.cfg. -// Search in the path provided by FindFile() -wxString tConfig::File() +//----------------------------------------------------------------------------- +// Description: +// Return the Jazz++ configuration file name, normally jazz.cfg. If the +// value has not been set by an earlier call to LoadConfig, attempt to find +// the file using FindFile(). +//----------------------------------------------------------------------------- +wxString tConfig::GetFileName() { - wxString FileName = FindFile("jazz.cfg"); - if (FileName.IsEmpty()) + if (!mFileName.empty()) { - FileName = FindFile(".jazz"); + return mFileName; } - return FileName; + + mFileName = FindFile("jazz.cfg"); + + if (mFileName.empty()) + { + mFileName = FindFile(".jazz"); + } + + return mFileName; } int tConfig::Load(char* buf) @@ -418,7 +430,7 @@ { assert((entry >= 0) && (entry < NumConfigNames)); - wxString FileName = File(); + wxString FileName = GetFileName(); if (FileName.IsEmpty()) { return false; @@ -458,15 +470,17 @@ return false; } +//----------------------------------------------------------------------------- // Description: // Write a configuration entry by making a temp file, and copying all // 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) { assert((Index >= 0) && (Index < NumConfigNames)); - wxString FileName = File(); + wxString FileName = GetFileName(); if (FileName.IsEmpty()) { return false; @@ -539,9 +553,16 @@ //----------------------------------------------------------------------------- void tConfig::LoadConfig(const wxString& FileName) { + if (!::wxFileExists(FileName)) + { + return; + } + + mFileName = FileName; + wxString OriginalCurrentWorkingDirectory = ::wxGetCwd(); - wxFileName FileNameObject(FileName); + wxFileName FileNameObject(mFileName); wxString Path = FileNameObject.GetPath(); ::wxSetWorkingDirectory(Path); @@ -562,10 +583,12 @@ FdArr[i] = NULL; } - cout << "tConfig::LoadConfig \"" << FileName << '"' << endl; + cout + << "tConfig::LoadConfig:" << '\n' + << " \"" << mFileName << '"' + << endl; - FdArr[IncLevel] = fopen(FileName.c_str(), "r"); - cout << FileName << endl; + FdArr[IncLevel] = fopen(mFileName.c_str(), "r"); if (FdArr[IncLevel] == NULL) { wxMessageBox( Modified: trunk/jazz/src/Configuration.h =================================================================== --- trunk/jazz/src/Configuration.h 2008-03-30 12:00:14 UTC (rev 362) +++ trunk/jazz/src/Configuration.h 2008-03-30 12:07:02 UTC (rev 363) @@ -181,8 +181,6 @@ void LoadConfig(const wxString& FileName); - wxString File(); - int Check(const char* pName) const; int Load(char* buf); @@ -232,6 +230,16 @@ private: + // Description: + // Return the Jazz++ configuration file name, normally jazz.cfg. If the + // value has not been set by an earlier call to LoadConfig, attempt to + // find the file using FindFile(). + wxString GetFileName(); + + private: + + wxString mFileName; + tConfigEntry* Names[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-03-30 12:00:26
|
Revision: 362 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=362&view=rev Author: pstieber Date: 2008-03-30 05:00:14 -0700 (Sun, 30 Mar 2008) Log Message: ----------- 1. Fixed a bug that involved the use of "Could not find configuration file." in a message box when it was actually found. 2. Changed the format of a debug message. Modified Paths: -------------- trunk/jazz/src/Project.cpp Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2008-03-30 11:58:15 UTC (rev 361) +++ trunk/jazz/src/Project.cpp 2008-03-30 12:00:14 UTC (rev 362) @@ -384,21 +384,18 @@ Is.open(ConfFileNameAndPath.c_str()); if (!Is) { - Is.close(); - Is.clear(); - } - else - { wxMessageBox( "Could not find configuration file.", "Warning", wxOK); } + Is.close(); + Is.clear(); } cout << "JZProject::ReadConfiguration() ConfFileNameAndPath:" << '\n' - << '"' << ConfFileNameAndPath << '"' + << " \"" << ConfFileNameAndPath << '"' << endl; if (!ConfFileNameAndPath.IsEmpty()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 11:58:18
|
Revision: 361 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=361&view=rev Author: pstieber Date: 2008-03-30 04:58:15 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Indicated global scope in a function call. Modified Paths: -------------- trunk/jazz/src/FindFile.cpp Modified: trunk/jazz/src/FindFile.cpp =================================================================== --- trunk/jazz/src/FindFile.cpp 2008-03-30 11:25:53 UTC (rev 360) +++ trunk/jazz/src/FindFile.cpp 2008-03-30 11:58:15 UTC (rev 361) @@ -46,7 +46,7 @@ //***************************************************************************** wxString FindFile(const wxString& FileName) { - if (wxFileExists(FileName)) + if (::wxFileExists(FileName)) { cout << "imediate hit " << FileName << endl; return FileName; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 11:25:55
|
Revision: 360 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=360&view=rev Author: pstieber Date: 2008-03-30 04:25:53 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Made cosmetic changes. Modified Paths: -------------- trunk/jazz/src/Events.cpp Modified: trunk/jazz/src/Events.cpp =================================================================== --- trunk/jazz/src/Events.cpp 2008-03-30 11:19:36 UTC (rev 359) +++ trunk/jazz/src/Events.cpp 2008-03-30 11:25:53 UTC (rev 360) @@ -39,7 +39,8 @@ //***************************************************************************** //***************************************************************************** - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tReadBase::Open(const char* pFileName) { if (pFileName == NULL) @@ -60,6 +61,8 @@ return 1; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tReadBase::Close() { if (fd != stdin) @@ -70,7 +73,8 @@ //***************************************************************************** //***************************************************************************** - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tWriteBase::Open(const char* pFileName, int nTracks, int TicksPerQuarter) { if (pFileName == NULL) @@ -106,7 +110,8 @@ return nTracks; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tWriteBase::Close() { if (fd != stdout) @@ -118,7 +123,8 @@ //***************************************************************************** // tGetMidiBytes //***************************************************************************** - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tGetMidiBytes::Write(JZEvent* pEvent, unsigned char* pString, int Length) { int Stat = pEvent->Stat; @@ -149,21 +155,23 @@ //***************************************************************************** //***************************************************************************** - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tSysEx::GetPitch() { edb(); - int id = gpSynth->GetSysexId( this ); - if ((id >= SX_GM_ON) && (id < SX_GS_ON)) + int Id = gpSynth->GetSysexId(this); + + if (Id >= SX_GM_ON && Id < SX_GS_ON) { return SX_GROUP_GM; } - else if ((id >= SX_GS_ON) && (id < SX_XG_ON)) + else if (Id >= SX_GS_ON && Id < SX_XG_ON) { return SX_GROUP_GS; } - else if ((id >= SX_XG_ON) && (id < NumSysexIds)) + else if (Id >= SX_XG_ON && Id < NumSysexIds) { return SX_GROUP_XG; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 11:19:40
|
Revision: 359 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=359&view=rev Author: pstieber Date: 2008-03-30 04:19:36 -0700 (Sun, 30 Mar 2008) Log Message: ----------- Removed unused preprocessor directives. Modified Paths: -------------- trunk/jazz/src/mswin/config.h Modified: trunk/jazz/src/mswin/config.h =================================================================== --- trunk/jazz/src/mswin/config.h 2008-03-30 05:05:05 UTC (rev 358) +++ trunk/jazz/src/mswin/config.h 2008-03-30 11:19:36 UTC (rev 359) @@ -33,26 +33,3 @@ // Do not support /dev/sequencer2 on Windows. #undef DEV_SEQUENCER2 - -#define JAZZ_DATADIR "." - -// Name of package. -#define PACKAGE "Jazz++" - -// Define to the address where bug reports for this package should be sent. -#define PACKAGE_BUGREPORT "pst...@ve..." - -// Define to the full name of this package. -#define PACKAGE_NAME "jazzplusplus" - -// Define to the full name and version of this package. -#define PACKAGE_STRING "jazzplusplus 4.1.9" - -// Define to the one symbol short name of this package. -#define PACKAGE_TARNAME "Jazz++" - -// Define to the version of this package. -#define PACKAGE_VERSION "4.1.9" - -// Version number of package. -#define VERSION "4.1.9" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 05:05:07
|
Revision: 358 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=358&view=rev Author: pstieber Date: 2008-03-29 22:05:05 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Made a cosmetic change. Modified Paths: -------------- trunk/jazz/src/Configuration.cpp Modified: trunk/jazz/src/Configuration.cpp =================================================================== --- trunk/jazz/src/Configuration.cpp 2008-03-30 03:05:55 UTC (rev 357) +++ trunk/jazz/src/Configuration.cpp 2008-03-30 05:05:05 UTC (rev 358) @@ -341,7 +341,7 @@ wxString tConfig::File() { wxString FileName = FindFile("jazz.cfg"); - if(FileName.IsEmpty()) + if (FileName.IsEmpty()) { FileName = FindFile(".jazz"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 03:05:57
|
Revision: 357 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=357&view=rev Author: pstieber Date: 2008-03-29 20:05:55 -0700 (Sat, 29 Mar 2008) Log Message: ----------- 1. Added code to initiate loop play. 2. Removed some debug output. Modified Paths: -------------- trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2008-03-30 03:04:51 UTC (rev 356) +++ trunk/jazz/src/TrackFrame.cpp 2008-03-30 03:05:55 UTC (rev 357) @@ -76,6 +76,8 @@ EVT_MENU(ID_PLAY, JZTrackFrame::OnPlay) + EVT_MENU(ID_PLAY_LOOP, JZTrackFrame::OnPlayLoop) + EVT_MENU(ID_PIANOWIN, JZTrackFrame::OnPianoWindow) EVT_MENU(ID_METRONOME_ON, JZTrackFrame::OnMetroOn) @@ -463,13 +465,20 @@ //----------------------------------------------------------------------------- void JZTrackFrame::OnPlay(wxCommandEvent& Event) { - cout << "JZTrackFrame::OnPlay" << endl; wxMouseEvent MouseEvent; MousePlay(MouseEvent, ePlayButton); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackFrame::OnPlayLoop(wxCommandEvent& Event) +{ + wxMouseEvent MouseEvent; + MousePlay(MouseEvent, ePlayLoopButton); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackFrame::OnPianoWindow(wxCommandEvent& Event) { JZPianoFrame* pPianoFrame = new JZPianoFrame( @@ -547,8 +556,6 @@ //----------------------------------------------------------------------------- void JZTrackFrame::MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode) { - cout << "JZTrackFrame::MousePlay" << endl; - mpTrackWindow->MousePlay(Event, Mode); /* @@ -585,7 +592,6 @@ break; case ePlayButton: - cout << "JZTrackFrame::PlayButton" << endl; gpProject->SetLoop(false); gpProject->SetRecord(false); break; @@ -665,16 +671,11 @@ loop_clock = mpFilter->ToClock; } - // GO! - cout << "Go!" << endl; - //if (pRecInfo->Track) // recording? //gpProject->Midi->SetRecordInfo(pRecInfo); //else //gpProject->Midi->SetRecordInfo(0); - cout << "Midi->StartPlay" << endl; - gpProject->mStartTime = mPreviousClock; gpProject->mStopTime = loop_clock; gpProject->Play(); Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2008-03-30 03:04:51 UTC (rev 356) +++ trunk/jazz/src/TrackFrame.h 2008-03-30 03:05:55 UTC (rev 357) @@ -78,6 +78,8 @@ void OnPlay(wxCommandEvent& Event); + void OnPlayLoop(wxCommandEvent& Event); + void OnPianoWindow(wxCommandEvent& Event); void OnToolsHarmonyBrowser(wxCommandEvent& Event); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 03:04:53
|
Revision: 356 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=356&view=rev Author: pstieber Date: 2008-03-29 20:04:51 -0700 (Sat, 29 Mar 2008) Log Message: ----------- 1. Wrapped debug code with a preprocessor directive check. 2. Changed some dialog text. Modified Paths: -------------- trunk/jazz/src/TrackWindow.cpp Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-30 03:03:40 UTC (rev 355) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-30 03:04:51 UTC (rev 356) @@ -1169,6 +1169,7 @@ { int Width, Height; GetVirtualEventSize(Width, Height); +#ifdef DEBUG_TRACK_WINDOW_SCROLL cout << mScrollSize << ' ' << mScrollSize @@ -1177,6 +1178,7 @@ << ' ' << x << ' ' << y << endl; +#endif // DEBUG_TRACK_WINDOW_SCROLL SetScrollbars( mScrollSize, mScrollSize, @@ -1238,7 +1240,7 @@ break; case ePlayLoopButton: - if (!EventsSelected("please select loop range first")) + if (!EventsSelected("Please select loop range first.")) { return; } @@ -1247,7 +1249,7 @@ break; case eRecordButton: - if (!EventsSelected("please select record track/bar first")) + if (!EventsSelected("Please select record track/bar first.")) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 03:03:42
|
Revision: 355 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=355&view=rev Author: pstieber Date: 2008-03-29 20:03:40 -0700 (Sat, 29 Mar 2008) Log Message: ----------- 1. Changed to take a const wxString&. 2. Fixed incorrect JAZZ environment variable test. 3. Only print debug info if the file is found. 4. Removed compiled path code. 5. Updated comment header. Modified Paths: -------------- trunk/jazz/src/FindFile.cpp trunk/jazz/src/FindFile.h Modified: trunk/jazz/src/FindFile.cpp =================================================================== --- trunk/jazz/src/FindFile.cpp 2008-03-30 00:21:03 UTC (rev 354) +++ trunk/jazz/src/FindFile.cpp 2008-03-30 03:03:40 UTC (rev 355) @@ -21,6 +21,7 @@ //***************************************************************************** #include "WxWidgets.h" +#include <wx/filename.h> #include <iostream> @@ -28,65 +29,64 @@ //***************************************************************************** // Description: -// Find a file, looking in -// 1. where the HOME environment var is pointing -// 2. where the JAZZ environment var is pointing -// 3. where the jazz executable was started +// This function attempts to find a file. It checks for the existence of +// the file by // -// This function was converted to use wxString instead of char* because it is -// safe to return localy allocated wxStrings because of reference counting. +// 1. using the passed file name +// 2. appending the passed file name to the path specified by the HOME +// 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 +// +// Returns: +// wxString: +// A complete path and file name for the found file or wxEmptyString if +// the file was not found. //***************************************************************************** -wxString FindFile(const char* pFileName) +wxString FindFile(const wxString& FileName) { - wxString buf; - - if (wxFileExists((char *)pFileName)) + if (wxFileExists(FileName)) { - cout << "imediate hit " << pFileName << endl; - return pFileName; + cout << "imediate hit " << FileName << endl; + return FileName; } - wxString home; + wxString FoundFileName; + + wxString Home; if (getenv("HOME") != 0) { - home = getenv("HOME"); - buf << home << "/" << pFileName; - cout << "home " << buf <<endl; - if (wxFileExists(buf)) + Home = getenv("HOME"); + FoundFileName << Home << wxFileName::GetPathSeparator() << FileName; + if (wxFileExists(FoundFileName)) { - return buf; + cout << "home " << FoundFileName << endl; + return FoundFileName; } } - if (getenv("HOME") != 0) + + if (getenv("JAZZ") != 0) { - buf = ""; - home = getenv("JAZZ"); - buf << home << "/" << pFileName; - cout << "jazz " << buf <<endl; - if (wxFileExists(buf)) + FoundFileName = ""; + Home = getenv("JAZZ"); + FoundFileName << Home << wxFileName::GetPathSeparator() << FileName; + if (wxFileExists(FoundFileName)) { - return buf; + cout << "jazz " << FoundFileName <<endl; + return FoundFileName; } } - // look where the executable was started - home = wxPathOnly((const char *)wxTheApp->argv[0]); - buf = ""; - buf << home << "/" << pFileName; - cout <<"startup " << buf <<endl; - if (wxFileExists(buf)) + // Look where the executable was started. + FoundFileName = ""; + Home = wxPathOnly((const char *)wxTheApp->argv[0]); + FoundFileName << Home << wxFileName::GetPathSeparator() << FileName; + if (wxFileExists(FoundFileName)) { - return buf; + cout << "startup " << FoundFileName << endl; + return FoundFileName; } - // look in the compiled-in path -// buf = ""; -// buf << JAZZ_DATADIR << "/" << pFileName; -// cout << "compiled in path " << buf << " " << wxFileExists(buf) << endl; -// if (wxFileExists(buf)) -// { -// return buf; -// } - return wxEmptyString; } Modified: trunk/jazz/src/FindFile.h =================================================================== --- trunk/jazz/src/FindFile.h 2008-03-30 00:21:03 UTC (rev 354) +++ trunk/jazz/src/FindFile.h 2008-03-30 03:03:40 UTC (rev 355) @@ -23,6 +23,23 @@ #ifndef JZ_FINDFILE_H #define JZ_FINDFILE_H -wxString FindFile(const char* pFileName); +//***************************************************************************** +// Description: +// This function attempts to find a file. It checks for the existence of +// the file by +// +// 1. using the passed file name +// 2. appending the passed file name to the path specified by the HOME +// 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 +// +// Returns: +// wxString: +// A complete path and file name for the found file or wxEmptyString if +// the file was not found. +//***************************************************************************** +wxString FindFile(const wxString& pFileName); #endif // !defined(JZ_FINDFILE_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-30 00:21:10
|
Revision: 354 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=354&view=rev Author: pstieber Date: 2008-03-29 17:21:03 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Fixed a comment typo. Modified Paths: -------------- trunk/jazz/src/Makefile.am Modified: trunk/jazz/src/Makefile.am =================================================================== --- trunk/jazz/src/Makefile.am 2008-03-29 23:58:36 UTC (rev 353) +++ trunk/jazz/src/Makefile.am 2008-03-30 00:21:03 UTC (rev 354) @@ -152,7 +152,7 @@ WxWidgets.h # This directive defines the Jazz++ data directory. This may be a hack, but -# other programs uyse similar techniques. +# other programs use similar techniques. # The automake info file suggests using INCLUDES for this purpose # and i cant even get it to expand the pkgdatadir, aargh INCLUDES= -DJAZZ_DATADIR=\"@datadir@/@PACKAGE@\" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-29 23:58:38
|
Revision: 353 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=353&view=rev Author: pstieber Date: 2008-03-29 16:58:36 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Made cosmetic changes. Modified Paths: -------------- trunk/jazz/src/Configuration.cpp Modified: trunk/jazz/src/Configuration.cpp =================================================================== --- trunk/jazz/src/Configuration.cpp 2008-03-29 23:57:51 UTC (rev 352) +++ trunk/jazz/src/Configuration.cpp 2008-03-29 23:58:36 UTC (rev 353) @@ -649,12 +649,12 @@ { // include file wxString pathname = FindFile(StrValue(entry)); - cout << "include "<< entry<<endl; + cout << "include " << entry << endl; IncLevel++; assert(IncLevel < MaxIncs); if (pathname) { - FdArr[IncLevel] = fopen(pathname,"r"); + FdArr[IncLevel] = fopen(pathname, "r"); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-29 23:57:53
|
Revision: 352 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=352&view=rev Author: pstieber Date: 2008-03-29 16:57:51 -0700 (Sat, 29 Mar 2008) Log Message: ----------- Made cosmetic changes. Modified Paths: -------------- trunk/jazz/src/AlsaPlayer.cpp Modified: trunk/jazz/src/AlsaPlayer.cpp =================================================================== --- trunk/jazz/src/AlsaPlayer.cpp 2008-03-29 21:23:55 UTC (rev 351) +++ trunk/jazz/src/AlsaPlayer.cpp 2008-03-29 23:57:51 UTC (rev 352) @@ -46,6 +46,8 @@ using namespace std; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- tAlsaPlayer::tAlsaPlayer(JZSong *song) : JZPlayer(song) { @@ -87,10 +89,10 @@ << ':' << static_cast<int>(self.port) << endl; - // allocate a queue + // Allocate a queue. queue = snd_seq_alloc_named_queue(handle, "Jazz++"); - // register my name + // Register the name of this application. set_client_info(handle, "The JAZZ++ Midi Sequencer"); // scan input addressess @@ -102,7 +104,7 @@ inp_dev = gpConfig->GetValue(C_AlsaInputDevice); if (inp_dev < 0) { - cout<<"invalid input device, so selecting one"<<endl; + cout << "invalid input device, so selecting one" << endl; inp_dev = select_list(iaddr, "Input Device", inp_dev); cout << "Input device is: " << inp_dev << endl; gpConfig->Put(C_AlsaInputDevice, inp_dev); @@ -110,14 +112,18 @@ outp_dev = gpConfig->GetValue(C_AlsaOutputDevice); if (outp_dev < 0) { - cout<<"invalid output device, so selecting one"<<endl; + cout << "invalid output device, so selecting one" << endl; outp_dev = select_list(oaddr, "Output Device", outp_dev); } if (inp_dev >= 0) + { subscribe_inp(inp_dev); + } if (outp_dev >= 0) + { subscribe_out(outp_dev); + } set_pool_sizes(); @@ -131,29 +137,35 @@ gpConfig->GetValue(C_ThruInput), gpConfig->GetValue(C_ThruOutput)); } - } - - - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::clear_input_queue() { snd_seq_drop_input(handle); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::set_pool_sizes() { if (snd_seq_set_client_pool_output(handle, 2000) < 0) + { perror("set pool output"); + } if (snd_seq_set_client_pool_input(handle, 2000) < 0) + { perror("set pool input"); + } if (snd_seq_set_client_pool_output_room(handle, 1000) < 0) + { perror("set pool output room"); + } } - - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::SetSoftThru(int on, int idev, int odev) { if (idev != ithru || odev != othru) @@ -162,7 +174,6 @@ othru = odev; thru->Stop(); - } if (on && !thru->IsRunning()) { @@ -170,26 +181,34 @@ thru->SetDestin(oaddr[othru].client, oaddr[othru].port); thru->Start(); - } else if (!on && thru->IsRunning()) { - thru->Stop(); - } } -// connect output addrs/queue with my client/oport +//----------------------------------------------------------------------------- +// Description: +// Connect output addrs/queue with my client/oport. +//----------------------------------------------------------------------------- void tAlsaPlayer::subscribe_out(int outp) { - if (snd_seq_connect_to(handle, self.port, oaddr[outp].client, oaddr[outp].port) < 0) + if ( + snd_seq_connect_to( + handle, + self.port, + oaddr[outp].client, + oaddr[outp].port) < 0) { perror("subscribe output"); } } -// connect input addrs/queue with my client/iport +//----------------------------------------------------------------------------- +// Description: +// Connect input addrs/queue with my client/iport +//----------------------------------------------------------------------------- void tAlsaPlayer::subscribe_inp(int inp) { snd_seq_port_subscribe_t *subs; @@ -204,34 +223,57 @@ } } -// disconnect output addrs/queue with my client/oport -void tAlsaPlayer::unsubscribe_out(int outp) { - if (snd_seq_disconnect_to(handle, self.port, oaddr[outp].client, oaddr[outp].port) < 0) { +//----------------------------------------------------------------------------- +// Description: +// Disconnect output addrs/queue with my client/oport. +//----------------------------------------------------------------------------- +void tAlsaPlayer::unsubscribe_out(int outp) +{ + if ( + snd_seq_disconnect_to( + handle, + self.port, + oaddr[outp].client, + oaddr[outp].port) < 0) + { perror("unsubscribe output"); } } -// connect input addrs/queue with my client/iport -void tAlsaPlayer::unsubscribe_inp(int inp) { +//----------------------------------------------------------------------------- +// Description: +// Connect input addrs/queue with my client/iport +//----------------------------------------------------------------------------- +void tAlsaPlayer::unsubscribe_inp(int inp) +{ snd_seq_port_subscribe_t *subs; snd_seq_port_subscribe_alloca(&subs); snd_seq_port_subscribe_set_time_update(subs, 1); snd_seq_port_subscribe_set_queue(subs, queue); snd_seq_port_subscribe_set_sender(subs, &iaddr[inp]); snd_seq_port_subscribe_set_dest(subs, &self); - if (snd_seq_unsubscribe_port(handle, subs) < 0) { + if (snd_seq_unsubscribe_port(handle, subs) < 0) + { perror("unsubscribe input"); } } -// set the name of this client -void tAlsaPlayer::set_client_info(snd_seq_t *handle, const char *name) { - if (snd_seq_set_client_name(handle, (char *)name) < 0) { +//----------------------------------------------------------------------------- +// Description: +// Set the name of this client. +//----------------------------------------------------------------------------- +void tAlsaPlayer::set_client_info(snd_seq_t *handle, const char *name) +{ + if (snd_seq_set_client_name(handle, (char *)name) < 0) + { perror("ioctl"); } } -// create a new port +//----------------------------------------------------------------------------- +// Description: +// Create a new port. +//----------------------------------------------------------------------------- int tAlsaPlayer::create_port(snd_seq_t *handle, const char *name) { return snd_seq_create_simple_port( @@ -244,21 +286,28 @@ SND_SEQ_PORT_TYPE_MIDI_GENERIC); } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tAlsaPlayer::Installed() { return installed; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- tAlsaPlayer::~tAlsaPlayer() { if (thru) + { delete thru; + } snd_seq_close(handle); } +//----------------------------------------------------------------------------- // 0 = event successfully sent to driver // 1 = try again later +//----------------------------------------------------------------------------- int tAlsaPlayer::OutEvent(JZEvent *e, int now) { int rc = 0; @@ -369,15 +418,18 @@ return rc < 0 ? 1 : 0; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::OutBreak() { OutBreak(OutClock); } -/** "echos" are used to synchronize. -they are supposed to be read later by the Notify call chain - */ +//----------------------------------------------------------------------------- +// Description: +// "echos" are used to synchronize. They are supposed to be read later by +// the Notify call chain. +//----------------------------------------------------------------------------- int tAlsaPlayer::compose_echo(int clock, unsigned int arg) { snd_seq_event_t ev; @@ -385,28 +437,34 @@ ev.source = self; ev.dest = self; snd_seq_ev_schedule_tick(&ev, queue, 0, clock); - cout<<"scheduling echo for "<<clock<<endl; + cout << "scheduling echo for " << clock << endl; snd_seq_ev_set_fixed(&ev); ev.type = SND_SEQ_EVENT_ECHO; ev.data.raw32.d[0] = arg; return write(&ev); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::OutBreak(long clock) { - - while (echo_clock + 48 < clock) { + while (echo_clock + 48 < clock) + { echo_clock += 48; if (compose_echo(echo_clock, 0) < 0) + { break; + } } flush_output(); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::StartPlay(long clock, long loopClock, int cont) { - cout<<"tAlsaPlayer::StartPlay"<<endl; + cout << "tAlsaPlayer::StartPlay" << endl; recd_clock = clock; echo_clock = clock; play_clock = clock; @@ -414,12 +472,14 @@ start_timer(clock); JZPlayer::StartPlay(clock, loopClock, cont); Notify(); - //flush_output(); +// flush_output(); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::ResetPlay(long clock) { - /* purge queues */ + // Purge queues. snd_seq_drop_output_buffer(handle); snd_seq_drop_output(handle); @@ -430,11 +490,11 @@ #define DELTACLOCK 960 #define ADVANCE_PLAY 480 -/** notify is periodically called by the timer. - -it will output events to the output buffer, and update play_clock and recd_clock - */ - +//----------------------------------------------------------------------------- +// Description: +// Notify is periodically called by the timer. It will output events to the +// output buffer, and update play_clock and recd_clock +//----------------------------------------------------------------------------- void tAlsaPlayer::Notify() { // called by timer @@ -462,13 +522,27 @@ PlayLoop->PrepareOutput(AudioBuffer, Song, Now, OutClock, 1); } mPlayBuffer.Length2Keyoff(); - } else { + } + else + { // time to put more events - if ( Now >= (OutClock - ADVANCE_PLAY) ) + if (Now >= (OutClock - ADVANCE_PLAY)) { - PlayLoop->PrepareOutput(&mPlayBuffer, Song, OutClock, Now + DELTACLOCK, 0); + PlayLoop->PrepareOutput( + &mPlayBuffer, + Song, + OutClock, + Now + DELTACLOCK, + 0); if (AudioBuffer) - PlayLoop->PrepareOutput(AudioBuffer, Song, OutClock, Now + DELTACLOCK, 1); + { + PlayLoop->PrepareOutput( + AudioBuffer, + Song, + OutClock, + Now + DELTACLOCK, + 1); + } OutClock = Now + DELTACLOCK; mPlayBuffer.Length2Keyoff(); } @@ -485,7 +559,9 @@ } } -void tAlsaPlayer::set_event_header(snd_seq_event_t *ev, long clock,int type) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void tAlsaPlayer::set_event_header(snd_seq_event_t *ev, long clock, int type) { memset(ev, 0, sizeof(*ev)); snd_seq_ev_set_source(ev, self.port); @@ -495,7 +571,13 @@ ev->type = type; } -void tAlsaPlayer::set_event_header(snd_seq_event_t *ev, long clock, int len, void *ptr) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void tAlsaPlayer::set_event_header( + snd_seq_event_t *ev, + long clock, + int len, + void *ptr) { memset(ev, 0, sizeof(*ev)); snd_seq_ev_set_source(ev, self.port); @@ -504,7 +586,10 @@ snd_seq_ev_set_variable(ev, len, ptr); } -/** init the alsa timer */ +//----------------------------------------------------------------------------- +// Description: +// Initialize the alsa timer. +//----------------------------------------------------------------------------- int tAlsaPlayer::start_timer(long clock) { int time_base = Song->TicksPerQuarter; @@ -514,7 +599,10 @@ return 0; } -/** set initial tempo */ +//----------------------------------------------------------------------------- +// Description: +// Set initial tempo. +//----------------------------------------------------------------------------- void tAlsaPlayer::init_queue_tempo(int time_base, int bpm) { snd_seq_queue_tempo_t *qtempo; @@ -522,13 +610,16 @@ snd_seq_queue_tempo_set_ppq(qtempo, time_base); snd_seq_queue_tempo_set_tempo(qtempo, 60*1000000/bpm); if (snd_seq_set_queue_tempo(handle, queue, qtempo) < 0) + { perror("set_queue_tempo"); + } } - -/** immediately start the alsa queue timer. -do this by sending an "start" event to the queue -*/ +//----------------------------------------------------------------------------- +// Description: +// Immediately start the alsa queue timer. Do this by sending an "start" +// event to the queue. +//----------------------------------------------------------------------------- void tAlsaPlayer::start_queue_timer(long clock) { stop_queue_timer(); // to be sure @@ -538,20 +629,30 @@ snd_seq_ev_set_source(&ev, self.port); snd_seq_ev_set_direct(&ev); snd_seq_ev_set_queue_pos_tick(&ev, queue, clock); - int rv=0; - rv=write(&ev, 1); - if(rv<0) - cout<<"tAlsaPlayer::start_queue_timer write failed"<<endl; + int rv = 0; + rv = write(&ev, 1); + if (rv < 0) + { + cout << "tAlsaPlayer::start_queue_timer write failed" << endl; + } snd_seq_ev_set_queue_continue(&ev, queue); - rv=write(&ev, 1); - if(rv<0) - cout<<"tAlsaPlayer::start_queue_timer write failed"<<endl; + rv = write(&ev, 1); + if (rv < 0) + { + cout << "tAlsaPlayer::start_queue_timer write failed" << endl; + } - cout<<"tAlsaPlayer::start_queue_timer added trial-and-terror start_queue"<<endl; + cout + << "tAlsaPlayer::start_queue_timer added trial-and-terror start_queue" + << endl; + snd_seq_start_queue(handle, queue, NULL); } -/** immediately stop the timer, by sending a stop event to the alsa queue*/ +//----------------------------------------------------------------------------- +// Description: +// Immediately stop the timer, by sending a stop event to the alsa queue. +//----------------------------------------------------------------------------- void tAlsaPlayer::stop_queue_timer() { snd_seq_event_t ev; @@ -562,32 +663,52 @@ write(&ev, 1); } -/** write an event to the queue, return < 0 on failure */ -int tAlsaPlayer::write(snd_seq_event_t *ev, int now) { - if (now) { +//----------------------------------------------------------------------------- +// Description: +// Write an event to the queue. +// +// Returns: +// int: +// returns a negative value on failure. +//----------------------------------------------------------------------------- +int tAlsaPlayer::write(snd_seq_event_t *ev, int now) +{ + if (now) + { snd_seq_ev_set_direct(ev); return snd_seq_event_output_direct(handle, ev); } - int rc = snd_seq_event_output(handle, ev) ; - if (rc < 0 && rc != -EAGAIN) { + int rc = snd_seq_event_output(handle, ev); + if (rc < 0 && rc != -EAGAIN) + { snd_seq_extract_output(handle, NULL); // remove the error event } return rc; } -void tAlsaPlayer::flush_output() { +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void tAlsaPlayer::flush_output() +{ snd_seq_drain_output(handle); } -int tAlsaPlayer::set_blocking_mode(int enable) { +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int tAlsaPlayer::set_blocking_mode(int enable) +{ int rc; if ((rc = snd_seq_nonblock(handle, !enable)) < 0) + { perror("blocking mode"); + } return rc; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::StopPlay() { JZPlayer::StopPlay(); @@ -599,55 +720,93 @@ RecdBuffer.Keyoff2Length(); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaPlayer::StartAudio() { } -/** called from GetRealTimeClock. -parses events in the queu. +//----------------------------------------------------------------------------- +// Description: +// Called from GetRealTimeClock. Parses events in the queue. Sets +// recd_clock, from event time stamps. +//----------------------------------------------------------------------------- +void tAlsaPlayer::recd_event(snd_seq_event_t* ev) +{ + JZEvent* pEvent = 0; - sets recd_clock, from event timestamps - */ -void tAlsaPlayer::recd_event(snd_seq_event_t *ev) -{ - JZEvent *e = 0; - cout << "tAlsaPlayer::recd_event got "<<(int)ev->type<<" (echo is "<<SND_SEQ_EVENT_ECHO<<") "<<endl; + cout + << "tAlsaPlayer::recd_event got " << (int)ev->type + << " (echo is " << SND_SEQ_EVENT_ECHO << ')' + << endl; + switch (ev->type) { - case SND_SEQ_EVENT_NOTEON: if (ev->data.note.velocity > 0) - e = new tKeyOn(0, ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); + { + pEvent = new tKeyOn( + 0, + ev->data.note.channel, + ev->data.note.note, + ev->data.note.velocity); + } else - e = new tKeyOff(0, ev->data.note.channel, ev->data.note.note, 0); + { + pEvent = new tKeyOff(0, ev->data.note.channel, ev->data.note.note, 0); + } break; case SND_SEQ_EVENT_NOTEOFF: - e = new tKeyOff(0, ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); + pEvent = new tKeyOff( + 0, + ev->data.note.channel, + ev->data.note.note, + ev->data.note.velocity); break; case SND_SEQ_EVENT_PGMCHANGE: - e = new tProgram(0, ev->data.control.channel, ev->data.control.value); + pEvent = new tProgram( + 0, + ev->data.control.channel, + ev->data.control.value); break; case SND_SEQ_EVENT_KEYPRESS: - e = new tKeyPressure(0, ev->data.note.channel, ev->data.note.note, ev->data.note.velocity); + pEvent = new tKeyPressure( + 0, + ev->data.note.channel, + ev->data.note.note, + ev->data.note.velocity); break; case SND_SEQ_EVENT_CHANPRESS: - e = new tChnPressure(0, ev->data.control.channel, ev->data.control.value); + pEvent = new tChnPressure( + 0, + ev->data.control.channel, + ev->data.control.value); break; case SND_SEQ_EVENT_CONTROLLER: - e = new tControl(0, ev->data.control.channel, ev->data.control.param, ev->data.control.value); + pEvent = new tControl( + 0, + ev->data.control.channel, + ev->data.control.param, + ev->data.control.value); break; case SND_SEQ_EVENT_PITCHBEND: - e = new tPitch(0, ev->data.control.channel, ev->data.control.value); + pEvent = new tPitch( + 0, + ev->data.control.channel, + ev->data.control.value); break; case SND_SEQ_EVENT_SYSEX: - e = new tSysEx(0, ((unsigned char *)ev->data.ext.ptr) + 1, ev->data.ext.len - 1); + pEvent = new tSysEx( + 0, + ((unsigned char *)ev->data.ext.ptr) + 1, + ev->data.ext.len - 1); break; case SND_SEQ_EVENT_ECHO: @@ -658,24 +817,27 @@ else { recd_clock = ev->time.tick; - cout<<"recd_clock now:"<<recd_clock<<endl; + cout << "recd_clock now: " << recd_clock << endl; } break; } - if (e) + + if (pEvent) { - // Not all events are to be recorded. Only those filtered out and put into - // the event. - e->SetClock(PlayLoop->Ext2IntClock(ev->time.tick)); - RecdBuffer.Put(e); + // Not all events are to be recorded. Only those filtered out and put + // into the event. + pEvent->SetClock(PlayLoop->Ext2IntClock(ev->time.tick)); + RecdBuffer.Put(pEvent); } } -/** called periodically from Notify -it calculates the rt clock by looking at timestamps on events in the queue, and also updates the display, so the name is -not well chosen. - */ +//----------------------------------------------------------------------------- +// Description: +// Called periodically from Notify. Calculates the real time clock by +// looking at time stamps on events in the queue, and also updates the +// display, so the name is not well chosen. +//----------------------------------------------------------------------------- long tAlsaPlayer::GetRealTimeClock() { // input recorded events (including my echo events) @@ -693,8 +855,10 @@ return recd_clock; } - -/** this function goes through each client, and each port on each client*/ +//----------------------------------------------------------------------------- +// Description: +// This function goes through each client, and each port on each client. +//----------------------------------------------------------------------------- void tAlsaPlayer::scan_clients( tAlsaDeviceList& DeviceList, unsigned DeviceCapabilities) @@ -712,7 +876,9 @@ { int c = snd_seq_client_info_get_client(cinfo); if (c == self.client) + { continue; + } snd_seq_port_info_set_client(pinfo, c); snd_seq_port_info_set_port(pinfo, -1); while (snd_seq_query_next_port(handle, pinfo) >= 0) @@ -732,27 +898,41 @@ } } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tAlsaPlayer::FindMidiDevice() { if (inp_dev != -1) + { unsubscribe_inp(inp_dev); + } inp_dev = select_list(iaddr, "Input MIDI device", inp_dev); gpConfig->Put(C_AlsaInputDevice, inp_dev); if (inp_dev != -1) + { subscribe_inp(inp_dev); + } if (outp_dev != -1) + { unsubscribe_out(outp_dev); + } outp_dev = select_list(oaddr, "Output MIDI device", outp_dev); gpConfig->Put(C_AlsaOutputDevice, outp_dev); if (outp_dev != -1) + { subscribe_out(outp_dev); + } return 0; } -int tAlsaPlayer::select_list(tAlsaDeviceList &list, char *title, int def_device) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int tAlsaPlayer::select_list( + tAlsaDeviceList& list, + char* title, + int def_device) { - if (list.GetCount() > 0) { int ndevs = list.GetCount(); @@ -779,7 +959,6 @@ } return k; - } else { @@ -788,7 +967,8 @@ } } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tAlsaDeviceList::print(const char *msg) { cout << msg << endl; @@ -799,10 +979,14 @@ ++iSound) { const snd_seq_addr_t& a = *iSound; - cout << GetName(i++) << " = " << (int)a.client << ":" << (int)a.port << endl; + cout + << GetName(i++) << " = " << (int)a.client << ":" << (int)a.port + << endl; } } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- unsigned tAlsaDeviceList::add(const char* pName, const snd_seq_addr_t& a) { mDeviceNames.push_back(pName); @@ -810,6 +994,8 @@ return addr.size(); } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- snd_seq_addr_t& tAlsaDeviceList::operator[](unsigned i) { if (i >= addr.size()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-29 21:23:57
|
Revision: 351 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=351&view=rev Author: pstieber Date: 2008-03-29 14:23:55 -0700 (Sat, 29 Mar 2008) Log Message: ----------- 1. Changed tPlayer to JZPlayer. 2. Wrapped some debug code with preprocessor checks in Player.cpp. Modified Paths: -------------- trunk/jazz/src/AlsaPlayer.cpp trunk/jazz/src/AlsaPlayer.h trunk/jazz/src/Globals.cpp trunk/jazz/src/Globals.h trunk/jazz/src/Player.cpp trunk/jazz/src/Player.h trunk/jazz/src/Project.h trunk/jazz/src/SampleWindow.cpp trunk/jazz/src/mswin/WindowsPlayer.cpp trunk/jazz/src/mswin/WindowsPlayer.h Modified: trunk/jazz/src/AlsaPlayer.cpp =================================================================== --- trunk/jazz/src/AlsaPlayer.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/AlsaPlayer.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -47,7 +47,7 @@ using namespace std; tAlsaPlayer::tAlsaPlayer(JZSong *song) - : tPlayer(song) + : JZPlayer(song) { ithru = othru = 0; @@ -74,7 +74,7 @@ snd_seq_poll_descriptors(handle, &pfds, 1, POLLIN|POLLOUT); //JAVE seqfd doesnt seem to be used for anything, not here nor in the base - // class tPlayer(but heavily in tSeq2Player) + // class JZPlayer(but heavily in tSeq2Player) // seqfd = pfds.fd; // create my input/output port @@ -412,7 +412,7 @@ play_clock = clock; flush_output(); start_timer(clock); - tPlayer::StartPlay(clock, loopClock, cont); + JZPlayer::StartPlay(clock, loopClock, cont); Notify(); //flush_output(); } @@ -590,7 +590,7 @@ void tAlsaPlayer::StopPlay() { - tPlayer::StopPlay(); + JZPlayer::StopPlay(); ResetPlay(0); flush_output(); stop_queue_timer(); Modified: trunk/jazz/src/AlsaPlayer.h =================================================================== --- trunk/jazz/src/AlsaPlayer.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/AlsaPlayer.h 2008-03-29 21:23:55 UTC (rev 351) @@ -40,7 +40,7 @@ -class tAlsaPlayer : public tPlayer +class tAlsaPlayer : public JZPlayer { friend class tAlsaThru; public: Modified: trunk/jazz/src/Globals.cpp =================================================================== --- trunk/jazz/src/Globals.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Globals.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -39,7 +39,7 @@ JZSynth* gpSynth = 0; -tPlayer* gpMidiPlayer = 0; +JZPlayer* gpMidiPlayer = 0; tHelp* HelpInstance = 0; Modified: trunk/jazz/src/Globals.h =================================================================== --- trunk/jazz/src/Globals.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Globals.h 2008-03-29 21:23:55 UTC (rev 351) @@ -32,7 +32,7 @@ class tConfig; class JZSong; class JZSynth; -class tPlayer; +class JZPlayer; class tHelp; class JZProject; class JZTrackFrame; @@ -49,7 +49,7 @@ extern std::string gpStartUpSong; extern JZSong* gpSong; extern JZSynth* gpSynth; -extern tPlayer* gpMidiPlayer; +extern JZPlayer* gpMidiPlayer; extern tHelp* HelpInstance; extern std::vector<std::pair<std::string, int> > gLimitSteps; extern std::vector<std::pair<std::string, int> > gModes; Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Player.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -187,10 +187,10 @@ } } -// ------------------------- tPlayer --------------------- +// ------------------------- JZPlayer --------------------- -tPlayer::tPlayer(JZSong *song) +JZPlayer::JZPlayer(JZSong *song) : samples( song->TicksPerQuarter * song->Speed() ) { DummyDeviceList.Add("default"); @@ -203,20 +203,22 @@ rec_info = 0; } -tPlayer::~tPlayer() +JZPlayer::~JZPlayer() { delete PlayLoop; } -void tPlayer::ShowError() +void JZPlayer::ShowError() { wxMessageBox("could not install driver", "Error", wxOK); } -void tPlayer::StartPlay(long Clock, long LoopClock, int Continue) +void JZPlayer::StartPlay(long Clock, long LoopClock, int Continue) { - cout<< "tPlayer::StartPlay" << endl; +#ifdef DEBUG_PLAYER_STARTPLAY + cout << "JZPlayer::StartPlay" << endl; +#endif // DEBUG_PLAYER_STARTPLAY int i; @@ -496,7 +498,7 @@ } -void tPlayer::StopPlay() +void JZPlayer::StopPlay() { // Stop the wxTimer. Stop(); @@ -536,11 +538,14 @@ } -void tPlayer::Notify() +void JZPlayer::Notify() { // called by timer long Now = GetRealTimeClock(); - cout << "tPlayer::Notify " << Now << endl; + +#ifdef DEBUG_PLAYER_NOTIFY + cout << "JZPlayer::Notify " << Now << endl; +#endif // DEBUG_PLAYER_NOTIFY if (Now < 0) { return; @@ -549,7 +554,9 @@ // time to put more events if (Now >= (OutClock - ADVANCE_PLAY)) { +#ifdef DEBUG_PLAYER_NOTIFY cout << "*** Notify: more events to playbuffer" << endl; +#endif // DEBUG_PLAYER_NOTIFY PlayLoop->PrepareOutput(&mPlayBuffer, Song, OutClock, Now + DELTACLOCK, 0); if (AudioBuffer) @@ -578,7 +585,7 @@ } -void tPlayer::FlushToDevice() +void JZPlayer::FlushToDevice() // try to send all events up to OutClock to device { int BufferFull = 0; @@ -602,7 +609,7 @@ } -void tPlayer::AllNotesOff(int Reset) +void JZPlayer::AllNotesOff(int Reset) { tControl NoteOff(0, 0, 0x78, 0); tPitch Pitch (0, 0, 0); @@ -635,7 +642,8 @@ -void tPlayer::OutNow(JZTrack *t, tParam *r) { +void JZPlayer::OutNow(JZTrack *t, tParam *r) +{ OutNow(t, &r->Msb); OutNow(t, &r->Lsb); OutNow(t, &r->DataMsb); @@ -650,7 +658,7 @@ #ifdef DEV_MPU401 tMpuPlayer::tMpuPlayer(JZSong *song) - : tPlayer(song) + : JZPlayer(song) { poll_millisec = 25; midinethost = getenv("MIDINETHOST"); @@ -778,7 +786,7 @@ write_ack_mpu(timebase, 2); OutOfBandEvents.Clear(); - tPlayer::StartPlay(IntClock, LoopClock, Continue); + JZPlayer::StartPlay(IntClock, LoopClock, Continue); // Supress realtime messages to MIDI Out port? if (!Config(C_RealTimeOut)) { @@ -815,7 +823,7 @@ } write_ack_mpu(clocksource, 2); - tPlayer::Notify(); + JZPlayer::Notify(); // Start play write_ack_mpu( play, playsize ); @@ -827,7 +835,7 @@ void tMpuPlayer::StopPlay() { static const char stop = RES; - tPlayer::StopPlay(); + JZPlayer::StopPlay(); // Reset mpu write_ack_mpu( &stop, 1); PlyBytes.Clear(); @@ -1378,7 +1386,7 @@ tSeq2Player::tSeq2Player(JZSong *song) - : tPlayer(song) + : JZPlayer(song) { // got to poll fast for midi thru poll_millisec = 10; @@ -1734,7 +1742,7 @@ // send initial program changes, controller etc SEQ_START_TIMER(); seqbuf_dump(); - tPlayer::StartPlay(Clock, LoopClock, Continue); + JZPlayer::StartPlay(Clock, LoopClock, Continue); seqbuf_dump(); ioctl(seqfd, SNDCTL_SEQ_SYNC); SEQ_STOP_TIMER(); @@ -1751,7 +1759,7 @@ // start play SEQ_START_TIMER(); StartAudio(); - tPlayer::Notify(); + JZPlayer::Notify(); seqbuf_dump(); } @@ -1764,7 +1772,7 @@ ioctl(seqfd, SNDCTL_SEQ_RESET, 0); SEQ_START_TIMER(); - tPlayer::StopPlay(); + JZPlayer::StopPlay(); AllNotesOff(); SEQ_STOP_TIMER(); seqbuf_dump(); Modified: trunk/jazz/src/Player.h =================================================================== --- trunk/jazz/src/Player.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Player.h 2008-03-29 21:23:55 UTC (rev 351) @@ -145,7 +145,7 @@ tDeviceList& operator = (const tDeviceList &); }; -class tPlayer : public wxTimer +class JZPlayer : public wxTimer { protected: @@ -229,8 +229,8 @@ tSampleSet samples; public: - tPlayer(JZSong *song); - virtual ~tPlayer(); + JZPlayer(JZSong *song); + virtual ~JZPlayer(); void Notify(); @@ -451,7 +451,7 @@ #define ACTIVE_TRACKS 7 #define ACTIVE_TRACKS_MASK 0x7f -class tMpuPlayer : public tPlayer +class tMpuPlayer : public JZPlayer { int dev; tBuffer PlyBytes; @@ -495,12 +495,12 @@ // ------------------------------ null-driver ------------------------------- -class tNullPlayer : public tPlayer +class tNullPlayer : public JZPlayer { public: tNullPlayer(JZSong* pSong) - : tPlayer(pSong) + : JZPlayer(pSong) { } @@ -565,7 +565,7 @@ -class tSeq2Player : public tPlayer +class tSeq2Player : public JZPlayer { public: friend class tOSSThru; Modified: trunk/jazz/src/Project.h =================================================================== --- trunk/jazz/src/Project.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/Project.h 2008-03-29 21:23:55 UTC (rev 351) @@ -23,7 +23,7 @@ #ifndef JZ_PROJECT_H #define JZ_PROJECT_H -class tPlayer; +class JZPlayer; class JZSynth; class tFilter; @@ -135,7 +135,7 @@ // Sets RecInfo, JZProject takes ownership of this object void SetRecInfo(JZRecordingInfo* pRecInfo); - tPlayer* GetPlayer() + JZPlayer* GetPlayer() { return mpMidiPlayer; } @@ -152,7 +152,7 @@ tConfig* mpConfig; - tPlayer* mpMidiPlayer; + JZPlayer* mpMidiPlayer; JZSynth* mpSynth; Modified: trunk/jazz/src/SampleWindow.cpp =================================================================== --- trunk/jazz/src/SampleWindow.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/SampleWindow.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -202,7 +202,7 @@ class tSamplePlayPosition : public wxTimer { public: - tSamplePlayPosition(tSampleCnvs &c, tPlayer *p, tSample &s) + tSamplePlayPosition(tSampleCnvs &c, JZPlayer *p, tSample &s) : cnvs(c), player(p), spl(s) { visible = FALSE; @@ -263,7 +263,7 @@ private: tSampleCnvs &cnvs; - tPlayer *player; + JZPlayer *player; tSample &spl; bool visible; int x; Modified: trunk/jazz/src/mswin/WindowsPlayer.cpp =================================================================== --- trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/mswin/WindowsPlayer.cpp 2008-03-29 21:23:55 UTC (rev 351) @@ -46,7 +46,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- tWinPlayer::tWinPlayer(JZSong* pSong) - : tPlayer(pSong) + : JZPlayer(pSong) { poll_millisec = 25; timer_installed = FALSE; @@ -631,7 +631,7 @@ OutOfBandEvents.Clear(); gpTrackWindow->NewPlayPosition(PlayLoop->Ext2IntClock(Clock)); state->playing = TRUE; // allow for SetTempo in OutNow() - tPlayer::StartPlay(Clock, LoopClock, Continue); + JZPlayer::StartPlay(Clock, LoopClock, Continue); if (gpConfig->GetValue(C_RealTimeOut)) { @@ -700,7 +700,7 @@ { wxBeginBusyCursor(); state->playing = FALSE; - tPlayer::StopPlay(); + JZPlayer::StopPlay(); if (gpConfig->GetValue(C_RealTimeOut)) { tStopPlay *e = new tStopPlay(0); Modified: trunk/jazz/src/mswin/WindowsPlayer.h =================================================================== --- trunk/jazz/src/mswin/WindowsPlayer.h 2008-03-21 06:16:33 UTC (rev 350) +++ trunk/jazz/src/mswin/WindowsPlayer.h 2008-03-29 21:23:55 UTC (rev 351) @@ -34,7 +34,7 @@ //***************************************************************************** //***************************************************************************** -class tWinPlayer : public tPlayer +class tWinPlayer : public JZPlayer { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-21 06:16:37
|
Revision: 350 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=350&view=rev Author: pstieber Date: 2008-03-20 23:16:33 -0700 (Thu, 20 Mar 2008) Log Message: ----------- Commented out some unused variables. Modified Paths: -------------- trunk/jazz/src/EventWindow.cpp Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2008-03-21 06:11:03 UTC (rev 349) +++ trunk/jazz/src/EventWindow.cpp 2008-03-21 06:16:33 UTC (rev 350) @@ -939,11 +939,11 @@ void JZEventFrame::ZoomIn() { - if (ClocksPerPixel >= 2) - { - ClocksPerPixel /= 2; - int x = CanvasX * 2; - int y = CanvasY; +// if (ClocksPerPixel >= 2) +// { +// ClocksPerPixel /= 2; +// int x = CanvasX * 2; +// int y = CanvasY; // wxDC* dc=new wxClientDC(Canvas); // JZEventFrame::OnPaintSub(dc, x, y); @@ -952,18 +952,18 @@ // if (x == 0) // Redraw(); - } +// } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZEventFrame::ZoomOut() { - if (ClocksPerPixel <= 120) - { - ClocksPerPixel *= 2; - int x = CanvasX / 2; - int y = CanvasY; +// if (ClocksPerPixel <= 120) +// { +// ClocksPerPixel *= 2; +// int x = CanvasX / 2; +// int y = CanvasY; //wxDC* dc=new wxClientDC(Canvas); //JZEventFrame::OnPaintSub(dc, x, y); @@ -971,5 +971,5 @@ // Canvas->SetScrollPosition(x, y); //if (x == 0) // Redraw(); - } +// } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-21 06:11:07
|
Revision: 349 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=349&view=rev Author: pstieber Date: 2008-03-20 23:11:03 -0700 (Thu, 20 Mar 2008) Log Message: ----------- Changed mScrollLines to mScrollSize. Modified Paths: -------------- trunk/jazz/src/TrackWindow.cpp Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2008-03-21 06:10:27 UTC (rev 348) +++ trunk/jazz/src/TrackWindow.cpp 2008-03-21 06:11:03 UTC (rev 349) @@ -399,9 +399,8 @@ int y = mScrolledY; SetScrollRanges(x, y); -// SetScrollPosition(x, y); - Refresh(false); +// Refresh(false); } } @@ -416,7 +415,6 @@ int y = mScrolledY; SetScrollRanges(x, y); -// SetScrollPosition(x, y); Refresh(false); } @@ -467,10 +465,10 @@ mScrolledY *= mScrollSize; GetClientSize(&mCanvasWidth, &mCanvasHeight); - cout - << "mCanvasWidth: " << mCanvasWidth - << " mCanvasHeight: " << mCanvasHeight - << endl; +//DEBUG cout +//DEBUG << "mCanvasWidth: " << mCanvasWidth +//DEBUG << " mCanvasHeight: " << mCanvasHeight +//DEBUG << endl; mEventsX = mLeftInfoWidth; mEventsY = mTopInfoHeight; @@ -506,17 +504,17 @@ { JZBarInfo BarInfo(mpSong); - cout - << "mCanvasWidth - mLeftInfoWidth: " << mCanvasWidth - mLeftInfoWidth << '\n' - << "BarInfo.TicksPerBar " << BarInfo.TicksPerBar << '\n' - << "From Clock: " << mFromClock << '\n' - << "To Clock: " << mToClock << '\n' - << "Clocks/Pixel: " << mClocksPerPixel << '\n' - << "From Measure: " << mFromClock / BarInfo.TicksPerBar << '\n' - << "To Measure: " << mToClock / BarInfo.TicksPerBar -// << "From X: " << mFromClock << '\n' -// << "To X: " << mToClock << '\n' - << endl; +//DEBUG cout +//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: " << mClocksPerPixel << '\n' +//DEBUG << "From Measure: " << mFromClock / BarInfo.TicksPerBar << '\n' +//DEBUG << "To Measure: " << mToClock / BarInfo.TicksPerBar +////DEBUG << "From X: " << mFromClock << '\n' +////DEBUG << "To X: " << mToClock << '\n' +//DEBUG << endl; BarInfo.SetClock(mFromClock); @@ -1171,6 +1169,14 @@ { int Width, Height; GetVirtualEventSize(Width, Height); + cout + << mScrollSize + << ' ' << mScrollSize + << ' ' << (Width + mScrollSize) / mScrollSize + << ' ' << (Height + mScrollSize) / mScrollSize + << ' ' << x + << ' ' << y + << endl; SetScrollbars( mScrollSize, mScrollSize, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-21 06:10:30
|
Revision: 348 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=348&view=rev Author: pstieber Date: 2008-03-20 23:10:27 -0700 (Thu, 20 Mar 2008) Log Message: ----------- Fixed initializer list order. Modified Paths: -------------- trunk/jazz/src/PianoWindow.cpp Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2008-03-21 05:59:20 UTC (rev 347) +++ trunk/jazz/src/PianoWindow.cpp 2008-03-21 06:10:27 UTC (rev 348) @@ -554,9 +554,11 @@ long WindowStyle) : wxScrolledWindow(pPianoFrame, wxID_ANY, Position, Size, WindowStyle), mpPianoFrame(pPianoFrame), + mpSong(pSong), mPlayClock(-1), mSnapCount(0), - mpSong(pSong), + mpMouseAction(0), + mpSnapSel(0), mpTrack(0), mTrackIndex(0), mpFilter(0), @@ -583,9 +585,7 @@ mpFixedFont(0), mFixedFontHeight(0), mpDrumFont(0), - mpSnapSel(0), mSnapDenomiator(16), - mpMouseAction(0), mVisibleKeyOn(true), mVisiblePitch(false), mVisibleController(false), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2008-03-21 05:59:25
|
Revision: 347 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=347&view=rev Author: pstieber Date: 2008-03-20 22:59:20 -0700 (Thu, 20 Mar 2008) Log Message: ----------- 1. Updated some piano window related code. 2.ade some cosmetic changes. Modified Paths: -------------- trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/ControlEdit.h Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2008-03-21 05:58:22 UTC (rev 346) +++ trunk/jazz/src/ControlEdit.cpp 2008-03-21 05:59:20 UTC (rev 347) @@ -23,7 +23,7 @@ #include "WxWidgets.h" #include "ControlEdit.h" -#include "PianoFrame.h" +#include "PianoWindow.h" #include "EventWindow.h" #include "Song.h" #include "Track.h" @@ -34,7 +34,7 @@ tCtrlEditBase::tCtrlEditBase( int min, int max, - JZPianoFrame* p, + JZPianoWindow* p, char const *label, int dx, int x, @@ -50,7 +50,7 @@ } void tCtrlEditBase::Create( - JZPianoFrame* p, + JZPianoWindow* pPianoWindow, char const *label, int dx, int x, @@ -59,7 +59,7 @@ int h) { x_off = dx; - parent = p; + mpPianoWindow = pPianoWindow; track = 0; from_clock = 0; to_clock = 1; @@ -67,7 +67,7 @@ clocks_per_pixel = 0; sticky = 1; - panel = new tCtrlPanel(this, (wxWindow*)parent, x, y, dx, h, 0, "Controller Edit"); + panel = new tCtrlPanel(this, mpPianoWindow, x, y, dx, h, 0, "Controller Edit"); //(void) new wxMessage(panel, (char *)label); //panel->NewLine(); @@ -94,7 +94,7 @@ // ab hier dient ctrlmode zur Unterscheidung zwischen // Apply und Edit. - edit = new tArrayEdit((wxFrame *)parent, array, x+dx, y, w - dx, h, 0); + edit = new tArrayEdit((wxFrame *)mpPianoWindow, array, x+dx, y, w - dx, h, 0); edit->SetLabel(label); edit->SetDrawBars(this); @@ -240,7 +240,7 @@ void tCtrlEditBase::OnApply() { wxBeginBusyCursor(); - parent->Song->NewUndoBuffer(); + mpPianoWindow->mpSong->NewUndoBuffer(); // delete old events, but skip clock 0 to preserve track defaults: // (dirty but might work...) tEventIterator iter(track); @@ -314,7 +314,7 @@ OnRevert(); // SN+ Bug Fix Controller in Piano Fenster updaten. - parent->Redraw(); + mpPianoWindow->Refresh(); } // SN++ @@ -360,7 +360,7 @@ // av: called by tArrayEdit::OnPaint void tCtrlEditBase::DrawBars(wxDC* dc) { - JZBarInfo BarInfo(parent->Song); + JZBarInfo BarInfo(mpPianoWindow->mpSong); BarInfo.SetClock(from_clock); long gclk,x; int ii; @@ -370,13 +370,13 @@ while (gclk < to_clock) { gclk = BarInfo.Clock; - x = parent->Clock2x(gclk-from_clock); + x = mpPianoWindow->Clock2x(gclk-from_clock); edit->DrawBarLine(dc, x - x_off); if (bars_state == 2) for (ii = 0; ii < BarInfo.CountsPerBar; ii++) { gclk += BarInfo.TicksPerBar / BarInfo.CountsPerBar; - x = parent->Clock2x(gclk-from_clock); + x = mpPianoWindow->Clock2x(gclk-from_clock); edit->DrawBarLine(dc, x - x_off); } BarInfo.Next(); @@ -388,14 +388,14 @@ // ------------------------------------------------------------------ tPitchEdit::tPitchEdit( - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(-8191, 8191, parent, label, xoff, x, y, w, h) + : tCtrlEditBase(-8191, 8191, pPianoWindow, label, xoff, x, y, w, h) { } @@ -423,14 +423,14 @@ tCtrlEdit::tCtrlEdit( int CtrlNum, - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(0, 127, parent, label, xoff, x, y, w, h, 1) + : tCtrlEditBase(0, 127, pPianoWindow, label, xoff, x, y, w, h, 1) { ctrl_num = CtrlNum; if (ctrl_num == 10) // panpot @@ -466,14 +466,14 @@ // ------------------------------------------------------------------ tVelocEdit::tVelocEdit( - JZPianoFrame* parent, + JZPianoWindow* pParent, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(1, 127, parent, label, xoff, x, y, w, h) + : tCtrlEditBase(1, 127, pParent, label, xoff, x, y, w, h) { sticky = 0; selectable = 1; @@ -488,18 +488,18 @@ { // SN++ Falls im PianoWin Events selektiert sind, werden nur diese // Events geaendert - if (!parent->SnapSel->Selected) + if (!mpPianoWindow->mpSnapSel->Selected) { - return (e->IsKeyOn() != 0); + return (e->IsKeyOn() != 0); } else { if (e->IsKeyOn()) { return ( - parent->mpFilter->IsSelected(e) && - (e->GetClock() >= parent->mpFilter->FromClock && - e->GetClock() <= parent->mpFilter->ToClock)); + mpPianoWindow->GetFilter()->IsSelected(e) && + (e->GetClock() >= mpPianoWindow->GetFilter()->FromClock && + e->GetClock() <= mpPianoWindow->GetFilter()->ToClock)); } } return 0; @@ -515,13 +515,14 @@ static long from_clk, to_clk; wxBeginBusyCursor(); - parent->Song->NewUndoBuffer(); + mpPianoWindow->mpSong->NewUndoBuffer(); tEventIterator iter(track); - if (parent->SnapSel->Selected) { - from_clk = parent->mpFilter->FromClock; - to_clk = parent->mpFilter->ToClock; + if (mpPianoWindow->mpSnapSel->Selected) + { + from_clk = mpPianoWindow->GetFilter()->FromClock; + to_clk = mpPianoWindow->GetFilter()->ToClock; } else { from_clk = from_clock; to_clk = to_clock; @@ -532,7 +533,7 @@ while (e) { // SN++ Falls im PianoWin Events selektiert sind, werden nur diese // Events geaendert - if (!parent->SnapSel->Selected || parent->mpFilter->IsSelected(e) ) + if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) ) { tKeyOn *k = e->IsKeyOn(); @@ -551,14 +552,22 @@ track->Cleanup(); wxEndBusyCursor(); OnRevert(); + // SN+ for Color Darstellung - parent->Redraw(); + mpPianoWindow->Refresh(); } // ------------------------------------------------------------------ -tPolyAfterEdit::tPolyAfterEdit(JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(0, 127, parent, label, xoff, x, y, w, h, 1) +tPolyAfterEdit::tPolyAfterEdit( + JZPianoWindow* pPianoWindow, + char const *label, + int xoff, + int x, + int y, + int w, + int h) + : tCtrlEditBase(0, 127, pPianoWindow, label, xoff, x, y, w, h, 1) { sticky = 0; // SN must be set for proper editing! selectable = 1; @@ -575,15 +584,15 @@ // SN++ Falls im PianoWin Events selektiert sind, werden nur diese // Events geaendert - if (!parent->SnapSel->Selected) + if (!mpPianoWindow->mpSnapSel->Selected) return e->IsKeyPressure() != 0; else if (e->IsKeyPressure()) { return ( - parent->mpFilter->IsSelected(e) && - (e->GetClock() >= parent->mpFilter->FromClock && - e->GetClock() <= parent->mpFilter->ToClock)); + mpPianoWindow->GetFilter()->IsSelected(e) && + (e->GetClock() >= mpPianoWindow->GetFilter()->FromClock && + e->GetClock() <= mpPianoWindow->GetFilter()->ToClock)); } return 0; } @@ -602,20 +611,24 @@ JZEvent *e; // SN++ Apply works only if some events are selected !! - if (!parent->SnapSel->Selected) { + if (!mpPianoWindow->mpSnapSel->Selected) + { OnRevert(); return; } wxBeginBusyCursor(); - parent->Song->NewUndoBuffer(); + mpPianoWindow->mpSong->NewUndoBuffer(); tEventIterator iter(track); - if (parent->SnapSel->Selected) { - from_clk = parent->mpFilter->FromClock; - to_clk = parent->mpFilter->ToClock; - } else { + if (mpPianoWindow->mpSnapSel->Selected) + { + from_clk = mpPianoWindow->GetFilter()->FromClock; + to_clk = mpPianoWindow->GetFilter()->ToClock; + } + else + { from_clk = from_clock; to_clk = to_clock; } @@ -626,7 +639,7 @@ // SN++ Alle selektierten AfterTouch events loeschen e = iter.Range(from_clk, to_clk); while (e) { - if (!parent->SnapSel->Selected || parent->mpFilter->IsSelected(e) ) + if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) ) { k = e->IsKeyPressure(); if (k) @@ -644,7 +657,7 @@ e = iter.Range(from_clk, to_clk); while (e) { - if (!parent->SnapSel->Selected || parent->mpFilter->IsSelected(e) ) + if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e) ) { keyon = e->IsKeyOn(); if (keyon) @@ -686,7 +699,7 @@ tKeyPressure *cpy; while (e) { - if (!parent->SnapSel->Selected || parent->mpFilter->IsSelected(e)) + if (!mpPianoWindow->mpSnapSel->Selected || mpPianoWindow->GetFilter()->IsSelected(e)) { if(e->IsKeyPressure()) { @@ -707,20 +720,20 @@ wxEndBusyCursor(); OnRevert(); // SN+ for Color Darstellung - parent->Redraw(); + mpPianoWindow->Refresh(); } // ---------------------------------------------------------------------- tChannelAfterEdit::tChannelAfterEdit( - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(0, 127, parent, label, xoff, x, y, w, h, 1) + : tCtrlEditBase(0, 127, pPianoWindow, label, xoff, x, y, w, h, 1) { } @@ -755,7 +768,7 @@ void tChannelAfterEdit::OnApply() { wxBeginBusyCursor(); - parent->Song->NewUndoBuffer(); + mpPianoWindow->mpSong->NewUndoBuffer(); // delete old events, but skip clock 0 to preserve track defaults: // (dirty but might work...) @@ -839,14 +852,14 @@ tTempoEdit::tTempoEdit( int min, int max, - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h) - : tCtrlEditBase(min, max, parent, label, xoff, x, y, w, h) + : tCtrlEditBase(min, max, pPianoWindow, label, xoff, x, y, w, h) { } Modified: trunk/jazz/src/ControlEdit.h =================================================================== --- trunk/jazz/src/ControlEdit.h 2008-03-21 05:58:22 UTC (rev 346) +++ trunk/jazz/src/ControlEdit.h 2008-03-21 05:59:20 UTC (rev 347) @@ -25,7 +25,7 @@ #include "Random.h" -class JZPianoFrame; +class JZPianoWindow; class JZTrack; class JZEvent; class tCtrlEditBase; @@ -36,10 +36,16 @@ { public: friend class tCtrlEditBase; - tCtrlPanel(tCtrlEditBase *e, wxWindow *parent, - int x=-1, int y=-1, int width=-1, int height=-1, long style=0, - char *name = "panel") - : wxPanel(parent, x, y, width, height, style, name) + tCtrlPanel( + tCtrlEditBase* e, + wxWindow* pParent, + int x=-1, + int y=-1, + int width=-1, + int height=-1, + long style=0, + char *name = "panel") + : wxPanel(pParent, x, y, width, height, style, name) { edit = e; } @@ -52,23 +58,42 @@ class tCtrlEditBase : public tArrayEditDrawBars { public: - tCtrlEditBase(int min, int max, JZPianoFrame *parent, char const *label, int xoff, int x, int y, int w, int h, int mode=0); + + tCtrlEditBase( + int min, + int max, + JZPianoWindow* pPianoWindow, + char const *label, + int xoff, + int x, + int y, + int w, + int h, + int mode = 0); + virtual ~tCtrlEditBase(); + void SetSize(int xoff, int x, int y, int w, int h); + void ReInit(JZTrack *track, long FromClock, long ClocksPerPixel); // SN++ Default = 0, 1 bedeutet der Editor arbeitet auch auf Selektionen. // Dieser Patch zusammen mit dem "selectable Patch" im PianoWin // ist for VelocEdit und AftertouchEdit Updates. int selectable; + virtual void UpDate(); -// + protected: + virtual int Missing() = 0; + virtual int IsCtrlEdit(JZEvent *e) = 0; - virtual int GetValue(JZEvent *e) = 0; - virtual JZEvent * NewEvent(long clock, int val) { return 0; } + virtual int GetValue(JZEvent *e) = 0; + + virtual JZEvent* NewEvent(long clock, int val) { return 0; } + virtual void OnApply(); virtual void OnRevert(); virtual void OnEdit(); @@ -90,12 +115,12 @@ JZRndArray array; tArrayEdit* edit; - JZPianoFrame* parent; + JZPianoWindow* mpPianoWindow; tCtrlPanel* panel; private: - void Create(JZPianoFrame* p, char const *label, int dx, int x, int y, int w, int h); + void Create(JZPianoWindow* p, char const *label, int dx, int x, int y, int w, int h); static void Apply(wxButton &but, wxCommandEvent& event); static void Revert(wxButton &but, wxCommandEvent& event); @@ -108,7 +133,7 @@ class tPitchEdit : public tCtrlEditBase { public: - tPitchEdit(JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h); + tPitchEdit(JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h); protected: virtual int Missing(); virtual int IsCtrlEdit(JZEvent *e); @@ -120,7 +145,7 @@ class tPolyAfterEdit : public tCtrlEditBase { public: - tPolyAfterEdit(JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h); + tPolyAfterEdit(JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h); protected: virtual int Missing(); virtual int IsCtrlEdit(JZEvent *e); @@ -132,7 +157,7 @@ class tChannelAfterEdit : public tCtrlEditBase { public: - tChannelAfterEdit(JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h); + tChannelAfterEdit(JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h); protected: virtual int Missing(); virtual int IsCtrlEdit(JZEvent *e); @@ -145,7 +170,7 @@ class tCtrlEdit : public tCtrlEditBase { public: - tCtrlEdit(int CtrlNum, JZPianoFrame* parent, char const *label, int xoff, int x, int y, int w, int h); + tCtrlEdit(int CtrlNum, JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, int y, int w, int h); protected: virtual int Missing(); virtual int IsCtrlEdit(JZEvent *e); @@ -160,7 +185,7 @@ public: tVelocEdit( - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const* label, int xoff, int x, @@ -183,7 +208,7 @@ tTempoEdit( int min, int max, - JZPianoFrame* parent, + JZPianoWindow* pPianoWindow, char const *label, int xoff, int x, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |