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...> - 2009-01-20 05:45:59
|
Revision: 693 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=693&view=rev Author: pstieber Date: 2009-01-20 05:45:55 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Changed state to mpState. Modified Paths: -------------- trunk/jazz/src/mswin/WindowsAudioInterface.cpp trunk/jazz/src/mswin/WindowsPlayer.cpp trunk/jazz/src/mswin/WindowsPlayer.h Modified: trunk/jazz/src/mswin/WindowsAudioInterface.cpp =================================================================== --- trunk/jazz/src/mswin/WindowsAudioInterface.cpp 2009-01-20 04:14:04 UTC (rev 692) +++ trunk/jazz/src/mswin/WindowsAudioInterface.cpp 2009-01-20 05:45:55 UTC (rev 693) @@ -152,7 +152,7 @@ mCanSynchronize(true), mpListener(0) { - state->audio_player = this; + mpState->audio_player = this; InitializeCriticalSection(&mutex); @@ -544,8 +544,8 @@ // low pass filter for time-correction (not really necessary) const long low = 50; - state->time_correction = - (low * state->time_correction + (100 - low) * (audio_now - time_now) ) / 100L; + mpState->time_correction = + (low * mpState->time_correction + (100 - low) * (audio_now - time_now) ) / 100L; } } } @@ -589,10 +589,10 @@ { long time_now = (long)timeGetTime(); long audio_now = - (long)((double)state->start_time + 1000.0 * mmtime.u.sample / mSamples.speed); + (long)((double)mpState->start_time + 1000.0 * mmtime.u.sample / mSamples.speed); // low pass filter for time-correction (not really necessary) const long low = 50; - state->time_correction = (low * state->time_correction + (100 - low) * (audio_now - time_now) ) / 100L; + mpState->time_correction = (low * mpState->time_correction + (100 - low) * (audio_now - time_now) ) / 100L; } } } @@ -616,9 +616,9 @@ delete mpListener; start_clock = Clock; - start_time = state->start_time; + start_time = mpState->start_time; - mSamples.ResetBuffers(AudioBuffer, start_clock, state->ticks_per_minute); + mSamples.ResetBuffers(AudioBuffer, start_clock, mpState->ticks_per_minute); mSamples.FillBuffers(OutClock); OpenDsp(); @@ -637,7 +637,7 @@ if (frc < start_clock) frc = start_clock; long toc = rec_info->mToClock; - long play_clock = Time2Clock(state->play_time); + long play_clock = Time2Clock(mpState->play_time); if (toc > play_clock) toc = play_clock; mSamples.SaveRecordingDlg(frc, toc, recbuffers); Modified: trunk/jazz/src/mswin/WindowsPlayer.cpp =================================================================== --- trunk/jazz/src/mswin/WindowsPlayer.cpp 2009-01-20 04:14:04 UTC (rev 692) +++ trunk/jazz/src/mswin/WindowsPlayer.cpp 2009-01-20 05:45:55 UTC (rev 693) @@ -48,21 +48,22 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZWindowsPlayer::JZWindowsPlayer(JZSong* pSong) - : JZPlayer(pSong) + : JZPlayer(pSong), + mpState(0) { poll_millisec = 25; timer_installed = FALSE; - state = NewWinPlayerState(); + mpState = NewWinPlayerState(); - state->hinp = 0; - state->hout = 0; - state->recd_buffer.clear(); - state->play_buffer.clear(); - state->thru_buffer.clear(); - state->playing = FALSE; - state->soft_thru = gpConfig->GetValue(C_SoftThru); - state->doing_mtc_rec = FALSE; - state->audio_player = 0; + mpState->hinp = 0; + mpState->hout = 0; + mpState->recd_buffer.clear(); + mpState->play_buffer.clear(); + mpState->thru_buffer.clear(); + mpState->playing = FALSE; + mpState->soft_thru = gpConfig->GetValue(C_SoftThru); + mpState->doing_mtc_rec = FALSE; + mpState->audio_player = 0; int ilong = -1, olong = -1; if ( @@ -86,28 +87,28 @@ { case CsMidi: rc = midiInOpen( - &state->hinp, + &mpState->hinp, dev, (DWORD)midiMidiInputHandler, - (DWORD)state, + (DWORD)mpState, CALLBACK_FUNCTION); break; case CsMtc: rc = midiInOpen( - &state->hinp, + &mpState->hinp, dev, (DWORD)midiMtcInputHandler, - (DWORD)state, + (DWORD)mpState, CALLBACK_FUNCTION); break; case CsInt: case CsFsk: default: rc = midiInOpen( - &state->hinp, + &mpState->hinp, dev, (DWORD)midiIntInputHandler, - (DWORD)state, + (DWORD)mpState, CALLBACK_FUNCTION); break; } @@ -126,8 +127,8 @@ if (dev == MAX_MIDI_DEVS) dev = MIDI_MAPPER; - //UINT rc = midiOutOpen(&state->hout, dev, 0L, 0L, 0L); - UINT rc = midiOutOpen(&state->hout, dev, (DWORD)MidiOutProc, (DWORD)state, CALLBACK_FUNCTION); + //UINT rc = midiOutOpen(&mpState->hout, dev, 0L, 0L, 0L); + UINT rc = midiOutOpen(&mpState->hout, dev, (DWORD)MidiOutProc, (DWORD)mpState, CALLBACK_FUNCTION); if (rc) { char errtxt[200]; @@ -141,9 +142,9 @@ TIMECAPS caps; if (timeGetDevCaps(&caps, sizeof(caps)) == 0) { - state->min_timer_period = caps.wPeriodMin; - state->max_timer_period = caps.wPeriodMax; - if (timeBeginPeriod(state->min_timer_period) == 0) + mpState->min_timer_period = caps.wPeriodMin; + mpState->max_timer_period = caps.wPeriodMax; + if (timeBeginPeriod(mpState->min_timer_period) == 0) timer_installed = TRUE; } if (!timer_installed) @@ -157,47 +158,47 @@ hSysBuf = GlobalAlloc(GMEM_SHARE | GMEM_MOVEABLE | GMEM_ZEROINIT, (DWORD)maxSysLen); pSysBuf = (unsigned char *)GlobalLock(hSysBuf); - if (state->hinp) - midiInStart(state->hinp); + if (mpState->hinp) + midiInStart(mpState->hinp); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- bool JZWindowsPlayer::IsInstalled() { - return timer_installed && state->hout; + return timer_installed && mpState->hout; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZWindowsPlayer::~JZWindowsPlayer() { - if (state->hinp) + if (mpState->hinp) { - midiInReset(state->hinp); - midiInClose(state->hinp); + midiInReset(mpState->hinp); + midiInClose(mpState->hinp); } - if (state->hout) + if (mpState->hout) { - midiOutReset(state->hout); - midiOutClose(state->hout); + midiOutReset(mpState->hout); + midiOutClose(mpState->hout); } if (timer_installed) - timeEndPeriod(state->min_timer_period); + timeEndPeriod(mpState->min_timer_period); GlobalUnlock(hSysHdr); GlobalFree(hSysHdr); GlobalUnlock(hSysBuf); GlobalFree(hSysBuf); - DeleteWinPlayerState(state); + DeleteWinPlayerState(mpState); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZWindowsPlayer::SetSoftThru(int on, int InputDevice, int OutputDevice) { - state->soft_thru = on; + mpState->soft_thru = on; } //----------------------------------------------------------------------------- @@ -361,21 +362,21 @@ //----------------------------------------------------------------------------- long JZWindowsPlayer::Clock2Time(long clock) { - if (clock < state->start_clock) - return state->start_time; - return (long)( (double)(clock - state->start_clock) * 60000.0 / - (double)state->ticks_per_minute + state->start_time); + if (clock < mpState->start_clock) + return mpState->start_time; + return (long)( (double)(clock - mpState->start_clock) * 60000.0 / + (double)mpState->ticks_per_minute + mpState->start_time); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- long JZWindowsPlayer::Time2Clock(long time) { - if (time < state->start_time) - return state->start_clock; + if (time < mpState->start_time) + return mpState->start_clock; return (long)( - (double)(time - state->start_time) * (double)state->ticks_per_minute / 60000.0 + - state->start_clock); + (double)(time - mpState->start_time) * (double)mpState->ticks_per_minute / 60000.0 + + mpState->start_clock); } //----------------------------------------------------------------------------- @@ -383,18 +384,18 @@ void JZWindowsPlayer::SetTempo(long bpm, long clock) { long t1 = Clock2Time(clock); - state->ticks_per_minute = (long)bpm * (long)Song->GetTicksPerQuarter(); + mpState->ticks_per_minute = (long)bpm * (long)Song->GetTicksPerQuarter(); long t2 = Clock2Time(clock); - state->start_time += (t1 - t2); + mpState->start_time += (t1 - t2); } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- long JZWindowsPlayer::RealTimeClock2Time(long clock) { - if (clock < state->start_clock) + if (clock < mpState->start_clock) return real_start_time; - return (long)( (double)(clock - state->start_clock) * 60000.0 / (double)real_ticks_per_minute + real_start_time); + return (long)( (double)(clock - mpState->start_clock) * 60000.0 / (double)real_ticks_per_minute + real_start_time); } //----------------------------------------------------------------------------- @@ -402,8 +403,8 @@ long JZWindowsPlayer::Time2RealTimeClock(long time) { if (time < real_start_time) - return state->start_clock; - return (long)((double)(time - real_start_time) * (double)real_ticks_per_minute / 60000.0 + state->start_clock); + return mpState->start_clock; + return (long)((double)(time - real_start_time) * (double)real_ticks_per_minute / 60000.0 + mpState->start_clock); } //----------------------------------------------------------------------------- @@ -424,14 +425,14 @@ if (sx == 0) return 1; - if (state->play_buffer.nfree() < 2) + if (mpState->play_buffer.nfree() < 2) return 1; - state->sysex_found = TRUE; - tWinSysexBuffer *buf = state->osx_buffers->AllocBuffer(); - buf->PrepareOut(state->hout, sx->GetData(), sx->GetLength() - 1); - state->play_buffer.put(SYSEX_EVENT, time); - state->play_buffer.put((DWORD)buf, time); + mpState->sysex_found = TRUE; + tWinSysexBuffer *buf = mpState->osx_buffers->AllocBuffer(); + buf->PrepareOut(mpState->hout, sx->GetData(), sx->GetLength() - 1); + mpState->play_buffer.put(SYSEX_EVENT, time); + mpState->play_buffer.put((DWORD)buf, time); return 0; } @@ -442,7 +443,7 @@ DWORD d = Event2Dword(pEvent); if (d) { - state->play_buffer.put(d, Clock2Time(pEvent->GetClock())); + mpState->play_buffer.put(d, Clock2Time(pEvent->GetClock())); } else if (pEvent->IsSysEx() && (pEvent->GetClock() > 0)) { @@ -458,7 +459,7 @@ DWORD d = Event2Dword(pEvent); if (d) { - state->play_buffer.put(d, pEvent->GetClock()); + mpState->play_buffer.put(d, pEvent->GetClock()); } else if (pEvent->IsSysEx() && (pEvent->GetClock() > 0)) { @@ -475,11 +476,11 @@ DWORD d = Event2Dword(pEvent); if (d) { - midiOutShortMsg(state->hout, d); + midiOutShortMsg(mpState->hout, d); } else if (pEvent->GetStat() == StatSetTempo) { - if (state->playing) + if (mpState->playing) { SetTempo(pEvent->IsSetTempo()->GetBPM(), OutClock); } @@ -496,11 +497,11 @@ pSysHdr->dwBufferLength = s->GetDataLength() + 1; pSysHdr->dwUser = 0; - if (midiOutPrepareHeader(state->hout, pSysHdr, sizeof(MIDIHDR)) == 0) - midiOutLongMsg(state->hout, pSysHdr, sizeof(MIDIHDR)); + if (midiOutPrepareHeader(mpState->hout, pSysHdr, sizeof(MIDIHDR)) == 0) + midiOutLongMsg(mpState->hout, pSysHdr, sizeof(MIDIHDR)); // here we should wait, until the data are physically sent. // but there is no API call for this?! - midiOutUnprepareHeader(state->hout, pSysHdr, sizeof(MIDIHDR)); + midiOutUnprepareHeader(mpState->hout, pSysHdr, sizeof(MIDIHDR)); } } } @@ -524,7 +525,7 @@ { tMidiClock* pEvent = new tMidiClock(midiClockOut); mPlayBuffer.Put(pEvent); - midiClockOut = midiClockOut + state->ticks_per_signal; + midiClockOut = midiClockOut + mpState->ticks_per_signal; } mPlayBuffer.Sort(); } @@ -540,7 +541,7 @@ } else { - state->play_buffer.put(0, Clock2Time(clock)); + mpState->play_buffer.put(0, Clock2Time(clock)); } } @@ -555,7 +556,7 @@ } else { - state->play_buffer.put(0, clock); + mpState->play_buffer.put(0, clock); } } @@ -595,51 +596,51 @@ //----------------------------------------------------------------------------- void JZWindowsPlayer::StartPlay(long Clock, long LoopClock, int Continue) { - state->play_buffer.clear(); - state->recd_buffer.clear(); - state->sysex_found = FALSE; + mpState->play_buffer.clear(); + mpState->recd_buffer.clear(); + mpState->sysex_found = FALSE; - state->ticks_per_minute = Song->GetTicksPerQuarter() * Song->Speed(); - real_ticks_per_minute = state->ticks_per_minute; - state->ticks_per_signal = Song->GetTicksPerQuarter() / 24; - state->time_per_tick = 60000000L / state->ticks_per_minute; - state->time_correction = 0; + mpState->ticks_per_minute = Song->GetTicksPerQuarter() * Song->Speed(); + real_ticks_per_minute = mpState->ticks_per_minute; + mpState->ticks_per_signal = Song->GetTicksPerQuarter() / 24; + mpState->time_per_tick = 60000000L / mpState->ticks_per_minute; + mpState->time_correction = 0; if (gpConfig->GetValue(C_ClockSource) == CsMtc) { - if (state->doing_mtc_rec) + if (mpState->doing_mtc_rec) { Clock = 0; } if (!Continue) { tMtcTime *offs = Song->GetTrack(0)->GetMtcOffset(); - state->start_time = offs->ToMillisec(); - real_start_time = state->start_time; - state->mtc_start.type = offs->type; + mpState->start_time = offs->ToMillisec(); + real_start_time = mpState->start_time; + mpState->mtc_start.type = offs->type; delete offs; - state->start_clock = 0; + mpState->start_clock = 0; } } else { - state->start_time = (long)timeGetTime() + 500; - real_start_time = state->start_time; - state->start_clock = Clock; + mpState->start_time = (long)timeGetTime() + 500; + real_start_time = mpState->start_time; + mpState->start_clock = Clock; } - state->play_time = state->start_time; + mpState->play_time = mpState->start_time; midiClockOut = Clock; if (GetAudioEnabled()) - state->play_buffer.put(START_AUDIO, state->start_time); + mpState->play_buffer.put(START_AUDIO, mpState->start_time); OutOfBandEvents.Clear(); JZProjectManager::Instance()->NewPlayPosition( PlayLoop->Ext2IntClock(Clock)); - state->playing = TRUE; // allow for SetTempo in OutNow() + mpState->playing = TRUE; // allow for SetTempo in OutNow() JZPlayer::StartPlay(Clock, LoopClock, Continue); if (gpConfig->GetValue(C_RealTimeOut)) @@ -661,46 +662,46 @@ switch (gpConfig->GetValue(C_ClockSource)) { case CsMidi: - state->virtual_clock = Clock - state->ticks_per_signal; - state->signal_time = state->start_time - 5000L; - // state->playing = TRUE; - timeSetEvent(state->min_timer_period, state->min_timer_period, midiMidiTimerHandler, (DWORD)state, TIME_ONESHOT); + mpState->virtual_clock = Clock - mpState->ticks_per_signal; + mpState->signal_time = mpState->start_time - 5000L; + // mpState->playing = TRUE; + timeSetEvent(mpState->min_timer_period, mpState->min_timer_period, midiMidiTimerHandler, (DWORD)mpState, TIME_ONESHOT); break; case CsMtc: if (!Continue) { // In microseconds: 1 sec / frames_per_sec - switch (state->mtc_start.type) + switch (mpState->mtc_start.type) { case 0: - state->time_per_frame = 1000000 / 24; + mpState->time_per_frame = 1000000 / 24; break; case 1: - state->time_per_frame = 1000000 / 25; + mpState->time_per_frame = 1000000 / 25; break; case 2: case 3: - state->time_per_frame = 1000000 / 30; + mpState->time_per_frame = 1000000 / 30; break; } - state->signal_time = 0; - state->mtc_valid = FALSE; - state->last_qfm = 0; - state->qfm_bits = 0; + mpState->signal_time = 0; + mpState->mtc_valid = FALSE; + mpState->last_qfm = 0; + mpState->qfm_bits = 0; lastValidMtcClock = Clock; } - // state->playing = TRUE; - timeSetEvent(state->min_timer_period, state->min_timer_period, midiMtcTimerHandler, (DWORD)state, TIME_ONESHOT); + // mpState->playing = TRUE; + timeSetEvent(mpState->min_timer_period, mpState->min_timer_period, midiMtcTimerHandler, (DWORD)mpState, TIME_ONESHOT); break; case CsInt: case CsFsk: default: - // state->playing = TRUE; + // mpState->playing = TRUE; timeSetEvent( - state->min_timer_period, - state->min_timer_period, + mpState->min_timer_period, + mpState->min_timer_period, midiIntTimerHandler, - (DWORD)state, + (DWORD)mpState, TIME_ONESHOT); break; } @@ -712,7 +713,7 @@ void JZWindowsPlayer::StopPlay() { wxBeginBusyCursor(); - state->playing = FALSE; + mpState->playing = FALSE; JZPlayer::StopPlay(); if (gpConfig->GetValue(C_RealTimeOut)) { @@ -721,39 +722,39 @@ delete pEvent; } AllNotesOff(); - RecdBuffer.Keyoff2Length(); + mRecdBuffer.Keyoff2Length(); - if (state->hout) + if (mpState->hout) { - if (state->sysex_found) - midiOutReset(state->hout); - int n = state->osx_buffers->Size(); + if (mpState->sysex_found) + midiOutReset(mpState->hout); + int n = mpState->osx_buffers->Size(); for (int i = 0; i < n; ++i) { - tWinSysexBuffer *buf = state->osx_buffers->At(i); + tWinSysexBuffer *buf = mpState->osx_buffers->At(i); if (buf->IsPrepared()) { - buf->UnprepareOut(state->hout); + buf->UnprepareOut(mpState->hout); } } - state->osx_buffers->ReleaseAllBuffers(); + mpState->osx_buffers->ReleaseAllBuffers(); } /* // sysex recording not finished yet. - if (state->hinp) + if (mpState->hinp) { - midiInReset(state->hinp); - int n = state->isx_buffers->Size(); + midiInReset(mpState->hinp); + int n = mpState->isx_buffers->Size(); for (int i = 0; i < n; ++i) { - tWinSysexBuffer *buf = state->isx_buffers->At(i); + tWinSysexBuffer *buf = mpState->isx_buffers->At(i); if (buf->IsPrepared()) { - buf->UnprepareIn(state->hinp); + buf->UnprepareIn(mpState->hinp); } - state->isx_buffers->ReleaseAllBuffers(); + mpState->isx_buffers->ReleaseAllBuffers(); } } */ @@ -797,20 +798,20 @@ //----------------------------------------------------------------------------- long JZWindowsIntPlayer::GetRealTimeClock() { - while (!state->recd_buffer.empty()) + while (!mpState->recd_buffer.empty()) { - midi_event *m = state->recd_buffer.get(); + midi_event *m = mpState->recd_buffer.get(); // Event? JZEvent* pEvent = Dword2Event(m->data); if (pEvent) { pEvent->SetClock(PlayLoop->Ext2IntClock(Time2RealTimeClock(m->ref))); - RecdBuffer.Put(pEvent); + mRecdBuffer.Put(pEvent); } } - long clock = Time2RealTimeClock( (long)timeGetTime() + state->time_correction ); + long clock = Time2RealTimeClock( (long)timeGetTime() + mpState->time_correction ); JZProjectManager::Instance()->NewPlayPosition( PlayLoop->Ext2IntClock(clock / 48 * 48)); @@ -844,9 +845,9 @@ { long clock; - while (!state->recd_buffer.empty()) + while (!mpState->recd_buffer.empty()) { - midi_event *m = state->recd_buffer.get(); + midi_event *m = mpState->recd_buffer.get(); if (m->data == 0xfc) { // Stop play received @@ -874,19 +875,19 @@ if (pEvent) { pEvent->SetClock(PlayLoop->Ext2IntClock(m->ref)); - RecdBuffer.Put(pEvent); + mRecdBuffer.Put(pEvent); } } - long delta_clock = (((long)timeGetTime() - state->signal_time) * 1000L) / state->time_per_tick; + long delta_clock = (((long)timeGetTime() - mpState->signal_time) * 1000L) / mpState->time_per_tick; - if (delta_clock > (2 * state->ticks_per_signal)) + if (delta_clock > (2 * mpState->ticks_per_signal)) { - clock = state->virtual_clock; + clock = mpState->virtual_clock; } else { - clock = state->virtual_clock + delta_clock; + clock = mpState->virtual_clock + delta_clock; } JZProjectManager::Instance()->NewPlayPosition( @@ -901,9 +902,9 @@ { long clock; - while (!state->recd_buffer.empty()) + while (!mpState->recd_buffer.empty()) { - midi_event *m = state->recd_buffer.get(); + midi_event *m = mpState->recd_buffer.get(); if (m->data == 0xf1) { // MTC starting (from midi input handler) @@ -919,29 +920,29 @@ if (pEvent) { pEvent->SetClock(PlayLoop->Ext2IntClock(Time2Clock(m->ref))); - RecdBuffer.Put(pEvent); + mRecdBuffer.Put(pEvent); } } - if (state->mtc_valid) + if (mpState->mtc_valid) { - if ( ((long)timeGetTime() - state->signal_time) > 500 ) + if ( ((long)timeGetTime() - mpState->signal_time) > 500 ) { /* Assume tape stopped */ disable(); - state->mtc_valid = 0; - state->qfm_bits = 0; + mpState->mtc_valid = 0; + mpState->qfm_bits = 0; enable(); AllNotesOff(); return( -1 ); } - if (state->doing_mtc_rec) + if (mpState->doing_mtc_rec) { clock = 0; } else { - clock = Time2Clock( GetMtcTime( state ) ); + clock = Time2Clock( GetMtcTime( mpState ) ); } lastValidMtcClock = clock; } @@ -980,7 +981,7 @@ //----------------------------------------------------------------------------- void JZWindowsMtcPlayer::InitMtcRec() { - state->doing_mtc_rec = TRUE; + mpState->doing_mtc_rec = TRUE; StartPlay( 0, 0, 0 ); } @@ -989,10 +990,10 @@ tMtcTime* JZWindowsMtcPlayer::FreezeMtcRec() { StopPlay(); - state->doing_mtc_rec = FALSE; + mpState->doing_mtc_rec = FALSE; return(new tMtcTime( - (long) GetMtcTime(state), - (tMtcType) state->mtc_start.type)); + (long) GetMtcTime(mpState), + (tMtcType) mpState->mtc_start.type)); } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/mswin/WindowsPlayer.h =================================================================== --- trunk/jazz/src/mswin/WindowsPlayer.h 2009-01-20 04:14:04 UTC (rev 692) +++ trunk/jazz/src/mswin/WindowsPlayer.h 2009-01-20 05:45:55 UTC (rev 693) @@ -69,7 +69,7 @@ protected: - tWinPlayerState* state; + tWinPlayerState* mpState; DWORD Event2Dword(JZEvent *e); JZEvent* Dword2Event(DWORD dw); long Clock2Time(long clock); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-20 04:14:10
|
Revision: 692 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=692&view=rev Author: pstieber Date: 2009-01-20 04:14:04 +0000 (Tue, 20 Jan 2009) Log Message: ----------- 1. Put the proper controls in the new shift dialog. 2. Made the event frame usable by derived classes and started leaning up this class. Most of the stuff that is in it should be in the event window class, but the old dialogs still rely on the code being there. 3. Added event shift handling to the event window. 4. Changed or removed comments in the piano window header. 5. Changed tSynthSysex::Reset() to tSynthSysex::CreateResetEvent(). 6. Attempted to prevent leaks in the player code when reset is sent. 7. Cleared all of the tracks in JZSong::Clear. 8. Changed e to pEvent in the track code and changed Reset to mpReset. 9. Deleted mpReset in JZTrack::Clear. 10. Fixed a leak in the track code by using a local instance of tJazzMeta. 11. Derived JZTrackFrame form JZEventFrame and let the base class deal with shift event handling. Modified Paths: -------------- trunk/jazz/src/Dialogs/ShiftDialog.cpp trunk/jazz/src/Dialogs/ShiftDialog.h trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h trunk/jazz/src/EventWindow.cpp trunk/jazz/src/PianoWindow.h trunk/jazz/src/Player.cpp trunk/jazz/src/Song.cpp trunk/jazz/src/Synth.h trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h Modified: trunk/jazz/src/Dialogs/ShiftDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -23,16 +23,13 @@ #include "../Command.h" #include "../Filter.h" #include "../ProjectManager.h" -#include "IntegerEdit.h" #include <wx/button.h> -#include <wx/checkbox.h> -#include <wx/msgdlg.h> #include <wx/sizer.h> +#include <wx/slider.h> #include <wx/stattext.h> -#include <wx/textctrl.h> -#include <string> +#include <sstream> using namespace std; @@ -51,92 +48,25 @@ JZShiftDialog::JZShiftDialog( JZEventWindow& EventWindow, JZFilter& Filter, + int Unit, + int& Shift, wxWindow* pParent) : wxDialog(pParent, wxID_ANY, wxString("Shift")), mFilter(Filter), - mpFromTimeEdit(0), - mpToTimeEdit(0), - mpFromTrackEdit(0), - mpToTrackEdit(0), - mpNoteCheckBox(0), - mpNoteMinEdit(0), - mpNoteMaxEdit(0), - mpPolyAftertouchCheckBox(0), - mpPolyAftertouchMinEdit(0), - mpPolyAftertouchMaxEdit(0), - mpControllerCheckBox(0), - mpControllerMinEdit(0), - mpControllerMaxEdit(0), - mpPatchCheckBox(0), - mpPatchMinEdit(0), - mpPatchMaxEdit(0), - mpPitchCheckBox(0), - mpPitchMinEdit(0), - mpPitchMaxEdit(0), - mpMeterCheckBox(0), - mpChannelAftertouchCheckBox(0), - mpSysExCheckBox(0), - mpOtherBox(0) + mUnit(Unit), + mShift(Shift), + mpStepsSlider(0) { - mpFromTimeEdit = new wxTextCtrl(this, wxID_ANY); - mpToTimeEdit = new wxTextCtrl(this, wxID_ANY); + mpStepsSlider = new wxSlider( + this, + wxID_ANY, + mShift, + -16, + 16, + wxDefaultPosition, + wxDefaultSize, + wxSL_LABELS | wxSL_BOTTOM); - mpFromTrackEdit = new JZIntegerEdit(this, wxID_ANY); - mpFromTrackEdit->SetValueName("FromTrack"); - mpFromTrackEdit->SetMinAndMax(1, 127); - mpToTrackEdit = new JZIntegerEdit(this, wxID_ANY); - mpToTrackEdit->SetValueName("To Track"); - mpToTrackEdit->SetMinAndMax(1, 127); - - mpNoteCheckBox = new wxCheckBox(this, wxID_ANY, "Note"); - mpNoteMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpNoteMinEdit->SetValueName("Note Minimum"); - mpNoteMinEdit->SetMinAndMax(0, 127); - mpNoteMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpNoteMaxEdit->SetValueName("Note Maximum"); - mpNoteMaxEdit->SetMinAndMax(0, 127); - - mpPolyAftertouchCheckBox = new wxCheckBox(this, wxID_ANY, "Poly Aftertouch"); - mpPolyAftertouchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPolyAftertouchMinEdit->SetValueName("Poly Aftertouch Minimum"); - mpPolyAftertouchMinEdit->SetMinAndMax(0, 127); - mpPolyAftertouchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPolyAftertouchMaxEdit->SetValueName("Poly Aftertouch Maximum"); - mpPolyAftertouchMaxEdit->SetMinAndMax(0, 127); - - mpControllerCheckBox = new wxCheckBox(this, wxID_ANY, "Controller"); - mpControllerMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpControllerMinEdit->SetValueName("Controller Minimum"); - mpControllerMinEdit->SetMinAndMax(0, 127); - mpControllerMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpControllerMaxEdit->SetValueName("Controller Maximum"); - mpControllerMaxEdit->SetMinAndMax(0, 127); - - mpPatchCheckBox = new wxCheckBox(this, wxID_ANY, "Patch"); - mpPatchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPatchMinEdit->SetValueName("Patch Minimum"); - mpPatchMinEdit->SetMinAndMax(0, 127); - mpPatchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPatchMaxEdit->SetValueName("Patch Maximum"); - mpPatchMaxEdit->SetMinAndMax(0, 127); - - mpPitchCheckBox = new wxCheckBox(this, wxID_ANY, "Pitch"); - mpPitchMinEdit = new JZIntegerEdit(this, wxID_ANY); - mpPitchMinEdit->SetValueName("Pitch Minimum"); - mpPitchMinEdit->SetMinAndMax(-8192, 8192); - mpPitchMaxEdit = new JZIntegerEdit(this, wxID_ANY); - mpPitchMaxEdit->SetValueName("Pitch Maximum"); - mpPitchMaxEdit->SetMinAndMax(-8192, 8192); - - mpMeterCheckBox = new wxCheckBox(this, wxID_ANY, "Meter"); - - mpChannelAftertouchCheckBox = - new wxCheckBox(this, wxID_ANY, "Channel Aftertouch"); - - mpSysExCheckBox = new wxCheckBox(this, wxID_ANY, "SysEx"); - - mpOtherBox = new wxCheckBox(this, wxID_ANY, "Other"); - wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); @@ -144,167 +74,23 @@ wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL); - wxFlexGridSizer* pFlexGridSizer; - - pFlexGridSizer = new wxFlexGridSizer(2, 4, 4, 2); - - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "From Time:"), + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, "Shift events left or right"), 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpFromTimeEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "To Time:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpToTimeEdit, - 0, - wxALIGN_CENTER_VERTICAL); + wxCENTER | wxALL, + 5); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "From Track:"), + ostringstream Oss; + Oss << "Snap is currently " << mUnit << " clocks"; + pTopSizer->Add( + new wxStaticText(this, wxID_ANY, Oss.str().c_str()), 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpFromTrackEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "To Track:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpToTrackEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 10); - - pFlexGridSizer = new wxFlexGridSizer(5, 5, 4, 2); - - pFlexGridSizer->Add( - mpNoteCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpNoteMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpNoteMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPolyAftertouchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPolyAftertouchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPolyAftertouchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpControllerCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpControllerMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpControllerMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPatchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPatchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPatchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pFlexGridSizer->Add( - mpPitchCheckBox, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Min:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPitchMinEdit, - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - new wxStaticText(this, wxID_ANY, "Max:"), - 0, - wxALIGN_CENTER_VERTICAL); - pFlexGridSizer->Add( - mpPitchMaxEdit, - 0, - wxALIGN_CENTER_VERTICAL); - - pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 10); - + wxCENTER | wxALL, + 5); wxBoxSizer* pCheckBoxSizer = new wxBoxSizer(wxHORIZONTAL); - pCheckBoxSizer->Add(mpMeterCheckBox, 0, wxALL, 5); + pTopSizer->Add(mpStepsSlider, 0, wxCENTER | wxALL, 5); - pCheckBoxSizer->Add(mpChannelAftertouchCheckBox, 0, wxALL, 5); - - pCheckBoxSizer->Add(mpSysExCheckBox, 0, wxALL, 5); - - pCheckBoxSizer->Add(mpOtherBox, 0, wxALL, 5); - - pTopSizer->Add(pCheckBoxSizer, 0, wxCENTER | wxALL, 5); - wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); pButtonSizer->Add(pOkButton, 0, wxALL, 5); pButtonSizer->Add(pCancelButton, 0, wxALL, 5); @@ -323,53 +109,6 @@ //----------------------------------------------------------------------------- bool JZShiftDialog::TransferDataToWindow() { - string TimeString; - - mFilter.GenerateFromTimeString(TimeString); - mpFromTimeEdit->ChangeValue(TimeString); - - mFilter.GenerateToTimeString(TimeString); - mpToTimeEdit->ChangeValue(TimeString); - - mpFromTrackEdit->SetNumber(mFilter.GetFromTrack()); - mpToTrackEdit->SetNumber(mFilter.GetToTrack()); - - bool Selected; - int FromValue, ToValue; - - mFilter.GetFilterEvent(eFilterKeyOn, Selected, FromValue, ToValue); - mpNoteCheckBox->SetValue(Selected); - mpNoteMinEdit->SetNumber(FromValue); - mpNoteMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterKeyPressure, Selected, FromValue, ToValue); - mpPolyAftertouchCheckBox->SetValue(Selected); - mpPolyAftertouchMinEdit->SetNumber(FromValue); - mpPolyAftertouchMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterControl, Selected, FromValue, ToValue); - mpControllerCheckBox->SetValue(Selected); - mpControllerMinEdit->SetNumber(FromValue); - mpControllerMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterProgram, Selected, FromValue, ToValue); - mpPatchCheckBox->SetValue(Selected); - mpPatchMinEdit->SetNumber(FromValue); - mpPatchMaxEdit->SetNumber(ToValue); - - mFilter.GetFilterEvent(eFilterPitch, Selected, FromValue, ToValue); - mpPitchCheckBox->SetValue(Selected); - mpPitchMinEdit->SetNumber(FromValue); - mpPitchMaxEdit->SetNumber(ToValue); - - mpMeterCheckBox->SetValue(mFilter.GetFilterMeter()); - - mpChannelAftertouchCheckBox->SetValue(mFilter.GetFilterChannelAftertouch()); - - mpSysExCheckBox->SetValue(mFilter.GetFilterSysEx()); - - mpOtherBox->SetValue(mFilter.GetFilterOther()); - return true; } @@ -377,171 +116,14 @@ //----------------------------------------------------------------------------- bool JZShiftDialog::TransferDataFromWindow() { - int FromTrack, ToTrack; - int NoteMin, NoteMax; - int PolyAftertouchMin, PolyAftertouchMax; - int ControllerMin, ControllerMax; - int PatchMin, PatchMax; - int PitchMin, PitchMax; + mShift = mpStepsSlider->GetValue(); - if ( - mpFromTrackEdit->GetNumber(FromTrack) && - mpToTrackEdit->GetNumber(ToTrack) && - mpNoteMinEdit->GetNumber(NoteMin) && - mpNoteMaxEdit->GetNumber(NoteMax) && - mpPolyAftertouchMinEdit->GetNumber(PolyAftertouchMin) && - mpPolyAftertouchMaxEdit->GetNumber(PolyAftertouchMax) && - mpControllerMinEdit->GetNumber(ControllerMin) && - mpControllerMaxEdit->GetNumber(ControllerMax) && - mpPatchMinEdit->GetNumber(PatchMin) && - mpPatchMaxEdit->GetNumber(PatchMax) && - mpPitchMinEdit->GetNumber(PitchMin) && - mpPitchMaxEdit->GetNumber(PitchMax)) - { - if (FromTrack > ToTrack) - { - ::wxMessageBox( - "The From Track must be less than or equal to the To Track", - "Invalid Track Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpFromTrackEdit->SetFocus(); - - return false; - } - - if (NoteMin > NoteMax) - { - ::wxMessageBox( - "The Minimum Note must be less than or equal to the Maximum Note", - "Invalid Note Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpNoteMinEdit->SetFocus(); - - return false; - } - - if (PolyAftertouchMin > PolyAftertouchMax) - { - ::wxMessageBox( - "The Minimum Poly Aftertouch must be less than or equal to the Maximum" - " Poly Aftertouch", - "Invalid Poly Aftertouch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPolyAftertouchMinEdit->SetFocus(); - - return false; - } - - if (ControllerMin > ControllerMax) - { - ::wxMessageBox( - "The Minimum Controller must be less than or equal to the Maximum" - " Controller", - "Invalid Controller Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpControllerMinEdit->SetFocus(); - - return false; - } - - if (PatchMin > PatchMax) - { - ::wxMessageBox( - "The Minimum Patch must be less than or equal to the Maximum Patch", - "Invalid Patch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPatchMinEdit->SetFocus(); - - return false; - } - - if (PitchMin > PitchMax) - { - ::wxMessageBox( - "The Minimum Pitch must be less than or equal to the Maximum Pitch", - "Invalid Pitch Values", - wxOK | wxICON_EXCLAMATION, - this); - - mpPitchMinEdit->SetFocus(); - - return false; - } - - string TimeString; - - TimeString = mpFromTimeEdit->GetValue(); - mFilter.SetFromTime(TimeString); - - TimeString = mpToTimeEdit->GetValue(); - mFilter.SetToTime(TimeString); - - mFilter.SetFromTrack(FromTrack); - mFilter.SetToTrack(ToTrack); - - mFilter.SetFilterEvent( - eFilterKeyOn, - mpNoteCheckBox->GetValue(), - NoteMin, - NoteMax); - - mFilter.SetFilterEvent( - eFilterKeyPressure, - mpPolyAftertouchCheckBox->GetValue(), - PolyAftertouchMin, - PolyAftertouchMax); - - mFilter.SetFilterEvent( - eFilterControl, - mpControllerCheckBox->GetValue(), - ControllerMin, - ControllerMax); - - mFilter.SetFilterEvent( - eFilterProgram, - mpPatchCheckBox->GetValue(), - PatchMin, - PatchMax); - - mFilter.SetFilterEvent( - eFilterPitch, - mpPitchCheckBox->GetValue(), - PitchMin, - PitchMax); - - mFilter.SetFilterMeter(mpMeterCheckBox->GetValue()); - - mFilter.SetFilterChannelAftertouch( - mpChannelAftertouchCheckBox->GetValue()); - - mFilter.SetFilterSysEx(mpSysExCheckBox->GetValue()); - - mFilter.SetFilterOther(mpOtherBox->GetValue()); - -// tCmdShift ShiftCommand(&mFilter, mSteps * mUnit); -// ShiftCommand.Execute(); - - JZProjectManager::Instance()->UpdateAllViews(); - - return true; - } - - return false; + return true; } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZShiftDialog::OnHelp(wxCommandEvent& Event) { -// gpHelpInstance->ShowTopic("Filter Dialog"); +// gpHelpInstance->ShowTopic("Shift Dialog"); } Modified: trunk/jazz/src/Dialogs/ShiftDialog.h =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-20 04:14:04 UTC (rev 692) @@ -28,6 +28,7 @@ class JZIntegerEdit; class wxCheckBox; class wxTextCtrl; +class wxSlider; //***************************************************************************** //***************************************************************************** @@ -38,6 +39,8 @@ JZShiftDialog( JZEventWindow& EventWindow, JZFilter& Filter, + int Unit, + int& Shift, wxWindow* pParent); private: @@ -51,41 +54,11 @@ private: JZFilter& mFilter; + int mUnit; + int& mShift; - wxTextCtrl* mpFromTimeEdit; - wxTextCtrl* mpToTimeEdit; + wxSlider* mpStepsSlider; - JZIntegerEdit* mpFromTrackEdit; - JZIntegerEdit* mpToTrackEdit; - - wxCheckBox* mpNoteCheckBox; - JZIntegerEdit* mpNoteMinEdit; - JZIntegerEdit* mpNoteMaxEdit; - - wxCheckBox* mpPolyAftertouchCheckBox; - JZIntegerEdit* mpPolyAftertouchMinEdit; - JZIntegerEdit* mpPolyAftertouchMaxEdit; - - wxCheckBox* mpControllerCheckBox; - JZIntegerEdit* mpControllerMinEdit; - JZIntegerEdit* mpControllerMaxEdit; - - wxCheckBox* mpPatchCheckBox; - JZIntegerEdit* mpPatchMinEdit; - JZIntegerEdit* mpPatchMaxEdit; - - wxCheckBox* mpPitchCheckBox; - JZIntegerEdit* mpPitchMinEdit; - JZIntegerEdit* mpPitchMaxEdit; - - wxCheckBox* mpMeterCheckBox; - - wxCheckBox* mpChannelAftertouchCheckBox; - - wxCheckBox* mpSysExCheckBox; - - wxCheckBox* mpOtherBox; - DECLARE_EVENT_TABLE(); }; Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventFrame.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -26,23 +26,20 @@ EVT_UPDATE_UI(ID_SHIFT, JZEventFrame::OnUpdateEditShift) EVT_MENU(ID_SHIFT, JZEventFrame::OnEditShift) - EVT_SIZE(JZEventFrame::OnSize) - END_EVENT_TABLE() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZEventFrame::JZEventFrame( - JZEventWindow* pEventWindow, + wxWindow* pParent, const wxString& Title, JZSong* pSong, const wxPoint& Position, - const wxSize& Size) - : wxFrame(pEventWindow, wxID_ANY, Title, Position, Size), + const wxSize& Size, + long WindowStyle) + : wxFrame(pParent, wxID_ANY, Title, Position, Size, WindowStyle), Song(pSong), mpFilter(0), - mpFixedFont(0), - hFixedFont(0), mTrackHeight(0), mTopInfoHeight(40), FontSize(12), @@ -67,7 +64,7 @@ mpToolBar(0), mpGreyColor(0), mpGreyBrush(0), - mpEventWindow(pEventWindow) + mpEventWindow(0) { #ifdef __WXMSW__ mpGreyColor = new wxColor(192, 192, 192); @@ -88,8 +85,6 @@ delete mpFilter; - delete mpFixedFont; - delete mpToolBar; if (MixerForm) @@ -99,127 +94,40 @@ } //----------------------------------------------------------------------------- +// Description: +// Register the event window with the frame. //----------------------------------------------------------------------------- -void JZEventFrame::CreateMenu() +void JZEventFrame::SetEventWindow(JZEventWindow* pEventWindow) { + mpEventWindow = pEventWindow; } - //----------------------------------------------------------------------------- -// create the canvas component(used for differently dependingon the subclass) -// size it to the client area of the frame(frame size minus toolbar and menus ) //----------------------------------------------------------------------------- -//void JZEventFrame::CreateCanvas() -//{ -// cout << "CreateCanvas" << endl; -// int Width, Height; -// GetClientSize(&Width, &Height); -// mpEventWindow = new JZEventWindow(this, 0, 0, Width, Height); -//} - -/** -second phase of creation. make menus, the canvas, and so on -*/ -void JZEventFrame::Create() -{ - CreateMenu(); - - Setup(); -} - -//----------------------------------------------------------------------------- -// Initialize the constants used in drawing. -//----------------------------------------------------------------------------- -void JZEventFrame::Setup() -{ -/* - int x, y; - - wxClientDC Dc(mpEventWindow); - Dc.SetFont(wxNullFont); - delete mpFixedFont; - mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFixedFont); - Dc.GetTextExtent("M", &x, &y); - hFixedFont = (int)y; - - delete mpFont; - mpFont = new wxFont(FontSize, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFont); - - Dc.GetTextExtent("M", &x, &y); - mLittleBit = (int)(x/2); - - Dc.GetTextExtent("HXWjgi", &x, &y); - mTrackHeight = (int)y + mLittleBit; -*/ -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- void JZEventFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) { - Event.Enable(mpEventWindow->AreEventsSelected()); + if (mpEventWindow) + { + Event.Enable(mpEventWindow->AreEventsSelected()); + } + else + { + Event.Enable(false); + } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- void JZEventFrame::OnEditShift(wxCommandEvent& Event) { -// mpEventWindow->Shift(); + if (mpEventWindow) + { + mpEventWindow->Shift(16); + } } //----------------------------------------------------------------------------- -// this onsize handler is supposed to take care of handling of the resizing -// the two subwindows sizes to they dont overlap //----------------------------------------------------------------------------- -void JZEventFrame::OnSize(wxSizeEvent& Event) -{ -// wxFrame::OnSize(Event); - - // The code below is from the toolbar sample, the layoutchidlren function - wxSize size = GetClientSize(); - - int offset; -// if (mpToolBar) -// { -// mpToolBar->SetSize(-1, size.y); -// mpToolBar->Move(0, 0); -// -// offset = mpToolBar->GetSize().x; -// } -// else -// { -// offset = 0; -// } - - // The step below should set the offset of the mpEventWindow - // m_textWindow->SetSize(offset, 0, size.x - offset, size.y); - -// float maxToolBarWidth = 0.0; -// float maxToolBarHeight = 0.0; -// if (mpToolBar) -// { -// mpToolBar->GetMaxSize(&maxToolBarWidth, &maxToolBarHeight); -// } - - offset = mpToolBar->GetSize().y; //get the height of the toolbar - - int frameWidth, frameHeight; - GetClientSize(&frameWidth, &frameHeight); - -// if (mpEventWindow) -// // mpEventWindow->SetSize(0, (int)offset, (int)frameWidth, (int)(frameHeight - offset)); -// mpEventWindow->SetSize(0, (int)0, (int)frameWidth, (int)(frameHeight)); -// // if (mpToolBar) -// // mpToolBar->SetSize(0, 0, (int)frameWidth, (int)maxToolBarHeight); - - cout - << "JZEventFrame::OnSize " << frameWidth<< 'x' << frameHeight << endl; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- bool JZEventFrame::OnCharHook(wxKeyEvent& e) { return OnKeyEvent(e); @@ -227,20 +135,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZEventFrame::y2yLine(int y, int up) -{ - if (up) - { - y += mTrackHeight; - } - y -= mTopInfoHeight; - y -= y % mTrackHeight; - y += mTopInfoHeight; - return y; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- int JZEventFrame::y2Line(int y, int up) { if (up) @@ -318,10 +212,14 @@ // wxPaintEvent e; // cout<<"FIXME JZEventFrame::Redraw"<<endl; // mpEventWindow->OnDraw(*dc); //this will in turn call the eventwin onpaintsub -// //the problem is that onpaint no longer tkes no argument, and is supposed to be called from the framework only, so it should be split +// // the problem is that onpaint no longer takes arguments, and is supposed +// // to be called from the framework only, so it should be split. // delete dc; -// mpEventWindow->Refresh(); +// if (mpEventWindow) +// { +// mpEventWindow->Refresh(); +// } } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventFrame.h 2009-01-20 04:14:04 UTC (rev 692) @@ -48,11 +48,12 @@ // 2-step initialization: 1) constructor JZEventFrame( - JZEventWindow* pEventWindow, + wxWindow* pParent, const wxString& Title, JZSong* pSong, const wxPoint& Position = wxDefaultPosition, - const wxSize& Size = wxDefaultSize); + const wxSize& Size = wxDefaultSize, + long WindowStyle = wxDEFAULT_FRAME_STYLE); virtual ~JZEventFrame(); @@ -60,25 +61,14 @@ JZFilter* mpFilter; - // 2) Create(): - virtual void Create(); - virtual void CreateMenu(); - void CreateCanvas(); -// JZEventWindow* mpEventWindow; + virtual void SetEventWindow(JZEventWindow* pEventWindow); - // Setup() - wxFont* mpFixedFont; // remains with 12pt - int hFixedFont; // Height of letters - int mTrackHeight; int mTopInfoHeight; int FontSize; int ClocksPerPixel; - // Parameters changed, e.g. Song loaded - virtual void Setup(); - int mEventsX, mEventsY, mEventsWidth, mEventsHeight; int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords int FromClock, ToClock; @@ -92,9 +82,7 @@ // methods int y2Line(int y, int up = 0); - int y2yLine(int y, int up = 0); int Line2y(int line); -// void LineText(wxDC *dc, int x, int y, int w, const char *str, int h = -1, bool down = false); int PlayClock; @@ -124,8 +112,6 @@ void OnUpdateEditShift(wxUpdateUIEvent& Event); void OnEditShift(wxCommandEvent& Event); - void OnSize(wxSizeEvent& Event); - bool OnCharHook(wxKeyEvent& Event); void OnChar(wxKeyEvent& Event); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/EventWindow.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -22,12 +22,14 @@ #include "EventWindow.h" +#include "Command.h" #include "Dialogs/ShiftDialog.h" #include "EventFrame.h" #include "Filter.h" #include "MouseAction.h" #include "Song.h" #include "Help.h" +#include "ProjectManager.h" #include "PropertyListDialog.h" #include <wx/dc.h> @@ -130,10 +132,16 @@ { if (AreEventsSelected()) { - JZShiftDialog ShiftDialog(*this, *mpFilter, this); + int Unit = 30; + int Shift = 0; + JZShiftDialog ShiftDialog(*this, *mpFilter, Units, Shift, this); - if (ShiftDialog.ShowModal() == wxID_OK) + if (ShiftDialog.ShowModal() == wxID_OK && Shift != 0) { + tCmdShift ShiftCommand(mpFilter, Shift * Unit); + ShiftCommand.Execute(); + + JZProjectManager::Instance()->UpdateAllViews(); } } } Modified: trunk/jazz/src/PianoWindow.h =================================================================== --- trunk/jazz/src/PianoWindow.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/PianoWindow.h 2009-01-20 04:14:04 UTC (rev 692) @@ -294,7 +294,7 @@ void Draw(wxDC& Dc); - // Overridden tButtonLabelInterface finction. + // Overridden tButtonLabelInterface function. void ButtonLabelDisplay(const wxString& Text, bool IsButtonDown); private: @@ -326,9 +326,8 @@ int mFontSize; wxFont* mpFont; - // remains with 12pt/ bleibt bei 12pt wxFont* mpFixedFont; - int mFixedFontHeight; //Height letters/ Hoehe eines Buchstaben + int mFixedFontHeight; wxFont* mpDrumFont; Modified: trunk/jazz/src/Player.cpp =================================================================== --- trunk/jazz/src/Player.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Player.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -245,7 +245,9 @@ { // fixme: we should have different synths for each device t = Song->GetTrack(0); - OutNow(t, gpSynth->Reset()); + JZEvent* mpResetEvent = gpSynth->CreateResetEvent(); + OutNow(t, mpResetEvent); + delete mpResetEvent; } // Send Volume, Pan, Chorus, etc @@ -640,7 +642,9 @@ if (Reset) { - OutNow(gpSynth->Reset()); + JZEvent* mpResetEvent = gpSynth->CreateResetEvent(); + OutNow(mpResetEvent); + delete mpResetEvent; } } Modified: trunk/jazz/src/Song.cpp =================================================================== --- trunk/jazz/src/Song.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Song.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -154,7 +154,7 @@ //----------------------------------------------------------------------------- void JZSong::Clear() { - for (int i = 0; i < mTrackCount; i++) + for (int i = 0; i < eMaxTrackCount; ++i) { mTracks[i].Clear(); } @@ -210,9 +210,10 @@ void JZSong::Write(JZWriteBase& Io, const char* pFileName) { // Make sure track 0 has a synth reset - if (!mTracks[0].Reset) + if (!mTracks[0].mpReset) { - mTracks[0].Reset = gpSynth->Reset()->IsSysEx(); + JZEvent* pEvent = gpSynth->CreateResetEvent(); + mTracks[0].mpReset = dynamic_cast<tSysEx*>(pEvent); } int n = NumUsedTracks(); Modified: trunk/jazz/src/Synth.h =================================================================== --- trunk/jazz/src/Synth.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Synth.h 2009-01-20 04:14:04 UTC (rev 692) @@ -325,7 +325,7 @@ Sysex.FixCheckSum( s ); } - virtual JZEvent* Reset() = 0; + virtual JZEvent* CreateResetEvent() = 0; virtual JZEvent* MasterVolSX( long clk, unsigned char vol ) { @@ -375,7 +375,7 @@ return this; } - virtual JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_GM_ON); } @@ -389,7 +389,7 @@ return this; } - JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_GS_ON); } @@ -420,7 +420,7 @@ return this; } - JZEvent* Reset() + virtual JZEvent* CreateResetEvent() { return Sysex(0, SX_XG_ON); } Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Track.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -523,9 +523,9 @@ nEvents = newnEvents; } -void tSimpleEventArray::Put(JZEvent* e) +void tSimpleEventArray::Put(JZEvent* pEvent) { - if (e->IsEndOfTrack()) + if (pEvent->IsEndOfTrack()) { // Remove the old EOT if we are adding a new one. RemoveEOT(); @@ -534,7 +534,7 @@ { Resize(); } - Events[nEvents++] = e; + Events[nEvents++] = pEvent; #ifdef E_DBUG { @@ -567,11 +567,11 @@ void tSimpleEventArray::Copy(tSimpleEventArray& src, int frclk, int toclk) { tEventIterator iter(&src); - JZEvent* e = iter.Range(frclk, toclk); - while (e) + JZEvent* pEvent = iter.Range(frclk, toclk); + while (pEvent) { - Put(e->Copy()); - e = iter.Next(); + Put(pEvent->Copy()); + pEvent = iter.Next(); } } @@ -588,7 +588,7 @@ Chorus(0), mpBank(0), mpBank2(0), - Reset(0) + mpReset(0) { nEvents = 0; @@ -632,7 +632,9 @@ delete mpBank2; mpBank2 = 0; - Reset = 0; + delete mpReset; + mpReset = 0; + Speed = 0; Channel = 1; Device = 0; @@ -741,7 +743,7 @@ void tEventArray::Cleanup(bool dont_delete_killed_events) { - JZEvent *e; + JZEvent* pEvent; tControl* pControl; tSysEx *s; int i; @@ -820,7 +822,7 @@ for (i = 0; i < nEvents; i++) { - if ((e = Events[i])->IsKilled()) + if ((pEvent = Events[i])->IsKilled()) { if (!dont_delete_killed_events) { @@ -834,29 +836,29 @@ } // accept only events having clock == 0 as track defaults - if (e->GetClock() != 0) + if (pEvent->GetClock() != 0) { continue; } if (!mpName) { - mpName = e->IsTrackName(); + mpName = pEvent->IsTrackName(); } if (!Copyright) { - Copyright = e->IsCopyright(); + Copyright = pEvent->IsCopyright(); } if (!Speed) { - Speed = e->IsSetTempo(); + Speed = pEvent->IsSetTempo(); } if (!MtcOffset) { - MtcOffset = e->IsMtcOffset(); + MtcOffset = pEvent->IsMtcOffset(); } - if ((pControl = e->IsControl()) != 0) + if ((pControl = pEvent->IsControl()) != 0) { switch (pControl->GetControl()) { @@ -886,13 +888,13 @@ break; } } - if ((s = e->IsSysEx()) != 0) + if ((s = pEvent->IsSysEx()) != 0) { - int sxid = gpSynth->GetSysexId(s); + int SysExId = gpSynth->GetSysexId(s); if (!gpSynth->IsGS()) { - switch (sxid) + switch (SysExId) { case SX_GM_MasterVol: // GS has its own; SC-55 doesn't recognize GM Mastervol @@ -905,7 +907,7 @@ if (gpSynth->IsGS()) { - switch (sxid) + switch (SysExId) { case SX_GS_MasterVol: MasterVol = s; @@ -924,7 +926,7 @@ case SX_GS_BendLfo2Pitch: case SX_GS_BendLfo2Tvf: case SX_GS_BendLfo2Tva: - BenderSettings[sxid - SX_GS_BendPitch] = s; + BenderSettings[SysExId - SX_GS_BendPitch] = s; break; case SX_GS_ModPitch: @@ -938,7 +940,7 @@ case SX_GS_ModLfo2Pitch: case SX_GS_ModLfo2Tvf: case SX_GS_ModLfo2Tva: - ModulationSettings[sxid - SX_GS_ModPitch] = s; + ModulationSettings[SysExId - SX_GS_ModPitch] = s; break; case SX_GS_CafPitch: @@ -952,7 +954,7 @@ case SX_GS_CafLfo2Pitch: case SX_GS_CafLfo2Tvf: case SX_GS_CafLfo2Tva: - CAfSettings[sxid - SX_GS_CafPitch] = s; + CAfSettings[SysExId - SX_GS_CafPitch] = s; break; case SX_GS_PafPitch: @@ -966,7 +968,7 @@ case SX_GS_PafLfo2Pitch: case SX_GS_PafLfo2Tvf: case SX_GS_PafLfo2Tva: - PAfSettings[sxid - SX_GS_PafPitch] = s; + PAfSettings[SysExId - SX_GS_PafPitch] = s; break; case SX_GS_CC1Pitch: @@ -980,7 +982,7 @@ case SX_GS_CC1Lfo2Pitch: case SX_GS_CC1Lfo2Tvf: case SX_GS_CC1Lfo2Tva: - CC1Settings[sxid - SX_GS_CC1Pitch] = s; + CC1Settings[SysExId - SX_GS_CC1Pitch] = s; break; case SX_GS_CC2Pitch: @@ -994,7 +996,7 @@ case SX_GS_CC2Lfo2Pitch: case SX_GS_CC2Lfo2Tvf: case SX_GS_CC2Lfo2Tva: - CC2Settings[sxid - SX_GS_CC2Pitch] = s; + CC2Settings[SysExId - SX_GS_CC2Pitch] = s; break; case SX_GS_ReverbMacro: @@ -1007,7 +1009,7 @@ case SX_GS_RevTime: case SX_GS_RevDelayFeedback: case SX_GS_RevSendChorus: - ReverbSettings[sxid - SX_GS_RevCharacter] = s; + ReverbSettings[SysExId - SX_GS_RevCharacter] = s; break; case SX_GS_ChorusMacro: @@ -1021,7 +1023,7 @@ case SX_GS_ChoRate: case SX_GS_ChoDepth: case SX_GS_ChoSendReverb: - ChorusSettings[sxid - SX_GS_ChoPreLpf] = s; + ChorusSettings[SysExId - SX_GS_ChoPreLpf] = s; break; case SX_GS_CC1CtrlNo: @@ -1050,78 +1052,78 @@ } else if (gpSynth->IsXG()) { - switch (sxid) + switch (SysExId) { case SX_XG_BendPitch: case SX_XG_BendTvf: case SX_XG_BendAmpl: - BenderSettings[sxid - SX_XG_BendPitch] = s; + BenderSettings[SysExId - SX_XG_BendPitch] = s; break; case SX_XG_BendLfoPitch: case SX_XG_BendLfoTvf: case SX_XG_BendLfoTva: - BenderSettings[sxid + 1 - SX_XG_BendPitch] = s; + BenderSettings[SysExId + 1 - SX_XG_BendPitch] = s; break; case SX_XG_ModPitch: case SX_XG_ModTvf: case SX_XG_ModAmpl: - ModulationSettings[sxid - SX_XG_ModPitch] = s; + ModulationSettings[SysExId - SX_XG_ModPitch] = s; break; case SX_XG_ModLfoPitch: case SX_XG_ModLfoTvf: case SX_XG_ModLfoTva: - ModulationSettings[sxid + 1 - SX_XG_ModPitch] = s; + ModulationSettings[SysExId + 1 - SX_XG_ModPitch] = s; break; case SX_XG_CafPitch: case SX_XG_CafTvf: case SX_XG_CafAmpl: - CAfSettings[sxid - SX_XG_CafPitch] = s; + CAfSettings[SysExId - SX_XG_CafPitch] = s; break; case SX_XG_CafLfoPitch: case SX_XG_CafLfoTvf: case SX_XG_CafLfoTva: - CAfSettings[sxid + 1 - SX_XG_CafPitch] = s; + CAfSettings[SysExId + 1 - SX_XG_CafPitch] = s; break; case SX_XG_PafPitch: case SX_XG_PafTvf: case SX_XG_PafAmpl: - PAfSettings[sxid - SX_XG_PafPitch] = s; + PAfSettings[SysExId - SX_XG_PafPitch] = s; break; case SX_XG_PafLfoPitch: case SX_XG_PafLfoTvf: case SX_XG_PafLfoTva: - PAfSettings[sxid + 1 - SX_XG_PafPitch] = s; + PAfSettings[SysExId + 1 - SX_XG_PafPitch] = s; break; case SX_XG_CC1Pitch: case SX_XG_CC1Tvf: case SX_XG_CC1Ampl: - CC1Settings[sxid - SX_XG_CC1Pitch] = s; + CC1Settings[SysExId - SX_XG_CC1Pitch] = s; break; case SX_XG_CC1LfoPitch: case SX_XG_CC1LfoTvf: case SX_XG_CC1LfoTva: - CC1Settings[sxid + 1 - SX_XG_CC1Pitch] = s; + CC1Settings[SysExId + 1 - SX_XG_CC1Pitch] = s; break; case SX_XG_CC2Pitch: case SX_XG_CC2Tvf: case SX_XG_CC2Ampl: - CC2Settings[sxid - SX_XG_CC2Pitch] = s; + CC2Settings[SysExId - SX_XG_CC2Pitch] = s; break; case SX_XG_CC2LfoPitch: case SX_XG_CC2LfoTvf: case SX_XG_CC2LfoTva: - CC2Settings[sxid + 1 - SX_XG_CC2Pitch] = s; + CC2Settings[SysExId + 1 - SX_XG_CC2Pitch] = s; break; case SX_XG_ReverbMacro: @@ -1200,10 +1202,10 @@ tKeyOff* pKeyOff; if ((pKeyOff = Events[i]->IsKeyOff()) != 0) { - JZEvent **e = &Events[i - 1]; - while (e >= Events) + JZEvent** ppEvent = &Events[i - 1]; + while (ppEvent >= Events) { - tKeyOn* pKeyOn = (*e)->IsKeyOn(); + tKeyOn* pKeyOn = (*ppEvent)->IsKeyOn(); if ( pKeyOn && pKeyOn->Key == pKeyOff->Key && @@ -1218,7 +1220,7 @@ pKeyOff->Kill(); break; } - --e; + --ppEvent; } } } @@ -1292,7 +1294,7 @@ void tEventArray::Write(JZWriteBase& Io) { - JZEvent *e; + JZEvent* pEvent; int WrittenBefore; Length2Keyoff(); @@ -1311,9 +1313,9 @@ } // Synth reset - if (Reset) + if (mpReset) { - Reset->Write(Io); + mpReset->Write(Io); } // Rpn / Nrpn: @@ -1385,21 +1387,20 @@ mPatch->Write(Io); } - // write jazz track info - tJazzMeta *jazz = new tJazzMeta; - jazz->SetAudioMode(audio_mode); - jazz->SetTrackState(State); - jazz->SetTrackDevice(Device); - jazz->SetIntroLength(gpSong->GetIntroLength()); - jazz->Write(Io); + tJazzMeta JazzMeta; + JazzMeta.SetAudioMode(audio_mode); + JazzMeta.SetTrackState(State); + JazzMeta.SetTrackDevice(Device); + JazzMeta.SetIntroLength(gpSong->GetIntroLength()); + JazzMeta.Write(Io); for (int i = 0; i < nEvents; i++) { - e = Events[i]; + pEvent = Events[i]; WrittenBefore = 0; - if (e->IsControl()) + if (pEvent->IsControl()) { - switch (e->IsControl()->GetControl()) + switch (pEvent->IsControl()->GetControl()) { // Don't write these again if present as events // and clock == 0 (should not happen) @@ -1410,7 +1411,7 @@ case 0x06: // Rpn/Nrpn Data case 0x00: // mpBank case 0x20: // Bank2 - if (e->GetClock() == 0) + if (pEvent->GetClock() == 0) { WrittenBefore = 1; } @@ -1419,23 +1420,23 @@ WrittenBefore = 0; } } - else if (e->IsProgram()) + else if (pEvent->IsProgram()) { // Don't write these again if present as events // and clock == 0 (should not happen) - if (e->GetClock() == 0) + if (pEvent->GetClock() == 0) { WrittenBefore = 1; } } - else if (e->IsCopyright() || e->IsMtcOffset()) + else if (pEvent->IsCopyright() || pEvent->IsMtcOffset()) { // Will probably happen WrittenBefore = 1; } if (!WrittenBefore) { - e->Write(Io); + pEvent->Write(Io); } } Keyoff2Length(); @@ -1443,10 +1444,10 @@ void tEventArray::Read(JZReadBase& Io) { - JZEvent *e; + JZEvent* pEvent; Channel = 0; unsigned char Msb, Lsb, Data; - int SpecialEvent; + bool SpecialEvent; Msb = Lsb = Data = 0xff; int cha; @@ -1454,13 +1455,13 @@ bool NeedToDelete; Io.NextTrack(); - while ((e = Io.Read()) != 0) + while ((pEvent = Io.Read()) != 0) { NeedToDelete = false; - SpecialEvent = 0; - if (e->IsJazzMeta()) + SpecialEvent = false; + if (pEvent->IsJazzMeta()) { - tJazzMeta *j = e->IsJazzMeta(); + tJazzMeta *j = pEvent->IsJazzMeta(); audio_mode = (int)j->GetAudioMode(); State = (int)j->GetTrackState(); Device = (int)j->GetTrackDevice(); @@ -1468,26 +1469,26 @@ delete j; continue; } - if (e->IsControl()) + if (pEvent->IsControl()) { - switch (e->IsControl()->GetControl()) + switch (pEvent->IsControl()->GetControl()) { // Grab Rpn/Nrpn/Bank from file and save them, don't put // them into event-array case 0x63: case 0x65: - Msb = e->IsControl()->GetControlValue(); // Rpn/Nrpn Msb - SpecialEvent = 1; + Msb = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Msb + SpecialEvent = true; break; case 0x62: case 0x64: - Lsb = e->IsControl()->GetControlValue(); // Rpn/Nrpn Lsb - SpecialEvent = 1; + Lsb = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Lsb + SpecialEvent = true; break; case 0x06: - Data = e->IsControl()->GetControlValue(); // Rpn/Nrpn Data - SpecialEvent = 1; - cha = e->IsControl()->GetChannel(); + Data = pEvent->IsControl()->GetControlValue(); // Rpn/Nrpn Data + SpecialEvent = true; + cha = pEvent->IsControl()->GetChannel(); switch (Msb) { case 0x01: // Nrpn @@ -1570,65 +1571,65 @@ case 0x00: if (!mpBank) { - SpecialEvent = 1; - mpBank = e->IsControl(); + SpecialEvent = true; + mpBank = pEvent->IsControl(); mpBank->SetClock(0); } break; case 0x20: if (!mpBank2) { - SpecialEvent = 1; - mpBank2 = e->IsControl(); + SpecialEvent = true; + mpBank2 = pEvent->IsControl(); mpBank2->SetClock(0); } break; default: - SpecialEvent = 0; // Other control + SpecialEvent = false; // Other control break; } } - else if (e->IsProgram()) + else if (pEvent->IsProgram()) { if (!mPatch) { - mPatch = e->IsProgram(); + mPatch = pEvent->IsProgram(); mPatch->SetClock(0); - SpecialEvent = 1; + SpecialEvent = true; } } - else if (e->IsCopyright()) + else if (pEvent->IsCopyright()) { if (!Copyright) { - Copyright = e->IsCopyright(); + Copyright = pEvent->IsCopyright(); // Just make sure clock is zero, then put into event array Copyright->SetClock(0); } } - else if (e->IsSysEx()) + else if (pEvent->IsSysEx()) { NeedToDelete = true; // Get hold of the Reset sysex... - int sxid = gpSynth->GetSysexId(e->IsSysEx()); + int SysExId = gpSynth->GetSysexId(pEvent->IsSysEx()); - if ((sxid == SX_GM_ON) || (sxid == SX_GS_ON) || (sxid == SX_XG_ON)) + if (SysExId == SX_GM_ON || SysExId == SX_GS_ON || SysExId == SX_XG_ON) { // Take them all away - SpecialEvent = 1; + SpecialEvent = true; // Save it in the track defaults if it fits with synth // type settings if ( - (gpSynth->IsGM() && (sxid == SX_GM_ON)) || - (gpSynth->IsGS() && (sxid == SX_GS_ON)) || - (gpSynth->IsXG() && (sxid == SX_XG_ON))) + (gpSynth->IsGM() && (SysExId == SX_GM_ON)) || + (gpSynth->IsGS() && (SysExId == SX_GS_ON)) || + (gpSynth->IsXG() && (SysExId == SX_XG_ON))) { - if (!Reset) + if (!mpReset) { - Reset = e->IsSysEx(); + mpReset = pEvent->IsSysEx(); NeedToDelete = false; } } @@ -1637,14 +1638,14 @@ if (!SpecialEvent) { - Put(e); + Put(pEvent); NeedToDelete = false; - if (!Channel && e->IsChannelEvent()) + if (!Channel && pEvent->IsChannelEvent()) { - Channel = e->IsChannelEvent()->GetChannel() + 1; + Channel = pEvent->IsChannelEvent()->GetChannel() + 1; } } - if (e->IsEndOfTrack()) + if (pEvent->IsEndOfTrack()) { // JAVE I want explicit end of track events // Break out of loop here because endoftrack is end, and we want it read @@ -1655,7 +1656,7 @@ if (NeedToDelete) { - delete e; + delete pEvent; } } // while read @@ -1772,17 +1773,17 @@ tSysEx *s; tEventIterator Iterator(trk); trk->Sort(); - JZEvent *e = Iterator.Range(0, (unsigned) trk->GetLastClock() + 1); - while (e) + JZEvent* pEvent = Iterator.Range(0, (unsigned) trk->GetLastClock() + 1); + while (pEvent) { - if ((c = e->IsChannelEvent()) != 0) + if ((c = pEvent->IsChannelEvent()) != 0) { - c = (tChannelEvent *)e->Copy(); + c = (tChannelEvent *)pEvent->Copy(); c->SetChannel(trk->Channel - 1); - trk->Kill(e); + trk->Kill(pEvent); trk->Put(c); } - else if ((s = e->IsSysEx()) != 0) + else if ((s = pEvent->IsSysEx()) != 0) { // Check for sysex that contains channel number const unsigned char* pChannel = gpSynth->GetSysexChaPtr(s); @@ -1798,13 +1799,13 @@ *pChannel |= sysex_channel(trk->Channel); } - s = (tSysEx *) e->Copy(); - trk->Kill(e); + s = (tSysEx *) pEvent->Copy(); + trk->Kill(pEvent); trk->Put(s); } } - e = Iterator.Next(); - } // while e + pEvent = Iterator.Next(); + } // while pEvent if (trk->VibRate) { @@ -1997,20 +1998,20 @@ if (Replace) { tEventIterator Erase(this); - JZEvent *e = Erase.Range(FromClock, ToClock); - while (e) + JZEvent* pEvent = Erase.Range(FromClock, ToClock); + while (pEvent) { - Kill(e); - e = Erase.Next(); + Kill(pEvent); + pEvent = Erase.Next(); } } // Merge Recorded Events tEventIterator Copy(other); - JZEvent *e = Copy.Range(FromClock, ToClock); - while (e) + JZEvent* pEvent = Copy.Range(FromClock, ToClock); + while (pEvent) { - JZEvent *c = e->Copy(); + JZEvent* c = pEvent->Copy(); if (ForceChannel) { tChannelEvent* pChannelEvent = c->IsChannelEvent(); @@ -2020,7 +2021,7 @@ } } Put(c); - e = Copy.Next(); + pEvent = Copy.Next(); } Cleanup(); } @@ -2044,17 +2045,17 @@ tUndoBuffer *undo = &mUndoBuffers[mUndoIndex]; for (int i = undo->nEvents - 1; i >= 0; i--) { - JZEvent *e = undo->Events[i]; + JZEvent* pEvent = undo->Events[i]; if (undo->bits(i)) { undo->bits.set(i, 0); - e->UnKill(); - tEventArray::Put(e); + pEvent->UnKill(); + tEventArray::Put(pEvent); } else { undo->bits.set(i, 1); - e->Kill(); + pEvent->Kill(); } } tEventArray::Cleanup(TRUE); @@ -2074,17 +2075,17 @@ tUndoBuffer *undo = &mUndoBuffers[mUndoIndex]; for (int i = 0; i < undo->nEvents; i++) { - JZEvent *e = undo->Events[i]; + JZEvent* pEvent = undo->Events[i]; if (undo->bits(i)) { undo->bits.set(i, 0); - e->UnKill(); - tEventArray::Put(e); + pEvent->UnKill(); + tEventArray::Put(pEvent); } else { undo->bits.set(i, 1); - e->Kill(); + pEvent->Kill(); } } tEventArray::Cleanup(TRUE); @@ -2268,9 +2269,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x0a, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x0a, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2294,9 +2295,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x5B, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x5B, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2320,9 +2321,9 @@ } if (Value > 0) { - JZEvent *e = new tControl(0, Channel - 1, 0x5D, Value - 1); - Put(e); - gpMidiPlayer->OutNow(this, e); + JZEvent* pEvent = new tControl(0, Channel - 1, 0x5D, Value - 1); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } Cleanup(); } @@ -2743,11 +2744,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ModSX(msp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ModSX(msp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2775,11 +2776,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->BendSX(bsp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->BendSX(bsp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2807,11 +2808,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->CafSX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CafSX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2839,11 +2840,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->PafSX(psp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->PafSX(psp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2871,11 +2872,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->CC1SX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CC1SX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2901,11 +2902,11 @@ Kill(CC2Settings[csp]); if (Value > 0) { - JZEvent *e = gpSynth->CC2SX(csp, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->CC2SX(csp, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2933,11 +2934,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ControllerNumberSX(1, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ControllerNumberSX(1, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -2965,11 +2966,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->ControllerNumberSX(2, 0, Channel, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ControllerNumberSX(2, 0, Channel, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3002,13 +3003,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ReverbMacroSX(0, Value - 1, lsb - 1); - if (e) + JZEvent* pEvent = gpSynth->ReverbMacroSX(0, Value - 1, lsb - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (gpConfig->GetValue(C_UseReverbMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3043,13 +3044,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ChorusMacroSX(0, Value - 1, lsb - 1); - if (e) + JZEvent* pEvent = gpSynth->ChorusMacroSX(0, Value - 1, lsb - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (gpConfig->GetValue(C_UseChorusMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3079,11 +3080,11 @@ if (Value > 0) { - JZEvent *e = gpSynth->EqualizerMacroSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->EqualizerMacroSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3112,13 +3113,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ReverbParamSX(rsp, 0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ReverbParamSX(rsp, 0, Value - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (!gpConfig->GetValue(C_UseReverbMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3148,13 +3149,13 @@ if (Value > 0) { - JZEvent *e = gpSynth->ChorusParamSX(csp, 0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->ChorusParamSX(csp, 0, Value - 1); + if (pEvent) { - Put(e); + Put(pEvent); if (!gpConfig->GetValue(C_UseChorusMacro)) { - gpMidiPlayer->OutNow(this, e); + gpMidiPlayer->OutNow(this, pEvent); } } } @@ -3185,11 +3186,11 @@ if (rsrv) { - JZEvent *e = gpSynth->PartialReserveSX(0, Channel, rsrv); - if (e) + JZEvent* pEvent = gpSynth->PartialReserveSX(0, Channel, rsrv); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3223,11 +3224,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->MasterVolSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->MasterVolSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3256,11 +3257,11 @@ } if (Value > 0) { - JZEvent *e = gpSynth->MasterPanSX(0, Value - 1); - if (e) + JZEvent* pEvent = gpSynth->MasterPanSX(0, Value - 1); + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3310,24 +3311,24 @@ break; } - JZEvent *e = 0; + JZEvent* pEvent = 0; if (Value > 0) { switch (param) { case mspRxChannel: - e = gpSynth->RxChannelSX(0, Channel, Value - 1); + pEvent = gpSynth->RxChannelSX(0, Channel, Value - 1); break; case mspUseForRhythm: - e = gpSynth->UseForRhythmSX(0, Channel, Value - 1); + pEvent = gpSynth->UseForRhythmSX(0, Channel, Value - 1); break; } - if (e) + if (pEvent) { - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); } } Cleanup(); @@ -3352,8 +3353,8 @@ } if (mtc) { - JZEvent *e = mtc->ToOffset(); - Put(e); + JZEvent* pEvent = mtc->ToOffset(); + Put(pEvent); } Cleanup(); } @@ -3372,13 +3373,13 @@ void JZTrack::SetDefaultSpeed(int bpm) { - JZEvent *e = new tSetTempo(0, bpm); + JZEvent* pEvent = new tSetTempo(0, bpm); if (Speed) { Kill(Speed); } - Put(e); - gpMidiPlayer->OutNow(this, e); + Put(pEvent); + gpMidiPlayer->OutNow(this, pEvent); Cleanup(); } @@ -3386,16 +3387,16 @@ { tEventIterator Iterator(this); Sort(); - JZEvent *e = Iterator.Range(0, clk + 1); + JZEvent* pEvent = Iterator.Range(0, clk + 1); tSetTempo *t = Speed; - while (e) + while (pEvent) { - if (e->IsSetTempo()) + if (pEvent->IsSetTempo()) { - t = e->IsSetTempo(); + t = pEvent->IsSetTempo(); } - e = Iterator.Next(); - } // while e + pEvent = Iterator.Next(); + } // while pEvent return t; } Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/Track.h 2009-01-20 04:14:04 UTC (rev 692) @@ -467,7 +467,7 @@ public: - tSysEx* Reset; + tSysEx* mpReset; tSysEx* ModulationSettings[mspModulationSysexParameters]; tSysEx* BenderSettings[bspBenderSysexParameters]; Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2009-01-20 03:46:28 UTC (rev 691) +++ trunk/jazz/src/TrackFrame.cpp 2009-01-20 04:14:04 UTC (rev 692) @@ -75,7 +75,7 @@ //***************************************************************************** //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(JZTrackFrame, wxFrame) +BEGIN_EVENT_TABLE(JZTrackFrame, JZEventFrame) EVT_MENU(wxID_NEW, JZTrackFrame::OnFileNew) @@ -85,9 +85,6 @@ EVT_MENU(wxID_EXIT, JZTrackFrame::OnFileExit) - EVT_UPDATE_UI(ID_SHIFT, JZTrackFrame::OnUpdateEditShift) - EVT_MENU(ID_SHIFT, JZTrackFrame::OnEditShift) - EVT_MENU... [truncated message content] |
From: <pst...@us...> - 2009-01-20 03:46:34
|
Revision: 691 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=691&view=rev Author: pstieber Date: 2009-01-20 03:46:28 +0000 (Tue, 20 Jan 2009) Log Message: ----------- 1. Added class and function comment headers. 2. Used pre increment instead of post increment for loop variables. 3. Made some style changes (e -> pEvent...). 4. Translated some German. Modified Paths: -------------- trunk/jazz/src/Command.cpp trunk/jazz/src/Command.h Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2009-01-20 03:39:55 UTC (rev 690) +++ trunk/jazz/src/Command.cpp 2009-01-20 03:46:28 UTC (rev 691) @@ -75,8 +75,9 @@ void tCommand::ExecuteTrack(JZTrack* pTrack) { tEventIterator Iterator(pTrack); - JZEvent* pEvent = - Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); + JZEvent* pEvent = Iterator.Range( + mpFilter->GetFromClock(), + mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent)) @@ -147,64 +148,71 @@ //***************************************************************************** // tScale //***************************************************************************** - // c d e f g a b +//----------------------------------------------------------------------------- +// Description: +// This is a C-major scale. +// c d e f g a b +//----------------------------------------------------------------------------- static const int CMajor[12] = { 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1 }; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void tScale::Init(int ScaleNr, JZFilter* pFilter) { - int i; - - for (i = 0; i < 12; i++) + for (int i = 0; i < 12; ++i) { ScaleKeys[i] = 0; } if (ScaleNr == gScaleChromatic) { - for (i = 0; i < 12; i++) + for (int i = 0; i < 12; ++i) + { ScaleKeys[i] = 1; + } } - else if (ScaleNr == gScaleSelected) { - int found = 0; + bool Found = false; tSelectedKeys cmd(pFilter); cmd.Execute(0); - for (i = 0; i < 128; i++) + for (int i = 0; i < 128; ++i) { if (cmd.Keys[i]) { ScaleKeys[ i % 12 ] = 1; - found = 1; + Found = true; } } - if (!found) + if (!Found) { ScaleKeys[0] = 1; // avoid loop in Member() } } - else { - for (i = 0; i < 12; i++) + for (int i = 0; i < 12; ++i) + { ScaleKeys[ (i + ScaleNr) % 12 ] = CMajor[i]; + } } } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::Analyze(JZFilter* pFilter) { - long keys[12]; - for (int i = 0; i < 12; i++) + long Keys[12]; + for (int i = 0; i < 12; ++i) { - keys[i] = 0; + Keys[i] = 0; } tSelectedKeys cmd(pFilter); cmd.Execute(0); - for (int i = 0; i < 128; i++) + for (int i = 0; i < 128; ++i) { - keys[i % 12] += cmd.Keys[i]; + Keys[i % 12] += cmd.Keys[i]; } long Min = std::numeric_limits<long>::max(); @@ -218,7 +226,7 @@ { if (Scale.ScaleKeys[i] == 0) { - Error += keys[i]; + Error += Keys[i]; } } if (Error < Min) @@ -231,78 +239,91 @@ return ScaleIndex; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::Next(int Key) { do - ++ Key; - while (!Member(Key)); + { + ++Key; + } while (!Member(Key)); return Key; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::Prev(int Key) { do - -- Key; - while (!Member(Key)); + { + --Key; + } while (!Member(Key)); return Key; } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::Transpose(int Key, int Steps) { int Offset = 0; while (!Member(Key)) { - ++ Key; - ++ Offset; + ++Key; + ++Offset; } while (Steps > 0) { Key = Next(Key); - -- Steps; + --Steps; } while (Steps < 0) { Key = Prev(Key); - ++ Steps; + ++Steps; } return Key - Offset; } - +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int tScale::FitInto(int Key) { int Offset = 0; while (!Member(Key)) { - ++ Offset; + ++Offset; if (Offset & 1) + { Key += Offset; + } else + { Key -= Offset; + } } return Key; } -// *********************************************************************** +//***************************************************************************** // tCmdShift -// *********************************************************************** - -tCmdShift::tCmdShift(JZFilter* pFilter, long dclk) - : tCommand(pFilter) +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +tCmdShift::tCmdShift(JZFilter* pFilter, long DeltaClock) + : tCommand(pFilter), + mDeltaClock(DeltaClock) { - DeltaClock = dclk; } void tCmdShift::ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent) { - JZEvent* c = pEvent->Copy(); + JZEvent* pEventCopy = pEvent->Copy(); pTrack->Kill(pEvent); - c->SetClock(c->GetClock() + DeltaClock); - pTrack->Put(c); + pEventCopy->SetClock(pEventCopy->GetClock() + mDeltaClock); + pTrack->Put(pEventCopy); } // ************************************************************************ @@ -694,7 +715,7 @@ { if (pEvent->IsKeyOn()) { - // only echo note events + // Only echo note events. pKeyOn = (tKeyOn *)pEvent->Copy(); pKeyOn->SetClock(pKeyOn->GetClock()+ clockDelay * i); pKeyOn->SetVelocity( @@ -853,9 +874,9 @@ if (s && d) { - // Events nach tmp kopieren tEventArray tmp; { + // Events after temporary copy. tEventIterator Iterator(s); long DeltaClock = StartClock - mpFilter->GetFromClock(); JZEvent* pEvent = @@ -882,8 +903,6 @@ } } - // ggf Freien Platz einfuegen - if (InsertSpace && d->GetLastClock() > StartClock) { tEventIterator Iterator(d); @@ -903,10 +922,9 @@ d->Cleanup(); } - // ggf Quelle loeschen - if (EraseSource) { + // Delete source. tEventIterator Iterator(s); JZEvent* pEvent = Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) @@ -920,10 +938,9 @@ s->Cleanup(); } - // ggf Ziel loeschen - if (EraseDestin) { + // Delete destination. tEventIterator Iterator(d); JZEvent* pEvent = Iterator.Range(StartClock, StopClock); while (pEvent) @@ -937,7 +954,7 @@ d->Cleanup(); } - // tmp und Zieltrack zusammenmischen, aufraeumen + // tmp track and target mix, aufraeumen d->Merge(&tmp); d->Cleanup(); Modified: trunk/jazz/src/Command.h =================================================================== --- trunk/jazz/src/Command.h 2009-01-20 03:39:55 UTC (rev 690) +++ trunk/jazz/src/Command.h 2009-01-20 03:46:28 UTC (rev 691) @@ -32,6 +32,8 @@ class JZBarInfo; class tKeyOn; +//***************************************************************************** +//***************************************************************************** class tScale { public: @@ -50,7 +52,8 @@ static int Analyze(JZFilter* pFilter); // returns ScaleNr }; - +//***************************************************************************** +//***************************************************************************** class tCommand { public: @@ -74,16 +77,22 @@ bool mReverse; }; - +//***************************************************************************** +//***************************************************************************** class tCmdShift : public tCommand { - long DeltaClock; public: + tCmdShift(JZFilter* pFilter, long DeltaClock); virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); + + private: + + long mDeltaClock; }; - +//***************************************************************************** +//***************************************************************************** class tCmdErase : public tCommand { public: @@ -93,6 +102,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; +//***************************************************************************** +//***************************************************************************** class tCmdVelocity : public tCommand { public: @@ -101,7 +112,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdLength : public tCommand { public: @@ -110,7 +122,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdSeqLength : public tCommand { public: @@ -120,8 +133,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - - +//***************************************************************************** +//***************************************************************************** class tCmdMidiDelay : public tCommand { public: @@ -137,6 +150,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; +//***************************************************************************** +//***************************************************************************** class tCmdConvertToModulation : public tCommand { public: @@ -145,10 +160,8 @@ virtual void ExecuteTrack(JZTrack* pTrack); }; - - - - +//***************************************************************************** +//***************************************************************************** class tCmdCleanup : public tCommand { long lengthLimit; @@ -160,7 +173,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdSearchReplace : public tCommand { short fr, to; @@ -169,7 +183,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdQuantize : public tCommand { long Quantize(long Clock, int islen); @@ -183,7 +198,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdTranspose : public tCommand { public: @@ -198,7 +214,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdSetChannel : public tCommand { public: @@ -207,7 +224,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; - +//***************************************************************************** +//***************************************************************************** class tCmdCopyToBuffer : public tCommand { public: @@ -221,8 +239,8 @@ tEventArray* mpBuffer; }; - - +//***************************************************************************** +//***************************************************************************** class tCmdCopy : public tCommand { public: @@ -238,8 +256,8 @@ virtual void ExecuteTrack(JZTrack* pTrack); }; - - +//***************************************************************************** +//***************************************************************************** class tCmdExchLeftRight : public tCommand { public: @@ -247,6 +265,8 @@ virtual void ExecuteEvent(JZTrack* pTrack, JZEvent* pEvent); }; +//***************************************************************************** +//***************************************************************************** class tCmdExchUpDown : public tCommand { public: @@ -254,6 +274,8 @@ virtual void ExecuteTrack(JZTrack* pTrack); }; +//***************************************************************************** +//***************************************************************************** class tCmdMapper : public tCommand { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-20 03:39:57
|
Revision: 690 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=690&view=rev Author: pstieber Date: 2009-01-20 03:39:55 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Commented out tShiftDlg. Modified Paths: -------------- trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Dialogs.h Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2009-01-20 03:37:24 UTC (rev 689) +++ trunk/jazz/src/Dialogs.cpp 2009-01-20 03:39:55 UTC (rev 690) @@ -53,56 +53,54 @@ // ************************************************************************* //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -tShiftDlg::tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long unit) - : tPropertyListDlg("Shift events left/right"), - mSteps(0), - mUnit(unit), - mpFilter(pFilter), - mpSong(pFilter->GetSong()) -{ -} +//tShiftDlg::tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long unit) +// : tPropertyListDlg("Shift events left/right"), +// mSteps(0), +// mUnit(unit), +// mpFilter(pFilter), +// mpSong(pFilter->GetSong()) +//{ +//} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool tShiftDlg::OnClose() -{ - cout << "tShiftDlg::OnClose " << mSteps << endl; - tCmdShift cmd(mpFilter, mSteps * mUnit); - cmd.Execute(); +//bool tShiftDlg::OnClose() +//{ +// cout << "tShiftDlg::OnClose " << mSteps << endl; +// tCmdShift cmd(mpFilter, mSteps * mUnit); +// cmd.Execute(); +// +// JZProjectManager::Instance()->UpdateAllViews(); +// +// // wxForm::OnOk(); +// return false; +//} - JZProjectManager::Instance()->UpdateAllViews(); - - // wxForm::OnOk(); - return false; -} - //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void tShiftDlg::OnHelp() -{ - gpHelpInstance->ShowTopic("Shift"); -} +//void tShiftDlg::OnHelp() +//{ +// gpHelpInstance->ShowTopic("Shift"); +//} //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -void tShiftDlg::AddProperties() -{ -//send wxPropertyValue REFERENCE not POINTER - sheet->AddProperty(new wxProperty( - "Snaps", - wxPropertyValue(&mSteps), - "integer", - new wxIntegerListValidator(-16, 16))); +//void tShiftDlg::AddProperties() +//{ +////send wxPropertyValue REFERENCE not POINTER +// sheet->AddProperty(new wxProperty( +// "Snaps", +// wxPropertyValue(&mSteps), +// "integer", +// new wxIntegerListValidator(-16, 16))); +// +// sheet->AddProperty(new wxProperty( +// "clocks per snap", +// (long)mUnit, +// "integer")); // informational only +//} - sheet->AddProperty(new wxProperty( - "clocks per snap", - (long)mUnit, - "integer")); // informational only -} - - - // ************************************************************************** // Cleanup // ************************************************************************* Modified: trunk/jazz/src/Dialogs.h =================================================================== --- trunk/jazz/src/Dialogs.h 2009-01-20 03:37:24 UTC (rev 689) +++ trunk/jazz/src/Dialogs.h 2009-01-20 03:39:55 UTC (rev 690) @@ -33,22 +33,22 @@ class JZTrack; class JZEvent; -class tShiftDlg : public tPropertyListDlg -{ - public: +//class tShiftDlg : public tPropertyListDlg +//{ +// public: +// +// long mSteps; // 0 was static +// long mUnit; +// +// JZFilter* mpFilter; +// JZSong* mpSong; +// +// tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long Unit); +// void AddProperties(); +// bool OnClose(); +// void OnHelp(); +//}; - long mSteps; // 0 was static - long mUnit; - - JZFilter* mpFilter; - JZSong* mpSong; - - tShiftDlg(JZEventFrame* pEventWindow, JZFilter* pFilter, long Unit); - void AddProperties(); - bool OnClose(); - void OnHelp(); -}; - class tCleanupDlg : public tPropertyListDlg { public: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-20 03:37:34
|
Revision: 689 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=689&view=rev Author: pstieber Date: 2009-01-20 03:37:24 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Added the base class to the initializer list. Modified Paths: -------------- trunk/jazz/src/Project.cpp Modified: trunk/jazz/src/Project.cpp =================================================================== --- trunk/jazz/src/Project.cpp 2009-01-20 00:46:00 UTC (rev 688) +++ trunk/jazz/src/Project.cpp 2009-01-20 03:37:24 UTC (rev 689) @@ -68,7 +68,8 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZProject::JZProject() - : mpConfig(0), + : JZSong(), + mpConfig(0), mpMidiPlayer(0), mpSynth(0), mpRecInfo(0), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-20 00:46:09
|
Revision: 688 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=688&view=rev Author: pstieber Date: 2009-01-20 00:46:00 +0000 (Tue, 20 Jan 2009) Log Message: ----------- Replaced tab characters with spaces. Modified Paths: -------------- branches/jazz-4.1.3/src/audiodrv.h branches/jazz-4.1.3/src/ctrledit.h branches/jazz-4.1.3/src/events.cpp branches/jazz-4.1.3/src/eventwin.h branches/jazz-4.1.3/src/filter.cpp branches/jazz-4.1.3/src/filter.h branches/jazz-4.1.3/src/genmeldy.cpp branches/jazz-4.1.3/src/guitar.cpp branches/jazz-4.1.3/src/harmonyp.cpp branches/jazz-4.1.3/src/harmonyp.h branches/jazz-4.1.3/src/hbanalyz.cpp branches/jazz-4.1.3/src/jazz.h branches/jazz-4.1.3/src/maction.cpp branches/jazz-4.1.3/src/maction.h branches/jazz-4.1.3/src/mapper.cpp branches/jazz-4.1.3/src/mapper.h branches/jazz-4.1.3/src/mstdfile.h branches/jazz-4.1.3/src/pianowin.cpp branches/jazz-4.1.3/src/pianowin.h branches/jazz-4.1.3/src/player.cpp branches/jazz-4.1.3/src/random.cpp branches/jazz-4.1.3/src/random.h branches/jazz-4.1.3/src/rhythm.cpp branches/jazz-4.1.3/src/rhythm.h branches/jazz-4.1.3/src/samplcmd.cpp branches/jazz-4.1.3/src/samplcmd.h branches/jazz-4.1.3/src/sampldlg.cpp branches/jazz-4.1.3/src/sample.cpp branches/jazz-4.1.3/src/sample.h branches/jazz-4.1.3/src/samplwin.cpp branches/jazz-4.1.3/src/sb_scrol.c branches/jazz-4.1.3/src/shuffle.cpp branches/jazz-4.1.3/src/shuffle.h branches/jazz-4.1.3/src/sig2.cpp branches/jazz-4.1.3/src/sig2.h branches/jazz-4.1.3/src/signali.h branches/jazz-4.1.3/src/song.cpp branches/jazz-4.1.3/src/song.h branches/jazz-4.1.3/src/splcmplx.cpp branches/jazz-4.1.3/src/splcmplx.h branches/jazz-4.1.3/src/synth.cpp branches/jazz-4.1.3/src/synth.h branches/jazz-4.1.3/src/track.cpp branches/jazz-4.1.3/src/track.h branches/jazz-4.1.3/src/trackwin.cpp branches/jazz-4.1.3/src/trackwin.h branches/jazz-4.1.3/src/util.cpp branches/jazz-4.1.3/src/util.h branches/jazz-4.1.3/src/winaudio.cpp branches/jazz-4.1.3/src/winaudio.h Modified: branches/jazz-4.1.3/src/audiodrv.h =================================================================== --- branches/jazz-4.1.3/src/audiodrv.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/audiodrv.h 2009-01-20 00:46:00 UTC (rev 688) @@ -28,7 +28,7 @@ // in oss/free (from kernel 2.0.29) the following is not implemented // but this works for oss/linux for 2.0.29 // #ifndef SNDCTL_SEQ_GETTIME -// #define SNDCTL_SEQ_GETTIME _IOR ('Q',19, int) +// #define SNDCTL_SEQ_GETTIME _IOR ('Q',19, int) // #endif #include <sys/time.h> @@ -67,7 +67,7 @@ } private: - int can_duplex; // TRUE = can do full duplex record/play + int can_duplex; // TRUE = can do full duplex record/play int WriteSamples(); void ReadSamples(); @@ -87,10 +87,9 @@ tAudioListener *listener; tAudioRecordBuffer recbuffers; - int force_read; // needed by buggy audio driver ... + int force_read; // needed by buggy audio driver ... }; - #endif // AUDIO #endif Modified: branches/jazz-4.1.3/src/ctrledit.h =================================================================== --- branches/jazz-4.1.3/src/ctrledit.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/ctrledit.h 2009-01-20 00:46:00 UTC (rev 688) @@ -83,7 +83,7 @@ int sticky; // SN++ - int x_off; + int x_off; int ctrlmode; tTrack *track; long from_clock; Modified: branches/jazz-4.1.3/src/events.cpp =================================================================== --- branches/jazz-4.1.3/src/events.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/events.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -79,15 +79,17 @@ { #ifndef wx_msw FILE *testfd = fopen(fname, "r"); - if (testfd) { - fclose( testfd ); - char *syscmd; - syscmd = new char[ strlen( "cp" ) + 2*strlen( fname ) + strlen( ".backup" ) + 3 ]; - sprintf( syscmd, "cp %s %s.backup", fname, fname ); - if (system( syscmd ) != 0) { - fprintf(stderr, "Could not make backup file %s.backup\n", fname ); - } - delete syscmd; + if (testfd) + { + fclose( testfd ); + char *syscmd; + syscmd = new char[ strlen( "cp" ) + 2*strlen( fname ) + strlen( ".backup" ) + 3 ]; + sprintf( syscmd, "cp %s %s.backup", fname, fname ); + if (system( syscmd ) != 0) + { + fprintf(stderr, "Could not make backup file %s.backup\n", fname ); + } + delete syscmd; } #endif fd = fopen(fname, "wb"); Modified: branches/jazz-4.1.3/src/eventwin.h =================================================================== --- branches/jazz-4.1.3/src/eventwin.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/eventwin.h 2009-01-20 00:46:00 UTC (rev 688) @@ -95,8 +95,8 @@ // Setup() wxFont *Font; - wxFont *FixedFont; // bleibt bei 12pt - int hFixedFont; // Hoehe eines Buchstaben + wxFont *FixedFont; // bleibt bei 12pt + int hFixedFont; // Hoehe eines Buchstaben long LittleBit; long hLine; @@ -113,7 +113,7 @@ // filled by OnPaint() wxDC *dc; long xEvents, yEvents, wEvents, hEvents; - long xx, yy, ww, hh; // canvas coords + long xx, yy, ww, hh; // canvas coords long FromClock, ToClock; long FromLine, ToLine; @@ -162,7 +162,7 @@ // Edit-Menu - int EventsSelected(const char *msg = 0); // if selection active: TRUE, else: Errormessage + FALSE + int EventsSelected(const char *msg = 0); // if selection active: TRUE, else: Errormessage + FALSE void MenQuantize(); void MenSetChannel(); void MenTranspose(); Modified: branches/jazz-4.1.3/src/filter.cpp =================================================================== --- branches/jazz-4.1.3/src/filter.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/filter.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -34,14 +34,14 @@ const tFltEvent FltEvents[nFltEvents] = { - { StatKeyOn, "Note", 1, 0, 127}, - { StatKeyPressure, "Poly Aftertouch",1, 0, 127}, - { StatControl, "Controller", 1, 0, 127}, - { StatProgram, "Patch", 1, 0, 127}, - { StatPitch, "Pitch", 1, -8192, 8192}, - { StatTimeSignat, "Meter", 1, 0, 0}, - { StatChnPressure, "Channel Aftertouch",1, 0, 0}, - { StatSysEx, "SysEx", 1, 0, 0} + { StatKeyOn, "Note", 1, 0, 127}, + { StatKeyPressure, "Poly Aftertouch", 1, 0, 127}, + { StatControl, "Controller", 1, 0, 127}, + { StatProgram, "Patch", 1, 0, 127}, + { StatPitch, "Pitch", 1, -8192, 8192}, + { StatTimeSignat, "Meter", 1, 0, 0}, + { StatChnPressure, "Channel Aftertouch", 1, 0, 0}, + { StatSysEx, "SysEx", 1, 0, 0} }; @@ -152,11 +152,11 @@ { Add(wxMakeFormShort("Min:", &Filter->FltEvents[i].FromValue, wxFORM_DEFAULT,0,0,0,90)); Add(wxMakeFormShort("Max:", &Filter->FltEvents[i].ToValue, wxFORM_DEFAULT,0,0,0,90)); - Add(wxMakeFormBool(Filter->FltEvents[i].Name, &Filter->FltEvents[i].Selected, wxFORM_DEFAULT)); + Add(wxMakeFormBool(Filter->FltEvents[i].Name, &Filter->FltEvents[i].Selected, wxFORM_DEFAULT)); Add(wxMakeFormNewLine()); } else - Add(wxMakeFormBool(Filter->FltEvents[i].Name, &Filter->FltEvents[i].Selected, wxFORM_DEFAULT)); + Add(wxMakeFormBool(Filter->FltEvents[i].Name, &Filter->FltEvents[i].Selected, wxFORM_DEFAULT)); } Add(wxMakeFormBool("Other", &Filter->OtherSelected)); Modified: branches/jazz-4.1.3/src/filter.h =================================================================== --- branches/jazz-4.1.3/src/filter.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/filter.h 2009-01-20 00:46:00 UTC (rev 688) @@ -35,16 +35,16 @@ class tTrack; -#define FltKeyOn 0 +#define FltKeyOn 0 #define FltKeyPressure 1 // SN++ PolyAftertouch gehoert to KeyOn Events! -#define FltControl 2 -#define FltProgram 3 -#define FltPitch 4 -#define FltTempo 5 +#define FltControl 2 +#define FltProgram 3 +#define FltPitch 4 +#define FltTempo 5 #define FltChnPressure 6 // SN++ Channel Aftertouch #define FltSysEx 7 -#define nFltEvents 8 +#define nFltEvents 8 class tFltEvent @@ -71,8 +71,8 @@ Bool OtherSelected; tSong *Song; - long FromClock, ToClock; // einschl .. ausschl - int FromTrack, ToTrack; // 1..n einschl .. einschl + long FromClock, ToClock; // include .. drop + int FromTrack, ToTrack; // 1..n include .. drop void Dialog(wxFrame *parent, int ShowEventStats = 1); @@ -88,24 +88,24 @@ for (int i = 0; i < nFltEvents; i++) { if (e->Stat == FltEvents[i].Stat) - { - // SN++ Aftertouch gehoert eigendlich zu KeyOn Events. - if (e->Stat == StatKeyPressure) { + { + // SN++ Aftertouch gehoert eigendlich zu KeyOn Events. + if (e->Stat == StatKeyPressure) { int aval = e->IsKeyPressure()->Key; return FltEvents[i].Selected && - FltEvents[i].FromValue <= aval && aval <= FltEvents[i].ToValue; - } - if( e->Stat == StatTimeSignat) - return FltEvents[i].Selected; - // SN++ + FltEvents[i].FromValue <= aval && aval <= FltEvents[i].ToValue; + } + if( e->Stat == StatTimeSignat) + return FltEvents[i].Selected; + // SN++ if( e->Stat == StatChnPressure) - return FltEvents[i].Selected; + return FltEvents[i].Selected; if (e->Stat == StatSysEx) - return FltEvents[i].Selected; + return FltEvents[i].Selected; return FltEvents[i].Selected && FltEvents[i].FromValue <= val && val <= FltEvents[i].ToValue; - } + } } return OtherSelected; } Modified: branches/jazz-4.1.3/src/genmeldy.cpp =================================================================== --- branches/jazz-4.1.3/src/genmeldy.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/genmeldy.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -45,24 +45,25 @@ #include "../bitmaps/play.xpm" #include "../bitmaps/help.xpm" -static tToolDef tdefs[] = { - { MEN_LOAD, FALSE, 0, tb_open }, - { MEN_SAVE, FALSE, 1, tb_save }, - { MEN_GEN, FALSE, 0, tb_rrggen }, - { MEN_TRANSP, FALSE, 0, tb_transpos }, - { MEN_PLAY, FALSE, 1, tb_play }, - { MEN_HELP, FALSE, 0, tb_help } +static tToolDef tdefs[] = +{ + { MEN_LOAD, FALSE, 0, tb_open }, + { MEN_SAVE, FALSE, 1, tb_save }, + { MEN_GEN, FALSE, 0, tb_rrggen }, + { MEN_TRANSP, FALSE, 0, tb_transpos }, + { MEN_PLAY, FALSE, 1, tb_play }, + { MEN_HELP, FALSE, 0, tb_help } }; #else static tToolDef tdefs[] = { - { MEN_LOAD, FALSE, 0, "tb_open", "load settings" }, - { MEN_SAVE, FALSE, 1, "tb_save", "save settings" }, - { MEN_GEN, FALSE, 0, "tb_rrggen", "generate" }, - { MEN_TRANSP, FALSE, 0, "tb_transpos", "transpose trackwin selection" }, - { MEN_PLAY, FALSE, 1, "tb_play", "play" }, - { MEN_HELP, FALSE, 0, "tb_help", "help" } + { MEN_LOAD, FALSE, 0, "tb_open", "load settings" }, + { MEN_SAVE, FALSE, 1, "tb_save", "save settings" }, + { MEN_GEN, FALSE, 0, "tb_rrggen", "generate" }, + { MEN_TRANSP, FALSE, 0, "tb_transpos", "transpose trackwin selection" }, + { MEN_PLAY, FALSE, 1, "tb_play", "play" }, + { MEN_HELP, FALSE, 0, "tb_help", "help" } }; #endif @@ -156,8 +157,9 @@ case MEN_LOAD: { char * fname = file_selector(default_filename, "Load Generator", 0, 0, "*.mel"); - if (fname) { - ifstream is(fname); + if (fname) + { + ifstream is(fname); int x; is >> x; // version is >> pitch_center; @@ -184,8 +186,9 @@ case MEN_SAVE: { char * fname = file_selector(default_filename, "Save Generator", 1, 0, "*.mel"); - if (fname) { - ofstream os(fname); + if (fname) + { + ofstream os(fname); os << 1 << endl; os << pitch_center << " "; os << pitch_range << " "; @@ -214,8 +217,8 @@ break; case MEN_HELP: - HelpInstance->ShowTopic("Random Melody Generator"); - break; + HelpInstance->ShowTopic("Random Melody Generator"); + break; } } Modified: branches/jazz-4.1.3/src/guitar.cpp =================================================================== --- branches/jazz-4.1.3/src/guitar.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/guitar.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -89,11 +89,11 @@ static const int bass_pitches[4]; int ww, hh; - int hstring, wfret; // rounded values + int hstring, wfret; // rounded values float wtext, htext; - int act_pitch; // mouse move - int play_pitch; // sound - long put_clock; // left up + int act_pitch; // mouse move + int play_pitch; // sound + long put_clock; // left up wxFont *font; }; @@ -116,7 +116,9 @@ public: tGuitarSettingsDlg(tGuitarCanvas *c) - : wxForm( USED_WXFORM_BUTTONS ), cnvs(c) {} + : wxForm( USED_WXFORM_BUTTONS ), cnvs(c) + { + } void EditForm(wxPanel *panel); virtual void OnOk(); virtual void OnHelp(); @@ -249,22 +251,22 @@ case 0: case 11: case 23: - dc->DrawLine(x+2, y1, x+2, y2); - break; + dc->DrawLine(x+2, y1, x+2, y2); + break; case 4: case 6: case 16: case 18: - dc->DrawLine(x+2, y1+d1, x+2, y2-d1); - break; + dc->DrawLine(x+2, y1+d1, x+2, y2-d1); + break; default: case 2: case 8: case 14: case 20: - break; + break; } } @@ -316,7 +318,7 @@ { for (int i = 0; i < n_strings; i++) for (int p = pitch % 12; p < 127; p += 12) - DrawPitch(p, i, show); + DrawPitch(p, i, show); } else for (int i = 0; i < n_strings; i++) @@ -364,8 +366,8 @@ } if (pitch) { - tKeyOn on(0, piano->Channel(), pitch, 80); - Midi->OutNow(piano->Track, &on); + tKeyOn on(0, piano->Channel(), pitch, 80); + Midi->OutNow(piano->Track, &on); } play_pitch = pitch; } @@ -412,10 +414,10 @@ // tGuitarWin // ==================================================================== -#define MEN_CLEAR 1 -#define MEN_SETTINGS 2 -#define MEN_CLOSE 3 -#define MEN_HELP 4 +#define MEN_CLEAR 1 +#define MEN_SETTINGS 2 +#define MEN_CLOSE 3 +#define MEN_HELP 4 tGuitarWin::tGuitarWin(tPianoWin *parent) : wxFrame(0, "Guitar board", 20, 20, 600, 120) @@ -424,12 +426,12 @@ int w = 600, h = 120; piano = parent; wxMenu *menu = new wxMenu; - menu->Append(MEN_CLEAR, "C&lear"); - menu->Append(MEN_SETTINGS, "&Settings"); - menu->Append(MEN_HELP, "&Help"); - menu->Append(MEN_CLOSE, "&Close"); + menu->Append(MEN_CLEAR, "C&lear"); + menu->Append(MEN_SETTINGS, "&Settings"); + menu->Append(MEN_HELP, "&Help"); + menu->Append(MEN_CLOSE, "&Close"); wxMenuBar *menu_bar = new wxMenuBar; - menu_bar->Append(menu, "&Menu"); + menu_bar->Append(menu, "&Menu"); SetMenuBar(menu_bar); canvas = new tGuitarCanvas(this, piano, 0, 0, w, h); } Modified: branches/jazz-4.1.3/src/harmonyp.cpp =================================================================== --- branches/jazz-4.1.3/src/harmonyp.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/harmonyp.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -29,7 +29,8 @@ // HBChord // ======================================================================== -const char *const HBChord::scale_names[2][12] = { +const char *const HBChord::scale_names[2][12] = +{ { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B" }, { "C", "Db", "D", "Eb", "E", "F", "Gb", "G", "Ab", "A", "Bb", "B" } }; @@ -205,15 +206,19 @@ void HBChord::Rotate(int semis) { - if (semis > 0) { - while (semis--) { + if (semis > 0) + { + while (semis--) + { if (keys & 0x800) keys = ((keys & ~0x800) << 1) + 1; else keys <<= 1; } } - else if (semis < 0) { - while (semis++) { + else if (semis < 0) + { + while (semis++) + { if (keys & 1) keys = (keys >> 1) | 0x800; else keys >>= 1; @@ -526,70 +531,71 @@ }; scdef scales[] = { - { "***** major scales *****", ""}, - { "major penta", "1 9 3 5 13" }, - { "ionic", "1 9 3 11 5 13 j7" }, - { "lydic", "1 9 3 11+ 5 13 j7"}, - { "har III (ion 5+)", "1 9 3 11 5+ 13 j7"}, - { "har VI (lyd 9+)", "1 9+ 3 11+ 5 13 j7"}, - { "mel III (lyd 5+)", "1 9 3 11+ 5+ 13 j7"}, - { "augmented", "1 9- 3 11 5+ 13"}, - { "ionic 13-", "1 9 3 11 5 13- j7"}, - { "***** minor scales *****", ""}, - { "minor penta", "1 3- 11 5 7"}, - { "aeolic", "1 9 3- 11 5 13- 7"}, - { "doric", "1 9 3- 11 5 13 7"}, - { "mel II (doric 9-)","1 9- 3- 11 5 13 7"}, - { "phrygic", "1 9- 3- 11 5 13- 7"}, - { "jap. penta", "1 9- 11 5 7"}, - { "har IV (dor 11+)", "1 9 3- 11+ 5 13 7"}, - { "harmonic minor", "1 9 3- 11 5 13- j7"}, - { "melodic minor", "1 9 3- 11 5 13 j7"}, - { "gipsy", "1 9 3- 11+ 5 13- j7" }, - { "melodic 11+", "1 9 3- 11+ 5 13 j7" }, - { "***** dominant scales *****", "" }, - { "major penta", "1 9 3 5 13" }, - { "ind. penta", "1 3 11 5 7" }, - { "mixolyd", "1 9 3 11 5 13 7" }, - { "har V (har dominant)", "1 9- 3 11 5 13- 7" }, - { "mel IV (mixo 11+)","1 9 3 11+ 5 13 7" }, - { "mixo 11+9-", "1 9- 3 11+ 5 13 7" }, - { "mel V (mixo 13-)", "1 9 3 11 5 13- 7" }, - { "mixo 9-", "1 9- 3 11 5 13 7" }, - { "full 1", "1 9 3 5- 13- 7" }, - { "full 2", "1 9 3 11+ 5+ 7" }, - { "har alt", "1 9- 9+ 3 5 13- 7" }, - { "mel VII (altered)","1 9- 9+ 3 11+ 13- 7" }, - { "semi/full", "1 9- 9+ 3 11+ 5 13 7" }, - { "***** semi dimin *****", ""}, - { "locrian", "1 9- 3- 11 5- 13- 7" }, - { "mel VI (locrian 9)", "1 9 3- 11 5- 13- 7" }, - { "har II (locrian 13)", "1 9- 3- 11 5- 13 7" }, - { "doric 5-", "1 9 3- 11 5- 13 7" }, - { "***** dimin *****", ""}, - { "har VII (har dim)","1 9- 3- 11- 5- 13- 7-"}, - { "full/semi", "1 9 3- 11 5- 13 7- 15-"}, - { "locrian dim", "1 9- 3- 11 5- 13- 7-" }, - { "***** blues scales *****", "" }, - { "minor penta 5-", "1 3- 11 5- 5 7" }, - { "blues scale", "1 3- 3 11 5- 5 7"}, + { "***** major scales *****", ""}, + { "major penta", "1 9 3 5 13"}, + { "ionic", "1 9 3 11 5 13 j7"}, + { "lydic", "1 9 3 11+ 5 13 j7"}, + { "har III (ion 5+)", "1 9 3 11 5+ 13 j7"}, + { "har VI (lyd 9+)", "1 9+ 3 11+ 5 13 j7"}, + { "mel III (lyd 5+)", "1 9 3 11+ 5+ 13 j7"}, + { "augmented", "1 9- 3 11 5+ 13"}, + { "ionic 13-", "1 9 3 11 5 13- j7"}, + { "***** minor scales *****", ""}, + { "minor penta", "1 3- 11 5 7"}, + { "aeolic", "1 9 3- 11 5 13- 7"}, + { "doric", "1 9 3- 11 5 13 7"}, + { "mel II (doric 9-)", "1 9- 3- 11 5 13 7"}, + { "phrygic", "1 9- 3- 11 5 13- 7"}, + { "jap. penta", "1 9- 11 5 7"}, + { "har IV (dor 11+)", "1 9 3- 11+ 5 13 7"}, + { "harmonic minor", "1 9 3- 11 5 13- j7"}, + { "melodic minor", "1 9 3- 11 5 13 j7"}, + { "gipsy", "1 9 3- 11+ 5 13- j7"}, + { "melodic 11+", "1 9 3- 11+ 5 13 j7"}, + { "***** dominant scales *****", ""}, + { "major penta", "1 9 3 5 13"}, + { "ind. penta", "1 3 11 5 7"}, + { "mixolyd", "1 9 3 11 5 13 7"}, + { "har V (har dominant)", "1 9- 3 11 5 13- 7"}, + { "mel IV (mixo 11+)", "1 9 3 11+ 5 13 7"}, + { "mixo 11+9-", "1 9- 3 11+ 5 13 7"}, + { "mel V (mixo 13-)", "1 9 3 11 5 13- 7"}, + { "mixo 9-", "1 9- 3 11 5 13 7"}, + { "full 1", "1 9 3 5- 13- 7"}, + { "full 2", "1 9 3 11+ 5+ 7"}, + { "har alt", "1 9- 9+ 3 5 13- 7"}, + { "mel VII (altered)", "1 9- 9+ 3 11+ 13- 7"}, + { "semi/full", "1 9- 9+ 3 11+ 5 13 7"}, + { "***** semi dimin *****", ""}, + { "locrian", "1 9- 3- 11 5- 13- 7"}, + { "mel VI (locrian 9)", "1 9 3- 11 5- 13- 7"}, + { "har II (locrian 13)", "1 9- 3- 11 5- 13 7"}, + { "doric 5-", "1 9 3- 11 5- 13 7"}, + { "***** dimin *****", ""}, + { "har VII (har dim)", "1 9- 3- 11- 5- 13- 7-"}, + { "full/semi", "1 9 3- 11 5- 13 7- 15-"}, + { "locrian dim", "1 9- 3- 11 5- 13- 7-"}, + { "***** blues scales *****", ""}, + { "minor penta 5-", "1 3- 11 5- 5 7"}, + { "blues scale", "1 3- 3 11 5- 5 7"}, { 0, 0 } }; -scdef chords[] = { - { "j7", "1 3 5 j7"}, - { "m7", "1 3- 5 7" }, - { "7", "1 3 5 7" }, - { "m75-", "1 3- 5- 7" }, - { "mj7", "1 3- 5 j7" }, - { "j75+", "1 3 5+ j7" }, - { "0", "1 3- 5- 6" }, - { "sus4", "1 4 5" }, - { "7sus4", "1 4 5 7" }, - { "j7sus4", "1 4 5 j7" }, - { "alt (79+13-)", "1 3 9+ 13- 7" }, - { "75-", "1 3 5- 7" }, +scdef chords[] = +{ + { "j7", "1 3 5 j7"}, + { "m7", "1 3- 5 7"}, + { "7", "1 3 5 7"}, + { "m75-", "1 3- 5- 7"}, + { "mj7", "1 3- 5 j7"}, + { "j75+", "1 3 5+ j7"}, + { "0", "1 3- 5- 6"}, + { "sus4", "1 4 5"}, + { "7sus4", "1 4 5 7"}, + { "j7sus4", "1 4 5 j7"}, + { "alt (79+13-)", "1 3 9+ 13- 7"}, + { "75-", "1 3 5- 7"}, }; long scansc(const char *s) Modified: branches/jazz-4.1.3/src/harmonyp.h =================================================================== --- branches/jazz-4.1.3/src/harmonyp.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/harmonyp.h 2009-01-20 00:46:00 UTC (rev 688) @@ -40,19 +40,19 @@ friend istream & operator >> (istream &is, HBChord &a); public: - HBChord() { keys = 0; } - HBChord(long k) { keys = k; } + HBChord() { keys = 0; } + HBChord(long k) { keys = k; } HBChord(int a, int b, int c = -1, int d = -1, int e = -1, int f = -1, int g = -1, int h = -1, int i = -1, int k = -1, int l = -1); void Rotate(int semis); - int Fit(int key); // nearest key in chord - int Count() const; // # keys in chord - int Iter(int key) const; // next key in chord + int Fit(int key); // nearest key in chord + int Count() const; // # keys in chord + int Iter(int key) const; // next key in chord - void Clear() { keys = 0; } - long Keys() const { return keys; } + void Clear() { keys = 0; } + long Keys() const { return keys; } - bool Contains(int key) const // key in chord? + bool Contains(int key) const // key in chord? { return (1L << ((key + 240) % 12)) & keys; } @@ -191,32 +191,32 @@ // scales, msb = highest note const HBChord major_scale (0xab5L); -const HBChord harmonic_scale (0x9adL); -const HBChord melodic_scale (0xaadL); -const HBChord ionb13_scale (0x9b5L); +const HBChord harmonic_scale (0x9adL); +const HBChord melodic_scale (0xaadL); +const HBChord ionb13_scale (0x9b5L); -const HBChord altered_scale (0, 1, 3, 4, 6, 8, 10); +const HBChord altered_scale (0, 1, 3, 4, 6, 8, 10); const HBChord dimin_scale (0xb6dL); -const HBChord chromatic_scale (0xfffL); +const HBChord chromatic_scale (0xfffL); // chords, based to C -const HBChord Cj7 (0,4,7,11); -const HBChord Cj7b5 (0,4,6,11); -const HBChord Cj7s5 (0,4,8,11); +const HBChord Cj7(0,4,7,11); +const HBChord Cj7b5(0,4,6,11); +const HBChord Cj7s5(0,4,8,11); -const HBChord C7 (0,4,7,10); -const HBChord C7b5 (0,4,6,10); -const HBChord C7s5 (0,4,8,10); +const HBChord C7(0,4,7,10); +const HBChord C7b5(0,4,6,10); +const HBChord C7s5(0,4,8,10); -const HBChord Cm7 (0,3,7,10); -const HBChord Cm7b5 (0,3,6,10); -const HBChord Cm7s5 (0,3,8,10); +const HBChord Cm7(0,3,7,10); +const HBChord Cm7b5(0,3,6,10); +const HBChord Cm7s5(0,3,8,10); -const HBChord Cmj7 (0,3,7,11); -const HBChord Cmj7b5 (0,3,6,11); -const HBChord Cmj7s5 (0,3,8,11); +const HBChord Cmj7(0,3,7,11); +const HBChord Cmj7b5(0,3,6,11); +const HBChord Cmj7s5(0,3,8,11); -const HBChord C0 (0,3,6,9); +const HBChord C0(0,3,6,9); // ------------------------------------------------------------------ // HBContext @@ -234,27 +234,27 @@ HBContext(int sn, int cn = 0, tScaleType st = Major); HBContext(); - HBChord *PScale() { return &scale; } - HBChord Scale() const { return scale; } - HBChord *PChord() { return &chord; } - HBChord Chord() const { return chord; } - int ScaleKey() const { return scale_nr; } - int ChordKey() const { return chord_key; } + HBChord *PScale() { return &scale; } + HBChord Scale() const { return scale; } + HBChord *PChord() { return &chord; } + HBChord Chord() const { return chord; } + int ScaleKey() const { return scale_nr; } + int ChordKey() const { return chord_key; } - int ChordNr() const { return chord_nr; } - int ScaleNr() const { return scale_nr; } - tScaleType ScaleType() const { return scale_type; } - int SeqNr() const { return seq_nr; } - void SetSeqNr(int n = 0) { seq_nr = n; } + int ChordNr() const { return chord_nr; } + int ScaleNr() const { return scale_nr; } + tScaleType ScaleType() const { return scale_type; } + int SeqNr() const { return seq_nr; } + void SetSeqNr(int n = 0) { seq_nr = n; } - const char * ChordName() const; // "Dm75-" - const char * ChordNrName() const; // "IV" - const char * ContextName() const // "mixo#11" + const char * ChordName() const; // "Dm75-" + const char * ChordNrName() const; // "IV" + const char * ContextName() const // "mixo#11" { return context_names[scale_type][chord_nr]; } - const char * ScaleName() const; // "C#" - const char * ScaleTypeName() const; // "major" + const char * ScaleName() const; // "C#" + const char * ScaleTypeName() const; // "major" int operator == (const HBContext &o) const { @@ -262,7 +262,10 @@ scale_nr == o.scale_nr && chord_nr == o.chord_nr; } - int operator != (const HBContext &o) const { return !operator==(o); } + int operator != (const HBContext &o) const + { + return !operator==(o); + } private: void Initialize(); @@ -297,7 +300,10 @@ class HBMatch { public: - virtual bool operator()(const HBContext &) { return true; } + virtual bool operator()(const HBContext &) + { + return true; + } }; class HBMatchContains : public HBMatch @@ -315,11 +321,15 @@ public: HBContextIterator(); HBContextIterator(HBMatch &); - void SetSequence(HBContext *s[], int n) { seq = s; n_seq = n; } + void SetSequence(HBContext *s[], int n) + { + seq = s; + n_seq = n; + } void SetScaleType(tScaleType st) { scale_type = st; } bool operator()(); - const HBContext *operator->() const { return &context; } - const HBContext &Context() const { return context; } + const HBContext *operator->() const { return &context; } + const HBContext &Context() const { return context; } private: HBContext context; Modified: branches/jazz-4.1.3/src/hbanalyz.cpp =================================================================== --- branches/jazz-4.1.3/src/hbanalyz.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/hbanalyz.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -49,7 +49,7 @@ void HBAnalyzer::Init(tFilter *f, int epc) { - Exit(); // cleanup from previous run + Exit(); // cleanup from previous run filter = f; start_clock = f->FromClock; @@ -57,7 +57,7 @@ eighths_per_chord = epc; if (eighths_per_chord == 0) - steps = max_seq; // map number of chords to selection + steps = max_seq; // map number of chords to selection else { tBarInfo BarInfo(filter->Song); @@ -133,10 +133,10 @@ tEvent *e = Events.Range(filter->FromClock, filter->ToClock); while (e) { - tKeyOn *on = e->IsKeyOn(); - if (on) - (this->*Action)(on, t); - e = Events.Next(); + tKeyOn *on = e->IsKeyOn(); + if (on) + (this->*Action)(on, t); + e = Events.Next(); } t->Cleanup(); } @@ -161,9 +161,9 @@ if (on->Clock + on->Length >= start && on->Clock < stop) { if (on->Clock > start) - start = on->Clock; + start = on->Clock; if (on->Clock + on->Length < stop) - stop = on->Clock + on->Length; + stop = on->Clock + on->Length; count[i][on->Key % 12] += stop - start; } } @@ -182,20 +182,20 @@ long fr = start; long to = stop; if (on->Clock > fr) - fr = on->Clock; + fr = on->Clock; if (on->Clock + on->Length < to) - to = on->Clock + on->Length; + to = on->Clock + on->Length; // transpose if most of key length belongs to this step // OR: it covers the whole step if (to - fr >= on->Length/2 || (fr == start && to == stop)) { - tKeyOn *cp = (tKeyOn *)on->Copy(); - cp->Key += delta[i][on->Key % 12]; - track->Kill(on); - track->Put(cp); + tKeyOn *cp = (tKeyOn *)on->Copy(); + cp->Key += delta[i][on->Key % 12]; + track->Kill(on); + track->Put(cp); - // do not transpose again + // do not transpose again break; } } @@ -304,7 +304,7 @@ tChordMatrix() { for (int i = 0; i < 12; i++) for (int j = 0; j < 12; j++) - mat[i][j] = 0; + mat[i][j] = 0; } double* operator[](int i) { return mat[i]; } private: @@ -336,12 +336,12 @@ for (j = 0; j < 12; j++) { double cost = 0; - if (!chord.Contains(j)) - cost += not_in_chord_costs; - if (!scale.Contains(j)) - cost += not_in_scale_costs; - cost += fabs(i-j) * costs_per_semitone; - cost *= count[step][i]; + if (!chord.Contains(j)) + cost += not_in_chord_costs; + if (!scale.Contains(j)) + cost += not_in_scale_costs; + cost += fabs(i-j) * costs_per_semitone; + cost *= count[step][i]; mat[i][j] = cost; } } @@ -393,12 +393,11 @@ } if (best[i] == -1 || err < best[i]) { - *seq[i] = ct; - seq[i]->SetSeqNr(i+1); - best[i] = err; + *seq[i] = ct; + seq[i]->SetSeqNr(i+1); + best[i] = err; } } } delete [] best; } - Modified: branches/jazz-4.1.3/src/jazz.h =================================================================== --- branches/jazz-4.1.3/src/jazz.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/jazz.h 2009-01-20 00:46:00 UTC (rev 688) @@ -119,17 +119,21 @@ int Value; char* StrValue; public: - tConfigEntry( char* name, int ival ) - : Name(name), - Value(ival), - StrValue(0), - Type( ConfigEntryTypeInt ) {} - tConfigEntry( char* name, char* sval ); - tConfigEntry( char* name ) - : Name(name), - Value(0), - StrValue(0), - Type( ConfigEntryTypeEmpty ) {} + tConfigEntry( char* name, int ival ) + : Name(name), + Value(ival), + StrValue(0), + Type( ConfigEntryTypeInt ) + { + } + tConfigEntry( char* name, char* sval ); + tConfigEntry( char* name ) + : Name(name), + Value(0), + StrValue(0), + Type( ConfigEntryTypeEmpty ) + { + } }; class tConfig @@ -162,14 +166,14 @@ char* Name( int entry ) { - assert( (entry >= 0) && (entry < NumConfigNames) ); - return Names[entry]->Name; + assert( (entry >= 0) && (entry < NumConfigNames) ); + return Names[entry]->Name; } char*& StrValue( int entry ) { - assert( (entry >= 0) && (entry < NumConfigNames) ); - return Names[entry]->StrValue; + assert( (entry >= 0) && (entry < NumConfigNames) ); + return Names[entry]->StrValue; } int& operator () ( char* name ); @@ -218,9 +222,9 @@ extern tSong *TheSong; extern tSynth *Synth; -#define USED_WXFORM_BUTTONS (wxFORM_BUTTON_OK | \ - wxFORM_BUTTON_CANCEL | \ - wxFORM_BUTTON_HELP) +#define USED_WXFORM_BUTTONS (wxFORM_BUTTON_OK | \ + wxFORM_BUTTON_CANCEL | \ + wxFORM_BUTTON_HELP) #ifndef MIN #define MIN(x, y) ( ((x) < (y)) ? (x) : (y) ) Modified: branches/jazz-4.1.3/src/maction.cpp =================================================================== --- branches/jazz-4.1.3/src/maction.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/maction.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -73,7 +73,7 @@ if (left_action > 0 && e.LeftDown() &&!e.ShiftDown() && !e.ControlDown()) return left_action; - int i = 0; // left down + int i = 0; // left down if (e.MiddleDown()) i = 1; else @@ -130,7 +130,7 @@ tRect rr = r; rr.SetNormal(); if (rr.w && rr.h) - dc->DrawRectangle(rr.x, rr.y, rr.w, rr.h); + dc->DrawRectangle(rr.x, rr.y, rr.w, rr.h); Dragging(e); } else @@ -182,9 +182,9 @@ dc->SetBrush(back); dc->SetLogicalFunction(wxXOR); if (r1.w && r1.h) - dc->DrawRectangle(r1.x, r1.y, r1.w, r1.h); + dc->DrawRectangle(r1.x, r1.y, r1.w, r1.h); if (r2.w && r2.h) - dc->DrawRectangle(r2.x, r2.y, r2.w, r2.h); + dc->DrawRectangle(r2.x, r2.y, r2.w, r2.h); dc->SetLogicalFunction(wxCOPY); } } @@ -272,7 +272,7 @@ if (Coords[i] > x) { if (up || i == 0) - x = Coords[i]; + x = Coords[i]; else x = Coords[i-1]; return; Modified: branches/jazz-4.1.3/src/maction.h =================================================================== --- branches/jazz-4.1.3/src/maction.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/maction.h 2009-01-20 00:46:00 UTC (rev 688) @@ -63,23 +63,23 @@ class tMouseAction { public: - virtual ~tMouseAction() {} - virtual int Dragging(wxMouseEvent &) { return 0; }; - virtual int LeftDown(wxMouseEvent &) { return 0; }; - virtual int LeftUp(wxMouseEvent &) { return 0; }; - virtual int RightDown(wxMouseEvent &) { return 0; }; - virtual int RightUp(wxMouseEvent &) { return 0; }; - virtual int MiddleDown(wxMouseEvent &) { return 0; }; - virtual int MiddleUp(wxMouseEvent &) { return 0; }; + virtual ~tMouseAction() {} + virtual int Dragging(wxMouseEvent &) { return 0; }; + virtual int LeftDown(wxMouseEvent &) { return 0; }; + virtual int LeftUp(wxMouseEvent &) { return 0; }; + virtual int RightDown(wxMouseEvent &) { return 0; }; + virtual int RightUp(wxMouseEvent &) { return 0; }; + virtual int MiddleDown(wxMouseEvent &) { return 0; }; + virtual int MiddleUp(wxMouseEvent &) { return 0; }; virtual int Event(wxMouseEvent &e) { - if (e.Dragging()) return Dragging(e); - else if (e.LeftDown()) return LeftDown(e); - else if (e.LeftUp()) return LeftUp(e); - else if (e.MiddleDown()) return MiddleDown(e); - else if (e.MiddleUp()) return MiddleUp(e); - else if (e.RightDown()) return RightDown(e); - else if (e.RightUp()) return RightUp(e); + if (e.Dragging()) return Dragging(e); + else if (e.LeftDown()) return LeftDown(e); + else if (e.LeftUp()) return LeftUp(e); + else if (e.MiddleDown()) return MiddleDown(e); + else if (e.MiddleUp()) return MiddleUp(e); + else if (e.RightDown()) return RightDown(e); + else if (e.RightUp()) return RightUp(e); return 0; } }; @@ -99,7 +99,7 @@ int Active; virtual void Snap(float &x, float &y, int drag) {} tRect r; - int Selected; // r is valid + int Selected; // r is valid virtual int Dragging(wxMouseEvent &); virtual int Event(wxMouseEvent &e); virtual int ButtonDown(wxMouseEvent &); @@ -138,7 +138,7 @@ { int Min, Max, Delta; int Timeout; - int Wait; // don't inc/dec at Init + int Wait; // don't inc/dec at Init tEventWin *win; virtual int LeftDown(wxMouseEvent &); Modified: branches/jazz-4.1.3/src/mapper.cpp =================================================================== --- branches/jazz-4.1.3/src/mapper.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/mapper.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -134,7 +134,7 @@ if (in_create) return; - if (!enable != !enabled) // avoid flickering + if (!enable != !enabled) // avoid flickering { steps_per_count_slider->Enable(enable); count_per_bar_slider->Enable(enable); @@ -179,13 +179,13 @@ wxMenuBar *menu_bar = new wxMenuBar; wxMenu *menu = new wxMenu; - menu->Append(MEN_HELP, "&Help"); - //menu->Append(MEN_LOAD, "&Load"); - //menu->Append(MEN_SAVE, "&Save"); - menu->Append(MEN_CLOSE, "&Close"); - //menu->Append(MEN_EQUAL, "&Equal"); - //menu->Append(MEN_ANALYZE, "&Analyze"); - menu_bar->Append(menu, "&Menu"); + menu->Append(MEN_HELP, "&Help"); +// menu->Append(MEN_LOAD, "&Load"); +// menu->Append(MEN_SAVE, "&Save"); + menu->Append(MEN_CLOSE, "&Close"); +// menu->Append(MEN_EQUAL, "&Equal"); +// menu->Append(MEN_ANALYZE, "&Analyze"); + menu_bar->Append(menu, "&Menu"); SetMenuBar(menu_bar); int w, h; @@ -255,21 +255,23 @@ case MEN_LOAD: { - char * fname = wxFileSelector("Load Rhythm", NULL, NULL, NULL, "*.rhy"); - if (fname) { - ifstream is(fname); - is >> *this; - } + char * fname = wxFileSelector("Load Rhythm", NULL, NULL, NULL, "*.rhy"); + if (fname) + { + ifstream is(fname); + is >> *this; + } } break; case MEN_SAVE: { - char * fname = wxFileSelector("Save Rhythm", NULL, NULL, NULL, "*.rhy"); - if (fname) { - ofstream os(fname); - os << *this; - } + char * fname = wxFileSelector("Save Rhythm", NULL, NULL, NULL, "*.rhy"); + if (fname) + { + ofstream os(fname); + os << *this; + } } break; Modified: branches/jazz-4.1.3/src/mapper.h =================================================================== --- branches/jazz-4.1.3/src/mapper.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/mapper.h 2009-01-20 00:46:00 UTC (rev 688) @@ -43,16 +43,16 @@ edits[n_edits++] = edit; } private: - Bool enabled; - Bool in_create; - wxSlider *steps_per_count_slider; - wxSlider *count_per_bar_slider; - wxSlider *n_bars_slider; - int steps_per_count; - int count_per_bar; - int n_bars; - tRhyArrayEdit *edits[20]; - int n_edits; + Bool enabled; + Bool in_create; + wxSlider* steps_per_count_slider; + wxSlider* count_per_bar_slider; + wxSlider* n_bars_slider; + int steps_per_count; + int count_per_bar; + int n_bars; + tRhyArrayEdit* edits[20]; + int n_edits; static void ItemCallback(wxItem& item, wxCommandEvent& event); void ItemChanged(); }; Modified: branches/jazz-4.1.3/src/mstdfile.h =================================================================== --- branches/jazz-4.1.3/src/mstdfile.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/mstdfile.h 2009-01-20 00:46:00 UTC (rev 688) @@ -35,13 +35,13 @@ class tStdChunk { - long Size; // Groesse von Base - long nRead; // soviele Bytes aus Datei gelesen + long Size; // Groesse von Base + long nRead; // soviele Bytes aus Datei gelesen unsigned char *Base; // Puffer fuer Daten - unsigned char *cp; // Aktueller Schreib/Lese Pointer - long Clock; // Absolute Clock - int EofSeen; // endoftrack meta-event gelesen - int RunningStatus; // letzter Status + unsigned char *cp; // Aktueller Schreib/Lese Pointer + long Clock; // Absolute Clock + int EofSeen; // endoftrack meta-event gelesen + int RunningStatus; // letzter Status void Resize(int SizeNeeded); void PutVar(ulong val); @@ -49,14 +49,14 @@ public: - int IsEof(); // nur nach Load, Save hat nie Eof + int IsEof(); // nur nach Load, Save hat nie Eof void Load(FILE *fd); - void Save(FILE *fd); // haengt EndOfTrack an + void Save(FILE *fd); // haengt EndOfTrack an tStdChunk(); ~tStdChunk(); void Put(tEvent *e, uchar *Data, int Length); - tEvent *Get(); // NULL bei Trackende - void Rewind(); // Schreib/Lesezeiger zur\x81cksetzen + tEvent *Get(); // NULL bei Trackende + void Rewind(); // Schreib/Lesezeiger zur\x81cksetzen }; Modified: branches/jazz-4.1.3/src/pianowin.cpp =================================================================== --- branches/jazz-4.1.3/src/pianowin.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/pianowin.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -885,7 +885,7 @@ { long OldFromClock = FromClock; tEventWin::OnPaint(x, y); -// SN++ Since jazz has a redo function. Fixes a little +// SN++ Since jazz has a redo function. Fixes a little // Update problem with multiple zoomOut. // Active Ctrl window redraw or reinitialization. @@ -969,7 +969,8 @@ // draw chords from harmony-browser - if (VisibleHBChord && the_harmony_browser && !Track->IsDrumTrack()) { + if (VisibleHBChord && the_harmony_browser && !Track->IsDrumTrack()) + { HBAnalyzer *an = the_harmony_browser->getAnalyzer(); if (an != 0) { Modified: branches/jazz-4.1.3/src/pianowin.h =================================================================== --- branches/jazz-4.1.3/src/pianowin.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/pianowin.h 2009-01-20 00:46:00 UTC (rev 688) @@ -70,7 +70,7 @@ wxFont *DrumFont; long SnapClocks(); - long SnapDenomiator; // 16 fuer 16-tel + long SnapDenomiator; // 16 fuer 16-tel long SnapClock(long Clock, int up = 0); tPianoWin(wxFrame *frame, char *title, tSong *song, int x, int y, int width, int height); @@ -79,7 +79,7 @@ void Setup(); void NewPosition(int TrackNr, long Clock); void ShowPitch(int pitch); - int Channel(); // Channel of actual track 0..15 + int Channel(); // Channel of actual track 0..15 void OnMenuCommand(int Id); void OnPaint(long x, long y); @@ -87,7 +87,7 @@ void SnapSelStop(wxMouseEvent &e); void SnapDlg(); - int TrackNr; // aktueller Track + int TrackNr; // aktueller Track tTrack *Track; tEventArray PasteBuffer; @@ -116,7 +116,10 @@ virtual Bool OnClose(); virtual void OnSize(int w, int h); - tGuitarWin *GetGuitarWin() { return GuitarWin; } + tGuitarWin *GetGuitarWin() + { + return GuitarWin; + } void SetSnapDenom(long value); void PressRadio(int id = 0); Modified: branches/jazz-4.1.3/src/player.cpp =================================================================== --- branches/jazz-4.1.3/src/player.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/player.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -591,7 +591,7 @@ CMD+1, 0x98, CMD+1, 0x9a, CMD+1, 0x9c, CMD+1, 0x9e, // channel-ref-tables off CMD+1, 0xec, - DAT+1, ACTIVE_TRACKS_MASK, // active tracks + DAT+1, ACTIVE_TRACKS_MASK, // active tracks CMD+1, 0xb8, // clear play counters CMD+1, 0x90, // real time affection off (yes!) CMD+1, 0x2a // stand by record Modified: branches/jazz-4.1.3/src/random.cpp =================================================================== --- branches/jazz-4.1.3/src/random.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/random.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -147,7 +147,7 @@ int tRndArray::Interval(int seed) { - if (seed < 0) // initial ? + if (seed < 0) // initial ? seed = int(rnd.asDouble() * n); int delta = Random(); if (rnd.asDouble() < 0.5) @@ -260,7 +260,7 @@ xmin = 0; xmax = n; - x = 0; // draw to topleft corner of canvas + x = 0; // draw to topleft corner of canvas y = 0; w = ww; h = hh; @@ -475,11 +475,11 @@ for (int val = min; val < max; val += step) { const char *buf = GetYText(val); - //sprintf(buf, "%d", val); - dc->GetTextExtent((char *)buf, &tw, &th); - float yy = y + h - h * (val - min) / (max - min) - th/2; - dc->DrawText(buf, x - tw - TICK_LINE, yy); - //dc->DrawLine(x - TICK_LINE, yy, x, yy); + //sprintf(buf, "%d", val); + dc->GetTextExtent((char *)buf, &tw, &th); + float yy = y + h - h * (val - min) / (max - min) - th/2; + dc->DrawText(buf, x - tw - TICK_LINE, yy); + //dc->DrawLine(x - TICK_LINE, yy, x, yy); } } } @@ -629,16 +629,16 @@ if (i < index) for (; i <= index; i++) { - DrawBar(i, 0); - array[i] = val; - DrawBar(i, 1); + DrawBar(i, 0); + array[i] = val; + DrawBar(i, 1); } else for (; i >= index; i--) { - DrawBar(i, 0); - array[i] = val; - DrawBar(i, 1); + DrawBar(i, 0); + array[i] = val; + DrawBar(i, 1); } index = k; } Modified: branches/jazz-4.1.3/src/random.h =================================================================== --- branches/jazz-4.1.3/src/random.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/random.h 2009-01-20 00:46:00 UTC (rev 688) @@ -38,7 +38,7 @@ //#define USE_ACG 1 #if USE_ACG -#include <ACG.h> // random generator from libg++ +#include <ACG.h> // random generator from libg++ extern ACG rnd; #else @@ -64,19 +64,31 @@ friend class tArrayEdit; protected: tIntArray array; - int n; // number of elements in array + int n; // number of elements in array int nul, min, max; public: - int Null() { return nul; } - void SetNull(int n) { nul = n; } + int Null() + { + return nul; + } + void SetNull(int n) + { + nul = n; + } tRndArray(int n, int min, int max); tRndArray & operator = (const tRndArray &); tRndArray(tRndArray const &); virtual ~tRndArray(); - int &operator[] (int i) { return array[i]; } - int operator[] (int i) const { return array[i]; } + int &operator[] (int i) + { + return array[i]; + } + int operator[] (int i) const + { + return array[i]; + } #ifdef FOR_MSW double operator[](double f); float operator[](float f) { @@ -86,17 +98,29 @@ #endif return (float)operator[]((double)f); } - int Size() const { return n; } - int Min() const { return min; } - int Max() const { return max; } + int Size() const + { + return n; + } + int Min() const + { + return min; + } + int Max() const + { + return max; + } void SetMinMax(int min, int max); - void Resize(int nn) { n = nn; } + void Resize(int nn) + { + n = nn; + } friend ostream & operator << (ostream &, tRndArray const &); friend istream & operator >> (istream &, tRndArray &); - int Random(); // returns index 0..n-1 (arrayvalues -> empiric distribution) - int Random(double rndval); // returns index 0..n-1 (arrayvalues -> empiric distribution) + int Random(); // returns index 0..n-1 (arrayvalues -> empiric distribution) + int Random(double rndval); // returns index 0..n-1 (arrayvalues -> empiric distribution) int Random(int i); // return 0/1 int Interval(int seed); @@ -109,16 +133,17 @@ }; -#define ARED_GAP 1 -#define ARED_XTICKS 2 -#define ARED_YTICKS 4 -#define ARED_MINMAX 8 -#define ARED_RHYTHM 16 -#define ARED_BLOCKS 32 -#define ARED_LINES 64 +#define ARED_GAP 1 +#define ARED_XTICKS 2 +#define ARED_YTICKS 4 +#define ARED_MINMAX 8 +#define ARED_RHYTHM 16 +#define ARED_BLOCKS 32 +#define ARED_LINES 64 -class tArrayEditDrawBars { +class tArrayEditDrawBars +{ public: virtual void DrawBars() = 0; }; @@ -131,11 +156,11 @@ long x, y, w, h, ynul; void DrawBar(int i, int black); - int dragging; // Dragging-Event valid - int index; // ctrl down: drag this one + int dragging; // Dragging-Event valid + int index; // ctrl down: drag this one tRndArray &array; - int &n, &min, &max, &nul; // shorthand for array.n, array.min, ... + int &n, &min, &max, &nul; // shorthand for array.n, array.min, ... char *label; tArrayEditDrawBars *draw_bars; Modified: branches/jazz-4.1.3/src/rhythm.cpp =================================================================== --- branches/jazz-4.1.3/src/rhythm.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/rhythm.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -65,10 +65,10 @@ // pseudo key nr's for harmony browser and sound effects -static const int MODE_ALL_OF = -1; -static const int MODE_ONE_OF = -2; -static const int MODE_PIANO = -3; -static const int MODE_CONTROL = -4; +static const int MODE_ALL_OF = -1; +static const int MODE_ONE_OF = -2; +static const int MODE_PIANO = -3; +static const int MODE_CONTROL = -4; tRhythm::tRhythm(int k) @@ -301,17 +301,17 @@ if (the_harmony_browser) { long step = (clock - fr_clock) * total_steps / (to_clock - fr_clock); - int keys[12], n_keys; + int keys[12], n_keys; if (key == CHORD_KEY) n_keys = the_harmony_browser->GetChordKeys(keys, (int)step, (int)total_steps); else n_keys = the_harmony_browser->GetBassKeys(keys, (int)step, (int)total_steps); for (int j = 0; j < n_keys; j++) { - tKeyOn *k = new tKeyOn(clock, chan, keys[j], vel, len - clocks_per_step/2); - track->Put(k); - } - } + tKeyOn *k = new tKeyOn(clock, chan, keys[j], vel, len - clocks_per_step/2); + track->Put(k); + } + } } // paste pianowin buffer @@ -323,23 +323,24 @@ tKeyOn *on = src.Events[ii]->IsKeyOn(); if (on) { - tKeyOn *k = new tKeyOn(clock, chan, on->Key, vel, len - clocks_per_step/2); - track->Put(k); + tKeyOn *k = new tKeyOn(clock, chan, on->Key, vel, len - clocks_per_step/2); + track->Put(k); } - } + } } // generate controller - else if (key == CONTROL_KEY) { - tControl *c = new tControl(clock, chan, parm - 1, vel); - track->Put(c); + else if (key == CONTROL_KEY) + { + tControl *c = new tControl(clock, chan, parm - 1, vel); + track->Put(c); } // generate note on events else { - tKeyOn *k = new tKeyOn(clock, chan, key, vel, len - clocks_per_step/2); - track->Put(k); + tKeyOn *k = new tKeyOn(clock, chan, key, vel, len - clocks_per_step/2); + track->Put(k); } clock += len; @@ -367,10 +368,10 @@ long clock = bi.Clock; while (clock < bi.Clock + bi.TicksPerBar) { - int i = Clock2i(clock, bi); - int j = r->Clock2i(clock, bi); - tmp[i] = r->history[j]; - clock += clocks_per_step; + int i = Clock2i(clock, bi); + int j = r->Clock2i(clock, bi); + tmp[i] = r->history[j]; + clock += clocks_per_step; } out.SetUnion(tmp, fuzz); } @@ -390,9 +391,9 @@ { GenGroup(tmp, gi, bi, rhy, n_rhy); if (groups[gi].listen > 0) - rrg.SetIntersection(tmp, groups[gi].listen); + rrg.SetIntersection(tmp, groups[gi].listen); else - rrg.SetDifference(tmp, -groups[gi].listen); + rrg.SetDifference(tmp, -groups[gi].listen); } } @@ -456,31 +457,31 @@ #include "../bitmaps/rrggen.xpm" #include "../bitmaps/help.xpm" static tToolDef tdefs[] = { - { MEN_LOAD, FALSE, 0, tb_open }, - { MEN_SAVE, FALSE, 1, tb_save }, + { MEN_LOAD, FALSE, 0, tb_open }, + { MEN_SAVE, FALSE, 1, tb_save }, - { MEN_ADD, FALSE, 0, tb_rrgadd }, - { MEN_DEL, FALSE, 0, tb_rrgdel }, - { MEN_UP, FALSE, 0, tb_rrgup }, - { MEN_DOWN, FALSE, 0, tb_rrgdown }, - { MEN_GEN, FALSE, 1, tb_rrggen }, + { MEN_ADD, FALSE, 0, tb_rrgadd }, + { MEN_DEL, FALSE, 0, tb_rrgdel }, + { MEN_UP, FALSE, 0, tb_rrgup }, + { MEN_DOWN, FALSE, 0, tb_rrgdown }, + { MEN_GEN, FALSE, 1, tb_rrggen }, - { MEN_HELP, FALSE, 0, tb_help } + { MEN_HELP, FALSE, 0, tb_help } }; #else static tToolDef tdefs[] = { - { MEN_LOAD, FALSE, 0, "tb_open", "open rhythm file" }, - { MEN_SAVE, FALSE, 1, "tb_save", "save into rhythm file" }, + { MEN_LOAD, FALSE, 0, "tb_open", "open rhythm file" }, + { MEN_SAVE, FALSE, 1, "tb_save", "save into rhythm file" }, - { MEN_ADD, FALSE, 0, "tb_rrgadd", "add instrumten" }, - { MEN_DEL, FALSE, 0, "tb_rrgdel", "remove instrument" }, - { MEN_UP, FALSE, 0, "tb_rrgup", "move instrument up" }, - { MEN_DOWN, FALSE, 0, "tb_rrgdown", "move instrument down" }, - { MEN_GEN, FALSE, 1, "tb_rrggen", "generate events into trackwin selection" }, + { MEN_ADD, FALSE, 0, "tb_rrgadd", "add instrumten" }, + { MEN_DEL, FALSE, 0, "tb_rrgdel", "remove instrument" }, + { MEN_UP, FALSE, 0, "tb_rrgup", "move instrument up" }, + { MEN_DOWN, FALSE, 0, "tb_rrgdown", "move instrument down" }, + { MEN_GEN, FALSE, 1, "tb_rrggen", "generate events into trackwin selection" }, - { MEN_HELP, FALSE, 0, "tb_help", "help" } + { MEN_HELP, FALSE, 0, "tb_help", "help" } }; #endif @@ -508,22 +509,22 @@ wxMenuBar *menu_bar = new wxMenuBar; wxMenu *menu = new wxMenu; - menu->Append(MEN_LOAD, "&Load"); - menu->Append(MEN_SAVE, "&Save"); - menu->Append(MEN_CLOSE, "&Close"); - menu_bar->Append(menu, "&File"); + menu->Append(MEN_LOAD, "&Load"); + menu->Append(MEN_SAVE, "&Save"); + menu->Append(MEN_CLOSE, "&Close"); + menu_bar->Append(menu, "&File"); menu = new wxMenu; - menu->Append(MEN_ADD, "&Add"); - menu->Append(MEN_DEL, "&Delete"); - menu->Append(MEN_UP, "&Up"); - menu->Append(MEN_DOWN, "&Down"); - menu->Append(MEN_GEN, "&Generate"); - menu_bar->Append(menu, "&Instrument"); + menu->Append(MEN_ADD, "&Add"); + menu->Append(MEN_DEL, "&Delete"); + menu->Append(MEN_UP, "&Up"); + menu->Append(MEN_DOWN, "&Down"); + menu->Append(MEN_GEN, "&Generate"); + menu_bar->Append(menu, "&Instrument"); menu = new wxMenu; - menu->Append(MEN_HELP, "&Help"); - menu_bar->Append(menu, "Help"); + menu->Append(MEN_HELP, "&Help"); + menu_bar->Append(menu, "Help"); SetMenuBar(menu_bar); @@ -670,23 +671,28 @@ } } -void tRhythmWin::OnMenuCommand(int id) { - switch (id) { - case MEN_HELP: Help(); break; +void tRhythmWin::OnMenuCommand(int id) +{ + switch (id) + { + case MEN_HELP: + Help(); + break; case MEN_CLOSE: - // motif crashes, when Show(FALSE) is called before destructor! - // Show(FALSE); - DELETE_THIS(); - break; + // motif crashes, when Show(FALSE) is called before destructor! + // Show(FALSE); + DELETE_THIS(); + break; case MEN_LOAD: { char * fname = file_selector(default_filename, "Load Rhythm", 0, has_changed, "*.rhy"); - if (fname) { - ifstream is(fname); - is >> *this; + if (fname) + { + ifstream is(fname); + is >> *this; OnPaint(); - } + } } break; @@ -694,10 +700,10 @@ { Win2Instrument(); char * fname = file_selector(default_filename, "Save Rhythm", 1, has_changed, "*.rhy"); - if (fname) { - ofstream os(fname); - os << *this; - } + if (fname) { + ofstream os(fname); + os << *this; + } } break; @@ -823,26 +829,27 @@ r->mode = keys[i]; tEventArray events; tCmdCopyToBuffer cmd(TrackWin->GetPianoWin()->Filter, &events); - cmd.Execute(0); // no UNDO + cmd.Execute(0); // no UNDO for (int ii = 0; ii < events.nEvents; ii++) { - tKeyOn *on = events.Events[ii]->IsKeyOn(); - if (on) { - r->keys[r->n_keys++] = on->Key; - if (r->n_keys > 1) - strcat(buf, ", "); - Key2Str(on->Key, buf + strlen(buf)); - if (r->n_keys >= MAX_KEYS) - break; - } + tKeyOn *on = events.Events[ii]->IsKeyOn(); + if (on) { + r->keys[r->n_keys++] = on->Key; + if (r->n_keys > 1) + strcat(buf, ", "); + Key2Str(on->Key, buf + strlen(buf)); + if (r->n_keys >= MAX_KEYS) + break; + } } r->SetLabel(buf); - if (r->n_keys == 0) { + if (r->n_keys == 0) + { wxMessageBox("select some notes in pianowin first", "Error", wxOK); - delete r; - r = 0; + delete r; + r = 0; } } Modified: branches/jazz-4.1.3/src/rhythm.h =================================================================== --- branches/jazz-4.1.3/src/rhythm.h 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/rhythm.h 2009-01-20 00:46:00 UTC (rev 688) @@ -147,7 +147,7 @@ enum { MAX_INSTRUMENTS = 20 }; tRhythm *instruments[MAX_INSTRUMENTS]; int n_instruments; - int act_instrument; // -1 if none + int act_instrument; // -1 if none // this one is edited and copied from/to instruments[i] tRhythm edit; @@ -164,8 +164,8 @@ static void Generate(wxButton &but, wxCommandEvent& event); static void Help(); - void Instrument2Win(int i = -1); // instrument[act_instrument] -> win - void Win2Instrument(int i = -1); // win -> instrument[act_instrument] + void Instrument2Win(int i = -1); // instrument[act_instrument] -> win + void Win2Instrument(int i = -1); // win -> instrument[act_instrument] void AddInstrumentDlg(); void AddInstrument(tRhythm *r); void DelInstrument(); Modified: branches/jazz-4.1.3/src/samplcmd.cpp =================================================================== --- branches/jazz-4.1.3/src/samplcmd.cpp 2009-01-19 21:43:48 UTC (rev 687) +++ branches/jazz-4.1.3/src/samplcmd.cpp 2009-01-20 00:46:00 UTC (rev 688) @@ -150,14 +150,14 @@ float tCMixCmd::tablei(long nsample, float *array, float *tab) { - register int loc1,loc2; - float frac = ((float)(nsample)/(*tab)) * *(tab+1); - if(frac < 0) return(array[0]); - if(frac >= *(tab+1)) return(array[(int)*(tab+1)]); - loc1 = (int)frac; - loc2 = loc1+1; - frac = frac - (float)loc1; - return(*(array+loc1) + frac * (*(array+loc2) - *(array+loc1))); + register int loc1,loc2; + float frac = ((float)(nsample)/(*tab)) * *(tab+1); + if(frac < 0) return(array[0]); + if(frac >= *(tab+1)) return(array[(int)*(tab+1)]); + loc1 = (int)frac; + loc2 = loc1+1; + frac = frac - (float)loc1; + return(*(array+loc1) + frac * (*(array+loc2) - *(array+loc1))); } /* p0,2,4,5,6,8,10.. are times, p1,3,5,7,9,11.. are amps, total number of @@ -166,23 +166,23 @@ void tCMixCmd::setline(const float *p, short n_args,int length,float *array) { - double increm; - int i,j,k,points; + double increm; + int i,j,k,points; - increm = (double)(p[n_args - 2] - p[0])/(double)length; - for(j=0,i=0; j < (n_args-2); j += 2) { - points = (int)((double)(p[j+2] - p[j]) / increm +.5); - if(p[j+2] != p[j]) { - if(points <= 0) points = 1; - for(k=0; k < points; k++) { - array[i++] = ((float)k/(float)points) - * (p[j+3] - p[j+1]) + p[j+1]; - if(i == length) return; - } - } - } - i--; - while(++i < length) array[i] = array[i-1]; + increm = (double)(p[n_args - 2] - p[0])/(double)length; + for(j=0,i=0; j < (n_args-2); j += 2) { + points = (int)((double)(p[j+2] - p[j]) / increm +.5); + if(p[j+2] != p[j]) { + if(points <= 0) points = 1; + for(k=0; k < points; k++) { + array[i++] = ((float)k/(f... [truncated message content] |
From: <pst...@us...> - 2009-01-19 22:55:30
|
Revision: 687 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=687&view=rev Author: pstieber Date: 2009-01-19 21:43:48 +0000 (Mon, 19 Jan 2009) Log Message: ----------- 1. Removed trailing white space. 2. Started replacing tab characters with white space. Modified Paths: -------------- branches/jazz-4.1.3/src/about.cpp branches/jazz-4.1.3/src/about.h branches/jazz-4.1.3/src/alsaplay.cpp branches/jazz-4.1.3/src/alsaplay.h branches/jazz-4.1.3/src/alsathru.cpp branches/jazz-4.1.3/src/alsathru.h branches/jazz-4.1.3/src/arpeggio.cpp branches/jazz-4.1.3/src/arpeggio.h branches/jazz-4.1.3/src/audio.cpp branches/jazz-4.1.3/src/audio.h branches/jazz-4.1.3/src/audiodrv.cpp branches/jazz-4.1.3/src/audiodrv.h branches/jazz-4.1.3/src/command.cpp branches/jazz-4.1.3/src/command.h branches/jazz-4.1.3/src/config.h branches/jazz-4.1.3/src/ctrledit.cpp branches/jazz-4.1.3/src/ctrledit.h branches/jazz-4.1.3/src/dialogs.cpp branches/jazz-4.1.3/src/dialogs.h branches/jazz-4.1.3/src/dynarray.cpp branches/jazz-4.1.3/src/dynarray.h branches/jazz-4.1.3/src/eventlst.cpp branches/jazz-4.1.3/src/eventlst.h branches/jazz-4.1.3/src/events.cpp branches/jazz-4.1.3/src/events.h branches/jazz-4.1.3/src/eventwin.cpp branches/jazz-4.1.3/src/eventwin.h branches/jazz-4.1.3/src/filter.cpp branches/jazz-4.1.3/src/filter.h branches/jazz-4.1.3/src/freqtab.cpp branches/jazz-4.1.3/src/freqtab.h branches/jazz-4.1.3/src/genmeldp.cpp branches/jazz-4.1.3/src/genmeldp.h branches/jazz-4.1.3/src/genmeldy.cpp branches/jazz-4.1.3/src/genmeldy.h branches/jazz-4.1.3/src/gs_dlg1.cpp branches/jazz-4.1.3/src/gs_dlg2.cpp branches/jazz-4.1.3/src/gs_dlgs.h branches/jazz-4.1.3/src/guitar.cpp branches/jazz-4.1.3/src/guitar.h branches/jazz-4.1.3/src/harmony.cpp branches/jazz-4.1.3/src/harmony.h branches/jazz-4.1.3/src/harmonyp.cpp branches/jazz-4.1.3/src/harmonyp.h branches/jazz-4.1.3/src/hbanalyz.cpp branches/jazz-4.1.3/src/hbanalyz.h branches/jazz-4.1.3/src/jazz.cpp branches/jazz-4.1.3/src/jazz.h branches/jazz-4.1.3/src/maction.cpp branches/jazz-4.1.3/src/maction.h branches/jazz-4.1.3/src/mapper.cpp branches/jazz-4.1.3/src/mapper.h branches/jazz-4.1.3/src/mascfile.cpp branches/jazz-4.1.3/src/mascfile.h branches/jazz-4.1.3/src/midinet.c branches/jazz-4.1.3/src/midinet.h branches/jazz-4.1.3/src/mstdfile.cpp branches/jazz-4.1.3/src/mstdfile.h branches/jazz-4.1.3/src/pianowin.cpp branches/jazz-4.1.3/src/pianowin.h branches/jazz-4.1.3/src/player.cpp branches/jazz-4.1.3/src/player.h branches/jazz-4.1.3/src/random.cpp branches/jazz-4.1.3/src/random.h branches/jazz-4.1.3/src/rhythm.cpp branches/jazz-4.1.3/src/rhythm.h branches/jazz-4.1.3/src/samplcmd.cpp branches/jazz-4.1.3/src/samplcmd.h branches/jazz-4.1.3/src/sampldlg.cpp branches/jazz-4.1.3/src/sampldlg.h branches/jazz-4.1.3/src/sample.cpp branches/jazz-4.1.3/src/sample.h branches/jazz-4.1.3/src/samplwin.cpp branches/jazz-4.1.3/src/samplwin.h branches/jazz-4.1.3/src/shuffle.cpp branches/jazz-4.1.3/src/shuffle.h branches/jazz-4.1.3/src/sig2.cpp branches/jazz-4.1.3/src/sig2.h branches/jazz-4.1.3/src/signali.h branches/jazz-4.1.3/src/slidrwin.cpp branches/jazz-4.1.3/src/slidrwin.h branches/jazz-4.1.3/src/song.cpp branches/jazz-4.1.3/src/song.h branches/jazz-4.1.3/src/splcmplx.cpp branches/jazz-4.1.3/src/splcmplx.h branches/jazz-4.1.3/src/synth.cpp branches/jazz-4.1.3/src/synth.h branches/jazz-4.1.3/src/toolbar.cpp branches/jazz-4.1.3/src/toolbar.h branches/jazz-4.1.3/src/track.cpp branches/jazz-4.1.3/src/track.h branches/jazz-4.1.3/src/trackwin.cpp branches/jazz-4.1.3/src/trackwin.h branches/jazz-4.1.3/src/util.cpp branches/jazz-4.1.3/src/util.h branches/jazz-4.1.3/src/winaudio.cpp branches/jazz-4.1.3/src/winaudio.h Modified: branches/jazz-4.1.3/src/about.cpp =================================================================== --- branches/jazz-4.1.3/src/about.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/about.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "about.h" #include "config.h" Modified: branches/jazz-4.1.3/src/about.h =================================================================== --- branches/jazz-4.1.3/src/about.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/about.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #define JAZZ_VERSION "4.1.3" Modified: branches/jazz-4.1.3/src/alsaplay.cpp =================================================================== --- branches/jazz-4.1.3/src/alsaplay.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/alsaplay.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,16 +17,16 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ /* * Changes * - * 2000.03.18 Takashi Iwai <iw...@ww...> - * - Modified for ALSA 0.5.x. - * You'll need the latest CVS version of ALSA-lib, which is expected - * to be released as ver.0.5.7. - * - The input/output devices are selected via a pop-up window - * like OSS driver mode. + * 2000.03.18 Takashi Iwai <iw...@ww...> + * - Modified for ALSA 0.5.x. + * You'll need the latest CVS version of ALSA-lib, which is expected + * to be released as ver.0.5.7. + * - The input/output devices are selected via a pop-up window + * like OSS driver mode. */ #include "alsaplay.h" @@ -136,7 +136,7 @@ } } -void tAlsaPlayer::SetSoftThru(int on, int idev, int odev) +void tAlsaPlayer::SetSoftThru(int on, int idev, int odev) { if (idev != ithru || odev != othru) { ithru = idev; @@ -205,7 +205,7 @@ } } -// set the name of this client +// 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"); @@ -215,12 +215,13 @@ // create a new port int tAlsaPlayer::create_port(snd_seq_t *handle, const char *name) { - return snd_seq_create_simple_port(handle, (char *)name, - SND_SEQ_PORT_CAP_READ | - SND_SEQ_PORT_CAP_SUBS_READ | - SND_SEQ_PORT_CAP_WRITE | - SND_SEQ_PORT_CAP_SUBS_WRITE, - SND_SEQ_PORT_TYPE_MIDI_GENERIC); + return snd_seq_create_simple_port( + handle, (char *)name, + SND_SEQ_PORT_CAP_READ | + SND_SEQ_PORT_CAP_SUBS_READ | + SND_SEQ_PORT_CAP_WRITE | + SND_SEQ_PORT_CAP_SUBS_WRITE, + SND_SEQ_PORT_TYPE_MIDI_GENERIC); } @@ -246,9 +247,9 @@ { case StatKeyOn: { - tKeyOn *k = e->IsKeyOn(); + tKeyOn *k = e->IsKeyOn(); set_event_header(&ev, e->Clock, SND_SEQ_EVENT_NOTEON); - ev.data.note.channel = k->Channel; + ev.data.note.channel = k->Channel; ev.data.note.note = k->Key; ev.data.note.velocity = k->Veloc; rc = write(&ev, now); @@ -257,9 +258,9 @@ case StatKeyOff: { - tKeyOff *k = e->IsKeyOff(); + tKeyOff *k = e->IsKeyOff(); set_event_header(&ev, e->Clock, SND_SEQ_EVENT_NOTEOFF); - ev.data.note.channel = k->Channel; + ev.data.note.channel = k->Channel; ev.data.note.note = k->Key; ev.data.note.velocity = k->OffVeloc; rc = write(&ev, now); @@ -268,76 +269,76 @@ case StatProgram: { - tProgram *k = e->IsProgram(); - set_event_header(&ev, e->Clock, SND_SEQ_EVENT_PGMCHANGE); - ev.data.control.channel = k->Channel; - ev.data.control.value = k->Program; - rc = write(&ev, now); + tProgram *k = e->IsProgram(); + set_event_header(&ev, e->Clock, SND_SEQ_EVENT_PGMCHANGE); + ev.data.control.channel = k->Channel; + ev.data.control.value = k->Program; + rc = write(&ev, now); } break; case StatKeyPressure: { - tKeyPressure *k = e->IsKeyPressure(); - set_event_header(&ev, e->Clock, SND_SEQ_EVENT_KEYPRESS); - ev.data.note.channel = k->Channel; - ev.data.note.note = k->Key; - ev.data.note.velocity = k->Value; - rc = write(&ev, now); + tKeyPressure *k = e->IsKeyPressure(); + set_event_header(&ev, e->Clock, SND_SEQ_EVENT_KEYPRESS); + ev.data.note.channel = k->Channel; + ev.data.note.note = k->Key; + ev.data.note.velocity = k->Value; + rc = write(&ev, now); } break; case StatChnPressure: { - tChnPressure *k = e->IsChnPressure(); - set_event_header(&ev, e->Clock, SND_SEQ_EVENT_CHANPRESS); - ev.data.control.channel = k->Channel; - ev.data.control.value = k->Value; - rc = write(&ev, now); + tChnPressure *k = e->IsChnPressure(); + set_event_header(&ev, e->Clock, SND_SEQ_EVENT_CHANPRESS); + ev.data.control.channel = k->Channel; + ev.data.control.value = k->Value; + rc = write(&ev, now); } break; case StatControl: { - tControl *k = e->IsControl(); - set_event_header(&ev, e->Clock, SND_SEQ_EVENT_CONTROLLER); - ev.data.control.channel = k->Channel; - ev.data.control.param = k->Control; - ev.data.control.value = k->Value; - rc = write(&ev, now); + tControl *k = e->IsControl(); + set_event_header(&ev, e->Clock, SND_SEQ_EVENT_CONTROLLER); + ev.data.control.channel = k->Channel; + ev.data.control.param = k->Control; + ev.data.control.value = k->Value; + rc = write(&ev, now); } break; case StatPitch: { - tPitch *k = e->IsPitch(); - set_event_header(&ev, e->Clock, SND_SEQ_EVENT_PITCHBEND); - ev.data.control.channel = k->Channel; - ev.data.control.value = k->Value; - rc = write(&ev, now); + tPitch *k = e->IsPitch(); + set_event_header(&ev, e->Clock, SND_SEQ_EVENT_PITCHBEND); + ev.data.control.channel = k->Channel; + ev.data.control.value = k->Value; + rc = write(&ev, now); } break; case StatSetTempo: { int bpm = e->IsSetTempo()->GetBPM(); - int us = (int)( 60.0E6 / (double)bpm ); - set_event_header(&ev, e->Clock, SND_SEQ_EVENT_TEMPO); - snd_seq_ev_set_queue_tempo(&ev, queue, us); - rc = write(&ev, now); + int us = (int)( 60.0E6 / (double)bpm ); + set_event_header(&ev, e->Clock, SND_SEQ_EVENT_TEMPO); + snd_seq_ev_set_queue_tempo(&ev, queue, us); + rc = write(&ev, now); } break; case StatSysEx: { tSysEx *s = e->IsSysEx(); - // prepend 0xf0 - char *buf = new char[s->Length + 1]; - buf[0] = 0xF0; - memcpy(buf + 1, s->Data, s->Length); - set_event_header(&ev, e->Clock, s->Length + 1, buf); - rc = write(&ev, now); - delete [] buf; + // prepend 0xf0 + char *buf = new char[s->Length + 1]; + buf[0] = 0xF0; + memcpy(buf + 1, s->Data, s->Length); + set_event_header(&ev, e->Clock, s->Length + 1, buf); + rc = write(&ev, now); + delete [] buf; } break; @@ -367,7 +368,7 @@ snd_seq_ev_set_fixed(&ev); ev.type = SND_SEQ_EVENT_ECHO; if (write(&ev) < 0) - break; + break; } snd_seq_flush_output(handle); } @@ -406,7 +407,7 @@ snd_seq_ev_set_variable(ev, len, ptr); } -int tAlsaPlayer::start_timer(long clock) +int tAlsaPlayer::start_timer(long clock) { int time_base = Song->TicksPerQuarter; int cur_speed = Song->GetTrack(0)->GetCurrentSpeed(clock); @@ -489,7 +490,7 @@ void tAlsaPlayer::recd_event(snd_seq_event_t *ev) { tEvent *e = 0; - switch (ev->type) + switch (ev->type) { case SND_SEQ_EVENT_NOTEON: @@ -573,20 +574,20 @@ if (client == this->client) continue; err = snd_seq_get_any_client_info (handle, client, &cinfo); - if (err < 0) + if (err < 0) continue; for (port = 0; port < cinfo.num_ports; port++) { snd_seq_get_any_port_info (handle, client, port, &pinfo); if ((pinfo.capability & cap) == cap) { snd_seq_addr_t a; - memset(&a, 0, sizeof(a)); - a.client = pinfo.client; - a.port = pinfo.port; - char buf[500]; - strcpy(buf, cinfo.name); - strcat(buf, " "); - strcat(buf, pinfo.name); + memset(&a, 0, sizeof(a)); + a.client = pinfo.client; + a.port = pinfo.port; + char buf[500]; + strcpy(buf, cinfo.name); + strcat(buf, " "); + strcat(buf, pinfo.name); list.add(buf, a); } } Modified: branches/jazz-4.1.3/src/alsaplay.h =================================================================== --- branches/jazz-4.1.3/src/alsaplay.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/alsaplay.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef ALSAPLAY #define ALSAPLAY @@ -73,7 +73,7 @@ snd_seq_addr_t self; // my address int queue; // queue int inp_dev, outp_dev; // input/output device index - + int installed; static int create_port(snd_seq_t *handle, const char *name); Modified: branches/jazz-4.1.3/src/alsathru.cpp =================================================================== --- branches/jazz-4.1.3/src/alsathru.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/alsathru.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,23 +17,23 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ /* * Changes * - * 2000.03.18 Takashi Iwai <iw...@ww...> - * - Modified for ALSA 0.5.x - * - Thru-connection is done inside ALSA sequencer core if - * USE_DIRECT_CONNECTION is defined in alsathru.h. - * It reduces latency. - * However, if jazz program is terminated abnormally by ctrl-c, - * or signal, the established connection will remain. - * You'll need to disconnect it via aconnect program (included - * in alsa-utils) manually. - * If USE_DIRECT_CONNECTION is not defined (as default), soft- - * thru is done. The event goes thru via either forked child - * or a thread. - * + * 2000.03.18 Takashi Iwai <iw...@ww...> + * - Modified for ALSA 0.5.x + * - Thru-connection is done inside ALSA sequencer core if + * USE_DIRECT_CONNECTION is defined in alsathru.h. + * It reduces latency. + * However, if jazz program is terminated abnormally by ctrl-c, + * or signal, the established connection will remain. + * You'll need to disconnect it via aconnect program (included + * in alsa-utils) manually. + * If USE_DIRECT_CONNECTION is not defined (as default), soft- + * thru is done. The event goes thru via either forked child + * or a thread. + * */ @@ -50,8 +50,8 @@ #include "alsaplay.h" /* -** midi thru for alsa. it creates a new process (because threads dont work -** with wxwin) that copies from input to output. +** midi thru for alsa. it creates a new process (because threads dont work +** with wxwin) that copies from input to output. */ tAlsaThru::tAlsaThru() @@ -160,7 +160,7 @@ // thread version -void tAlsaThru::stopworker(int sig) +void tAlsaThru::stopworker(int sig) { running = 0; snd_seq_close(handle); @@ -178,7 +178,7 @@ return 0; } -void tAlsaThru::Start() +void tAlsaThru::Start() { if (!running) pthread_create(&worker, (void *)0, startworker, (void *)this); @@ -187,7 +187,7 @@ void tAlsaThru::Stop() { if (running) - pthread_kill(worker, SIGHUP); + pthread_kill(worker, SIGHUP); } @@ -198,13 +198,13 @@ static snd_seq_t *static_handle; // ugly!! -void tAlsaThru::stopworker(int sig) +void tAlsaThru::stopworker(int sig) { snd_seq_close(static_handle); exit(0); } -void tAlsaThru::Start() +void tAlsaThru::Start() { if (!running) { worker = fork(); Modified: branches/jazz-4.1.3/src/alsathru.h =================================================================== --- branches/jazz-4.1.3/src/alsathru.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/alsathru.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef alsathru_h Modified: branches/jazz-4.1.3/src/arpeggio.cpp =================================================================== --- branches/jazz-4.1.3/src/arpeggio.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/arpeggio.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "arpeggio.h" #include "trackwin.h" @@ -207,23 +207,23 @@ #include "../bitmaps/help.xpm" static tToolDef tdefs[] = { - { MEN_LOAD, FALSE, 0, tb_open }, - { MEN_SAVE, FALSE, 1, tb_save }, - { MEN_GEN, FALSE, 0, tb_rrggen }, - { MEN_RANDOM, FALSE, 0, tb_alea}, - { MEN_PLAY, FALSE, 1, tb_play }, - { MEN_HELP, FALSE, 0, tb_help } + { MEN_LOAD, FALSE, 0, tb_open }, + { MEN_SAVE, FALSE, 1, tb_save }, + { MEN_GEN, FALSE, 0, tb_rrggen }, + { MEN_RANDOM, FALSE, 0, tb_alea}, + { MEN_PLAY, FALSE, 1, tb_play }, + { MEN_HELP, FALSE, 0, tb_help } }; #else static tToolDef tdefs[] = { - { MEN_LOAD, FALSE, 0, "tb_open", "load settings" }, - { MEN_SAVE, FALSE, 1, "tb_save", "save settings" }, - { MEN_GEN, FALSE, 0, "tb_rrggen", "generate" }, - { MEN_RANDOM, FALSE, 0, "tb_alea", "random arpeggio" }, - { MEN_PLAY, FALSE, 1, "tb_play", "play" }, - { MEN_HELP, FALSE, 0, "tb_help", "help" } + { MEN_LOAD, FALSE, 0, "tb_open", "load settings" }, + { MEN_SAVE, FALSE, 1, "tb_save", "save settings" }, + { MEN_GEN, FALSE, 0, "tb_rrggen", "generate" }, + { MEN_RANDOM, FALSE, 0, "tb_alea", "random arpeggio" }, + { MEN_PLAY, FALSE, 1, "tb_play", "play" }, + { MEN_HELP, FALSE, 0, "tb_help", "help" } }; #endif @@ -301,7 +301,7 @@ char * fname = file_selector(default_filename, "Load Arpeggio", 0, 0, "*.apg"); if (fname) { int x; - ifstream is(fname); + ifstream is(fname); is >> x; // version is >> step_count; is >> note_count; @@ -330,7 +330,7 @@ { char * fname = file_selector(default_filename, "Save Arpeggio", 1, 0, "*.apg"); if (fname) { - ofstream os(fname); + ofstream os(fname); os << 1 << endl; // version os << step_count << " "; os << note_count << " "; Modified: branches/jazz-4.1.3/src/arpeggio.h =================================================================== --- branches/jazz-4.1.3/src/arpeggio.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/arpeggio.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef arpeggio_h #define arpeggio_h Modified: branches/jazz-4.1.3/src/audio.cpp =================================================================== --- branches/jazz-4.1.3/src/audio.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/audio.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "wx.h" #pragma hdrstop @@ -81,16 +81,16 @@ long offset = 0; if (first) { if (clock >= buffer_clock) - offset = set.Ticks2Samples(clock - buffer_clock); - else { - // output starts somewhere in the middle of a sample - long data_offs = set.Ticks2Samples(buffer_clock - clock); - data += data_offs; - length -= data_offs; - if (length <= 0) - return; - } - first = 0; + offset = set.Ticks2Samples(clock - buffer_clock); + else { + // output starts somewhere in the middle of a sample + long data_offs = set.Ticks2Samples(buffer_clock - clock); + data += data_offs; + length -= data_offs; + if (length <= 0) + return; + } + first = 0; } // compute number of samples to put into this buffer @@ -102,7 +102,7 @@ length -= count; b += offset; while (count--) - *b++ += *data++; + *b++ += *data++; } @@ -115,16 +115,16 @@ if (first) { - if (to_smpl > 0 && to_smpl < length) - length = to_smpl; + if (to_smpl > 0 && to_smpl < length) + length = to_smpl; if (fr_smpl > 0 && fr_smpl < length) { - data += fr_smpl; - length -= fr_smpl; - } - first = FALSE; - if (length <= 0) - return; + data += fr_smpl; + length -= fr_smpl; + } + first = FALSE; + if (length <= 0) + return; } int count = BUFSHORTS; @@ -134,7 +134,7 @@ // update length and copy data length -= count; while (count--) - *b++ += *data++; + *b++ += *data++; } @@ -179,7 +179,7 @@ } speed = 22050; channels = 1; - bits = 16; // dont change!! + bits = 16; // dont change!! for (i = 0; i < MAXPOLY; i++) voices[i] = new tSampleVoice(*this); @@ -250,18 +250,18 @@ if (!wxFileExists(fname)) { // try to prepend the spl_path - char tmp[128]; - strcpy(tmp, spl_path); - strcat(tmp, "/"); - strcat(tmp, fname); - strcpy(fname, tmp); + char tmp[128]; + strcpy(tmp, spl_path); + strcat(tmp, "/"); + strcat(tmp, fname); + strcpy(fname, tmp); } if (!wxFileExists(fname)) { - char buf[500]; - sprintf(buf, "File not found: \"%s\"", fname); - wxMessageBox(buf, "Error", wxOK); - continue; + char buf[500]; + sprintf(buf, "File not found: \"%s\"", fname); + wxMessageBox(buf, "Error", wxOK); + continue; } assert(0 <= key && key < MAXSMPL); samples[key]->SetFilename(fname); @@ -271,9 +271,9 @@ samples[key]->SetPitch(pitch); if (samples[key]->Load()) { - char buf[500]; - sprintf(buf, "could not load \"%s\"", samples[key]->GetFilename()); - wxMessageBox(buf, "Error", wxOK); + char buf[500]; + sprintf(buf, "could not load \"%s\"", samples[key]->GetFilename()); + wxMessageBox(buf, "Error", wxOK); } if (samplewin[key]) samplewin[key]->Redraw(); @@ -573,11 +573,11 @@ speedstr = 0; for (int i = 0; speedtxt[i]; i++) { strlist.Append((wxObject *)speedtxt[i]); // ??? - if (atol(speedtxt[i]) == speed) - speedstr = copystring(speedtxt[i]); + if (atol(speedtxt[i]) == speed) + speedstr = copystring(speedtxt[i]); } if (!speedstr) - speedstr = copystring(speedtxt[0]); + speedstr = copystring(speedtxt[0]); enable = Midi->GetAudioEnabled(); stereo = (set.GetChannels() == 2); @@ -622,27 +622,27 @@ Midi->SetAudioEnabled(enable); if (Config(C_EnableAudio) != enable) { - Config(C_EnableAudio) = enable; - Config.Put(C_EnableAudio, enable); + Config(C_EnableAudio) = enable; + Config.Put(C_EnableAudio, enable); } if (Config(C_OssBug1) != ossbug1) { - Config(C_OssBug1) = ossbug1; + Config(C_OssBug1) = ossbug1; Config.Put(C_OssBug1, ossbug1); } if (Config(C_OssBug2) != ossbug2) { - Config(C_OssBug2) = ossbug2; + Config(C_OssBug2) = ossbug2; Config.Put(C_OssBug2, ossbug2); } if (Config(C_DuplexAudio) != duplex_audio) { - Config(C_DuplexAudio) = duplex_audio; + Config(C_DuplexAudio) = duplex_audio; Config.Put(C_DuplexAudio, duplex_audio); } if (enable) - set.ReloadSamples(); + set.ReloadSamples(); wxEndBusyCursor(); wxForm::OnOk(); } @@ -1078,25 +1078,25 @@ case MEN_AUDIO_LOAD: { char * fname = file_selector(default_filename, "Load Sample Set", 0, has_changed, "*.spl"); - if (fname) - Load(fname); - return 1; + if (fname) + Load(fname); + return 1; } case MEN_AUDIO_SAVE_AS: { char * fname = file_selector(default_filename, "Save Sample Set", 1, has_changed, "*.spl"); - if (fname) - Save(fname); - return 1; + if (fname) + Save(fname); + return 1; } case MEN_AUDIO_SAVE: { if (strcmp(default_filename, "noname.spl") == 0) - return OnMenuCommand(MEN_AUDIO_SAVE_AS); - Save(default_filename); - return 1; + return OnMenuCommand(MEN_AUDIO_SAVE_AS); + Save(default_filename); + return 1; } case MEN_AUDIO_GLOBAL: @@ -1110,10 +1110,10 @@ case MEN_AUDIO_NEW: if (spl_dialog == 0 && glb_dialog == 0) { - if (wxMessageBox("Clear Sample Set?", "Confirm", wxYES_NO) == wxNO) - return 1; - for (int i = 0; i < MAXSMPL; i++) - samples[i]->Clear(); + if (wxMessageBox("Clear Sample Set?", "Confirm", wxYES_NO) == wxNO) + return 1; + for (int i = 0; i < MAXSMPL; i++) + samples[i]->Clear(); } return 1; Modified: branches/jazz-4.1.3/src/audio.h =================================================================== --- branches/jazz-4.1.3/src/audio.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/audio.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef audio_h #define audio_h @@ -286,17 +286,17 @@ return channels * (bits == 8 ? 1L : 2L) * num_samples; } - long speed; // samples / second - int channels; // mono = 1, stereo = 2 - int bits; // must be 16! + long speed; // samples / second + int channels; // mono = 1, stereo = 2 + int bits; // must be 16! Bool softsync; // enable software midi/audio sync enum { MAXSMPL = 128 }; tSample *samples[MAXSMPL]; tSampleWin *samplewin[MAXSMPL]; - long ticks_per_minute; // midi speed for audio/midi sync + long ticks_per_minute; // midi speed for audio/midi sync double clocks_per_buffer; - long start_clock; // when did play start + long start_clock; // when did play start int event_index; Modified: branches/jazz-4.1.3/src/audiodrv.cpp =================================================================== --- branches/jazz-4.1.3/src/audiodrv.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/audiodrv.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,14 +17,14 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "wx.h" #pragma hdrstop #include "config.h" #include "audiodrv.h" -#include "jazz.h" // MIN and MAX +#include "jazz.h" #include <unistd.h> #include <stdlib.h> #include <sys/ioctl.h> @@ -83,7 +83,7 @@ long GetPlayPosition() { count_info cinfo; if (ioctl(player->dev, SNDCTL_DSP_GETOPTR, &cinfo) == -1) - perror("SNDCTL_DSP_GETOPTR"); + perror("SNDCTL_DSP_GETOPTR"); return (cinfo.bytes - cinfo.ptr) / sizeof(short); } @@ -116,7 +116,7 @@ if (caps & DSP_CAP_REALTIME) ; // fprintf(stderr, AUDIO " supports REALTIME, good!\n"); if (caps & DSP_CAP_DUPLEX) - can_duplex = 1; // good soundcard! + can_duplex = 1; // good soundcard! if (!(caps & DSP_CAP_TRIGGER)) fprintf(stderr, "no CAP_TRIGGER support!\n"); else @@ -252,7 +252,7 @@ if (reset) { if (ioctl(dev, SNDCTL_DSP_RESET, 0) == -1) - perror("SNDCTL_DSP_RESET"); + perror("SNDCTL_DSP_RESET"); } else { if (ioctl (dev, SNDCTL_DSP_SYNC, NULL) < 0) @@ -331,7 +331,7 @@ if (read(dev, b, BUFBYTES) != BUFBYTES) { // oss bug? It send EINTR?? on first read.. if (errno != EINTR && errno != EAGAIN) - perror("read"); + perror("read"); recbuffers.UndoRequest(); break; } @@ -379,9 +379,9 @@ if (new_speed != curr_speed) { if (ioctl(seqfd, SNDCTL_TMR_TEMPO, &new_speed) < 0) // this sometimes happens with mpu-401 timer - ; // perror("SNDCTL_TMR_TEMPO"); + ; // perror("SNDCTL_TMR_TEMPO"); else - curr_speed = new_speed; + curr_speed = new_speed; // xview has reentrancy problems!! // TrackWin->DrawSpeed(curr_speed); } Modified: branches/jazz-4.1.3/src/audiodrv.h =================================================================== --- branches/jazz-4.1.3/src/audiodrv.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/audiodrv.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef audiodrv_h #define audiodrv_h Modified: branches/jazz-4.1.3/src/command.cpp =================================================================== --- branches/jazz-4.1.3/src/command.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/command.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "wx.h" #pragma hdrstop @@ -89,7 +89,7 @@ } } if (!found) - ScaleKeys[0] = 1; // avoid loop in Member() + ScaleKeys[0] = 1; // avoid loop in Member() } else @@ -114,7 +114,7 @@ for (i = 0; i < 128; i++) keys[i % 12] += cmd.Keys[i]; - min = (unsigned long)-1; // max ulong + min = (unsigned long)-1; // max ulong scale = 0; for (s = 0; s < 12; s++) { @@ -565,10 +565,10 @@ DestTrack = dt; DestClock = dc; - EraseSource = 0; // no - EraseDestin = 1; // yes - InsertSpace = 0; // no - RepeatClock = -1; // -1L + EraseSource = 0; // no + EraseDestin = 1; // yes + InsertSpace = 0; // no + RepeatClock = -1; // -1L Reverse = DestTrack > Filter->FromTrack; if (Reverse) @@ -610,23 +610,23 @@ tEvent *e = Iterator.Range(Filter->FromClock, Filter->ToClock); while (e) { - long NewClock = e->Clock + DeltaClock; - if (NewClock >= StopClock) - break; + long NewClock = e->Clock + DeltaClock; + if (NewClock >= StopClock) + break; - if (Filter->IsSelected(e)) - { - tEvent *cpy = e->Copy(); - cpy->Clock = NewClock; - tmp.Put(cpy); - } + if (Filter->IsSelected(e)) + { + tEvent *cpy = e->Copy(); + cpy->Clock = NewClock; + tmp.Put(cpy); + } - e = Iterator.Next(); - if (!e) - { - e = Iterator.First(); - DeltaClock += Filter->ToClock - Filter->FromClock; - } + e = Iterator.Next(); + if (!e) + { + e = Iterator.First(); + DeltaClock += Filter->ToClock - Filter->FromClock; + } } } @@ -639,14 +639,14 @@ long DeltaClock = StopClock - StartClock; while (e) { - if (Filter->IsSelected(e)) - { - tEvent *c = e->Copy(); - c->Clock += DeltaClock; - d->Kill(e); - d->Put(c); - } - e = Iterator.Next(); + if (Filter->IsSelected(e)) + { + tEvent *c = e->Copy(); + c->Clock += DeltaClock; + d->Kill(e); + d->Put(c); + } + e = Iterator.Next(); } d->Cleanup(); } @@ -659,9 +659,9 @@ tEvent *e = Iterator.Range(Filter->FromClock, Filter->ToClock); while (e) { - if (Filter->IsSelected(e)) - s->Kill(e); - e = Iterator.Next(); + if (Filter->IsSelected(e)) + s->Kill(e); + e = Iterator.Next(); } s->Cleanup(); } @@ -674,9 +674,9 @@ tEvent *e = Iterator.Range(StartClock, StopClock); while (e) { - if (Filter->IsSelected(e)) - d->Kill(e); - e = Iterator.Next(); + if (Filter->IsSelected(e)) + d->Kill(e); + e = Iterator.Next(); } d->Cleanup(); } @@ -826,7 +826,7 @@ sval = array.Random(); if (add) sval -= array.Size()/2; - break; + break; default: break; @@ -834,27 +834,29 @@ switch (destin) { - case veloc: { + case veloc: + { if (add) - sval = k->Veloc + sval; + sval = k->Veloc + sval; if (sval > 127) sval = 127; - if (sval < 1) - sval = 1; + if (sval < 1) + sval = 1; tKeyOn *c = (tKeyOn *)k->Copy(); t->Kill(k); - c->Veloc = sval; + c->Veloc = sval; t->Put(c); } break; - case key: { + case key: + { if (add) - sval = k->Key + sval; + sval = k->Key + sval; if (sval > 127) sval = 127; - if (sval < 1) - sval = 1; + if (sval < 1) + sval = 1; tKeyOn *c = (tKeyOn *)k->Copy(); t->Kill(k); c->Key = sval; @@ -862,19 +864,21 @@ } break; - case length: { - if (add) - sval = k->Length + sval; - if (sval < 1) - sval = 1; - tKeyOn *c = (tKeyOn *)k->Copy(); + case length: + { + if (add) + sval = k->Length + sval; + if (sval < 1) + sval = 1; + tKeyOn *c = (tKeyOn *)k->Copy(); t->Kill(k); c->Length = sval; t->Put(c); } break; - case clock: { + case clock: + { tKeyOn *c = (tKeyOn *)k->Copy(); c->Clock += sval; if (c->Clock < 0) @@ -894,4 +898,3 @@ } } } - Modified: branches/jazz-4.1.3/src/command.h =================================================================== --- branches/jazz-4.1.3/src/command.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/command.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef command_h @@ -51,7 +51,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(tFilter *f); // returns ScaleNr }; @@ -132,8 +132,8 @@ long Quantize(long Clock, int islen); public: long QntClocks; - int NoteStart; // yes - int NoteLength; // no + int NoteStart; // yes + int NoteLength; // no int Delay; // zero int Groove; // zero tCmdQuantize(tFilter *f, long QntClocks, int groove, int delay); @@ -155,7 +155,7 @@ class tCmdSetChannel : public tCommand { public: - int NewChannel; // 0 + int NewChannel; // 0 tCmdSetChannel(tFilter *f, int NewChannel); virtual void ExecuteEvent(tTrack *t, tEvent *e); }; @@ -177,10 +177,10 @@ int DestTrack; long DestClock; - int EraseSource; // no - int EraseDestin; // yes - int InsertSpace; // no - long RepeatClock; // -1L + int EraseSource; // no + int EraseDestin; // yes + int InsertSpace; // no + long RepeatClock; // -1L tCmdCopy(tFilter *f, long DestTrack, long DestClock); virtual void ExecuteTrack(tTrack *t); Modified: branches/jazz-4.1.3/src/config.h =================================================================== --- branches/jazz-4.1.3/src/config.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/config.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef config_h #define config_h Modified: branches/jazz-4.1.3/src/ctrledit.cpp =================================================================== --- branches/jazz-4.1.3/src/ctrledit.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/ctrledit.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "wx.h" #pragma hdrstop @@ -179,8 +179,8 @@ { int k = Clock2i(e->Clock); if (sticky) - while (i < k) - array[i++] = val; + while (i < k) + array[i++] = val; val = GetValue(e); array[k] = val; } @@ -255,12 +255,12 @@ tControl *cpy; while (e) { if(IsCtrlEdit(e)) - if (Clock2Val(e->Clock) != e->IsControl()->Value) { - cpy = e->Copy()->IsControl(); - cpy->Value = Clock2Val(e->Clock); - track->Kill(e); - track->Put(cpy); - } + if (Clock2Val(e->Clock) != e->IsControl()->Value) { + cpy = e->Copy()->IsControl(); + cpy->Value = Clock2Val(e->Clock); + track->Kill(e); + track->Put(cpy); + } e=iter.Next(); } } @@ -364,7 +364,7 @@ : tCtrlEditBase(0, 127, parent, label, xoff, x, y, w, h, 1) { ctrl_num = CtrlNum; - if (ctrl_num == 10) // panpot + if (ctrl_num == 10) // panpot array.SetNull(64); } @@ -541,8 +541,8 @@ while (e) { if (!parent->SnapSel->Selected || parent->Filter->IsSelected(e) ) { - k = e->IsKeyPressure(); - if (k) track->Kill(k); + k = e->IsKeyPressure(); + if (k) track->Kill(k); } e = iter.Next(); } @@ -555,28 +555,28 @@ while (e) { if (!parent->SnapSel->Selected || parent->Filter->IsSelected(e) ) { - keyon = e->IsKeyOn(); - if (keyon) { - key_clk = keyon->Clock+1; - key_end = keyon->Clock + keyon->Length; - key_val = keyon->Key; - key_cha = keyon->Channel; - } - if (key_val>0) - { - int i,temp=0; - for (long iclk=key_clk;iclk<key_end && iclk<to_clk;iclk +=8) { - i = Clock2i(iclk); - // SN++ Ein neues Event wird nur erzeut wenn sich der Wert aendert - // und der Wert groesser als 0 ist. - if (array[i] > 0 && array[i] != temp) { - after = new tKeyPressure(iclk,key_cha,key_val,array[i]); - track->Put(after); - temp = array[i]; - } - } - key_val = -1; - } + keyon = e->IsKeyOn(); + if (keyon) { + key_clk = keyon->Clock+1; + key_end = keyon->Clock + keyon->Length; + key_val = keyon->Key; + key_cha = keyon->Channel; + } + if (key_val>0) + { + int i,temp=0; + for (long iclk=key_clk;iclk<key_end && iclk<to_clk;iclk +=8) { + i = Clock2i(iclk); + // SN++ Ein neues Event wird nur erzeut wenn sich der Wert aendert + // und der Wert groesser als 0 ist. + if (array[i] > 0 && array[i] != temp) { + after = new tKeyPressure(iclk,key_cha,key_val,array[i]); + track->Put(after); + temp = array[i]; + } + } + key_val = -1; + } } e = iter.Next(); } @@ -587,14 +587,18 @@ e = iter.Range(from_clk, to_clk); tKeyPressure *cpy; while (e) { - if (!parent->SnapSel->Selected || parent->Filter->IsSelected(e)) { + if (!parent->SnapSel->Selected || parent->Filter->IsSelected(e)) + { if(e->IsKeyPressure()) - if (Clock2Val(e->Clock) != e->IsKeyPressure()->Value) { - cpy = e->Copy()->IsKeyPressure(); - cpy->Value = Clock2Val(e->Clock); - track->Kill(e); - track->Put(cpy); - } + { + if (Clock2Val(e->Clock) != e->IsKeyPressure()->Value) + { + cpy = e->Copy()->IsKeyPressure(); + cpy->Value = Clock2Val(e->Clock); + track->Kill(e); + track->Put(cpy); + } + } } e = iter.Next(); } @@ -655,39 +659,40 @@ // SN++ events nur im apply-mode loeschen! if (!ctrlmode) { while (e) - { - if (IsCtrlEdit(e)) - track->Kill(e); - e = iter.Next(); - } + { + if (IsCtrlEdit(e)) + track->Kill(e); + e = iter.Next(); + } // find any previous events - if (sticky) { + if (sticky) + { e = iter.Range(0, from_clock-1 ); while (e) - { - if (IsCtrlEdit(e)) - { - old_val = GetValue(e); - } - e = iter.Next(); - } + { + if (IsCtrlEdit(e)) + { + old_val = GetValue(e); + } + e = iter.Next(); + } } // SN++ set-Mode // create new events long clock; for (clock = from_clock; clock < to_clock; clock += 8) + { + int new_val = Clock2Val(clock); + + if (old_val != new_val) { - int new_val = Clock2Val(clock); - - if (old_val != new_val) - { - e = NewEvent(clock, new_val); - track->Put(e); - old_val = new_val; - } + e = NewEvent(clock, new_val); + track->Put(e); + old_val = new_val; } + } } else { // edit mode: Erzeugt keine neuen Events sondern aendert den Wert // bestehender Events. @@ -695,13 +700,13 @@ tChnPressure *cpy; while (e) { if(IsCtrlEdit(e)) - if (Clock2Val(e->Clock) != GetValue(e)) { - cpy = e->Copy()->IsChnPressure(); - cpy->Value = Clock2Val(e->Clock); - track->Kill(e); - track->Put(cpy); - } - e=iter.Next(); + if (Clock2Val(e->Clock) != GetValue(e)) { + cpy = e->Copy()->IsChnPressure(); + cpy->Value = Clock2Val(e->Clock); + track->Kill(e); + track->Put(cpy); + } + e=iter.Next(); } } Modified: branches/jazz-4.1.3/src/ctrledit.h =================================================================== --- branches/jazz-4.1.3/src/ctrledit.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/ctrledit.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ Modified: branches/jazz-4.1.3/src/dialogs.cpp =================================================================== --- branches/jazz-4.1.3/src/dialogs.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/dialogs.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "wx.h" #pragma hdrstop @@ -77,16 +77,16 @@ qnt.Execute(); EventWin->Redraw(); if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + EventWin->NextWin->Redraw(); wxForm::OnOk(); } void tQuantizeDlg::OnHelp() { - if (EventWin->NextWin) - HelpInstance->ShowTopic("Quantize"); - else - HelpInstance->ShowTopic("Pianowin Quantize"); + if (EventWin->NextWin) + HelpInstance->ShowTopic("Quantize"); + else + HelpInstance->ShowTopic("Pianowin Quantize"); } void tQuantizeDlg::EditForm(wxPanel *panel) @@ -132,13 +132,13 @@ cln.Execute(); EventWin->Redraw(); if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + EventWin->NextWin->Redraw(); wxForm::OnOk(); } void tCleanupDlg::OnHelp() { - HelpInstance->ShowTopic("Cleanup"); + HelpInstance->ShowTopic("Cleanup"); } void tCleanupDlg::EditForm(wxPanel *panel) @@ -205,7 +205,7 @@ int tShiftDlg::Steps = 0; tShiftDlg::tShiftDlg(tEventWin *w, tFilter *f, long unit) -: wxForm( USED_WXFORM_BUTTONS ) + : wxForm( USED_WXFORM_BUTTONS ) { Filter = f; Song = f->Song; @@ -221,13 +221,13 @@ cmd.Execute(); EventWin->Redraw(); if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + EventWin->NextWin->Redraw(); wxForm::OnOk(); } void tShiftDlg::OnHelp() { - HelpInstance->ShowTopic("Shift"); + HelpInstance->ShowTopic("Shift"); } @@ -289,15 +289,15 @@ tCmdTranspose trn(Filter, Notes, Scale, FitIntoScale); trn.Execute(); if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + EventWin->NextWin->Redraw(); else - EventWin->Redraw(); + EventWin->Redraw(); wxForm::OnOk(); } void tTransposeDlg::OnHelp() { - HelpInstance->ShowTopic("Transpose"); + HelpInstance->ShowTopic("Transpose"); } @@ -438,13 +438,13 @@ cmd.Execute(); EventWin->Redraw(); if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + EventWin->NextWin->Redraw(); wxForm::OnOk(); } void tLengthDlg::OnHelp() { - HelpInstance->ShowTopic("Length"); + HelpInstance->ShowTopic("Length"); } @@ -488,13 +488,13 @@ cmd.Execute(); EventWin->Redraw(); if (EventWin->NextWin) - EventWin->NextWin->Redraw(); + EventWin->NextWin->Redraw(); wxForm::OnOk(); } void tDeleteDlg::OnHelp() { - HelpInstance->ShowTopic("Delete"); + HelpInstance->ShowTopic("Delete"); } void tDeleteDlg::EditForm(wxPanel *panel) @@ -561,7 +561,7 @@ void tMidiDeviceDlg::OnHelp() { - HelpInstance->ShowTopic("MIDI device"); + HelpInstance->ShowTopic("MIDI device"); } void tMidiDeviceDlg::EditForm(wxPanel *panel) @@ -625,13 +625,13 @@ Track->Cleanup(); Win->Redraw(); if (Win->NextWin) - Win->NextWin->Redraw(); + Win->NextWin->Redraw(); wxForm::OnOk(); } void tEventDlg::OnHelp() { - HelpInstance->ShowTopic("Piano Window"); + HelpInstance->ShowTopic("Piano Window"); } // --------------------------- ChannelEvent ---------------------------- @@ -646,7 +646,7 @@ tChEventDlg(tChannelEvent *e, tEventWin *w, tTrack *t) : tEventDlg(e, w, t) { - Channel = e->Channel + 1; // 1..16 + Channel = e->Channel + 1; // 1..16 } void EditForm(wxPanel *panel); void OnOk(); @@ -932,20 +932,20 @@ for (i = 0, j = 0; j <= jstop; j += k, i++) { - sscanf( str + j, "%02x %n", &d[i], &k ); + sscanf( str + j, "%02x %n", &d[i], &k ); - if (d[i] == 0xf7) - break; + if (d[i] == 0xf7) + break; } int found = 0; for (i = 0; i < 256; i++) { - if (d[i] == 0xf7) - { - found = 1; - break; - } + if (d[i] == 0xf7) + { + found = 1; + break; + } } if (found) @@ -992,9 +992,9 @@ if (uptr) { - sprintf( label2, "First data byte is at offset %d, value %02x (%d decimal)", uptr - Event->IsSysEx()->Data + 1, *uptr, *uptr ); - Add(wxMakeFormMessage(label2)); - Add(wxMakeFormNewLine()); + sprintf( label2, "First data byte is at offset %d, value %02x (%d decimal)", uptr - Event->IsSysEx()->Data + 1, *uptr, *uptr ); + Add(wxMakeFormMessage(label2)); + Add(wxMakeFormNewLine()); } } else @@ -1042,12 +1042,12 @@ case StatProgram: e = new tProgram(Clock, Channel, Pitch); break; - case StatSetTempo: + case StatSetTempo: e = new tSetTempo(Clock, 100); break; - case StatSysEx: - e = new tSysEx(Clock, (uchar*) "", 0); - break; + case StatSysEx: + e = new tSysEx(Clock, (uchar*) "", 0); + break; } } return e; @@ -1069,10 +1069,11 @@ { case StatKeyOn: #ifdef AUDIO - if (t->GetAudioMode()) { + if (t->GetAudioMode()) + { if (!Midi->IsPlaying()) - Midi->EditSample(e->IsKeyOn()->Key); - break; + Midi->EditSample(e->IsKeyOn()->Key); + break; } #endif str = "Key On"; Modified: branches/jazz-4.1.3/src/dialogs.h =================================================================== --- branches/jazz-4.1.3/src/dialogs.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/dialogs.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef dialogs_h @@ -37,11 +37,11 @@ { public: - static Bool NoteStart; // 1 - static Bool NoteLength; // 0 - static long QntStep; // 1/16 - static int Groove; // -x .. +x - static int Delay; // -x .. +x + static Bool NoteStart; // 1 + static Bool NoteLength; // 0 + static long QntStep; // 1/16 + static int Groove; // -x .. +x + static int Delay; // -x .. +x tFilter *Filter; tSong *Song; @@ -60,7 +60,7 @@ { public: - static long lowLimit; // 1/32 + static long lowLimit; // 1/32 static Bool shortenOverlaps; tFilter *Filter; @@ -96,7 +96,7 @@ class tShiftDlg : public wxForm { public: - static int Steps; // 0 + static int Steps; // 0 long Unit; tFilter *Filter; @@ -116,7 +116,7 @@ { public: - static int Notes; // 0 + static int Notes; // 0 static Bool FitIntoScale; static long Scale; @@ -138,7 +138,7 @@ { public: - static int NewChannel; // 0 + static int NewChannel; // 0 tFilter *Filter; tSong *Song; @@ -199,7 +199,7 @@ tEventWin *EventWin; public: - static Bool LeaveSpace; // 1 + static Bool LeaveSpace; // 1 tDeleteDlg(tEventWin *w, tFilter *f); void EditForm(wxPanel *panel); Modified: branches/jazz-4.1.3/src/dynarray.cpp =================================================================== --- branches/jazz-4.1.3/src/dynarray.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/dynarray.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "dynarray.h" #include <assert.h> @@ -27,7 +27,7 @@ tUniqIds::tUniqIds() : array(0) { - array[0] = 1; // 0 is an invalid id + array[0] = 1; // 0 is an invalid id } int tUniqIds::Get() Modified: branches/jazz-4.1.3/src/dynarray.h =================================================================== --- branches/jazz-4.1.3/src/dynarray.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/dynarray.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef dynarray_h #define dynarray_h @@ -161,7 +161,7 @@ tUniqIds(); int Get(); void Get(int id); - int Put(int id); // returns no of pending references to id + int Put(int id); // returns no of pending references to id }; Modified: branches/jazz-4.1.3/src/eventlst.cpp =================================================================== --- branches/jazz-4.1.3/src/eventlst.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/eventlst.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "eventlst.h" #include "trackwin.h" @@ -521,17 +521,17 @@ #include "../bitmaps/help.xpm" static tToolDef tdefs[] = { - { MEN_ACCEPT, FALSE, 0, tb_accept }, - { MEN_CANCEL, FALSE, 1, tb_cancel }, - { MEN_HELP, FALSE, 0, tb_help } + { MEN_ACCEPT, FALSE, 0, tb_accept }, + { MEN_CANCEL, FALSE, 1, tb_cancel }, + { MEN_HELP, FALSE, 0, tb_help } }; #else static tToolDef tdefs[] = { - { MEN_ACCEPT, FALSE, 0, "tb_accept", "accept changes" }, - { MEN_CANCEL, FALSE, 1, "tb_cancel", "discard changes" }, - { MEN_HELP, FALSE, 0, "tb_help", "help" } + { MEN_ACCEPT, FALSE, 0, "tb_accept", "accept changes" }, + { MEN_CANCEL, FALSE, 1, "tb_cancel", "discard changes" }, + { MEN_HELP, FALSE, 0, "tb_help", "help" } }; #endif Modified: branches/jazz-4.1.3/src/eventlst.h =================================================================== --- branches/jazz-4.1.3/src/eventlst.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/eventlst.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef eventlst_h #define eventlst_h Modified: branches/jazz-4.1.3/src/events.cpp =================================================================== --- branches/jazz-4.1.3/src/events.cpp 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/events.cpp 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #include "wx.h" #pragma hdrstop Modified: branches/jazz-4.1.3/src/events.h =================================================================== --- branches/jazz-4.1.3/src/events.h 2009-01-19 17:58:10 UTC (rev 686) +++ branches/jazz-4.1.3/src/events.h 2009-01-19 21:43:48 UTC (rev 687) @@ -17,7 +17,7 @@ ** along with this program; if not, write to the Free Software ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** -*/ +*/ #ifndef events_h @@ -84,7 +84,7 @@ FILE *fd; public: - int TicksPerQuarter; // nach Open bekannt + int TicksPerQuarter; int nTracks; virtual int Open(char *fname); @@ -171,44 +171,44 @@ * normale Events (mit Kanal) */ -#define StatKeyOff 0x80 -#define StatKeyOn 0x90 -#define StatKeyPressure 0xA0 // Key pressure -#define StatControl 0xB0 -#define StatProgram 0xC0 -#define StatChnPressure 0xD0 // SN++ Channel pressure -#define StatPitch 0xE0 +#define StatKeyOff 0x80 +#define StatKeyOn 0x90 +#define StatKeyPressure 0xA0 // Key pressure +#define StatControl 0xB0 +#define StatProgram 0xC0 +#define StatChnPressure 0xD0 // SN++ Channel pressure +#define StatPitch 0xE0 /* * Meta-Events (no channel) */ -#define StatSysEx 0xF0 -#define StatSongPtr 0xF2 -#define StatSongSelect 0xF3 -#define StatTuneRequest 0xF6 +#define StatSysEx 0xF0 +#define StatSongPtr 0xF2 +#define StatSongSelect 0xF3 +#define StatTuneRequest 0xF6 #define StatMidiClock 0xf8 #define StatStartPlay 0xfa #define StatContPlay 0xfb #define StatStopPlay 0xfc -#define StatText 0x01 -#define StatCopyright 0x02 -#define StatTrackName 0x03 -#define StatMarker 0x06 -#define StatEndOfTrack 0x2F -#define StatSetTempo 0x51 -#define StatMtcOffset 0x54 -#define StatTimeSignat 0x58 -#define StatKeySignat 0x59 +#define StatText 0x01 +#define StatCopyright 0x02 +#define StatTrackName 0x03 +#define StatMarker 0x06 +#define StatEndOfTrack 0x2F +#define StatSetTempo 0x51 +#define StatMtcOffset 0x54 +#define StatTimeSignat 0x58 +#define StatKeySignat 0x59 -#define StatUnknown 0x00 +#define StatUnknown 0x00 // proprietary event status #define StatJazzMeta 0x7F -#define LastClock (0x7fffffffL) -#define KilledClock (0x80000000L) +#define LastClock (0x7fffffffL) +#define KilledClock (0x80000000L) @@ -292,31 +292,31 @@ void UnKill() { edb(); Clock &= ~KilledClock; } int IsKilled() { edb(); return (Clock & KilledClock) != 0; } - virtual tMetaEvent *IsMetaEvent() { edb(); return 0; } + virtual tMetaEvent *IsMetaEvent() { edb(); return 0; } virtual tChannelEvent *IsChannelEvent() { edb(); return 0; } - virtual tKeyOn *IsKeyOn() { edb(); return 0; } - virtual tKeyOff *IsKeyOff() { edb(); return 0; } - virtual tPitch *IsPitch() { edb(); return 0; } - virtual tControl *IsControl() { edb(); return 0; } - virtual tProgram *IsProgram() { edb(); return 0; } - virtual tSysEx *IsSysEx() { edb(); return 0; } - virtual tSongPtr *IsSongPtr() { edb(); return 0; } - virtual tMidiClock *IsMidiClock() { edb(); return 0; } - virtual tStartPlay *IsStartPlay() { edb(); return 0; } - virtual tContPlay *IsContPlay() { edb(); return 0; } - virtual tStopPlay *IsStopPlay() { edb(); return 0; } - virtual tText *IsText() { edb(); return 0; } - virtual tCopyright *IsCopyright() { edb(); return 0; } - virtual tTrackName *IsTrackName() { edb(); return 0; } - virtual tMarker *IsMarker() { edb(); return 0; } - virtual tSetTempo *IsSetTempo() { edb(); return 0; } - virtual tMtcOffset *IsMtcOffset() { edb(); return 0; } - virtual tTimeSignat *IsTimeSignat() { edb(); return 0; } - virtual tKeySignat *IsKeySignat() { edb(); return 0; } + virtual tKeyOn *IsKeyOn() { edb(); return 0; } + virtual tKeyOff *IsKeyOff() { edb(); return 0; } + virtual tPitch *IsPitch() { edb(); return 0; } + virtual tControl *IsControl() { edb(); return 0; } + virtual tProgram *IsProgram() { edb(); return 0; } + virtual tSysEx *IsSysEx() { edb(); return 0; } + virtual tSongPtr *IsSongPtr() { edb(); return 0; } + virtual tMidiClock *IsMidiClock() { edb(); return 0; } + virtual tStartPlay *IsStartPlay() { edb(); return 0; } + virtual tContPlay *IsContPlay() { edb(); return 0; } + virtual tStopPlay *IsStopPlay() { edb(); return 0; } + virtual tText *IsText() { edb(); return 0; } + virtual tCopyright *IsCopyright() { edb(); return 0; } + virtual tTrackName *IsTrackName() { edb(); return 0; } + virtual tMarker *IsMarker() { edb(); return 0; } + virtual tSetTempo *IsSetTempo() { edb(); return 0; } + virtual tMtcOffset *IsMtcOffset() { edb(); return 0; } + virtual tTimeSignat *IsTimeSignat() { edb(); return 0; } + virtual tKeySignat *IsKeySignat() { edb(); return 0; } virtual tKeyPressure *IsKeyPressure() { edb(); return 0; } - virtual tJazzMeta *IsJazzMeta() { edb(); return 0; } - virtual tChnPressure *IsChnPressure() { edb(); return 0; } + virtual tJazzMeta *IsJazzMeta() { edb(); return 0; } + virtual tChnPressure *IsChnPressure() { edb(); return 0; } virtual int Write(tWriteBase &io) { edb(); return io.Write(this); } @@ -324,9 +324,9 @@ { edb(); if ((unsigned long)e.Clock > (unsigned long)Clock) - ... [truncated message content] |
From: <pst...@us...> - 2009-01-19 17:58:19
|
Revision: 686 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=686&view=rev Author: pstieber Date: 2009-01-19 17:58:10 +0000 (Mon, 19 Jan 2009) Log Message: ----------- Made the parent an event window instead of an event frame. Still haven't hooked up the actual command. This is a WIP. Modified Paths: -------------- trunk/jazz/src/Dialogs/ShiftDialog.cpp trunk/jazz/src/Dialogs/ShiftDialog.h Modified: trunk/jazz/src/Dialogs/ShiftDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-19 17:56:29 UTC (rev 685) +++ trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-19 17:58:10 UTC (rev 686) @@ -20,7 +20,9 @@ #include "ShiftDialog.h" +#include "../Command.h" #include "../Filter.h" +#include "../ProjectManager.h" #include "IntegerEdit.h" #include <wx/button.h> @@ -47,7 +49,7 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZShiftDialog::JZShiftDialog( - JZEventFrame& EventWindow, + JZEventWindow& EventWindow, JZFilter& Filter, wxWindow* pParent) : wxDialog(pParent, wxID_ANY, wxString("Shift")), @@ -526,6 +528,11 @@ mFilter.SetFilterOther(mpOtherBox->GetValue()); +// tCmdShift ShiftCommand(&mFilter, mSteps * mUnit); +// ShiftCommand.Execute(); + + JZProjectManager::Instance()->UpdateAllViews(); + return true; } Modified: trunk/jazz/src/Dialogs/ShiftDialog.h =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-19 17:56:29 UTC (rev 685) +++ trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-19 17:58:10 UTC (rev 686) @@ -23,7 +23,7 @@ #include <wx/dialog.h> -class JZEventFrame; +class JZEventWindow; class JZFilter; class JZIntegerEdit; class wxCheckBox; @@ -36,7 +36,7 @@ public: JZShiftDialog( - JZEventFrame& EventWindow, + JZEventWindow& EventWindow, JZFilter& Filter, wxWindow* pParent); @@ -89,5 +89,4 @@ DECLARE_EVENT_TABLE(); }; - #endif // !defined(JZ_SHIFTDIALOG_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-19 17:56:33
|
Revision: 685 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=685&view=rev Author: pstieber Date: 2009-01-19 17:56:29 +0000 (Mon, 19 Jan 2009) Log Message: ----------- 1. Added a pointer to the associated event window as a data member. 2. Added event handlers for shifting events. This is a WIP. Modified Paths: -------------- trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h Modified: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp 2009-01-19 17:53:36 UTC (rev 684) +++ trunk/jazz/src/EventFrame.cpp 2009-01-19 17:56:29 UTC (rev 685) @@ -1,10 +1,11 @@ #include "EventFrame.h" #include "Command.h" -#include "Dialogs/ShiftDialog.h" #include "Dialogs.h" +#include "EventWindow.h" #include "Filter.h" #include "MouseAction.h" +#include "Resources.h" #include "ToolBar.h" #include <wx/dc.h> @@ -21,18 +22,23 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- BEGIN_EVENT_TABLE(JZEventFrame, wxFrame) + + EVT_UPDATE_UI(ID_SHIFT, JZEventFrame::OnUpdateEditShift) + EVT_MENU(ID_SHIFT, JZEventFrame::OnEditShift) + EVT_SIZE(JZEventFrame::OnSize) + END_EVENT_TABLE() //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- JZEventFrame::JZEventFrame( - wxWindow* pParent, + JZEventWindow* pEventWindow, const wxString& Title, JZSong* pSong, const wxPoint& Position, const wxSize& Size) - : wxFrame(pParent, wxID_ANY, Title, Position, Size), + : wxFrame(pEventWindow, wxID_ANY, Title, Position, Size), Song(pSong), mpFilter(0), mpFixedFont(0), @@ -60,7 +66,8 @@ MixerForm(0), mpToolBar(0), mpGreyColor(0), - mpGreyBrush(0) + mpGreyBrush(0), + mpEventWindow(pEventWindow) { #ifdef __WXMSW__ mpGreyColor = new wxColor(192, 192, 192); @@ -149,6 +156,20 @@ } //----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) +{ + Event.Enable(mpEventWindow->AreEventsSelected()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::OnEditShift(wxCommandEvent& Event) +{ +// mpEventWindow->Shift(); +} + +//----------------------------------------------------------------------------- // this onsize handler is supposed to take care of handling of the resizing // the two subwindows sizes to they dont overlap //----------------------------------------------------------------------------- @@ -455,22 +476,7 @@ } //----------------------------------------------------------------------------- -// show the "shift events" dialog //----------------------------------------------------------------------------- -void JZEventFrame::MenShift(int Unit) -{ - if (EventsSelected()) - { - JZShiftDialog ShiftDialog(*this, *mpFilter, this); - - if (ShiftDialog.ShowModal() == wxID_OK) - { - } - } -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- void JZEventFrame::MenDelete() { if (!EventsSelected()) Modified: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h 2009-01-19 17:53:36 UTC (rev 684) +++ trunk/jazz/src/EventFrame.h 2009-01-19 17:56:29 UTC (rev 685) @@ -25,6 +25,7 @@ #include <wx/frame.h> +class JZEventWindow; class JZFilter; class JZSnapSelection; class JZSong; @@ -34,10 +35,9 @@ //***************************************************************************** // Description: -// A frame window that containes a scrolled event window. Acts as the -// common base class for JZTrackFrame and JSPianoFrame. -// -// The panel and menu are administered by derived classes. +// A frame window that containes a scrolled event window. This class acts +// as the common base class for the JZTrackFrame class and the JZPianoFrame +// class. // Functionality: // - Settings dialog // - Selection via Snapsel @@ -46,12 +46,9 @@ { public: - bool OnCharHook(wxKeyEvent& event); - void OnChar(wxKeyEvent& event); - // 2-step initialization: 1) constructor JZEventFrame( - wxWindow* pParent, + JZEventWindow* pEventWindow, const wxString& Title, JZSong* pSong, const wxPoint& Position = wxDefaultPosition, @@ -104,7 +101,6 @@ // Events virtual int OnMouseEvent(wxMouseEvent& Event); virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin - virtual void OnSize(wxSizeEvent& Event); virtual void OnMenuCommand(int id); virtual bool OnClose(); @@ -123,10 +119,20 @@ // if selection active: TRUE, else: Errormessage + FALSE int EventsSelected(const char* msg = 0); + private: + + void OnUpdateEditShift(wxUpdateUIEvent& Event); + void OnEditShift(wxCommandEvent& Event); + + void OnSize(wxSizeEvent& Event); + + bool OnCharHook(wxKeyEvent& Event); + + void OnChar(wxKeyEvent& Event); + void MenQuantize(); void MenSetChannel(); void MenTranspose(); - void MenShift(int Unit); void MenDelete(); void MenVelocity(); void MenLength(); @@ -143,6 +149,8 @@ wxColor* mpGreyColor; wxBrush* mpGreyBrush; + JZEventWindow* mpEventWindow; + DECLARE_EVENT_TABLE() }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-19 17:53:41
|
Revision: 684 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=684&view=rev Author: pstieber Date: 2009-01-19 17:53:36 +0000 (Mon, 19 Jan 2009) Log Message: ----------- 1. Moved the declaration of the snap selection and filter data members. 2. Added code for determining if events are selected and shifting events. This is a WIP. Modified Paths: -------------- trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-19 17:47:16 UTC (rev 683) +++ trunk/jazz/src/EventWindow.cpp 2009-01-19 17:53:36 UTC (rev 684) @@ -22,6 +22,7 @@ #include "EventWindow.h" +#include "Dialogs/ShiftDialog.h" #include "EventFrame.h" #include "Filter.h" #include "MouseAction.h" @@ -104,6 +105,13 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +bool JZEventWindow::AreEventsSelected() +{ + return mpSnapSel->IsSelected(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- bool JZEventWindow::EventsSelected(const wxString& Message) const { if (!mpSnapSel->IsSelected()) @@ -116,6 +124,22 @@ //----------------------------------------------------------------------------- // Description: +// Display the "shift events" dialog. +//----------------------------------------------------------------------------- +void JZEventWindow::Shift(int Units) +{ + if (AreEventsSelected()) + { + JZShiftDialog ShiftDialog(*this, *mpFilter, this); + + if (ShiftDialog.ShowModal() == wxID_OK) + { + } + } +} + +//----------------------------------------------------------------------------- +// Description: // Only consider the event portion of the window when computing the virtual // size. Do not consider the static information of the left or top portion of // the screen. Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2009-01-19 17:47:16 UTC (rev 683) +++ trunk/jazz/src/EventWindow.h 2009-01-19 17:53:36 UTC (rev 684) @@ -38,10 +38,6 @@ { public: - JZSnapSelection* mpSnapSel; - - JZFilter* mpFilter; - JZEventWindow( wxFrame* pParent, JZSong* pSong, @@ -53,8 +49,12 @@ // WARNING: non-constant access. JZSong* GetSong() const; + bool AreEventsSelected(); + bool EventsSelected(const wxString& Message) const; + void Shift(int Units); + void LineText( wxDC& Dc, int x, @@ -92,6 +92,12 @@ int y2yLine(int y, int Up = 0); + public: + + JZSnapSelection* mpSnapSel; + + JZFilter* mpFilter; + protected: JZSong* mpSong; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-19 17:47:21
|
Revision: 683 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=683&view=rev Author: pstieber Date: 2009-01-19 17:47:16 +0000 (Mon, 19 Jan 2009) Log Message: ----------- Changed a constant from a long to an integer. Modified Paths: -------------- trunk/jazz/src/PianoWindow.cpp Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2009-01-19 17:45:14 UTC (rev 682) +++ trunk/jazz/src/PianoWindow.cpp 2009-01-19 17:47:16 UTC (rev 683) @@ -2299,7 +2299,7 @@ //----------------------------------------------------------------------------- int JZPianoWindow::SnapClocks() { - int Clock = mpSong->GetTicksPerQuarter() * 4L / mSnapDenomiator; + int Clock = mpSong->GetTicksPerQuarter() * 4 / mSnapDenomiator; if (Clock < 1) { return 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-19 17:45:26
|
Revision: 682 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=682&view=rev Author: pstieber Date: 2009-01-19 17:45:14 +0000 (Mon, 19 Jan 2009) Log Message: ----------- Added a function to determine if events are selected. Modified Paths: -------------- trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2009-01-02 19:13:35 UTC (rev 681) +++ trunk/jazz/src/TrackWindow.cpp 2009-01-19 17:45:14 UTC (rev 682) @@ -1229,13 +1229,6 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -bool JZTrackWindow::AreEventsSelected() -{ - return mpSnapSel->IsSelected(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- int JZTrackWindow::EventsSelected(const wxString& Message) { if (!mpSnapSel->IsSelected()) Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2009-01-02 19:13:35 UTC (rev 681) +++ trunk/jazz/src/TrackWindow.h 2009-01-19 17:45:14 UTC (rev 682) @@ -75,8 +75,6 @@ void MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode); - bool AreEventsSelected(); - int EventsSelected(const wxString& Message); void ZoomIn(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-02 19:13:41
|
Revision: 681 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=681&view=rev Author: pstieber Date: 2009-01-02 19:13:35 +0000 (Fri, 02 Jan 2009) Log Message: ----------- Added the shift dialog to the Linux build. Modified Paths: -------------- trunk/jazz/src/Makefile.am Modified: trunk/jazz/src/Makefile.am =================================================================== --- trunk/jazz/src/Makefile.am 2009-01-02 18:37:48 UTC (rev 680) +++ trunk/jazz/src/Makefile.am 2009-01-02 19:13:35 UTC (rev 681) @@ -26,6 +26,7 @@ Dialogs/IntegerEdit.cpp \ Dialogs/KeyOnDialog.cpp \ Dialogs/MetronomeSettingsDialog.cpp \ +Dialogs/ShiftDialog.cpp \ Dialogs/SynthesizerSettingsDialog.cpp \ Dialogs/TrackDialog.cpp \ Dialogs.cpp \ @@ -105,6 +106,7 @@ Dialogs/IntegerEdit.cpp \ Dialogs/KeyOnDialog.cpp \ Dialogs/MetronomeSettingsDialog.cpp \ +Dialogs/ShiftDialog.cpp \ Dialogs/SynthesizerSettingsDialog.cpp \ Dialogs/TrackDialog.cpp \ Dialogs.cpp \ @@ -189,6 +191,7 @@ Dialogs/IntegerEdit.h \ Dialogs/KeyOnDialog.h \ Dialogs/MetronomeSettingsDialog.h \ +Dialogs/ShiftDialog.h \ Dialogs/SynthesizerSettingsDialog.h \ Dialogs/TrackDialog.h \ Dialogs.h \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-02 18:37:54
|
Revision: 680 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=680&view=rev Author: pstieber Date: 2009-01-02 18:37:48 +0000 (Fri, 02 Jan 2009) Log Message: ----------- 1. Separated the event frame and event window code into separate source modules. Modified some includes in various file to handle this change. 2. Started implementing the shift dialog using a more modern wxWidgets approach. This is a WIP. 3. Modified Paths: -------------- trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/Dialogs.cpp trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/HarmonyBrowserAnalyzer.cpp trunk/jazz/src/Makefile.am trunk/jazz/src/Rhythm.cpp trunk/jazz/src/TrackFrame.cpp trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj Added Paths: ----------- trunk/jazz/src/Dialogs/ShiftDialog.cpp trunk/jazz/src/Dialogs/ShiftDialog.h trunk/jazz/src/EventFrame.cpp trunk/jazz/src/EventFrame.h Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2009-01-01 08:46:37 UTC (rev 679) +++ trunk/jazz/src/ControlEdit.cpp 2009-01-02 18:37:48 UTC (rev 680) @@ -23,6 +23,7 @@ #include "ControlEdit.h" #include "EventWindow.h" +#include "Filter.h" #include "PianoWindow.h" #include "Song.h" #include "Track.h" Added: trunk/jazz/src/Dialogs/ShiftDialog.cpp =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.cpp (rev 0) +++ trunk/jazz/src/Dialogs/ShiftDialog.cpp 2009-01-02 18:37:48 UTC (rev 680) @@ -0,0 +1,540 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2008 Peter J. Stieber, all rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//***************************************************************************** + +#include "ShiftDialog.h" + +#include "../Filter.h" +#include "IntegerEdit.h" + +#include <wx/button.h> +#include <wx/checkbox.h> +#include <wx/msgdlg.h> +#include <wx/sizer.h> +#include <wx/stattext.h> +#include <wx/textctrl.h> + +#include <string> + +using namespace std; + +//***************************************************************************** +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZShiftDialog, wxDialog) + + EVT_BUTTON(wxID_HELP, JZShiftDialog::OnHelp) + +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZShiftDialog::JZShiftDialog( + JZEventFrame& EventWindow, + JZFilter& Filter, + wxWindow* pParent) + : wxDialog(pParent, wxID_ANY, wxString("Shift")), + mFilter(Filter), + mpFromTimeEdit(0), + mpToTimeEdit(0), + mpFromTrackEdit(0), + mpToTrackEdit(0), + mpNoteCheckBox(0), + mpNoteMinEdit(0), + mpNoteMaxEdit(0), + mpPolyAftertouchCheckBox(0), + mpPolyAftertouchMinEdit(0), + mpPolyAftertouchMaxEdit(0), + mpControllerCheckBox(0), + mpControllerMinEdit(0), + mpControllerMaxEdit(0), + mpPatchCheckBox(0), + mpPatchMinEdit(0), + mpPatchMaxEdit(0), + mpPitchCheckBox(0), + mpPitchMinEdit(0), + mpPitchMaxEdit(0), + mpMeterCheckBox(0), + mpChannelAftertouchCheckBox(0), + mpSysExCheckBox(0), + mpOtherBox(0) +{ + mpFromTimeEdit = new wxTextCtrl(this, wxID_ANY); + mpToTimeEdit = new wxTextCtrl(this, wxID_ANY); + + mpFromTrackEdit = new JZIntegerEdit(this, wxID_ANY); + mpFromTrackEdit->SetValueName("FromTrack"); + mpFromTrackEdit->SetMinAndMax(1, 127); + mpToTrackEdit = new JZIntegerEdit(this, wxID_ANY); + mpToTrackEdit->SetValueName("To Track"); + mpToTrackEdit->SetMinAndMax(1, 127); + + mpNoteCheckBox = new wxCheckBox(this, wxID_ANY, "Note"); + mpNoteMinEdit = new JZIntegerEdit(this, wxID_ANY); + mpNoteMinEdit->SetValueName("Note Minimum"); + mpNoteMinEdit->SetMinAndMax(0, 127); + mpNoteMaxEdit = new JZIntegerEdit(this, wxID_ANY); + mpNoteMaxEdit->SetValueName("Note Maximum"); + mpNoteMaxEdit->SetMinAndMax(0, 127); + + mpPolyAftertouchCheckBox = new wxCheckBox(this, wxID_ANY, "Poly Aftertouch"); + mpPolyAftertouchMinEdit = new JZIntegerEdit(this, wxID_ANY); + mpPolyAftertouchMinEdit->SetValueName("Poly Aftertouch Minimum"); + mpPolyAftertouchMinEdit->SetMinAndMax(0, 127); + mpPolyAftertouchMaxEdit = new JZIntegerEdit(this, wxID_ANY); + mpPolyAftertouchMaxEdit->SetValueName("Poly Aftertouch Maximum"); + mpPolyAftertouchMaxEdit->SetMinAndMax(0, 127); + + mpControllerCheckBox = new wxCheckBox(this, wxID_ANY, "Controller"); + mpControllerMinEdit = new JZIntegerEdit(this, wxID_ANY); + mpControllerMinEdit->SetValueName("Controller Minimum"); + mpControllerMinEdit->SetMinAndMax(0, 127); + mpControllerMaxEdit = new JZIntegerEdit(this, wxID_ANY); + mpControllerMaxEdit->SetValueName("Controller Maximum"); + mpControllerMaxEdit->SetMinAndMax(0, 127); + + mpPatchCheckBox = new wxCheckBox(this, wxID_ANY, "Patch"); + mpPatchMinEdit = new JZIntegerEdit(this, wxID_ANY); + mpPatchMinEdit->SetValueName("Patch Minimum"); + mpPatchMinEdit->SetMinAndMax(0, 127); + mpPatchMaxEdit = new JZIntegerEdit(this, wxID_ANY); + mpPatchMaxEdit->SetValueName("Patch Maximum"); + mpPatchMaxEdit->SetMinAndMax(0, 127); + + mpPitchCheckBox = new wxCheckBox(this, wxID_ANY, "Pitch"); + mpPitchMinEdit = new JZIntegerEdit(this, wxID_ANY); + mpPitchMinEdit->SetValueName("Pitch Minimum"); + mpPitchMinEdit->SetMinAndMax(-8192, 8192); + mpPitchMaxEdit = new JZIntegerEdit(this, wxID_ANY); + mpPitchMaxEdit->SetValueName("Pitch Maximum"); + mpPitchMaxEdit->SetMinAndMax(-8192, 8192); + + mpMeterCheckBox = new wxCheckBox(this, wxID_ANY, "Meter"); + + mpChannelAftertouchCheckBox = + new wxCheckBox(this, wxID_ANY, "Channel Aftertouch"); + + mpSysExCheckBox = new wxCheckBox(this, wxID_ANY, "SysEx"); + + mpOtherBox = new wxCheckBox(this, wxID_ANY, "Other"); + + wxButton* pOkButton = new wxButton(this, wxID_OK, "&OK"); + wxButton* pCancelButton = new wxButton(this, wxID_CANCEL, "Cancel"); + wxButton* pHelpButton = new wxButton(this, wxID_HELP, "Help"); + pOkButton->SetDefault(); + + wxBoxSizer* pTopSizer = new wxBoxSizer(wxVERTICAL); + + wxFlexGridSizer* pFlexGridSizer; + + pFlexGridSizer = new wxFlexGridSizer(2, 4, 4, 2); + + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "From Time:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpFromTimeEdit, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "To Time:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpToTimeEdit, + 0, + wxALIGN_CENTER_VERTICAL); + + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "From Track:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpFromTrackEdit, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "To Track:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpToTrackEdit, + 0, + wxALIGN_CENTER_VERTICAL); + + pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 10); + + pFlexGridSizer = new wxFlexGridSizer(5, 5, 4, 2); + + pFlexGridSizer->Add( + mpNoteCheckBox, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Min:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpNoteMinEdit, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Max:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpNoteMaxEdit, + 0, + wxALIGN_CENTER_VERTICAL); + + pFlexGridSizer->Add( + mpPolyAftertouchCheckBox, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Min:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpPolyAftertouchMinEdit, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Max:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpPolyAftertouchMaxEdit, + 0, + wxALIGN_CENTER_VERTICAL); + + pFlexGridSizer->Add( + mpControllerCheckBox, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Min:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpControllerMinEdit, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Max:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpControllerMaxEdit, + 0, + wxALIGN_CENTER_VERTICAL); + + pFlexGridSizer->Add( + mpPatchCheckBox, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Min:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpPatchMinEdit, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Max:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpPatchMaxEdit, + 0, + wxALIGN_CENTER_VERTICAL); + + pFlexGridSizer->Add( + mpPitchCheckBox, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Min:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpPitchMinEdit, + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + new wxStaticText(this, wxID_ANY, "Max:"), + 0, + wxALIGN_CENTER_VERTICAL); + pFlexGridSizer->Add( + mpPitchMaxEdit, + 0, + wxALIGN_CENTER_VERTICAL); + + pTopSizer->Add(pFlexGridSizer, 0, wxCENTER | wxALL, 10); + + wxBoxSizer* pCheckBoxSizer = new wxBoxSizer(wxHORIZONTAL); + + pCheckBoxSizer->Add(mpMeterCheckBox, 0, wxALL, 5); + + pCheckBoxSizer->Add(mpChannelAftertouchCheckBox, 0, wxALL, 5); + + pCheckBoxSizer->Add(mpSysExCheckBox, 0, wxALL, 5); + + pCheckBoxSizer->Add(mpOtherBox, 0, wxALL, 5); + + pTopSizer->Add(pCheckBoxSizer, 0, wxCENTER | wxALL, 5); + + wxBoxSizer* pButtonSizer = new wxBoxSizer(wxHORIZONTAL); + pButtonSizer->Add(pOkButton, 0, wxALL, 5); + pButtonSizer->Add(pCancelButton, 0, wxALL, 5); + pButtonSizer->Add(pHelpButton, 0, wxALL, 5); + + pTopSizer->Add(pButtonSizer, 0, wxALIGN_CENTER | wxBOTTOM, 6); + + SetAutoLayout(true); + SetSizer(pTopSizer); + + pTopSizer->SetSizeHints(this); + pTopSizer->Fit(this); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZShiftDialog::TransferDataToWindow() +{ + string TimeString; + + mFilter.GenerateFromTimeString(TimeString); + mpFromTimeEdit->ChangeValue(TimeString); + + mFilter.GenerateToTimeString(TimeString); + mpToTimeEdit->ChangeValue(TimeString); + + mpFromTrackEdit->SetNumber(mFilter.GetFromTrack()); + mpToTrackEdit->SetNumber(mFilter.GetToTrack()); + + bool Selected; + int FromValue, ToValue; + + mFilter.GetFilterEvent(eFilterKeyOn, Selected, FromValue, ToValue); + mpNoteCheckBox->SetValue(Selected); + mpNoteMinEdit->SetNumber(FromValue); + mpNoteMaxEdit->SetNumber(ToValue); + + mFilter.GetFilterEvent(eFilterKeyPressure, Selected, FromValue, ToValue); + mpPolyAftertouchCheckBox->SetValue(Selected); + mpPolyAftertouchMinEdit->SetNumber(FromValue); + mpPolyAftertouchMaxEdit->SetNumber(ToValue); + + mFilter.GetFilterEvent(eFilterControl, Selected, FromValue, ToValue); + mpControllerCheckBox->SetValue(Selected); + mpControllerMinEdit->SetNumber(FromValue); + mpControllerMaxEdit->SetNumber(ToValue); + + mFilter.GetFilterEvent(eFilterProgram, Selected, FromValue, ToValue); + mpPatchCheckBox->SetValue(Selected); + mpPatchMinEdit->SetNumber(FromValue); + mpPatchMaxEdit->SetNumber(ToValue); + + mFilter.GetFilterEvent(eFilterPitch, Selected, FromValue, ToValue); + mpPitchCheckBox->SetValue(Selected); + mpPitchMinEdit->SetNumber(FromValue); + mpPitchMaxEdit->SetNumber(ToValue); + + mpMeterCheckBox->SetValue(mFilter.GetFilterMeter()); + + mpChannelAftertouchCheckBox->SetValue(mFilter.GetFilterChannelAftertouch()); + + mpSysExCheckBox->SetValue(mFilter.GetFilterSysEx()); + + mpOtherBox->SetValue(mFilter.GetFilterOther()); + + return true; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZShiftDialog::TransferDataFromWindow() +{ + int FromTrack, ToTrack; + int NoteMin, NoteMax; + int PolyAftertouchMin, PolyAftertouchMax; + int ControllerMin, ControllerMax; + int PatchMin, PatchMax; + int PitchMin, PitchMax; + + if ( + mpFromTrackEdit->GetNumber(FromTrack) && + mpToTrackEdit->GetNumber(ToTrack) && + mpNoteMinEdit->GetNumber(NoteMin) && + mpNoteMaxEdit->GetNumber(NoteMax) && + mpPolyAftertouchMinEdit->GetNumber(PolyAftertouchMin) && + mpPolyAftertouchMaxEdit->GetNumber(PolyAftertouchMax) && + mpControllerMinEdit->GetNumber(ControllerMin) && + mpControllerMaxEdit->GetNumber(ControllerMax) && + mpPatchMinEdit->GetNumber(PatchMin) && + mpPatchMaxEdit->GetNumber(PatchMax) && + mpPitchMinEdit->GetNumber(PitchMin) && + mpPitchMaxEdit->GetNumber(PitchMax)) + { + if (FromTrack > ToTrack) + { + ::wxMessageBox( + "The From Track must be less than or equal to the To Track", + "Invalid Track Values", + wxOK | wxICON_EXCLAMATION, + this); + + mpFromTrackEdit->SetFocus(); + + return false; + } + + if (NoteMin > NoteMax) + { + ::wxMessageBox( + "The Minimum Note must be less than or equal to the Maximum Note", + "Invalid Note Values", + wxOK | wxICON_EXCLAMATION, + this); + + mpNoteMinEdit->SetFocus(); + + return false; + } + + if (PolyAftertouchMin > PolyAftertouchMax) + { + ::wxMessageBox( + "The Minimum Poly Aftertouch must be less than or equal to the Maximum" + " Poly Aftertouch", + "Invalid Poly Aftertouch Values", + wxOK | wxICON_EXCLAMATION, + this); + + mpPolyAftertouchMinEdit->SetFocus(); + + return false; + } + + if (ControllerMin > ControllerMax) + { + ::wxMessageBox( + "The Minimum Controller must be less than or equal to the Maximum" + " Controller", + "Invalid Controller Values", + wxOK | wxICON_EXCLAMATION, + this); + + mpControllerMinEdit->SetFocus(); + + return false; + } + + if (PatchMin > PatchMax) + { + ::wxMessageBox( + "The Minimum Patch must be less than or equal to the Maximum Patch", + "Invalid Patch Values", + wxOK | wxICON_EXCLAMATION, + this); + + mpPatchMinEdit->SetFocus(); + + return false; + } + + if (PitchMin > PitchMax) + { + ::wxMessageBox( + "The Minimum Pitch must be less than or equal to the Maximum Pitch", + "Invalid Pitch Values", + wxOK | wxICON_EXCLAMATION, + this); + + mpPitchMinEdit->SetFocus(); + + return false; + } + + string TimeString; + + TimeString = mpFromTimeEdit->GetValue(); + mFilter.SetFromTime(TimeString); + + TimeString = mpToTimeEdit->GetValue(); + mFilter.SetToTime(TimeString); + + mFilter.SetFromTrack(FromTrack); + mFilter.SetToTrack(ToTrack); + + mFilter.SetFilterEvent( + eFilterKeyOn, + mpNoteCheckBox->GetValue(), + NoteMin, + NoteMax); + + mFilter.SetFilterEvent( + eFilterKeyPressure, + mpPolyAftertouchCheckBox->GetValue(), + PolyAftertouchMin, + PolyAftertouchMax); + + mFilter.SetFilterEvent( + eFilterControl, + mpControllerCheckBox->GetValue(), + ControllerMin, + ControllerMax); + + mFilter.SetFilterEvent( + eFilterProgram, + mpPatchCheckBox->GetValue(), + PatchMin, + PatchMax); + + mFilter.SetFilterEvent( + eFilterPitch, + mpPitchCheckBox->GetValue(), + PitchMin, + PitchMax); + + mFilter.SetFilterMeter(mpMeterCheckBox->GetValue()); + + mFilter.SetFilterChannelAftertouch( + mpChannelAftertouchCheckBox->GetValue()); + + mFilter.SetFilterSysEx(mpSysExCheckBox->GetValue()); + + mFilter.SetFilterOther(mpOtherBox->GetValue()); + + return true; + } + + return false; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZShiftDialog::OnHelp(wxCommandEvent& Event) +{ +// gpHelpInstance->ShowTopic("Filter Dialog"); +} Property changes on: trunk/jazz/src/Dialogs/ShiftDialog.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/jazz/src/Dialogs/ShiftDialog.h =================================================================== --- trunk/jazz/src/Dialogs/ShiftDialog.h (rev 0) +++ trunk/jazz/src/Dialogs/ShiftDialog.h 2009-01-02 18:37:48 UTC (rev 680) @@ -0,0 +1,93 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 2008 Peter J. Stieber, all rights reserved. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//***************************************************************************** + +#ifndef JZ_SHIFTDIALOG_H +#define JZ_SHIFTDIALOG_H + +#include <wx/dialog.h> + +class JZEventFrame; +class JZFilter; +class JZIntegerEdit; +class wxCheckBox; +class wxTextCtrl; + +//***************************************************************************** +//***************************************************************************** +class JZShiftDialog : public wxDialog +{ + public: + + JZShiftDialog( + JZEventFrame& EventWindow, + JZFilter& Filter, + wxWindow* pParent); + + private: + + virtual bool TransferDataToWindow(); + + virtual bool TransferDataFromWindow(); + + void OnHelp(wxCommandEvent& Event); + + private: + + JZFilter& mFilter; + + wxTextCtrl* mpFromTimeEdit; + wxTextCtrl* mpToTimeEdit; + + JZIntegerEdit* mpFromTrackEdit; + JZIntegerEdit* mpToTrackEdit; + + wxCheckBox* mpNoteCheckBox; + JZIntegerEdit* mpNoteMinEdit; + JZIntegerEdit* mpNoteMaxEdit; + + wxCheckBox* mpPolyAftertouchCheckBox; + JZIntegerEdit* mpPolyAftertouchMinEdit; + JZIntegerEdit* mpPolyAftertouchMaxEdit; + + wxCheckBox* mpControllerCheckBox; + JZIntegerEdit* mpControllerMinEdit; + JZIntegerEdit* mpControllerMaxEdit; + + wxCheckBox* mpPatchCheckBox; + JZIntegerEdit* mpPatchMinEdit; + JZIntegerEdit* mpPatchMaxEdit; + + wxCheckBox* mpPitchCheckBox; + JZIntegerEdit* mpPitchMinEdit; + JZIntegerEdit* mpPitchMaxEdit; + + wxCheckBox* mpMeterCheckBox; + + wxCheckBox* mpChannelAftertouchCheckBox; + + wxCheckBox* mpSysExCheckBox; + + wxCheckBox* mpOtherBox; + + DECLARE_EVENT_TABLE(); +}; + + +#endif // !defined(JZ_SHIFTDIALOG_H) Property changes on: trunk/jazz/src/Dialogs/ShiftDialog.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2009-01-01 08:46:37 UTC (rev 679) +++ trunk/jazz/src/Dialogs.cpp 2009-01-02 18:37:48 UTC (rev 680) @@ -28,6 +28,7 @@ #include "Dialogs/KeyOnDialog.h" #include "Events.h" #include "EventWindow.h" +#include "Filter.h" #include "Globals.h" #include "Help.h" #include "NamedChoice.h" @@ -982,7 +983,7 @@ { Event = e; text=new char[2048]; - strcpy(text,(const char*)(e->GetText())); + strcpy(text, (const char*)(e->GetText())); } Added: trunk/jazz/src/EventFrame.cpp =================================================================== --- trunk/jazz/src/EventFrame.cpp (rev 0) +++ trunk/jazz/src/EventFrame.cpp 2009-01-02 18:37:48 UTC (rev 680) @@ -0,0 +1,512 @@ +#include "EventFrame.h" + +#include "Command.h" +#include "Dialogs/ShiftDialog.h" +#include "Dialogs.h" +#include "Filter.h" +#include "MouseAction.h" +#include "ToolBar.h" + +#include <wx/dc.h> +#include <wx/msgdlg.h> + +#include <iostream> + +using namespace std; + +//***************************************************************************** +// Description: +// This is the event frame class definition. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +BEGIN_EVENT_TABLE(JZEventFrame, wxFrame) + EVT_SIZE(JZEventFrame::OnSize) +END_EVENT_TABLE() + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZEventFrame::JZEventFrame( + wxWindow* pParent, + const wxString& Title, + JZSong* pSong, + const wxPoint& Position, + const wxSize& Size) + : wxFrame(pParent, wxID_ANY, Title, Position, Size), + Song(pSong), + mpFilter(0), + mpFixedFont(0), + hFixedFont(0), + mTrackHeight(0), + mTopInfoHeight(40), + FontSize(12), + ClocksPerPixel(36), + mEventsX(), + mEventsY(mTopInfoHeight), + mEventsWidth(0), + mEventsHeight(0), + CanvasX(0), + CanvasY(0), + CanvasW(0), + CanvasH(0), + FromClock(0), + ToClock(0), + FromLine(0), + ToLine(0), + SnapSel(0), + MouseAction(0), + PlayClock(-1), + mpSettingsDialog(0), + MixerForm(0), + mpToolBar(0), + mpGreyColor(0), + mpGreyBrush(0) +{ +#ifdef __WXMSW__ + mpGreyColor = new wxColor(192, 192, 192); +#else + mpGreyColor = new wxColor(220, 220, 220); +#endif + mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID); + + mpFilter = new JZFilter(Song); +} + +JZEventFrame::~JZEventFrame() +{ + delete SnapSel; + + delete mpGreyColor; + delete mpGreyBrush; + + delete mpFilter; + + delete mpFixedFont; + + delete mpToolBar; + + if (MixerForm) + { + delete MixerForm; + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::CreateMenu() +{ +} + + +//----------------------------------------------------------------------------- +// create the canvas component(used for differently dependingon the subclass) +// size it to the client area of the frame(frame size minus toolbar and menus ) +//----------------------------------------------------------------------------- +//void JZEventFrame::CreateCanvas() +//{ +// cout << "CreateCanvas" << endl; +// int Width, Height; +// GetClientSize(&Width, &Height); +// mpEventWindow = new JZEventWindow(this, 0, 0, Width, Height); +//} + +/** +second phase of creation. make menus, the canvas, and so on +*/ +void JZEventFrame::Create() +{ + CreateMenu(); + + Setup(); +} + +//----------------------------------------------------------------------------- +// Initialize the constants used in drawing. +//----------------------------------------------------------------------------- +void JZEventFrame::Setup() +{ +/* + int x, y; + + wxClientDC Dc(mpEventWindow); + Dc.SetFont(wxNullFont); + delete mpFixedFont; + mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); + Dc.SetFont(*mpFixedFont); + Dc.GetTextExtent("M", &x, &y); + hFixedFont = (int)y; + + delete mpFont; + mpFont = new wxFont(FontSize, wxSWISS, wxNORMAL, wxNORMAL); + Dc.SetFont(*mpFont); + + Dc.GetTextExtent("M", &x, &y); + mLittleBit = (int)(x/2); + + Dc.GetTextExtent("HXWjgi", &x, &y); + mTrackHeight = (int)y + mLittleBit; +*/ +} + +//----------------------------------------------------------------------------- +// this onsize handler is supposed to take care of handling of the resizing +// the two subwindows sizes to they dont overlap +//----------------------------------------------------------------------------- +void JZEventFrame::OnSize(wxSizeEvent& Event) +{ +// wxFrame::OnSize(Event); + + // The code below is from the toolbar sample, the layoutchidlren function + wxSize size = GetClientSize(); + + int offset; +// if (mpToolBar) +// { +// mpToolBar->SetSize(-1, size.y); +// mpToolBar->Move(0, 0); +// +// offset = mpToolBar->GetSize().x; +// } +// else +// { +// offset = 0; +// } + + // The step below should set the offset of the mpEventWindow + // m_textWindow->SetSize(offset, 0, size.x - offset, size.y); + +// float maxToolBarWidth = 0.0; +// float maxToolBarHeight = 0.0; +// if (mpToolBar) +// { +// mpToolBar->GetMaxSize(&maxToolBarWidth, &maxToolBarHeight); +// } + + offset = mpToolBar->GetSize().y; //get the height of the toolbar + + int frameWidth, frameHeight; + GetClientSize(&frameWidth, &frameHeight); + +// if (mpEventWindow) +// // mpEventWindow->SetSize(0, (int)offset, (int)frameWidth, (int)(frameHeight - offset)); +// mpEventWindow->SetSize(0, (int)0, (int)frameWidth, (int)(frameHeight)); +// // if (mpToolBar) +// // mpToolBar->SetSize(0, 0, (int)frameWidth, (int)maxToolBarHeight); + + cout + << "JZEventFrame::OnSize " << frameWidth<< 'x' << frameHeight << endl; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZEventFrame::OnCharHook(wxKeyEvent& e) +{ + return OnKeyEvent(e); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZEventFrame::y2yLine(int y, int up) +{ + if (up) + { + y += mTrackHeight; + } + y -= mTopInfoHeight; + y -= y % mTrackHeight; + y += mTopInfoHeight; + return y; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZEventFrame::y2Line(int y, int up) +{ + if (up) + { + y += mTrackHeight; + } + y -= mTopInfoHeight; + return y / mTrackHeight; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZEventFrame::Line2y(int Line) +{ + return Line * mTrackHeight + mTopInfoHeight; +} + +/* +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::LineText(wxDC *dc, int x, int y, int w, const char *str, int h, bool down) +{ + if (h <= 0) + { + h = mTrackHeight; + y = y2yLine(y); + } + if (w && h) + { + //dc->SetBrush(wxGREY_BRUSH); + dc->SetBrush(*mpGreyBrush); + dc->SetPen(*wxGREY_PEN); + #ifdef __WXMSW__ + dc->DrawRectangle(x, y, w+1, h+1); + #else + dc->DrawRectangle(x, y, w, h); + #endif + x += 1; + y += 1; + w -= 2; + h -= 2; + if (down) + { + dc->SetPen(*wxBLACK_PEN); + dc->DrawLine(x, y, x+w, y); + dc->DrawLine(x, y, x, y+h); + dc->SetPen(*wxWHITE_PEN); + dc->DrawLine(x+w, y, x+w, y+h); + dc->DrawLine(x, y+h, x+w, y+h); + } + else + { + dc->SetPen(*wxWHITE_PEN); + dc->DrawLine(x, y, x+w, y); + dc->DrawLine(x, y, x, y+h); + dc->SetPen(*wxBLACK_PEN); + dc->DrawLine(x+w, y, x+w, y+h); + dc->DrawLine(x, y+h, x+w, y+h); + } + dc->SetPen(*wxBLACK_PEN); + x -= 2; + y -= 2; + } + dc->SetTextBackground(*mpGreyColor); + dc->DrawText((char *)str, x + mLittleBit, y + mLittleBit); + dc->SetTextBackground(*wxWHITE); +} +*/ + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::Redraw() +{ +// wxDC* dc=new wxClientDC(this); +// wxPaintEvent e; +// cout<<"FIXME JZEventFrame::Redraw"<<endl; +// mpEventWindow->OnDraw(*dc); //this will in turn call the eventwin onpaintsub +// //the problem is that onpaint no longer tkes no argument, and is supposed to be called from the framework only, so it should be split +// delete dc; + +// mpEventWindow->Refresh(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZEventFrame::OnKeyEvent(wxKeyEvent &e) +{ + return false; +} + +//----------------------------------------------------------------------------- +// seems to handle the "selection" rectangle. normally called from the base +// class onmouseevent handler +//----------------------------------------------------------------------------- +int JZEventFrame::OnMouseEvent(wxMouseEvent &e) +{ + // cout <<"JZEventFrame::OnMouseEvent"<<endl; + if (!MouseAction) + { + // create SnapSel? + int x; + int y; + e.GetPosition(&x, &y); + if (mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight) + { + if (e.LeftDown()) + { + { + SnapSelStart(e); + + if (SnapSel->IsSelected()) + { + Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect) + } + SnapSel->Event(e); + MouseAction = SnapSel; + } + } + } + } + else + { + // MouseAction active + + if (MouseAction->Event(e)) + { + // MouseAction finished + + if (MouseAction == SnapSel) + { + SnapSelStop(e); + Redraw(); //ineficcient, invalidate rect first instead + MouseAction = 0; + return 1; + } + + MouseAction = 0; + } + } + return 0; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool JZEventFrame::OnClose() +{ + return FALSE; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::OnMenuCommand(int) +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZEventFrame::EventsSelected(const char* msg) +{ + if (!SnapSel->IsSelected()) + { + if (msg == 0) + { + msg = "please select some events first"; + } + wxMessageBox((char *)msg, "Error", wxOK); + return 0; + } + return 1; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::MenQuantize() +{ + if (!EventsSelected()) + return; + // wxDialogBox *panel = new wxDialogBox(this, "Quantize", FALSE ); + tQuantizeDlg * dlg = new tQuantizeDlg(this, mpFilter); + dlg->Create(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::MenCleanup() +{ + if (!EventsSelected()) + return; + tCleanupDlg * dlg = new tCleanupDlg(this, mpFilter); + dlg->Create(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::MenSearchReplace() +{ + if (!EventsSelected()) + return; + tSearchReplaceDlg * dlg = new tSearchReplaceDlg(this, mpFilter); + dlg->Create(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::MenSetChannel() +{ + if (!EventsSelected()) + return; + tSetChannelDlg * dlg = new tSetChannelDlg(mpFilter); + dlg->Create(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::MenTranspose() +{ + if (!EventsSelected()) + return; + tTransposeDlg * dlg = new tTransposeDlg(this, mpFilter); + dlg->Create(); +} + +//----------------------------------------------------------------------------- +// show the "shift events" dialog +//----------------------------------------------------------------------------- +void JZEventFrame::MenShift(int Unit) +{ + if (EventsSelected()) + { + JZShiftDialog ShiftDialog(*this, *mpFilter, this); + + if (ShiftDialog.ShowModal() == wxID_OK) + { + } + } +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::MenDelete() +{ + if (!EventsSelected()) + return; + tDeleteDlg * dlg = new tDeleteDlg(this, mpFilter); + dlg->Create(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::MenVelocity() +{ + if (!EventsSelected()) + return; + tVelocityDlg * dlg = new tVelocityDlg(mpFilter); + dlg->Create(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZEventFrame::MenLength() +{ + if (!EventsSelected()) + return; + tLengthDlg * dlg = new tLengthDlg(this, mpFilter); + dlg->Create(); +} + +//----------------------------------------------------------------------------- +// convert to modulation +//----------------------------------------------------------------------------- +void JZEventFrame::MenConvertToModulation() +{ + if (!EventsSelected()) + return; + tCmdConvertToModulation cmd(mpFilter); + cmd.Execute(); + Redraw(); +} Property changes on: trunk/jazz/src/EventFrame.cpp ___________________________________________________________________ Added: svn:eol-style + native Added: trunk/jazz/src/EventFrame.h =================================================================== --- trunk/jazz/src/EventFrame.h (rev 0) +++ trunk/jazz/src/EventFrame.h 2009-01-02 18:37:48 UTC (rev 680) @@ -0,0 +1,149 @@ +//***************************************************************************** +// The JAZZ++ Midi Sequencer +// +// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. +// Modifications Copyright (C) 2004 Patrick Earl +// Modifications Copyright (C) 2008 Peter J. Stieber +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +//***************************************************************************** + +#ifndef JZ_EVENTFRAME_H +#define JZ_EVENTFRAME_H + +#include <wx/frame.h> + +class JZFilter; +class JZSnapSelection; +class JZSong; +class JZToolBar; +class tMouseAction; +class wxDialog; + +//***************************************************************************** +// Description: +// A frame window that containes a scrolled event window. Acts as the +// common base class for JZTrackFrame and JSPianoFrame. +// +// The panel and menu are administered by derived classes. +// Functionality: +// - Settings dialog +// - Selection via Snapsel +//***************************************************************************** +class JZEventFrame : public wxFrame +{ + public: + + bool OnCharHook(wxKeyEvent& event); + void OnChar(wxKeyEvent& event); + + // 2-step initialization: 1) constructor + JZEventFrame( + wxWindow* pParent, + const wxString& Title, + JZSong* pSong, + const wxPoint& Position = wxDefaultPosition, + const wxSize& Size = wxDefaultSize); + + virtual ~JZEventFrame(); + + JZSong* Song; + + JZFilter* mpFilter; + + // 2) Create(): + virtual void Create(); + virtual void CreateMenu(); + void CreateCanvas(); +// JZEventWindow* mpEventWindow; + + // Setup() + wxFont* mpFixedFont; // remains with 12pt + int hFixedFont; // Height of letters + + int mTrackHeight; + + int mTopInfoHeight; + int FontSize; + int ClocksPerPixel; + + // Parameters changed, e.g. Song loaded + virtual void Setup(); + + int mEventsX, mEventsY, mEventsWidth, mEventsHeight; + int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords + int FromClock, ToClock; + int FromLine, ToLine; + + // Mousehandling + JZSnapSelection* SnapSel; + tMouseAction* MouseAction; + virtual void SnapSelStart(wxMouseEvent &e); + virtual void SnapSelStop(wxMouseEvent &e); + + // methods + int y2Line(int y, int up = 0); + int y2yLine(int y, int up = 0); + int Line2y(int line); +// void LineText(wxDC *dc, int x, int y, int w, const char *str, int h = -1, bool down = false); + + int PlayClock; + + // Events + virtual int OnMouseEvent(wxMouseEvent& Event); + virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin + virtual void OnSize(wxSizeEvent& Event); + virtual void OnMenuCommand(int id); + virtual bool OnClose(); + + // Redraw - nach Aenderungen von Parametern, kein GUI-Event + virtual void Redraw(); + + // Settings-Dialog + wxDialog* mpSettingsDialog; + void SettingsDialog(int piano); + + // Mixer-Dialog + wxDialog* MixerForm; + + // Edit-Menu + + // if selection active: TRUE, else: Errormessage + FALSE + int EventsSelected(const char* msg = 0); + + void MenQuantize(); + void MenSetChannel(); + void MenTranspose(); + void MenShift(int Unit); + void MenDelete(); + void MenVelocity(); + void MenLength(); + void MenSeqLength(); + void MenMidiDelay(); + void MenConvertToModulation(); + void MenCleanup(); + void MenSearchReplace(); + void MenMeterChange(); + + protected: + + JZToolBar* mpToolBar; + wxColor* mpGreyColor; + wxBrush* mpGreyBrush; + + DECLARE_EVENT_TABLE() +}; + +#endif // !defined(JZ_EVENTFRAME_H) Property changes on: trunk/jazz/src/EventFrame.h ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-01 08:46:37 UTC (rev 679) +++ trunk/jazz/src/EventWindow.cpp 2009-01-02 18:37:48 UTC (rev 680) @@ -22,15 +22,13 @@ #include "EventWindow.h" -#include "PianoFrame.h" +#include "EventFrame.h" +#include "Filter.h" +#include "MouseAction.h" #include "Song.h" -#include "Command.h" -#include "Dialogs.h" #include "Help.h" -#include "ToolBar.h" #include "PropertyListDialog.h" -#include <wx/brush.h> #include <wx/dc.h> #include <wx/msgdlg.h> @@ -346,500 +344,6 @@ //} //***************************************************************************** -// Description: -// This is the event frame class definition. -//***************************************************************************** -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -BEGIN_EVENT_TABLE(JZEventFrame, wxFrame) - EVT_SIZE(JZEventFrame::OnSize) -END_EVENT_TABLE() - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -JZEventFrame::JZEventFrame( - wxWindow* pParent, - const wxString& Title, - JZSong* pSong, - const wxPoint& Position, - const wxSize& Size) - : wxFrame(pParent, wxID_ANY, Title, Position, Size), - Song(pSong), - mpFilter(0), - mpFixedFont(0), - hFixedFont(0), - mTrackHeight(0), - mTopInfoHeight(40), - FontSize(12), - ClocksPerPixel(36), - mEventsX(), - mEventsY(mTopInfoHeight), - mEventsWidth(0), - mEventsHeight(0), - CanvasX(0), - CanvasY(0), - CanvasW(0), - CanvasH(0), - FromClock(0), - ToClock(0), - FromLine(0), - ToLine(0), - SnapSel(0), - MouseAction(0), - PlayClock(-1), - mpSettingsDialog(0), - MixerForm(0), - mpToolBar(0), - mpGreyColor(0), - mpGreyBrush(0) -{ -#ifdef __WXMSW__ - mpGreyColor = new wxColor(192, 192, 192); -#else - mpGreyColor = new wxColor(220, 220, 220); -#endif - mpGreyBrush = new wxBrush(*mpGreyColor, wxSOLID); - - mpFilter = new JZFilter(Song); -} - -JZEventFrame::~JZEventFrame() -{ - delete SnapSel; - - delete mpGreyColor; - delete mpGreyBrush; - - delete mpFilter; - - delete mpFixedFont; - - delete mpToolBar; - - if (MixerForm) - { - delete MixerForm; - } -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::CreateMenu() -{ -} - - -//----------------------------------------------------------------------------- -// create the canvas component(used for differently dependingon the subclass) -// size it to the client area of the frame(frame size minus toolbar and menus ) -//----------------------------------------------------------------------------- -//void JZEventFrame::CreateCanvas() -//{ -// cout << "CreateCanvas" << endl; -// int Width, Height; -// GetClientSize(&Width, &Height); -// mpEventWindow = new JZEventWindow(this, 0, 0, Width, Height); -//} - -/** -second phase of creation. make menus, the canvas, and so on -*/ -void JZEventFrame::Create() -{ - CreateMenu(); - - Setup(); -} - -//----------------------------------------------------------------------------- -// Initialize the constants used in drawing. -//----------------------------------------------------------------------------- -void JZEventFrame::Setup() -{ -/* - int x, y; - - wxClientDC Dc(mpEventWindow); - Dc.SetFont(wxNullFont); - delete mpFixedFont; - mpFixedFont = new wxFont(12, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFixedFont); - Dc.GetTextExtent("M", &x, &y); - hFixedFont = (int)y; - - delete mpFont; - mpFont = new wxFont(FontSize, wxSWISS, wxNORMAL, wxNORMAL); - Dc.SetFont(*mpFont); - - Dc.GetTextExtent("M", &x, &y); - mLittleBit = (int)(x/2); - - Dc.GetTextExtent("HXWjgi", &x, &y); - mTrackHeight = (int)y + mLittleBit; -*/ -} - -//----------------------------------------------------------------------------- -// this onsize handler is supposed to take care of handling of the resizing -// the two subwindows sizes to they dont overlap -//----------------------------------------------------------------------------- -void JZEventFrame::OnSize(wxSizeEvent& Event) -{ -// wxFrame::OnSize(Event); - - // The code below is from the toolbar sample, the layoutchidlren function - wxSize size = GetClientSize(); - - int offset; -// if (mpToolBar) -// { -// mpToolBar->SetSize(-1, size.y); -// mpToolBar->Move(0, 0); -// -// offset = mpToolBar->GetSize().x; -// } -// else -// { -// offset = 0; -// } - - // The step below should set the offset of the mpEventWindow - // m_textWindow->SetSize(offset, 0, size.x - offset, size.y); - -// float maxToolBarWidth = 0.0; -// float maxToolBarHeight = 0.0; -// if (mpToolBar) -// { -// mpToolBar->GetMaxSize(&maxToolBarWidth, &maxToolBarHeight); -// } - - offset = mpToolBar->GetSize().y; //get the height of the toolbar - - int frameWidth, frameHeight; - GetClientSize(&frameWidth, &frameHeight); - -// if (mpEventWindow) -// // mpEventWindow->SetSize(0, (int)offset, (int)frameWidth, (int)(frameHeight - offset)); -// mpEventWindow->SetSize(0, (int)0, (int)frameWidth, (int)(frameHeight)); -// // if (mpToolBar) -// // mpToolBar->SetSize(0, 0, (int)frameWidth, (int)maxToolBarHeight); - - cout - << "JZEventFrame::OnSize " << frameWidth<< 'x' << frameHeight << endl; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -bool JZEventFrame::OnCharHook(wxKeyEvent& e) -{ - return OnKeyEvent(e); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -int JZEventFrame::y2yLine(int y, int up) -{ - if (up) - { - y += mTrackHeight; - } - y -= mTopInfoHeight; - y -= y % mTrackHeight; - y += mTopInfoHeight; - return y; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -int JZEventFrame::y2Line(int y, int up) -{ - if (up) - { - y += mTrackHeight; - } - y -= mTopInfoHeight; - return y / mTrackHeight; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -int JZEventFrame::Line2y(int Line) -{ - return Line * mTrackHeight + mTopInfoHeight; -} - -/* -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::LineText(wxDC *dc, int x, int y, int w, const char *str, int h, bool down) -{ - if (h <= 0) - { - h = mTrackHeight; - y = y2yLine(y); - } - if (w && h) - { - //dc->SetBrush(wxGREY_BRUSH); - dc->SetBrush(*mpGreyBrush); - dc->SetPen(*wxGREY_PEN); - #ifdef __WXMSW__ - dc->DrawRectangle(x, y, w+1, h+1); - #else - dc->DrawRectangle(x, y, w, h); - #endif - x += 1; - y += 1; - w -= 2; - h -= 2; - if (down) - { - dc->SetPen(*wxBLACK_PEN); - dc->DrawLine(x, y, x+w, y); - dc->DrawLine(x, y, x, y+h); - dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(x+w, y, x+w, y+h); - dc->DrawLine(x, y+h, x+w, y+h); - } - else - { - dc->SetPen(*wxWHITE_PEN); - dc->DrawLine(x, y, x+w, y); - dc->DrawLine(x, y, x, y+h); - dc->SetPen(*wxBLACK_PEN); - dc->DrawLine(x+w, y, x+w, y+h); - dc->DrawLine(x, y+h, x+w, y+h); - } - dc->SetPen(*wxBLACK_PEN); - x -= 2; - y -= 2; - } - dc->SetTextBackground(*mpGreyColor); - dc->DrawText((char *)str, x + mLittleBit, y + mLittleBit); - dc->SetTextBackground(*wxWHITE); -} -*/ - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::Redraw() -{ -// wxDC* dc=new wxClientDC(this); -// wxPaintEvent e; -// cout<<"FIXME JZEventFrame::Redraw"<<endl; -// mpEventWindow->OnDraw(*dc); //this will in turn call the eventwin onpaintsub -// //the problem is that onpaint no longer tkes no argument, and is supposed to be called from the framework only, so it should be split -// delete dc; - -// mpEventWindow->Refresh(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -bool JZEventFrame::OnKeyEvent(wxKeyEvent &e) -{ - return false; -} - -//----------------------------------------------------------------------------- -// seems to handle the "selection" rectangle. normally called from the base -// class onmouseevent handler -//----------------------------------------------------------------------------- -int JZEventFrame::OnMouseEvent(wxMouseEvent &e) -{ - // cout <<"JZEventFrame::OnMouseEvent"<<endl; - if (!MouseAction) - { - // create SnapSel? - int x; - int y; - e.GetPosition(&x, &y); - if (mEventsX < x && x < mEventsX + mEventsWidth && mEventsY < y && y < mEventsY + mEventsHeight) - { - if (e.LeftDown()) - { - { - SnapSelStart(e); - - if (SnapSel->IsSelected()) - { - Refresh(); //redraw the whole window instead(inefficient, we should rather invalidate a rect) - } - SnapSel->Event(e); - MouseAction = SnapSel; - } - } - } - } - else - { - // MouseAction active - - if (MouseAction->Event(e)) - { - // MouseAction finished - - if (MouseAction == SnapSel) - { - SnapSelStop(e); - Redraw(); //ineficcient, invalidate rect first instead - MouseAction = 0; - return 1; - } - - MouseAction = 0; - } - } - return 0; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -bool JZEventFrame::OnClose() -{ - return FALSE; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::OnMenuCommand(int) -{ -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::SnapSelStart(wxMouseEvent& MouseEvent) -{ -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::SnapSelStop(wxMouseEvent& MouseEvent) -{ -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -int JZEventFrame::EventsSelected(const char* msg) -{ - if (!SnapSel->IsSelected()) - { - if (msg == 0) - { - msg = "please select some events first"; - } - wxMessageBox((char *)msg, "Error", wxOK); - return 0; - } - return 1; -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenQuantize() -{ - if (!EventsSelected()) - return; - // wxDialogBox *panel = new wxDialogBox(this, "Quantize", FALSE ); - tQuantizeDlg * dlg = new tQuantizeDlg(this, mpFilter); - dlg->Create(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenCleanup() -{ - if (!EventsSelected()) - return; - tCleanupDlg * dlg = new tCleanupDlg(this, mpFilter); - dlg->Create(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenSearchReplace() -{ - if (!EventsSelected()) - return; - tSearchReplaceDlg * dlg = new tSearchReplaceDlg(this, mpFilter); - dlg->Create(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenSetChannel() -{ - if (!EventsSelected()) - return; - tSetChannelDlg * dlg = new tSetChannelDlg(mpFilter); - dlg->Create(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenTranspose() -{ - if (!EventsSelected()) - return; - tTransposeDlg * dlg = new tTransposeDlg(this, mpFilter); - dlg->Create(); -} - -//----------------------------------------------------------------------------- -// show the "shift events" dialog -//----------------------------------------------------------------------------- -void JZEventFrame::MenShift(int Unit) -{ - if (EventsSelected()) - { - tShiftDlg * dlg = new tShiftDlg(this, mpFilter, Unit); - dlg->Create(); - } -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenDelete() -{ - if (!EventsSelected()) - return; - tDeleteDlg * dlg = new tDeleteDlg(this, mpFilter); - dlg->Create(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenVelocity() -{ - if (!EventsSelected()) - return; - tVelocityDlg * dlg = new tVelocityDlg(mpFilter); - dlg->Create(); -} - -//----------------------------------------------------------------------------- -//----------------------------------------------------------------------------- -void JZEventFrame::MenLength() -{ - if (!EventsSelected()) - return; - tLengthDlg * dlg = new tLengthDlg(this, mpFilter); - dlg->Create(); -} - -//----------------------------------------------------------------------------- -// convert to modulation -//----------------------------------------------------------------------------- -void JZEventFrame::MenConvertToModulation() -{ - if (!EventsSelected()) - return; - tCmdConvertToModulation cmd(mpFilter); - cmd.Execute(); - Redraw(); -} - -//***************************************************************************** // MeterChange Dialog //***************************************************************************** class tMeterChangeDlg : public tPropertyListDlg Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2009-01-01 08:46:37 UTC (rev 679) +++ trunk/jazz/src/EventWindow.h 2009-01-02 18:37:48 UTC (rev 680) @@ -20,18 +20,14 @@ // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. //***************************************************************************** -#ifndef JZ_EVENTFRAME_H -#define JZ_EVENTFRAME_H +#ifndef JZ_EVENTWINDOW_H +#define JZ_EVENTWINDOW_H -#include "Filter.h" -#include "MouseAction.h" +#include <wx/window.h> -#include <wx/frame.h> - -class JZEventFrame; +class JZFilter; +class JZSnapSelection; class JZSong; -class JZToolBar; -class JZPianoFrame; //***************************************************************************** // Description: @@ -132,118 +128,4 @@ return mpSong; } -//***************************************************************************** -// Description: -// A frame window that containes a scrolled event window. Acts as the -// common base class for JZTrackFrame and JSPianoFrame. -// -// The panel and menu are administered by derived classes. -// Functionality: -// - Settings dialog -// - Selection via Snapsel -//***************************************************************************** -class JZEventFrame : public wxFrame -{ - public: - - bool OnCharHook(wxKeyEvent& event); - void OnChar(wxKeyEvent& event); - - // 2-step initialization: 1) constructor - JZEventFrame( - wxWindow* pParent, - const wxString& Title, - JZSong* pSong, - const wxPoint& Position = wxDefaultPosition, - const wxSize& Size = wxDefaultSize); - - virtual ~JZEventFrame(); - - JZSong* Song; - - JZFilter* mpFilter; - - // 2) Create(): - virtual void Create(); - virtual void CreateMenu(); - void CreateCanvas(); -// JZEventWindow* mpEventWindow; - - // Setup() - wxFont* mpFixedFont; // remains with 12pt - int hFixedFont; // Height of letters - - int mTrackHeight; - - int mTopInfoHeight; - int FontSize; - int ClocksPerPixel; - - // Parameters changed, e.g. Song loaded - virtual void Setup(); - - int mEventsX, mEventsY, mEventsWidth, mEventsHeight; - int CanvasX, CanvasY, CanvasW, CanvasH; // canvas coords - int FromClock, ToClock; - int FromLine, ToLine; - - // Mousehandling - JZSnapSelection *SnapSel; - tMouseAction *MouseAction; - virtual void SnapSelStart(wxMouseEvent &e); - virtual void SnapSelStop(wxMouseEvent &e); - - // methods - int y2Line(int y, int up = 0); - int y2yLine(int y, int up = 0); - int Line2y(int line); -// void LineText(wxDC *dc, int x, int y, int w, const char *str, int h = -1, bool down = false); - - int PlayClock; - - // Events - virtual int OnMouseEvent(wxMouseEvent& Event); - virtual bool OnKeyEvent(wxKeyEvent& Event); // true = processed by eventwin - virtual void OnSize(wxSizeEvent& Event); - virtual void OnMenuCommand(int id); - virtual bool OnClose(); - - // Redraw - nach Aenderungen von Parametern, kein GUI-Event - virtual void Redraw(); - - // Settings-Dialog - wxDialog* mpSettingsDialog; - void SettingsDialog(int piano); - - // Mixer-Dialog - wxDialog* MixerForm; - - // Edit-Menu - - // if selection active: TRUE, else: Errormessage + FALSE - int EventsSelected(const char* msg = 0); - - void MenQuantize(); - void MenSetChannel(); - void MenTranspose(); - void MenShift(int Unit); - void MenDelete(); - void MenVelocity(); - void MenLength(); - void MenSeqLength(); - void MenMidiDelay(); - void MenConvertToModulation(); - void MenCleanup(); - void MenSearchReplace(); - void MenMeterChange(); - - protected: - - JZToolBar* mpToolBar; - wxColor* mpGreyColor; - wxBrush* mpGreyBrush; - - DECLARE_EVENT_TABLE() -}; - -#endif // !defined(JZ_EVENTFRAME_H) +#endif // !defined(JZ_EVENTWINDOW_H) Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2009-01-01 08:46:37 UTC (rev 679) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2009-01-02 18:37:48 UTC (rev 680) @@ -22,8 +22,9 @@ #include "HarmonyBrowserAnalyzer.h" +#include "Command.h" #include "EventWindow.h" -#include "Command.h" +#include "Filter.h" #include "Harm... [truncated message content] |
From: <pst...@us...> - 2009-01-01 08:46:42
|
Revision: 679 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=679&view=rev Author: pstieber Date: 2009-01-01 08:46:37 +0000 (Thu, 01 Jan 2009) Log Message: ----------- 1. Changed the return type of JZEventWindow::EventsSelected from int to bool. 2. Added ID_SHIFT. 3. Moved ... nect to menu entries. 4. Removed MEN_SHIFT from the piano frame and used ID_SHIFT instead. 5. Changed framesPerSecond to gFramesPerSecond in Track.cpp and made come cosmetic indentation changes. 6. Added an unimplemented shift entry to the Edit menu of the track frame. 7. Added AreEventsSelected to the track window. Happy New Year. Modified Paths: -------------- trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/EventWindow.cpp trunk/jazz/src/EventWindow.h trunk/jazz/src/PianoFrame.cpp trunk/jazz/src/Resources.h trunk/jazz/src/Sample.h trunk/jazz/src/SampleWindow.cpp trunk/jazz/src/Track.cpp trunk/jazz/src/TrackFrame.cpp trunk/jazz/src/TrackFrame.h trunk/jazz/src/TrackWindow.cpp trunk/jazz/src/TrackWindow.h Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/ControlEdit.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -75,7 +75,7 @@ // PORTING: changed the calls a bit so it would compile, need to remake the layout and do the event bindings - ctrlmode = 0; // edit seems stupid to me ... + ctrlmode = 0; // Edit seems stupid to me. wxBoxSizer *topsizer = new wxBoxSizer( wxVERTICAL ); Modified: trunk/jazz/src/EventWindow.cpp =================================================================== --- trunk/jazz/src/EventWindow.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/EventWindow.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -106,14 +106,14 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -int JZEventWindow::EventsSelected(const wxString& Message) const +bool JZEventWindow::EventsSelected(const wxString& Message) const { if (!mpSnapSel->IsSelected()) { wxMessageBox(Message, "Error", wxOK); - return 0; + return false; } - return 1; + return true; } //----------------------------------------------------------------------------- Modified: trunk/jazz/src/EventWindow.h =================================================================== --- trunk/jazz/src/EventWindow.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/EventWindow.h 2009-01-01 08:46:37 UTC (rev 679) @@ -57,7 +57,7 @@ // WARNING: non-constant access. JZSong* GetSong() const; - int EventsSelected(const wxString& Message) const; + bool EventsSelected(const wxString& Message) const; void LineText( wxDC& Dc, Modified: trunk/jazz/src/PianoFrame.cpp =================================================================== --- trunk/jazz/src/PianoFrame.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/PianoFrame.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -58,7 +58,6 @@ #define MEN_METERCH 8 #define ACT_HELP_MOUSE 9 -#define MEN_SHIFT 11 #define MEN_QUANTIZE 12 #define MEN_SETCHAN 14 #define MEN_TRANSP 15 @@ -174,7 +173,7 @@ EVT_MENU(wxID_DELETE, JZPianoFrame::OnErase) EVT_MENU(wxID_CUT, JZPianoFrame::OnCut) EVT_MENU(wxID_COPY, JZPianoFrame::OnCopy) - EVT_MENU(MEN_SHIFT, JZPianoFrame::OnShift) + EVT_MENU(ID_SHIFT, JZPianoFrame::OnShift) EVT_MENU(MEN_SHIFTL, JZPianoFrame::OnShiftLeft) EVT_MENU(MEN_SHIFTR, JZPianoFrame::OnShiftRight) EVT_MENU(MEN_LERI, JZPianoFrame::OnExchangeLeftRight) @@ -336,28 +335,28 @@ edit_menu->Append(wxID_DELETE, "&Delete"); edit_menu->Append(wxID_COPY, "&Copy"); edit_menu->Append(wxID_CUT, "&Cut"); - edit_menu->Append(MEN_SHIFT, "&Shift ..."); - edit_menu->Append(MEN_QUANTIZE, "&Quantize ..."); - edit_menu->Append(MEN_SETCHAN, "&Set MIDI Channel ..."); - edit_menu->Append(MEN_TRANSP, "&Transpose ..."); - edit_menu->Append(MEN_VELOC, "&Velocity ..."); - edit_menu->Append(MEN_LENGTH, "&Length ..."); + edit_menu->Append(ID_SHIFT, "&Shift..."); + edit_menu->Append(MEN_QUANTIZE, "&Quantize..."); + edit_menu->Append(MEN_SETCHAN, "&Set MIDI Channel..."); + edit_menu->Append(MEN_TRANSP, "&Transpose..."); + edit_menu->Append(MEN_VELOC, "&Velocity..."); + edit_menu->Append(MEN_LENGTH, "&Length..."); - edit_menu->Append(MEN_SEQLENGTH, "&Sequence Length ..."); - edit_menu->Append(MEN_MIDIDELAY, "&Midi Delay ..."); + edit_menu->Append(MEN_SEQLENGTH, "&Sequence Length..."); + edit_menu->Append(MEN_MIDIDELAY, "&Midi Delay..."); edit_menu->Append(MEN_CONVERT_TO_MODULATION, "&Convert to Modulation(experimental)"); edit_menu->Append(MEN_LERI, "&Left <-> Right"); edit_menu->Append(MEN_UPDN, "&Up <-> Down"); - edit_menu->Append(MEN_CLEANUP, "&Cleanup ..."); - edit_menu->Append(MEN_SEARCHREP, "&Search Replace ..."); + edit_menu->Append(MEN_CLEANUP, "&Cleanup..."); + edit_menu->Append(MEN_SEARCHREP, "&Search Replace..."); wxMenu *setting_menu = new wxMenu("",wxMENU_TEAROFF); - setting_menu->Append(MEN_FILTER, "&Filter ..."); - setting_menu->Append(ACT_SETTINGS, "&Window ..."); + setting_menu->Append(MEN_FILTER, "&Filter..."); + setting_menu->Append(ACT_SETTINGS, "&Window..."); setting_menu->Append(MEN_VISIBLE, "&Events..."); - setting_menu->Append(MEN_SNAP, "&Snap ..."); - setting_menu->Append(MEN_METERCH, "&Meterchange ..."); + setting_menu->Append(MEN_SNAP, "&Snap..."); + setting_menu->Append(MEN_METERCH, "&Meterchange..."); wxMenu *misc_menu = new wxMenu("",wxMENU_TEAROFF); misc_menu->Append(wxID_UNDO, "&Undo"); @@ -369,7 +368,7 @@ misc_menu->Append(MEN_CTRL_POLY_AFTER, "Edit &Key Aftertouch"); misc_menu->Append(MEN_CTRL_CHANNEL_AFTER, "Edit &Chn Aftertouch"); - misc_menu->Append(MEN_CTRL_CONTR, "Edit &Controller ..."); + misc_menu->Append(MEN_CTRL_CONTR, "Edit &Controller..."); misc_menu->Append(MEN_CTRL_TEMPO, "Edit &Tempo"); misc_menu->Append(MEN_CTRL_NONE, "Edit &None"); misc_menu->Append(MEN_GUITAR, "&Guitar board"); Modified: trunk/jazz/src/Resources.h =================================================================== --- trunk/jazz/src/Resources.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/Resources.h 2009-01-01 08:46:37 UTC (rev 679) @@ -46,15 +46,16 @@ #define ID_TRIM wxID_HIGHEST + 30 #define ID_QUANTIZE wxID_HIGHEST + 31 -#define ID_SHIFT_LEFT wxID_HIGHEST + 32 -#define ID_SHIFT_RIGHT wxID_HIGHEST + 33 -#define ID_SNAP_8 wxID_HIGHEST + 34 -#define ID_SNAP_8D wxID_HIGHEST + 35 -#define ID_SNAP_16 wxID_HIGHEST + 36 -#define ID_SNAP_16D wxID_HIGHEST + 37 -#define ID_MIXER wxID_HIGHEST + 38 -#define ID_PIANOWIN wxID_HIGHEST + 39 -#define ID_METRONOME_TOGGLE wxID_HIGHEST + 40 +#define ID_SHIFT wxID_HIGHEST + 32 +#define ID_SHIFT_LEFT wxID_HIGHEST + 33 +#define ID_SHIFT_RIGHT wxID_HIGHEST + 34 +#define ID_SNAP_8 wxID_HIGHEST + 35 +#define ID_SNAP_8D wxID_HIGHEST + 36 +#define ID_SNAP_16 wxID_HIGHEST + 37 +#define ID_SNAP_16D wxID_HIGHEST + 38 +#define ID_MIXER wxID_HIGHEST + 39 +#define ID_PIANOWIN wxID_HIGHEST + 40 +#define ID_METRONOME_TOGGLE wxID_HIGHEST + 41 #define ID_PLAY wxID_HIGHEST + 50 #define ID_PLAY_LOOP wxID_HIGHEST + 51 Modified: trunk/jazz/src/Sample.h =================================================================== --- trunk/jazz/src/Sample.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/Sample.h 2009-01-01 08:46:37 UTC (rev 679) @@ -270,7 +270,7 @@ void Clear(); void GotoRAM() { - // try to swap this sample into memory ... + // Try to swap this sample into memory. volatile short dummy; for (int i = 0; i < length; i++) dummy = data[i]; Modified: trunk/jazz/src/SampleWindow.cpp =================================================================== --- trunk/jazz/src/SampleWindow.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/SampleWindow.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -322,7 +322,7 @@ wxDC* pDc = new wxClientDC(this); - // tSnapSel is strange ... + // tSnapSel is strange. if (e.LeftDown()) { mouse_up_sets_insertion_point = 0; @@ -739,11 +739,11 @@ menu_bar->Append(menu, "&Edit"); menu = new wxMenu; - menu->Append(MEN_VOLUME_PNT, "&Volume ..."); - menu->Append(MEN_PAN_PNT, "&Panpot ..."); - menu->Append(MEN_TRANSP_PNT, "&Pitch ..."); - menu->Append(MEN_WAHWAH, "&Filter ..."); - menu->Append(MEN_CANCEL, "&None ..."); + menu->Append(MEN_VOLUME_PNT, "&Volume..."); + menu->Append(MEN_PAN_PNT, "&Panpot..."); + menu->Append(MEN_TRANSP_PNT, "&Pitch..."); + menu->Append(MEN_WAHWAH, "&Filter..."); + menu->Append(MEN_CANCEL, "&None..."); menu_bar->Append(menu, "&Painters"); menu = new wxMenu; @@ -760,8 +760,8 @@ menu_bar->Append(menu, "&Effects"); menu = new wxMenu; - menu->Append(MEN_TRANSP_SET, "&Pitch Painter ..."); - menu->Append(MEN_WAHSETTINGS, "&Filter Painter ..."); + menu->Append(MEN_TRANSP_SET, "&Pitch Painter..."); + menu->Append(MEN_WAHSETTINGS, "&Filter Painter..."); // menu->Append(wxID_ZOOM_IN, "Zoom &In"); // menu->Append(wxID_ZOOM_OUT, "Zoom &Out"); menu->Append(MEN_SETTINGS, "&View Settings..."); @@ -955,7 +955,7 @@ return; } - // player crashes if data disappear ... + // Player crashes if data disappear. if (id != MEN_PLAY) { cnvs->playpos->StopListen(); Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/Track.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -90,7 +90,13 @@ } */ -static double framesPerSecond[] = { 24.0, 25.0, 30.0, 30.0 }; +static double gFramesPerSecond[] = +{ + 24.0, + 25.0, + 30.0, + 30.0 +}; tMtcTime::tMtcTime(tMtcOffset* pMtcOffset) { @@ -127,7 +133,7 @@ sec = sec % 60; hour = min / 60; min = min % 60; - double frametime = 1000.0 / framesPerSecond[type]; + double frametime = 1000.0 / gFramesPerSecond[type]; fm = (int) ((double) msec / frametime); } @@ -147,9 +153,9 @@ type = Mtc30Ndf; } sscanf(str, "%d:%d:%d.%d", &hour, &min, &sec, &fm); - if (fm >= framesPerSecond[type]) + if (fm >= gFramesPerSecond[type]) { - fm = (int) framesPerSecond[type] - 1; + fm = (int) gFramesPerSecond[type] - 1; } } @@ -193,7 +199,7 @@ int tMtcTime::ToMillisec() { int msec = (((((hour * 60L) + min) * 60L) + sec) * 1000L) + - ((fm * 1000L) / (int) framesPerSecond[type]); + ((fm * 1000L) / (int) gFramesPerSecond[type]); return msec; } Modified: trunk/jazz/src/TrackFrame.cpp =================================================================== --- trunk/jazz/src/TrackFrame.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/TrackFrame.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -85,6 +85,9 @@ EVT_MENU(wxID_EXIT, JZTrackFrame::OnFileExit) + EVT_UPDATE_UI(ID_SHIFT, JZTrackFrame::OnUpdateEditShift) + EVT_MENU(ID_SHIFT, JZTrackFrame::OnEditShift) + EVT_MENU(ID_PLAY, JZTrackFrame::OnPlay) EVT_MENU(ID_PLAY_LOOP, JZTrackFrame::OnPlayLoop) @@ -236,6 +239,17 @@ mpEditMenu->AppendSeparator(); +// mpEditMenu->Append(MEN_QUANTIZE, "&Quantize..."); +// mpEditMenu->Append(MEN_SETCHAN, "&Set MIDI Channel..."); +// mpEditMenu->Append(MEN_TRANSP, "&Transpose..."); +// mpEditMenu->Append(MEN_VELOC, "&Velocity..."); +// mpEditMenu->Append(MEN_LENGTH, "&Length..."); + mpEditMenu->Append(ID_SHIFT, "Shi&ft..."); +// mpEditMenu->Append(MEN_CLEANUP, "C&leanup..."); +// mpEditMenu->Append(MEN_SEARCHREP, "Search Re&place..."); + + mpEditMenu->AppendSeparator(); + mpEditMenu->Append(wxID_DELETE, "&Delete"); mpEditMenu->Append(wxID_DELETE, "&Silence"); @@ -251,16 +265,6 @@ mpEditMenu->AppendSeparator(); - /* Move Elsewhere - mpEditMenu->Append(MEN_QUANTIZE, "&Quantize..."); - mpEditMenu->Append(MEN_SETCHAN, "&Set MIDI Channel..."); - mpEditMenu->Append(MEN_TRANSP, "&Transpose..."); - mpEditMenu->Append(MEN_VELOC, "&Velocity..."); - mpEditMenu->Append(MEN_LENGTH, "&Length..."); - mpEditMenu->Append(MEN_SHIFT, "Shi&ft..."); - mpEditMenu->Append(MEN_CLEANUP, "C&leanup..."); - mpEditMenu->Append(MEN_SEARCHREP, "Search Re&place..."); - */ // Miscellaneous Menu is Stupid. // Now it's a View Menu @@ -521,6 +525,19 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +void JZTrackFrame::OnUpdateEditShift(wxUpdateUIEvent& Event) +{ + Event.Enable(mpTrackWindow->AreEventsSelected()); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZTrackFrame::OnEditShift(wxCommandEvent& Event) +{ +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- void JZTrackFrame::OnPlay(wxCommandEvent& Event) { wxMouseEvent MouseEvent; Modified: trunk/jazz/src/TrackFrame.h =================================================================== --- trunk/jazz/src/TrackFrame.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/TrackFrame.h 2009-01-01 08:46:37 UTC (rev 679) @@ -82,6 +82,9 @@ void OnZoomOut(wxCommandEvent& Event); + void OnUpdateEditShift(wxUpdateUIEvent& Event); + void OnEditShift(wxCommandEvent& Event); + void OnPlay(wxCommandEvent& Event); void OnPlayLoop(wxCommandEvent& Event); Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/TrackWindow.cpp 2009-01-01 08:46:37 UTC (rev 679) @@ -1229,6 +1229,13 @@ //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- +bool JZTrackWindow::AreEventsSelected() +{ + return mpSnapSel->IsSelected(); +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- int JZTrackWindow::EventsSelected(const wxString& Message) { if (!mpSnapSel->IsSelected()) Modified: trunk/jazz/src/TrackWindow.h =================================================================== --- trunk/jazz/src/TrackWindow.h 2009-01-01 06:20:59 UTC (rev 678) +++ trunk/jazz/src/TrackWindow.h 2009-01-01 08:46:37 UTC (rev 679) @@ -75,6 +75,8 @@ void MousePlay(wxMouseEvent& Event, TEMousePlayMode Mode); + bool AreEventsSelected(); + int EventsSelected(const wxString& Message); void ZoomIn(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 06:21:04
|
Revision: 678 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=678&view=rev Author: pstieber Date: 2009-01-01 06:20:59 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Removed the unused KeyDialog code. Modified Paths: -------------- trunk/jazz/src/Dialogs.cpp trunk/jazz/src/Makefile.am trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj Removed Paths: ------------- trunk/jazz/src/KeyDialog.cpp trunk/jazz/src/KeyDialog.h Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2009-01-01 04:22:58 UTC (rev 677) +++ trunk/jazz/src/Dialogs.cpp 2009-01-01 06:20:59 UTC (rev 678) @@ -30,7 +30,6 @@ #include "EventWindow.h" #include "Globals.h" #include "Help.h" -#include "KeyDialog.h" #include "NamedChoice.h" #include "PianoFrame.h" #include "PianoWindow.h" @@ -88,8 +87,16 @@ void tShiftDlg::AddProperties() { //send wxPropertyValue REFERENCE not POINTER - sheet->AddProperty(new wxProperty("Snaps", wxPropertyValue(&mSteps), "integer", new wxIntegerListValidator(-16, 16))); - sheet->AddProperty(new wxProperty("clocks per snap", (long)mUnit, "integer"));//informational only + sheet->AddProperty(new wxProperty( + "Snaps", + wxPropertyValue(&mSteps), + "integer", + new wxIntegerListValidator(-16, 16))); + + sheet->AddProperty(new wxProperty( + "clocks per snap", + (long)mUnit, + "integer")); // informational only } Deleted: trunk/jazz/src/KeyDialog.cpp =================================================================== --- trunk/jazz/src/KeyDialog.cpp 2009-01-01 04:22:58 UTC (rev 677) +++ trunk/jazz/src/KeyDialog.cpp 2009-01-01 06:20:59 UTC (rev 678) @@ -1,60 +0,0 @@ -//***************************************************************************** -// The JAZZ++ Midi Sequencer -// -// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. -// Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -//***************************************************************************** - -#include "KeyDialog.h" - -#include "KeyStringConverters.h" -#include "DeprecatedStringUtils.h" -#include "DeprecatedWx/proplist.h" - -using namespace std; - -JZKeyDialog::JZKeyDialog(const char* pTitle, int Key) -{ - string KeyString; - KeyToString(Key, KeyString); - mpString = copystring(KeyString.c_str()); - mpTitle = pTitle; -} - - -JZKeyDialog::~JZKeyDialog() -{ - delete mpString; -} - -#ifdef OBSOLETE -wxFormItem *JZKeyDialog::mkFormItem(int w) -{ - return wxMakeFormString(mpTitle, &mpString, wxFORM_DEFAULT, 0, 0, 0, w); -} -#endif - -wxProperty* JZKeyDialog::mkProperty() -{ - return new wxProperty(mpTitle, wxPropertyValue((char**)&mpString), "string"); -} - -int JZKeyDialog::GetKey() -{ - return StringToKey(mpString); -} Deleted: trunk/jazz/src/KeyDialog.h =================================================================== --- trunk/jazz/src/KeyDialog.h 2009-01-01 04:22:58 UTC (rev 677) +++ trunk/jazz/src/KeyDialog.h 2009-01-01 06:20:59 UTC (rev 678) @@ -1,51 +0,0 @@ -//***************************************************************************** -// The JAZZ++ Midi Sequencer -// -// Copyright (C) 1994-2000 Andreas Voss and Per Sigmond, all rights reserved. -// Modifications Copyright (C) 2004 Patrick Earl -// Modifications Copyright (C) 2008 Peter J. Stieber -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -//***************************************************************************** - -#ifndef JZ_KEYDIALOG_H -#define JZ_KEYDIALOG_H - -class wxProperty; - -//***************************************************************************** -//***************************************************************************** -class JZKeyDialog -{ - public: - - JZKeyDialog(const char* pTitle, int Key); - - ~JZKeyDialog(); - - //wxFormItem *mkFormItem(int w); - - wxProperty* mkProperty(); - - int GetKey(); - - private: - - char* mpString; - - const char* mpTitle; -}; - -#endif // !defined(JZ_KEYDIALOG_H) Modified: trunk/jazz/src/Makefile.am =================================================================== --- trunk/jazz/src/Makefile.am 2009-01-01 04:22:58 UTC (rev 677) +++ trunk/jazz/src/Makefile.am 2009-01-01 06:20:59 UTC (rev 678) @@ -48,7 +48,6 @@ HarmonyP.cpp \ Help.cpp \ JazzPlusPlusApplication.cpp \ -KeyDialog.cpp \ KeyStringConverters.cpp \ Knob.cpp \ Mapper.cpp \ @@ -127,7 +126,6 @@ HarmonyP.cpp \ Help.cpp \ JazzPlusPlusApplication.cpp \ -KeyDialog.cpp \ KeyStringConverters.cpp \ Knob.cpp \ Mapper.cpp \ @@ -211,7 +209,6 @@ HarmonyP.h \ Help.h \ JazzPlusPlusApplication.h \ -KeyDialog.h \ KeyStringConverters.h \ Mapper.h \ MeasureChoice.h \ Modified: trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj =================================================================== --- trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2009-01-01 04:22:58 UTC (rev 677) +++ trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2009-01-01 06:20:59 UTC (rev 678) @@ -446,14 +446,6 @@ > </File> <File - RelativePath="..\src\KeyDialog.cpp" - > - </File> - <File - RelativePath="..\src\KeyDialog.h" - > - </File> - <File RelativePath="..\src\KeyStringConverters.cpp" > </File> Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj =================================================================== --- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2009-01-01 04:22:58 UTC (rev 677) +++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2009-01-01 06:20:59 UTC (rev 678) @@ -445,14 +445,6 @@ > </File> <File - RelativePath="..\src\KeyDialog.cpp" - > - </File> - <File - RelativePath="..\src\KeyDialog.h" - > - </File> - <File RelativePath="..\src\KeyStringConverters.cpp" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 04:23:01
|
Revision: 677 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=677&view=rev Author: pstieber Date: 2009-01-01 04:22:58 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Added the new source modules to the VC8 build. Modified Paths: -------------- trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj Modified: trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj =================================================================== --- trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2009-01-01 03:47:21 UTC (rev 676) +++ trunk/jazz/vc8/JazzPlusPlus-VC8.vcproj 2009-01-01 04:22:58 UTC (rev 677) @@ -835,6 +835,22 @@ Name="Dialog Source Files" > <File + RelativePath="..\src\Dialogs\FilterDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\FilterDialog.h" + > + </File> + <File + RelativePath="..\src\Dialogs\IntegerEdit.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\IntegerEdit.h" + > + </File> + <File RelativePath="..\src\Dialogs\KeyOnDialog.cpp" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:47:24
|
Revision: 676 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=676&view=rev Author: pstieber Date: 2009-01-01 03:47:21 +0000 (Thu, 01 Jan 2009) Log Message: ----------- 1. Changed the time converter to use an STL string instead of a char *. 2. Changed the tMtcTime class constructor to use an initializer list. 3. Used an output string stream instead of sprintf. Modified Paths: -------------- trunk/jazz/src/Track.cpp trunk/jazz/src/Track.h Modified: trunk/jazz/src/Track.cpp =================================================================== --- trunk/jazz/src/Track.cpp 2009-01-01 03:32:09 UTC (rev 675) +++ trunk/jazz/src/Track.cpp 2009-01-01 03:47:21 UTC (rev 676) @@ -33,7 +33,10 @@ #include <cassert> #include <cstdlib> +#include <sstream> +using namespace std; + int tParam::Write(JZWriteBase& Io) { return mMsb.Write(Io) + mLsb.Write(Io) + mDataMsb.Write(Io); @@ -128,7 +131,11 @@ fm = (int) ((double) msec / frametime); } -tMtcTime::tMtcTime(char *str, tMtcType t) +tMtcTime::tMtcTime(char* str, tMtcType t) + : hour(0), + min(0), + sec(0), + fm(0) { type = t; if (type < Mtc24) @@ -139,10 +146,6 @@ { type = Mtc30Ndf; } - hour = 0; - min = 0; - sec = 0; - fm = 0; sscanf(str, "%d:%d:%d.%d", &hour, &min, &sec, &fm); if (fm >= framesPerSecond[type]) { @@ -167,9 +170,11 @@ } } -void tMtcTime::ToString(char *str) +void tMtcTime::ToString(string& String) { - sprintf(str, "%d:%d:%d.%d", hour, min, sec, fm); + ostringstream Oss; + Oss << hour << ':' << min << ':' << sec << '.' << fm; + String = Oss.str(); } tMtcOffset *tMtcTime::ToOffset() Modified: trunk/jazz/src/Track.h =================================================================== --- trunk/jazz/src/Track.h 2009-01-01 03:32:09 UTC (rev 675) +++ trunk/jazz/src/Track.h 2009-01-01 03:47:21 UTC (rev 676) @@ -27,6 +27,8 @@ #include "DynamicArray.h" #include "NamedValue.h" +#include <string> + class JZTrackWindow; class wxDialog; @@ -379,8 +381,8 @@ tMtcTime( int millisek, tMtcType t ); tMtcTime( char *str, tMtcType t ); tMtcTime( unsigned h, unsigned m, unsigned s, unsigned f, unsigned t ); - void ToString( char *str ); - tMtcOffset *ToOffset(); + void ToString(std::string& String); + tMtcOffset* ToOffset(); int ToMillisec(); }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:32:12
|
Revision: 675 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=675&view=rev Author: pstieber Date: 2009-01-01 03:32:09 +0000 (Thu, 01 Jan 2009) Log Message: ----------- 1. Changed to use the new versions of ReadString and WriteString. 2. Replaced some char buffers with STL strings. 3. Updated to use the new filter accessor and mutator function. Modified Paths: -------------- trunk/jazz/src/Rhythm.cpp Modified: trunk/jazz/src/Rhythm.cpp =================================================================== --- trunk/jazz/src/Rhythm.cpp 2009-01-01 03:30:55 UTC (rev 674) +++ trunk/jazz/src/Rhythm.cpp 2009-01-01 03:32:09 UTC (rev 675) @@ -188,7 +188,6 @@ void tRhythm::read(istream& Is, int version) { - char buf[200]; Is >> rhythm; Is >> length; Is >> veloc; @@ -213,8 +212,9 @@ } Is >> parm; - ReadString(Is, buf, sizeof(buf)); - SetLabel(buf); + string Label; + ReadString(Is, Label); + SetLabel(Label.c_str()); if (version > 1) { @@ -1077,15 +1077,15 @@ JZFilter* pFilter = mpEventWindow->mpFilter; - if (pFilter->FromTrack != pFilter->ToTrack) + if (pFilter->GetFromTrack() != pFilter->GetToTrack()) { wxMessageBox("you must select exacty 1 track", "Error", wxOK); return; } - long fr_clock = pFilter->FromClock; - long to_clock = pFilter->ToClock; - JZTrack *track = mpSong->GetTrack(pFilter->FromTrack); + long fr_clock = pFilter->GetFromClock(); + long to_clock = pFilter->GetToClock(); + JZTrack *track = mpSong->GetTrack(pFilter->GetFromTrack()); mpSong->NewUndoBuffer(); // remove selection This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:30:59
|
Revision: 674 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=674&view=rev Author: pstieber Date: 2009-01-01 03:30:55 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Added the new source modules to the VC9 build. Modified Paths: -------------- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj Modified: trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj =================================================================== --- trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2009-01-01 03:22:49 UTC (rev 673) +++ trunk/jazz/vc9/JazzPlusPlus-VC9.vcproj 2009-01-01 03:30:55 UTC (rev 674) @@ -853,6 +853,22 @@ Name="Dialog Source Files" > <File + RelativePath="..\src\Dialogs\FilterDialog.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\FilterDialog.h" + > + </File> + <File + RelativePath="..\src\Dialogs\IntegerEdit.cpp" + > + </File> + <File + RelativePath="..\src\Dialogs\IntegerEdit.h" + > + </File> + <File RelativePath="..\src\Dialogs\KeyOnDialog.cpp" > </File> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:22:52
|
Revision: 673 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=673&view=rev Author: pstieber Date: 2009-01-01 03:22:49 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Updated to use the new filter accessor and mutator function. Modified Paths: -------------- trunk/jazz/src/Command.cpp trunk/jazz/src/ControlEdit.cpp trunk/jazz/src/Dialogs.cpp trunk/jazz/src/HarmonyBrowserAnalyzer.cpp trunk/jazz/src/PianoWindow.cpp Modified: trunk/jazz/src/Command.cpp =================================================================== --- trunk/jazz/src/Command.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/Command.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -40,7 +40,7 @@ //----------------------------------------------------------------------------- tCommand::tCommand(JZFilter* pFilter) : mpFilter(pFilter), - mpSong(pFilter->mpSong), + mpSong(pFilter->GetSong()), mReverse(false) { } @@ -75,7 +75,8 @@ void tCommand::ExecuteTrack(JZTrack* pTrack) { tEventIterator Iterator(pTrack); - JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + JZEvent* pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent)) @@ -97,8 +98,8 @@ //----------------------------------------------------------------------------- int tCommand::Interpolate(int Clock, int vmin, int vmax) { - int ClockMin = mpFilter->FromClock; - int ClockMax = mpFilter->ToClock; + int ClockMin = mpFilter->GetFromClock(); + int ClockMax = mpFilter->GetToClock(); return (Clock - ClockMin) * (vmax - vmin) / (ClockMax - ClockMin) + vmin; } @@ -319,10 +320,10 @@ tCommand::Execute(NewUndo); if (!LeaveSpace) { - JZFilter Filter(mpFilter); - Filter.FromClock = mpFilter->ToClock; - Filter.ToClock = mpSong->GetLastClock() + 1; - long DeltaClock = mpFilter->FromClock - mpFilter->ToClock; + JZFilter Filter(*mpFilter); + Filter.SetFromClock(mpFilter->GetToClock()); + Filter.SetToClock(mpSong->GetLastClock() + 1); + long DeltaClock = mpFilter->GetFromClock() - mpFilter->GetToClock(); tCmdShift shift(&Filter, DeltaClock); shift.Execute(0); } @@ -584,11 +585,14 @@ void tCmdConvertToModulation::ExecuteTrack(JZTrack* pTrack) { - //JAVE:iterate over all events, make a long event from start until stop of the sequence, - //convert all note-on messages to a pitch bend/volume controller pair, velocity -> volume - //make a volume off controller at the end of the current event + // JAVE: + // Iterate over all events, make a long event from start until stop of the + // sequence, convert all note-on messages to a pitch bend/volume controller + // pair, velocity -> volume make a volume off controller at the end of the + // current event. tEventIterator Iterator(pTrack); - JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + JZEvent* pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); long startclock=-1; long endclock=-1; unsigned char channel=0; @@ -810,10 +814,11 @@ InsertSpace = 0; // no RepeatClock = -1; // -1L - mReverse = DestTrack > mpFilter->FromTrack; + mReverse = DestTrack > mpFilter->GetFromTrack(); if (mReverse) { - DestTrack += mpFilter->ToTrack - mpFilter->FromTrack; // ToTrack inclusive + // ToTrack inclusive. + DestTrack += mpFilter->GetToTrack() - mpFilter->GetFromTrack(); } } @@ -827,7 +832,7 @@ StartClock = DestClock; if (RepeatClock < 0) - StopClock = StartClock + mpFilter->ToClock - mpFilter->FromClock; + StopClock = StartClock + mpFilter->GetToClock() - mpFilter->GetFromClock(); else StopClock = RepeatClock; @@ -852,8 +857,9 @@ tEventArray tmp; { tEventIterator Iterator(s); - long DeltaClock = StartClock - mpFilter->FromClock; - JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + long DeltaClock = StartClock - mpFilter->GetFromClock(); + JZEvent* pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { long NewClock = pEvent->GetClock() + DeltaClock; @@ -871,7 +877,7 @@ if (!pEvent) { pEvent = Iterator.First(); - DeltaClock += mpFilter->ToClock - mpFilter->FromClock; + DeltaClock += mpFilter->GetToClock() - mpFilter->GetFromClock(); } } } @@ -902,7 +908,7 @@ if (EraseSource) { tEventIterator Iterator(s); - JZEvent* pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + JZEvent* pEvent = Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent)) @@ -953,7 +959,7 @@ { tKeyOn* pKeyOn = (tKeyOn *)pEvent->Copy(); pKeyOn->SetClock( - mpFilter->FromClock + mpFilter->ToClock - pKeyOn->GetClock()); + mpFilter->GetFromClock() + mpFilter->GetToClock() - pKeyOn->GetClock()); pTrack->Kill(pEvent); pTrack->Put(pKeyOn); } @@ -983,7 +989,8 @@ } tEventIterator Iterator(pTrack); - pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent) && pEvent->IsKeyOn()) @@ -996,7 +1003,8 @@ // reverse Key's - pEvent = Iterator.Range(mpFilter->FromClock, mpFilter->ToClock); + pEvent = + Iterator.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); while (pEvent) { if (mpFilter->IsSelected(pEvent) && pEvent->IsKeyOn()) @@ -1047,7 +1055,7 @@ mRandomArray(RandomArray) { mpBarInfo = new JZBarInfo(*mpSong); - mpBarInfo->SetClock(mpFilter->FromClock); + mpBarInfo->SetClock(mpFilter->GetFromClock()); mStartBar = mpBarInfo->GetBarIndex(); } Modified: trunk/jazz/src/ControlEdit.cpp =================================================================== --- trunk/jazz/src/ControlEdit.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/ControlEdit.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -523,8 +523,8 @@ { return ( mpPianoWindow->GetFilter()->IsSelected(pEvent) && - (pEvent->GetClock() >= mpPianoWindow->GetFilter()->FromClock && - pEvent->GetClock() <= mpPianoWindow->GetFilter()->ToClock)); + (pEvent->GetClock() >= mpPianoWindow->GetFilter()->GetFromClock() && + pEvent->GetClock() <= mpPianoWindow->GetFilter()->GetToClock())); } } return 0; @@ -546,8 +546,8 @@ if (mpPianoWindow->mpSnapSel->IsSelected()) { - from_clk = mpPianoWindow->GetFilter()->FromClock; - to_clk = mpPianoWindow->GetFilter()->ToClock; + from_clk = mpPianoWindow->GetFilter()->GetFromClock(); + to_clk = mpPianoWindow->GetFilter()->GetToClock(); } else { @@ -624,8 +624,8 @@ { return ( mpPianoWindow->GetFilter()->IsSelected(pEvent) && - (pEvent->GetClock() >= mpPianoWindow->GetFilter()->FromClock && - pEvent->GetClock() <= mpPianoWindow->GetFilter()->ToClock)); + (pEvent->GetClock() >= mpPianoWindow->GetFilter()->GetFromClock() && + pEvent->GetClock() <= mpPianoWindow->GetFilter()->GetToClock())); } } return 0; @@ -661,8 +661,8 @@ if (mpPianoWindow->mpSnapSel->IsSelected()) { - from_clk = mpPianoWindow->GetFilter()->FromClock; - to_clk = mpPianoWindow->GetFilter()->ToClock; + from_clk = mpPianoWindow->GetFilter()->GetFromClock(); + to_clk = mpPianoWindow->GetFilter()->GetToClock(); } else { Modified: trunk/jazz/src/Dialogs.cpp =================================================================== --- trunk/jazz/src/Dialogs.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/Dialogs.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -58,7 +58,7 @@ mSteps(0), mUnit(unit), mpFilter(pFilter), - mpSong(pFilter->mpSong) + mpSong(pFilter->GetSong()) { } @@ -108,7 +108,7 @@ : tPropertyListDlg( "Clean up events" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -188,7 +188,7 @@ : tPropertyListDlg("Search and replace controller types" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } bool tSearchReplaceDlg::OnClose() @@ -236,7 +236,7 @@ : tPropertyListDlg("Transpose") { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -285,7 +285,7 @@ : tPropertyListDlg("Set MIDI Channel") { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -336,7 +336,7 @@ : tPropertyListDlg( "Velocity" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -387,7 +387,7 @@ : tPropertyListDlg("Length") { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -447,7 +447,7 @@ : tPropertyListDlg("stretch/contract by scale from start of selected sequence" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -490,7 +490,7 @@ : tPropertyListDlg("MIDI delay line" ) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } @@ -640,7 +640,7 @@ //, Steps("steps", gQntSteps, &gQntStep) { Filter = f; - Song = f->mpSong; + Song = f->GetSong(); } Modified: trunk/jazz/src/HarmonyBrowserAnalyzer.cpp =================================================================== --- trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/HarmonyBrowserAnalyzer.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -55,8 +55,8 @@ Exit(); // cleanup from previous run mpFilter = pFilter; - start_clock = pFilter->FromClock; - stop_clock = pFilter->ToClock; + start_clock = pFilter->GetFromClock(); + stop_clock = pFilter->GetToClock(); eighths_per_chord = epc; if (eighths_per_chord == 0) @@ -65,7 +65,7 @@ } else { - JZBarInfo BarInfo(*mpFilter->mpSong); + JZBarInfo BarInfo(*mpFilter->GetSong()); BarInfo.SetClock(start_clock); int start_bar = BarInfo.GetBarIndex(); BarInfo.SetClock(stop_clock); @@ -117,7 +117,7 @@ int HBAnalyzer::Transpose(JZFilter* pFilter, int qbc) { - pFilter->mpSong->NewUndoBuffer(); + pFilter->GetSong()->NewUndoBuffer(); Init(pFilter, qbc); IterateEvents(&HBAnalyzer::CountEvent); GenerateMapping(); @@ -135,15 +135,16 @@ if (!t->IsDrumTrack()) { tEventIterator Events(t); - JZEvent *e = Events.Range(mpFilter->FromClock, mpFilter->ToClock); - while (e) + JZEvent* pEvent = + Events.Range(mpFilter->GetFromClock(), mpFilter->GetToClock()); + while (pEvent) { - tKeyOn* pKeyOn = e->IsKeyOn(); + tKeyOn* pKeyOn = pEvent->IsKeyOn(); if (pKeyOn) { (this->*Action)(pKeyOn, t); } - e = Events.Next(); + pEvent = Events.Next(); } t->Cleanup(); } @@ -154,8 +155,8 @@ int HBAnalyzer::Step2Clock(int step) { - int fr = mpFilter->FromClock; - int to = mpFilter->ToClock; + int fr = mpFilter->GetFromClock(); + int to = mpFilter->GetToClock(); return (step * (to - fr)) / mSteps + fr; } Modified: trunk/jazz/src/PianoWindow.cpp =================================================================== --- trunk/jazz/src/PianoWindow.cpp 2009-01-01 03:20:32 UTC (rev 672) +++ trunk/jazz/src/PianoWindow.cpp 2009-01-01 03:22:49 UTC (rev 673) @@ -1658,8 +1658,8 @@ { if (mpSnapSel->IsSelected()) { - Clock = mpFilter->FromClock; - LoopClock = mpFilter->ToClock; + Clock = mpFilter->GetFromClock(); + LoopClock = mpFilter->GetToClock(); } else { @@ -1828,46 +1828,32 @@ mpSnapSel->GetRectangle().y + mpSnapSel->GetRectangle().height - 1); int to = y2Pitch(mpSnapSel->GetRectangle().y + 1); - mpFilter->FltEvents[FltKeyOn].Selected = mVisibleKeyOn; - mpFilter->FltEvents[FltKeyOn].FromValue = fr; - mpFilter->FltEvents[FltKeyOn].ToValue = to; + mpFilter->SetFilterEvent(eFilterKeyOn, mVisibleKeyOn, fr, to); - mpFilter->FltEvents[FltPitch].Selected = mVisiblePitch; - mpFilter->FltEvents[FltPitch].FromValue = (fr << 7) - 8192; - mpFilter->FltEvents[FltPitch].ToValue = ((to + 1) << 7) - 8192; + mpFilter->SetFilterEvent( + eFilterPitch, + mVisiblePitch, + (fr << 7) - 8192, + ((to + 1) << 7) - 8192); - mpFilter->FltEvents[FltControl].Selected = mVisibleController; - mpFilter->FltEvents[FltControl].FromValue = fr; - mpFilter->FltEvents[FltControl].ToValue = to; + mpFilter->SetFilterEvent(eFilterControl, mVisibleController, fr, to); - mpFilter->FltEvents[FltProgram].Selected = mVisibleProgram; - mpFilter->FltEvents[FltProgram].FromValue = fr; - mpFilter->FltEvents[FltProgram].ToValue = to; + mpFilter->SetFilterEvent(eFilterProgram, mVisibleProgram, fr, to); - mpFilter->FltEvents[FltTempo].Selected = mVisibleTempo; - mpFilter->FltEvents[FltTempo].FromValue = fr; - mpFilter->FltEvents[FltTempo].ToValue = to; + mpFilter->SetFilterEvent(eFilterKeyPressure, mVisibleKeyOn, fr, to); - mpFilter->FltEvents[FltSysEx].Selected = mVisibleSysex; - mpFilter->FltEvents[FltSysEx].FromValue = fr; - mpFilter->FltEvents[FltSysEx].ToValue = to; + mpFilter->SetFilterMeter(mVisibleTempo); - // SN++ Aftertouch (gehoeren to KeyOn Events). - mpFilter->FltEvents[FltKeyPressure].Selected = mVisibleKeyOn; - mpFilter->FltEvents[FltKeyPressure].FromValue = fr; - mpFilter->FltEvents[FltKeyPressure].ToValue = to; + mpFilter->SetFilterChannelAftertouch(mVisibleMono); - // SN++ Channel Aftertouch - mpFilter->FltEvents[FltChnPressure].Selected = mVisibleMono; - mpFilter->FltEvents[FltChnPressure].FromValue = fr; - mpFilter->FltEvents[FltChnPressure].ToValue = to; + mpFilter->SetFilterSysEx(mVisibleSysex); - - mpFilter->FromTrack = mTrackIndex; - mpFilter->ToTrack = mTrackIndex; - mpFilter->FromClock = SnapClock(x2Clock(mpSnapSel->GetRectangle().x + 1)); - mpFilter->ToClock = SnapClock(x2Clock( - mpSnapSel->GetRectangle().x + mpSnapSel->GetRectangle().width + 1)); + mpFilter->SetFromTrack(mTrackIndex); + mpFilter->SetToTrack(mTrackIndex); + mpFilter->SetFromClock( + SnapClock(x2Clock(mpSnapSel->GetRectangle().x + 1))); + mpFilter->SetToClock(SnapClock(x2Clock( + mpSnapSel->GetRectangle().x + mpSnapSel->GetRectangle().width + 1))); } // SN++ Veloc- oder Aftertouch-Editor updaten @@ -2836,7 +2822,7 @@ { mPasteBuffer.Clear(); tCmdCopyToBuffer cmd(mpFilter, &mPasteBuffer); - mpFilter->OtherSelected = mVisibleTempo; + mpFilter->SetOtherSelected(mVisibleTempo); cmd.Execute(0); // no UNDO if (Id == wxID_CUT) { @@ -2844,7 +2830,7 @@ cmd.Execute(1); // with UNDO Refresh(); } - mpFilter->OtherSelected = 0; + mpFilter->SetOtherSelected(false); //OLD if (mpGuitarFrame) //OLD { //OLD mpGuitarFrame->Update(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:20:37
|
Revision: 672 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=672&view=rev Author: pstieber Date: 2009-01-01 03:20:32 +0000 (Thu, 01 Jan 2009) Log Message: ----------- 1. Changed to use the new versions of ReadString and WriteString. 2. Replaced some char buffers with STL strings. 3. Renamed some variables. Modified Paths: -------------- trunk/jazz/src/Audio.cpp Modified: trunk/jazz/src/Audio.cpp =================================================================== --- trunk/jazz/src/Audio.cpp 2009-01-01 03:18:28 UTC (rev 671) +++ trunk/jazz/src/Audio.cpp 2009-01-01 03:20:32 UTC (rev 672) @@ -38,6 +38,7 @@ #include "Help.h" #include "Resources.h" +#include <wx/filename.h> #include <wx/listbox.h> #include <wx/msgdlg.h> #include <wx/slider.h> @@ -45,8 +46,9 @@ #include <cassert> #include <cmath> #include <cstdlib> -#include <fstream> #include <iostream> +#include <fstream> +#include <sstream> #include <sys/stat.h> #include <string.h> @@ -271,9 +273,7 @@ //----------------------------------------------------------------------------- int tSampleSet::Load(const wxString& FileName) { - int version; - - // enable audio when loading a sample set + // Enable audio when loading a sample set. gpMidiPlayer->SetAudioEnabled(true); wxBeginBusyCursor(); @@ -282,66 +282,59 @@ samples[i]->Clear(); } - // path of the spl file + // Get the path of the sample file. wxString SplFilePath = ::wxPathOnly(FileName); - ifstream is(FileName.c_str()); - is >> version >> speed >> channels >> softsync; - while (is) + ifstream Is(FileName.c_str()); + int Version; + Is >> Version >> speed >> channels >> softsync; + while (Is) { int key, pan, vol, pitch; - char fname[128]; - fname[0] = 0; - char label[500]; - is >> key; - ReadString(is, fname, sizeof(fname)); - ReadString(is, label, sizeof(label)); - is >> pan >> vol >> pitch; - if (fname[0]) + wxFileName SampleFileName; + Is >> key; + string FileNameString; + ReadString(Is, FileNameString); + SampleFileName.Assign(FileNameString); + string Label; + ReadString(Is, Label); + Is >> pan >> vol >> pitch; + if (!SampleFileName.FileExists()) { - if (!wxFileExists(fname)) - { - // try to prepend the SplFilePath - char tmp[128]; - strcpy(tmp, SplFilePath.c_str()); - strcat(tmp, "/"); - strcat(tmp, fname); - strcpy(fname, tmp); - } - if (!wxFileExists(fname)) - { - wxString String; - String - << "File not found: \"" - << fname - << '"'; - ::wxMessageBox(String, "Error", wxOK); - continue; - } - assert(0 <= key && key < MAXSMPL); - samples[key]->SetFilename(fname); - samples[key]->SetLabel(label); - samples[key]->SetVolume(vol); - samples[key]->SetPan(pan); - samples[key]->SetPitch(pitch); - if (samples[key]->Load()) - { - wxString String; - String - << "Could not load: \"" - << samples[key]->GetFilename() - << '"'; - ::wxMessageBox(String, "Error", wxOK); - } - if (samplewin[key]) - { - samplewin[key]->Redraw(); - } + // Try to prepend the sample file path. + wxString PathAndFileName; + PathAndFileName = + SplFilePath + + wxFileName::GetPathSeparator() + + SampleFileName.GetFullPath(); + SampleFileName = PathAndFileName; } - else + if (!SampleFileName.FileExists()) { - break; + wxString String; + String = "File not found: \"" + SampleFileName.GetFullPath() + '"'; + ::wxMessageBox(String, "Error", wxOK); + continue; } + assert(0 <= key && key < MAXSMPL); + samples[key]->SetFilename(SplFilePath.c_str()); + samples[key]->SetLabel(Label.c_str()); + samples[key]->SetVolume(vol); + samples[key]->SetPan(pan); + samples[key]->SetPitch(pitch); + if (samples[key]->Load()) + { + wxString String; + String + << "Could not load: \"" + << samples[key]->GetFilename() + << '"'; + ::wxMessageBox(String, "Error", wxOK); + } + if (samplewin[key]) + { + samplewin[key]->Redraw(); + } } wxEndBusyCursor(); dirty = 0; @@ -367,7 +360,7 @@ { tSample *spl = samples[i]; const char *fname = spl->GetFilename(); - const char *label = spl->GetLabel(); + const char* pLabel = spl->GetLabel(); int vol = spl->GetVolume(); int pan = spl->GetPan(); int pitch = spl->GetPitch(); @@ -376,7 +369,7 @@ os << i << " "; WriteString(os, fname); os << " "; - WriteString(os, label); + WriteString(os, pLabel); os << " " << pan << " " << vol << " " << pitch << endl; } } @@ -663,8 +656,8 @@ wxSlider *vol; wxSlider *pitch; #ifdef OBSOLETE - wxText *label; - wxText *file; + wxText* pLabel; + wxText* pFile; #endif // OBSOLETE static char *path; @@ -1089,7 +1082,7 @@ pitch = new wxSlider(this, (wxFunction)0, " ", 0, -12, 12, 200); (void) new wxMessage(this, "Pitch"); NewLine(); - label = new wxText(this, (wxFunction)0, "Label", "", -1, -1, 300); + pLabel = new wxText(this, (wxFunction)0, "Label", "", -1, -1, 300); NewLine(); file = new wxText(this, (wxFunction)0, "File", "", -1, -1, 300); NewLine(); @@ -1104,11 +1097,10 @@ //----------------------------------------------------------------------------- char *tSamplesDlg::ListEntry(int i) { - char buf[500]; - sprintf(buf, "%d ", i+1); + ostringstream Oss; + Oss << i + 1 << ' ' << set.samples[i]->GetLabel(); // KeyToString(i, buf + strlen(buf)); - sprintf(buf + strlen(buf), set.samples[i]->GetLabel()); - return copystring(buf); + return copystring(Oss.str().c_str()); } //----------------------------------------------------------------------------- @@ -1120,7 +1112,7 @@ pitch->SetValue(spl->GetPitch()); pan->SetValue(spl->GetPan()); #ifdef OBSOLETE - label->SetValue((char *)spl->GetLabel()); + pLabel->SetValue((char *)spl->GetLabel()); file->SetValue((char *)spl->GetFilename()); #endif } @@ -1134,7 +1126,7 @@ spl->SetVolume(vol->GetValue()); spl->SetPan(pan->GetValue()); #ifdef OBSOLETE - spl->SetLabel(label->GetValue()); + spl->SetLabel(pLabel->GetValue()); spl->SetFilename(file->GetValue()); #endif } @@ -1184,7 +1176,7 @@ { #ifdef OBSOLETE file->SetValue(fname); - label->SetValue(wxFileNameFromPath(fname)); + pLabel->SetValue(wxFileNameFromPath(fname)); #endif Win2Sample(current); SetCurrentListEntry(current); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:18:32
|
Revision: 671 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=671&view=rev Author: pstieber Date: 2009-01-01 03:18:28 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Changed to use STL strings instead of char*. Modified Paths: -------------- trunk/jazz/src/StringReadWrite.cpp trunk/jazz/src/StringReadWrite.h Modified: trunk/jazz/src/StringReadWrite.cpp =================================================================== --- trunk/jazz/src/StringReadWrite.cpp 2009-01-01 03:17:48 UTC (rev 670) +++ trunk/jazz/src/StringReadWrite.cpp 2009-01-01 03:18:28 UTC (rev 671) @@ -21,44 +21,39 @@ //***************************************************************************** #include <iostream> +#include <string> using namespace std; //***************************************************************************** //***************************************************************************** -istream& ReadString(istream& Is, char* pString, int MaximumLength) +istream& ReadString(istream& Is, string& String) { - // Save space for the trailing 0. - --MaximumLength; - - int c; + int Character; do { // Ignore through the first ". - c = Is.get(); - } while (c != '"' && c != EOF); + Character = Is.get(); + } while (Character != '"' && Character != EOF); - int i; - for (i = 0; i < MaximumLength; ++i) + // This is an intention infinite for loop. + for (;;) { - c = Is.get(); - if (c == '"' || c == EOF) + Character = Is.get(); + if (Character == '"' || Character != EOF) { break; } - pString[i] = c; + String += Character; } - // Terminate the C-style string. - pString[i] = 0; - return Is; } //***************************************************************************** //***************************************************************************** -ostream& WriteString(ostream& Os, const char* pString) +ostream& WriteString(ostream& Os, const string& String) { - Os << '"' << pString << '"'; + Os << '"' << String << '"'; return Os; } Modified: trunk/jazz/src/StringReadWrite.h =================================================================== --- trunk/jazz/src/StringReadWrite.h 2009-01-01 03:17:48 UTC (rev 670) +++ trunk/jazz/src/StringReadWrite.h 2009-01-01 03:18:28 UTC (rev 671) @@ -23,14 +23,15 @@ #ifndef JZ_STRINGREADWRITE_H #define JZ_STRINGREADWRITE_H -#include <iostream> +#include <iosfwd> +#include <string> //***************************************************************************** //***************************************************************************** -std::istream& ReadString(std::istream& Is, char* pString, int MaximumLength); +std::istream& ReadString(std::istream& Is, std::string& String); //***************************************************************************** //***************************************************************************** -std::ostream& WriteString(std::ostream& Os, const char* pString); +std::ostream& WriteString(std::ostream& Os, const std::string& String); #endif // !defined(JZ_STRINGREADWRITE_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:17:52
|
Revision: 670 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=670&view=rev Author: pstieber Date: 2009-01-01 03:17:48 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Encapsulated more of the data by using accessors and mutators. Modified Paths: -------------- trunk/jazz/src/Filter.cpp trunk/jazz/src/Filter.h Modified: trunk/jazz/src/Filter.cpp =================================================================== --- trunk/jazz/src/Filter.cpp 2009-01-01 03:14:00 UTC (rev 669) +++ trunk/jazz/src/Filter.cpp 2009-01-01 03:17:48 UTC (rev 670) @@ -22,184 +22,215 @@ #include "Filter.h" -#include "ClockDialog.h" +#include "Dialogs/FilterDialog.h" + #include "Events.h" #include "Help.h" -#include "PropertyListDialog.h" #include "Song.h" #include <cstdlib> +using namespace std; -const JZFilterEvent FltEvents[nFltEvents] = +//***************************************************************************** +//***************************************************************************** +const JZFilterEvent DefaultFilterEvents[eFilterCount] = { { StatKeyOn, "Note", 1, 0, 127}, { StatKeyPressure, "Poly Aftertouch", 1, 0, 127}, { StatControl, "Controller", 1, 0, 127}, { StatProgram, "Patch", 1, 0, 127}, - { StatPitch, "Pitch", 1, -8192, 8192}, - { StatTimeSignat, "Meter", 1, 0, 0}, - { StatChnPressure, "Channel Aftertouch", 1, 0, 0}, - { StatSysEx, "SysEx", 1, 0, 0} + { StatPitch, "Pitch", 1, -8192, 8192} }; - - -JZFilter::JZFilter(JZSong *s) +//***************************************************************************** +// Description: +// This is the filter class definition. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZFilter::JZFilter(JZSong* pSong) + : mFilterEvents(0), + mOtherSelected(true), + mpSong(pSong), + mFromClock(0), + mToClock(120 * 4), + mFromTrack(1), + mToTrack(1) { - mpSong = s; - FltEvents = new JZFilterEvent [nFltEvents]; - memcpy(FltEvents, ::FltEvents, sizeof(::FltEvents)); + mFilterEvents = new JZFilterEvent [eFilterCount]; + memcpy(mFilterEvents, ::DefaultFilterEvents, sizeof(::DefaultFilterEvents)); - FromClock = 0; - ToClock = 120*4; - FromTrack = 1; - ToTrack = 1; - OtherSelected = 1; - - for (int i = 0; i < nFltEvents; i++) + for (int i = 0; i < eFilterCount; ++i) { - FltEvents[i].FromValue = FltEvents[i].MinValue; - FltEvents[i].ToValue = FltEvents[i].MaxValue; + mFilterEvents[i].FromValue = DefaultFilterEvents[i].MinValue; + mFilterEvents[i].ToValue = DefaultFilterEvents[i].MaxValue; } } - -JZFilter::JZFilter(JZFilter *f) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZFilter::JZFilter(JZFilter const& Other) + : mFilterEvents(0), + mOtherSelected(Other.mOtherSelected), + mpSong(Other.mpSong), + mFromClock(Other.mFromClock), + mToClock(Other.mToClock), + mFromTrack(Other.mFromTrack), + mToTrack(Other.mToTrack) { - copy (*f); + mFilterEvents = new JZFilterEvent [eFilterCount]; + memcpy(mFilterEvents, Other.mFilterEvents, sizeof(::DefaultFilterEvents)); } - -JZFilter::JZFilter(JZFilter const &o) { - copy(o); +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZFilter& JZFilter::operator = (JZFilter const& Rhs) +{ + if (this != &Rhs) + { + memcpy(mFilterEvents, Rhs.mFilterEvents, sizeof(::DefaultFilterEvents)); + mOtherSelected = Rhs.mOtherSelected; + mpSong = Rhs.mpSong; + mFromClock = Rhs.mFromClock; + mToClock = Rhs.mToClock; + mFromTrack = Rhs.mFromTrack; + mToTrack = Rhs.mToTrack; + } + return *this; } - -JZFilter& JZFilter::operator=(JZFilter const &o) { - delete FltEvents; - copy(o); - return *this; +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +JZFilter::~JZFilter() +{ + delete mFilterEvents; } -void JZFilter::copy(JZFilter const &o) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::GetFilterEvent( + TEFilterType FilterType, + bool& Selected, + int& FromValue, + int& ToValue) { - mpSong = o.mpSong; - FromClock = o.FromClock; - ToClock = o.ToClock; - FromTrack = o.FromTrack; - ToTrack = o.ToTrack; - OtherSelected = o.OtherSelected; - - FltEvents = new JZFilterEvent [nFltEvents]; - memcpy(FltEvents, o.FltEvents, sizeof(::FltEvents)); + Selected = mFilterEvents[FilterType].Selected; + FromValue = mFilterEvents[FilterType].FromValue; + ToValue = mFilterEvents[FilterType].ToValue; } - -JZFilter::~JZFilter() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::SetFilterEvent( + TEFilterType FilterType, + bool Selected, + int FromValue, + int ToValue) { - delete FltEvents; + mFilterEvents[FilterType].Selected = Selected; + mFilterEvents[FilterType].FromValue = FromValue; + mFilterEvents[FilterType].ToValue = ToValue; } - -// ************************************************************************* -// Dialog -// ************************************************************************* - - - -class tFilterDlg : public tPropertyListDlg +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::SetOtherSelected(bool OtherSelected) { - JZFilter *Filter; - JZClockDialog FromClockDlg, ToClockDlg; + mOtherSelected = OtherSelected; +} - public: - tFilterDlg(JZFilter *f, JZSong *s, int ShowEventStats); - void AddProperties(); - bool OnClose(); - void OnHelp(); - int ShowEventStats; -}; - - -tFilterDlg::tFilterDlg(JZFilter *f, JZSong *Song, int ShowEventStats) - : tPropertyListDlg("Filter"), - FromClockDlg(Song, "From Time: ", f->FromClock), - ToClockDlg(Song, "To Time: ", f->ToClock) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::GenerateFromTimeString(string& FromTimeString) const { - this->ShowEventStats=ShowEventStats; - Filter = f; + if (mpSong) + { + mpSong->ClockToString(mFromClock, FromTimeString); + } } - -void tFilterDlg::AddProperties() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::SetFromTime(const string& FromTimeString) { -// Add(FromClockDlg.mkFormItem(150)); -// Add(ToClockDlg.mkFormItem(150)); -// Add(wxMakeFormNewLine()); -// #ifdef __WXMSW__ -// Add(wxMakeFormShort("From Track:", &Filter->FromTrack, wxFORM_DEFAULT, 0,0,0,110)); -// Add(wxMakeFormShort("To Track:", &Filter->ToTrack, wxFORM_DEFAULT, 0,0,0,110)); -// Add(wxMakeFormNewLine()); -// #else -// Add(wxMakeFormShort("From Track:", &Filter->FromTrack, wxFORM_DEFAULT)); -// Add(wxMakeFormShort("To Track:", &Filter->ToTrack, wxFORM_DEFAULT)); -// Add(wxMakeFormNewLine()); -// #endif - -// if (ShowEventStats) -// { -// for (int i = 0; i < nFltEvents; i++) -// { -// if (Filter->FltEvents[i].MinValue != Filter->FltEvents[i].MaxValue) -// { -// Add(wxMakeFormShort("Min:", &Filter->FltEvents[i].FromValue, wxFORM_DEFAULT,0,0,0,90)); -// Add(wxMakeFormShort("Max:", &Filter->FltEvents[i].ToValue, wxFORM_DEFAULT,0,0,0,90)); -// Add(wxMakeFormBool(Filter->FltEvents[i].Name, &Filter->FltEvents[i].Selected, wxFORM_DEFAULT)); -// Add(wxMakeFormNewLine()); -// } -// else -// Add(wxMakeFormBool(Filter->FltEvents[i].Name, &Filter->FltEvents[i].Selected, wxFORM_DEFAULT)); -// } - -// Add(wxMakeFormBool("Other", &Filter->OtherSelected)); -// } -// AssociatePanel(panel); + if (mpSong) + { + mFromClock = mpSong->StringToClock(FromTimeString); + } } - -bool tFilterDlg::OnClose() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::GenerateToTimeString(string& ToTimeString) const { - Filter->FromClock = FromClockDlg.GetClock(); - Filter->ToClock = ToClockDlg.GetClock(); - //wxForm::OnOk(); - return FALSE; + if (mpSong) + { + mpSong->ClockToString(mToClock, ToTimeString); + } } -void tFilterDlg::OnHelp() +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::SetToTime(const string& ToTimeString) { - gpHelpInstance->ShowTopic("Filter"); + if (mpSong) + { + mToClock = mpSong->StringToClock(ToTimeString); + } } +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +int JZFilter::IsSelected(JZEvent* pEvent) +{ + int Value = pEvent->GetValue(); + for (int i = 0; i < eFilterCount; ++i) + { + if (pEvent->GetStat() == mFilterEvents[i].Stat) + { + // Aftertouch belongs to KeyOn events. + if (pEvent->GetStat() == StatKeyPressure) + { + int aval = pEvent->IsKeyPressure()->GetKey(); + return + mFilterEvents[i].Selected && + mFilterEvents[i].FromValue <= aval && + aval <= mFilterEvents[i].ToValue; + } + if (pEvent->GetStat() == StatTimeSignat) + { + return mFilterEvents[i].Selected; + } + if (pEvent->GetStat() == StatChnPressure) + { + return mFilterEvents[i].Selected; + } + if (pEvent->GetStat() == StatSysEx) + { + return mFilterEvents[i].Selected; + } + return + mFilterEvents[i].Selected && + mFilterEvents[i].FromValue <= Value && + Value <= mFilterEvents[i].ToValue; + } + } + return mOtherSelected; +} - - -void JZFilter::Dialog(wxFrame *parent, int ShowEventStats) +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +void JZFilter::Dialog(wxWindow* pParent) { - tFilterDlg *dlg; - // mpDialogBox = new wxDialogBox(parent, "Event Filter", FALSE ); - dlg = new tFilterDlg(this, mpSong, ShowEventStats); - dlg->Create(); -// dlg->EditForm(mpDialogBox, ShowEventStats); -// mpDialogBox->Fit(); -// mpDialogBox->Show(TRUE); + JZFilterDialog FilterDialog(*this, pParent); + if (FilterDialog.ShowModal() == wxID_OK) + { + } } - - - //***************************************************************************** // Description: // This is the track iterator class definition. @@ -207,7 +238,7 @@ //----------------------------------------------------------------------------- JZTrackIterator::JZTrackIterator(JZFilter* pFilter, bool Reverse) : mpFilter(pFilter), - mpSong(mpFilter->mpSong), + mpSong(mpFilter->GetSong()), mTrackIndex(0), mReverse(Reverse) { @@ -219,11 +250,11 @@ { if (mReverse) { - mTrackIndex = mpFilter->ToTrack; + mTrackIndex = mpFilter->GetToTrack(); } else { - mTrackIndex = mpFilter->FromTrack; + mTrackIndex = mpFilter->GetFromTrack(); } return mpSong->GetTrack(mTrackIndex); } @@ -235,7 +266,7 @@ if (mReverse) { --mTrackIndex; - if (mTrackIndex < mpFilter->FromTrack) + if (mTrackIndex < mpFilter->GetFromTrack()) { return 0; } @@ -243,7 +274,7 @@ else { ++mTrackIndex; - if (mTrackIndex > mpFilter->ToTrack) + if (mTrackIndex > mpFilter->GetToTrack()) { return 0; } @@ -255,5 +286,5 @@ //----------------------------------------------------------------------------- int JZTrackIterator::Count() const { - return mpFilter->ToTrack - mpFilter->FromTrack + 1; + return mpFilter->GetToTrack() - mpFilter->GetFromTrack() + 1; } Modified: trunk/jazz/src/Filter.h =================================================================== --- trunk/jazz/src/Filter.h 2009-01-01 03:14:00 UTC (rev 669) +++ trunk/jazz/src/Filter.h 2009-01-01 03:17:48 UTC (rev 670) @@ -28,26 +28,27 @@ class JZSong; class JZTrack; class wxDialog; -class wxFrame; +class wxWindow; -#define FltKeyOn 0 -#define FltKeyPressure 1 // SN++ PolyAftertouch gehoert to KeyOn Events! -#define FltControl 2 -#define FltProgram 3 -#define FltPitch 4 -#define FltTempo 5 -#define FltChnPressure 6 // SN++ Channel Aftertouch -#define FltSysEx 7 +//***************************************************************************** +//***************************************************************************** +enum TEFilterType +{ + eFilterKeyOn = 0, + eFilterKeyPressure = 1, // PolyAftertouch belongs to KeyOn Events. + eFilterControl = 2, + eFilterProgram = 3, + eFilterPitch = 4, + eFilterCount = 5 +}; -#define nFltEvents 8 - //***************************************************************************** //***************************************************************************** class JZFilterEvent { public: int Stat; - const char* Name; + const char* mName; bool Selected; int MinValue, MaxValue; int FromValue, ToValue; @@ -57,73 +58,87 @@ //***************************************************************************** class JZFilter : public wxObject { - friend class tFilterDlg; - wxDialog* mpDialogBox; - void copy(const JZFilter& Other); - public: - JZFilterEvent* FltEvents; - bool OtherSelected; + JZFilter(JZSong* pSong); + JZFilter(const JZFilter& Other); + + JZFilter& operator = (const JZFilter& Rhs); + + virtual ~JZFilter(); + + void GetFilterEvent( + TEFilterType FilterType, + bool& Selected, + int& FromValue, + int& ToValue); + + void SetFilterEvent( + TEFilterType FilterType, + bool Selected, + int FromValue, + int ToValue); + + void SetOtherSelected(bool OtherSelected); + + JZSong* GetSong() const; + + int GetFromClock() const; + void SetFromClock(int FromClock); + void GenerateFromTimeString(std::string& FromTimeString) const; + void SetFromTime(const std::string& FromTimeString); + + int GetToClock() const; + void SetToClock(int ToClock); + void GenerateToTimeString(std::string& ToTimeString) const; + void SetToTime(const std::string& ToTimeString); + + int GetFromTrack() const; + void SetFromTrack(int FromTrack); + + int GetToTrack() const; + void SetToTrack(int ToTrack); + + bool GetFilterMeter() const; + void SetFilterMeter(bool FilterMeter); + + bool GetFilterChannelAftertouch() const; + void SetFilterChannelAftertouch(bool FilterChannelAftertouch); + + bool GetFilterSysEx() const; + void SetFilterSysEx(bool FilterSysEx); + + bool GetFilterOther() const; + void SetFilterOther(bool FilterOther); + + int IsSelected(JZEvent* pEvent); + + void Dialog(wxWindow* pParent); + + private: + + JZFilterEvent* mFilterEvents; + + bool mOtherSelected; + JZSong* mpSong; - int FromClock, ToClock; // einschl .. ausschl + int mFromClock, mToClock; - int FromTrack, ToTrack; // 1..n einschl .. einschl + int mFromTrack, mToTrack; - void Dialog(wxFrame* parent, int ShowEventStats = 1); + bool mFilterMeter; - JZFilter(JZSong* pSong); - JZFilter(JZFilter* pOtherFilter); - JZFilter(const JZFilter& Other); - JZFilter& operator = (const JZFilter& Rhs); - virtual ~JZFilter(); + bool mFilterChannelAftertouch; - int IsSelected(JZEvent* pEvent) - { - int Value = pEvent->GetValue(); - for (int i = 0; i < nFltEvents; ++i) - { - if (pEvent->GetStat() == FltEvents[i].Stat) - { - // SN++ Aftertouch gehoert eigendlich zu KeyOn Events. - if (pEvent->GetStat() == StatKeyPressure) - { - int aval = pEvent->IsKeyPressure()->GetKey(); - return - FltEvents[i].Selected && - FltEvents[i].FromValue <= aval && - aval <= FltEvents[i].ToValue; - } - if (pEvent->GetStat() == StatTimeSignat) - { - return FltEvents[i].Selected; - } - // SN++ - if (pEvent->GetStat() == StatChnPressure) - { - return FltEvents[i].Selected; - } + bool mFilterSysEx; - if (pEvent->GetStat() == StatSysEx) - { - return FltEvents[i].Selected; - } + bool mFilterOther; - return - FltEvents[i].Selected && - FltEvents[i].FromValue <= Value && - Value <= FltEvents[i].ToValue; - } - } - return OtherSelected; - } + wxDialog* mpDialogBox; }; -// void GlobalFilterDlg(wxButton& but, wxMouseEvent& event); -// void GlobalFilterDlgNoStats(wxButton& but, wxMouseEvent& event); - //***************************************************************************** // Description: // This is the track iterator class declaration. @@ -145,4 +160,144 @@ bool mReverse; }; +//***************************************************************************** +// Description: +// These are the filter class inline member functions. +//***************************************************************************** +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +JZSong* JZFilter::GetSong() const +{ + return mpSong; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZFilter::GetFromClock() const +{ + return mFromClock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFromClock(int FromClock) +{ + mFromClock = FromClock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZFilter::GetToClock() const +{ + return mToClock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetToClock(int ToClock) +{ + mToClock = ToClock; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZFilter::GetFromTrack() const +{ + return mFromTrack; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFromTrack(int FromTrack) +{ + mFromTrack = FromTrack; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +int JZFilter::GetToTrack() const +{ + return mToTrack; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetToTrack(int ToTrack) +{ + mToTrack = ToTrack; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +bool JZFilter::GetFilterMeter() const +{ + return mFilterMeter; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFilterMeter(bool FilterMeter) +{ + mFilterMeter = FilterMeter; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +bool JZFilter::GetFilterChannelAftertouch() const +{ + return mFilterChannelAftertouch; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFilterChannelAftertouch(bool FilterChannelAftertouch) +{ + mFilterChannelAftertouch = FilterChannelAftertouch; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +bool JZFilter::GetFilterSysEx() const +{ + return mFilterSysEx; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFilterSysEx(bool FilterSysEx) +{ + mFilterSysEx = FilterSysEx; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +bool JZFilter::GetFilterOther() const +{ + return mFilterOther; +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +inline +void JZFilter::SetFilterOther(bool FilterOther) +{ + mFilterOther = FilterOther; +} + #endif // !defined(JZ_FILTER_H) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pst...@us...> - 2009-01-01 03:14:03
|
Revision: 669 http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=669&view=rev Author: pstieber Date: 2009-01-01 03:14:00 +0000 (Thu, 01 Jan 2009) Log Message: ----------- Updated to use the new filter accessor and mutator function. Modified Paths: -------------- trunk/jazz/src/TrackWindow.cpp Modified: trunk/jazz/src/TrackWindow.cpp =================================================================== --- trunk/jazz/src/TrackWindow.cpp 2009-01-01 03:13:07 UTC (rev 668) +++ trunk/jazz/src/TrackWindow.cpp 2009-01-01 03:14:00 UTC (rev 669) @@ -1316,7 +1316,7 @@ } JZBarInfo BarInfo(*gpProject); - BarInfo.SetClock(mpFilter->FromClock); + BarInfo.SetClock(mpFilter->GetFromClock()); if (BarInfo.GetBarIndex() > 0) { @@ -1337,12 +1337,12 @@ // Is it possible to record? if (Record && mpSnapSel->IsSelected()) { - pRecInfo->mTrackIndex = mpFilter->FromTrack; + pRecInfo->mTrackIndex = mpFilter->GetFromTrack(); pRecInfo->mpTrack = gpProject->GetTrack(pRecInfo->mTrackIndex); - pRecInfo->mFromClock = mpFilter->FromClock; - pRecInfo->mToClock = mpFilter->ToClock; + pRecInfo->mFromClock = mpFilter->GetFromClock(); + pRecInfo->mToClock = mpFilter->GetToClock(); if (muted) { @@ -1371,8 +1371,8 @@ int loop_clock = 0; if (loop && mpSnapSel->IsSelected()) { - mPreviousClock = mpFilter->FromClock; - loop_clock = mpFilter->ToClock; + mPreviousClock = mpFilter->GetFromClock(); + loop_clock = mpFilter->GetToClock(); } // GO! @@ -1450,14 +1450,14 @@ { if (mpSnapSel->IsSelected()) { - mpFilter->FromTrack = y2TrackIndex(mpSnapSel->GetRectangle().y); - mpFilter->ToTrack = y2TrackIndex( + mpFilter->SetFromTrack(y2TrackIndex(mpSnapSel->GetRectangle().y)); + mpFilter->SetToTrack(y2TrackIndex( mpSnapSel->GetRectangle().y + - mpSnapSel->GetRectangle().GetHeight() - 1); - mpFilter->FromClock = x2BarClock(mpSnapSel->GetRectangle().x + 1); - mpFilter->ToClock = x2BarClock( - mpSnapSel->GetRectangle().x + mpSnapSel->GetRectangle().GetWidth() + 1); -// NextWin->NewPosition(mpFilter->FromTrack, mpFilter->FromClock); + mpSnapSel->GetRectangle().GetHeight() - 1)); + mpFilter->SetFromClock(x2BarClock(mpSnapSel->GetRectangle().x + 1)); + mpFilter->SetToClock(x2BarClock( + mpSnapSel->GetRectangle().x + mpSnapSel->GetRectangle().GetWidth() + 1)); +// NextWin->NewPosition(mpFilter->GetFromTrack(), mpFilter->GetFromClock()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |