From: <sag...@us...> - 2013-04-06 14:55:15
|
Revision: 1750 http://sourceforge.net/p/modplug/code/1750 Author: saga-games Date: 2013-04-06 14:55:00 +0000 (Sat, 06 Apr 2013) Log Message: ----------- [Ref] Split up MPTNOTIFICATION::dwType into type and and item variables [Ref] Renamed MPTNOTIFICATION to Notification, MPTNOTIFY_* are now members of Notification Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_gen.cpp trunk/OpenMPT/mptrack/Draw_pat.cpp trunk/OpenMPT/mptrack/Globals.cpp trunk/OpenMPT/mptrack/Globals.h trunk/OpenMPT/mptrack/MainFrm.cpp trunk/OpenMPT/mptrack/Mainbar.cpp trunk/OpenMPT/mptrack/Mainbar.h trunk/OpenMPT/mptrack/Mainfrm.h trunk/OpenMPT/mptrack/Moddoc.cpp trunk/OpenMPT/mptrack/Moddoc.h trunk/OpenMPT/mptrack/PatternEditorDialogs.h trunk/OpenMPT/mptrack/View_ins.cpp trunk/OpenMPT/mptrack/View_ins.h trunk/OpenMPT/mptrack/View_pat.cpp trunk/OpenMPT/mptrack/View_pat.h trunk/OpenMPT/mptrack/View_smp.cpp trunk/OpenMPT/mptrack/View_smp.h trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/View_tre.h trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/soundlib/Dlsbank.cpp trunk/OpenMPT/soundlib/Dlsbank.h Modified: trunk/OpenMPT/mptrack/Ctrl_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Ctrl_gen.cpp 2013-04-06 14:55:00 UTC (rev 1750) @@ -145,8 +145,8 @@ //--------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); - if (m_pModDoc) m_pModDoc->SetFollowWnd(m_hWnd, MPTNOTIFY_DEFAULT); - if (pMainFrm) pMainFrm->SetFollowSong(m_pModDoc, m_hWnd, TRUE, MPTNOTIFY_DEFAULT); + if (m_pModDoc) m_pModDoc->SetFollowWnd(m_hWnd, Notification::Default); + if (pMainFrm) pMainFrm->SetFollowSong(m_pModDoc, m_hWnd, TRUE, Notification::Default); PostViewMessage(VIEWMSG_SETACTIVE, NULL); SetFocus(); @@ -158,7 +158,7 @@ void CCtrlGeneral::OnDeactivatePage() //----------------------------------- { - if (m_pModDoc) m_pModDoc->SetFollowWnd(NULL, 0); + if (m_pModDoc) m_pModDoc->SetFollowWnd(NULL, Notification::None); m_VuMeterLeft.SetVuMeter(0); m_VuMeterRight.SetVuMeter(0); } @@ -524,11 +524,11 @@ LRESULT CCtrlGeneral::OnUpdatePosition(WPARAM, LPARAM lParam) //----------------------------------------------------------- { - MPTNOTIFICATION *pnotify = (MPTNOTIFICATION *)lParam; + Notification *pnotify = (Notification *)lParam; if (pnotify) { - m_VuMeterLeft.SetVuMeter(pnotify->MasterVuLeft); - m_VuMeterRight.SetVuMeter(pnotify->MasterVuRight); + m_VuMeterLeft.SetVuMeter(pnotify->masterVu[0]); + m_VuMeterRight.SetVuMeter(pnotify->masterVu[1]); } return 0; } Modified: trunk/OpenMPT/mptrack/Draw_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Draw_pat.cpp 2013-04-06 14:55:00 UTC (rev 1750) @@ -1701,8 +1701,8 @@ //end rewbs.xinfo -void CViewPattern::UpdateAllVUMeters(MPTNOTIFICATION *pnotify) -//------------------------------------------------------------ +void CViewPattern::UpdateAllVUMeters(Notification *pnotify) +//--------------------------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); const CModDoc *pModDoc = GetDocument(); @@ -1714,7 +1714,6 @@ int x, xofs; if ((!pModDoc) || (!pMainFrm)) return; - memset(ChnVUMeters, 0, sizeof(ChnVUMeters)); GetClientRect(&rcClient); xofs = GetXScrollPos(); pSndFile = pModDoc->GetSoundFile(); @@ -1724,8 +1723,8 @@ nChn = xofs; while ((nChn < pSndFile->m_nChannels) && (x < rcClient.right)) { - ChnVUMeters[nChn] = (WORD)pnotify->dwPos[nChn]; - if ((!bPlaying) || (pnotify->dwType & MPTNOTIFY_STOP)) ChnVUMeters[nChn] = 0; + ChnVUMeters[nChn] = (WORD)pnotify->pos[nChn]; + if ((!bPlaying) || pnotify->type[Notification::Stop]) ChnVUMeters[nChn] = 0; DrawChannelVUMeter(hdc, x + 1, rcClient.top + COLHDR_HEIGHT, nChn); nChn++; x += m_szCell.cx; Modified: trunk/OpenMPT/mptrack/Globals.cpp =================================================================== --- trunk/OpenMPT/mptrack/Globals.cpp 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Globals.cpp 2013-04-06 14:55:00 UTC (rev 1750) @@ -642,7 +642,7 @@ if (pMainFrm->GetFollowSong(pModDoc) == m_hWnd) { pMainFrm->SetFollowSong(pModDoc, NULL, FALSE); - pModDoc->SetFollowWnd(NULL, 0); + pModDoc->SetFollowWnd(NULL, Notification::None); } if (pMainFrm->GetMidiRecordWnd() == m_hWnd) { @@ -656,7 +656,7 @@ LRESULT CModScrollView::OnUpdatePosition(WPARAM, LPARAM lParam) //------------------------------------------------------------- { - MPTNOTIFICATION *pnotify = (MPTNOTIFICATION *)lParam; + Notification *pnotify = (Notification *)lParam; if (pnotify) return OnPlayerNotify(pnotify); return 0; } Modified: trunk/OpenMPT/mptrack/Globals.h =================================================================== --- trunk/OpenMPT/mptrack/Globals.h 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Globals.h 2013-04-06 14:55:00 UTC (rev 1750) @@ -214,7 +214,7 @@ virtual void UpdateView(DWORD, CObject *) {} virtual LRESULT OnModViewMsg(WPARAM wParam, LPARAM lParam); virtual BOOL OnDragonDrop(BOOL, LPDRAGONDROP) { return FALSE; } - virtual LRESULT OnPlayerNotify(MPTNOTIFICATION *) { return 0; } + virtual LRESULT OnPlayerNotify(Notification *) { return 0; } //}}AFX_VIRTUAL protected: Modified: trunk/OpenMPT/mptrack/MainFrm.cpp =================================================================== --- trunk/OpenMPT/mptrack/MainFrm.cpp 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/MainFrm.cpp 2013-04-06 14:55:00 UTC (rev 1750) @@ -196,7 +196,7 @@ m_hWndMidi = NULL; m_pSndFile = nullptr; m_dwTimeSec = 0; - m_dwNotifyType = 0; + m_notifyItem = 0; m_nTimer = 0; m_nAvgMixChn = m_nMixChn = 0; m_szUserText[0] = 0; @@ -662,11 +662,14 @@ // Notify thread DWORD WINAPI CMainFrame::NotifyThreadWrapper(LPVOID) +//-------------------------------------------------- { return ((CMainFrame*)theApp.m_pMainWnd)->NotifyThread(); } + + DWORD CMainFrame::NotifyThread() -//------------------------------------------- +//------------------------------ { // initialize thread message queue MSG msg; @@ -690,7 +693,7 @@ break; case WAIT_OBJECT_0: { - const MPTNOTIFICATION * pnotify = nullptr; + const Notification * pnotify = nullptr; { int64 currenttotalsamples = 0; Util::lock_guard<Util::mutex> lock(m_NotificationBufferMutex); @@ -702,11 +705,11 @@ currenttotalsamples = m_TotalSamplesRendered; } // advance to the newest notification, drop the obsolete ones - const MPTNOTIFICATION * p = m_NotifyBuffer.peek_p(); - if(p && currenttotalsamples >= p->TimestampSamples) + const Notification * p = m_NotifyBuffer.peek_p(); + if(p && currenttotalsamples >= p->timestampSamples) { pnotify = p; - while(m_NotifyBuffer.peek_next_p() && currenttotalsamples >= m_NotifyBuffer.peek_next_p()->TimestampSamples) + while(m_NotifyBuffer.peek_next_p() && currenttotalsamples >= m_NotifyBuffer.peek_next_p()->timestampSamples) { m_NotifyBuffer.pop(); p = m_NotifyBuffer.peek_p(); @@ -774,18 +777,16 @@ ULONG CMainFrame::AudioRead(PVOID pvData, ULONG MaxSamples) //--------------------------------------------------------- { - DWORD dwSamplesRead = m_pSndFile->Read(pvData, MaxSamples); - //m_dTotalCPU = m_pPerfCounter->StartStop()/(static_cast<double>(dwSamplesRead)/m_dwRate); - return dwSamplesRead; + return m_pSndFile->Read(pvData, MaxSamples); } -void CMainFrame::AudioDone(ULONG SamplesWritten, ULONG SamplesLatency, bool end_of_stream) -//---------------------------------------------------------------------------------------- +void CMainFrame::AudioDone(ULONG SamplesWritten, ULONG SamplesLatency, bool endOfStream) +//-------------------------------------------------------------------------------------- { - if (SamplesWritten > 0) + if(SamplesWritten > 0) { - DoNotification(SamplesWritten, SamplesLatency, end_of_stream); + DoNotification(SamplesWritten, SamplesLatency, endOfStream); } } @@ -935,8 +936,8 @@ } -BOOL CMainFrame::DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool end_of_stream) -//------------------------------------------------------------------- +BOOL CMainFrame::DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool endOfStream) +//------------------------------------------------------------------------------------------ { int64 notificationtimestamp = 0; { @@ -950,10 +951,10 @@ notificationtimestamp = m_TotalSamplesRendered + SamplesLatency; } } - if (!m_pSndFile) return FALSE; - if (m_nMixChn < m_pSndFile->m_nMixStat) m_nMixChn++; - if (m_nMixChn > m_pSndFile->m_nMixStat) m_nMixChn--; - if (!(m_dwNotifyType & MPTNOTIFY_TYPEMASK)) return FALSE; + if(!m_pSndFile) return FALSE; + if(m_nMixChn < m_pSndFile->m_nMixStat) m_nMixChn++; + if(m_nMixChn > m_pSndFile->m_nMixStat) m_nMixChn--; + if(m_notifyType == Notification::None) return FALSE; // Notify Client //if(m_NotifyBuffer.read_size() > 0) { @@ -961,86 +962,95 @@ } // Add an entry to the notification history - MPTNOTIFICATION notification; - MemsetZero(notification); - MPTNOTIFICATION *p = ¬ification; + Notification notification; + Notification *p = ¬ification; - p->dwType = m_dwNotifyType | (end_of_stream ? MPTNOTIFY_EOS : 0); - p->TimestampSamples = notificationtimestamp; - p->nOrder = m_pSndFile->m_nCurrentOrder; - p->nRow = m_pSndFile->m_nRow; - p->nPattern = m_pSndFile->m_nPattern; - p->nTick = m_pSndFile->m_nTickCount; - if (m_dwNotifyType & MPTNOTIFY_SAMPLE) + p->type = m_notifyType; + p->item = m_notifyItem; + if(endOfStream) p->type.set(Notification::EOS); + p->timestampSamples = notificationtimestamp; + + p->row = m_pSndFile->m_nRow; + p->tick = m_pSndFile->m_nTickCount; + p->order = m_pSndFile->m_nCurrentOrder; + p->pattern = m_pSndFile->m_nPattern; + + if(m_notifyType[Notification::Sample]) + { + // Sample positions + SAMPLEINDEX smp = m_notifyItem; + for(CHANNELINDEX k = 0; k < MAX_CHANNELS; k++) + { + const ModChannel &chn = m_pSndFile->Chn[k]; + if(smp && smp <= m_pSndFile->GetNumSamples() && chn.nLength && chn.pSample // There is a sample and it's playing + && chn.pSample == m_pSndFile->GetSample(smp).pSample // And it's the correct sample + && (!chn.dwFlags[CHN_NOTEFADE] || chn.nFadeOutVol)) // And it hasn't completely faded out yet, so it's still playing { - SAMPLEINDEX nSmp = m_dwNotifyType & 0xFFFF; - for (CHANNELINDEX k = 0; k < MAX_CHANNELS; k++) - { - ModChannel *pChn = &m_pSndFile->Chn[k]; - p->dwPos[k] = 0; - if ((nSmp) && (nSmp <= m_pSndFile->GetNumSamples()) && (pChn->nLength) - && (pChn->pSample) && (pChn->pSample == m_pSndFile->GetSample(nSmp).pSample) - && ((!(pChn->dwFlags & CHN_NOTEFADE)) || (pChn->nFadeOutVol))) - { - p->dwPos[k] = MPTNOTIFY_POSVALID | (DWORD)(pChn->nPos); - } - } - } else if (m_dwNotifyType & (MPTNOTIFY_VOLENV|MPTNOTIFY_PANENV|MPTNOTIFY_PITCHENV)) + p->pos[k] = chn.nPos; + } else { - UINT nIns = m_dwNotifyType & 0xFFFF; - for (CHANNELINDEX k = 0; k < MAX_CHANNELS; k++) + p->pos[k] = Notification::PosInvalid; + } + } + } else if(m_notifyType[Notification::VolEnv | Notification::PanEnv | Notification::PitchEnv]) + { + // Instrument envelopes + INSTRUMENTINDEX ins = m_notifyItem; + for(CHANNELINDEX k = 0; k < MAX_CHANNELS; k++) + { + const ModChannel &chn = m_pSndFile->Chn[k]; + if(ins != 0 && ins <= m_pSndFile->GetNumInstruments() // There is an instrument + && chn.pModInstrument && chn.pModInstrument == m_pSndFile->Instruments[ins] // And it's the correct instrument + && (chn.nLength || chn.pModInstrument->HasValidMIDIChannel()) // And it's playing something (sample or instrument) + && (!chn.dwFlags[CHN_NOTEFADE] || chn.nFadeOutVol)) // And it hasn't completely faded out yet, so it's still playing + { + enmEnvelopeTypes notifyEnv = ENV_VOLUME; + if(m_notifyType[Notification::PitchEnv]) + notifyEnv = ENV_PITCH; + else if(m_notifyType[Notification::PanEnv]) + notifyEnv = ENV_PANNING; + + const ModChannel::EnvInfo &chnEnv = chn.GetEnvelope(notifyEnv); + if(chnEnv.flags[ENV_ENABLED]) { - ModChannel *pChn = &m_pSndFile->Chn[k]; - p->dwPos[k] = 0; - if(nIns != 0 && nIns <= m_pSndFile->GetNumInstruments() // There is an instrument - && pChn->pModInstrument && pChn->pModInstrument == m_pSndFile->Instruments[nIns] // And it's the correct instrument - && (pChn->nLength || pChn->pModInstrument->HasValidMIDIChannel()) // And it's playing something (sample or instrument) - && (!pChn->dwFlags[CHN_NOTEFADE] || pChn->nFadeOutVol)) // And it hasn't completely faded out yet, so it's still playing + uint32 pos = chnEnv.nEnvPosition; + if(m_pSndFile->IsCompatibleMode(TRK_IMPULSETRACKER)) { - enmEnvelopeTypes notifyEnv = ENV_VOLUME; - if (m_dwNotifyType & MPTNOTIFY_PITCHENV) - notifyEnv = ENV_PITCH; - else if (m_dwNotifyType & MPTNOTIFY_PANENV) - notifyEnv = ENV_PANNING; - - const ModChannel::EnvInfo &chnEnv = pChn->GetEnvelope(notifyEnv); - - if(chnEnv.flags[ENV_ENABLED]) - { - uint32 pos = chnEnv.nEnvPosition; - if(m_pSndFile->IsCompatibleMode(TRK_IMPULSETRACKER)) - { - // Impulse Tracker envelope handling (see e.g. CSoundFile::IncrementEnvelopePosition in SndMix.cpp for details) - if(pos > 0) - pos--; - else - continue; - } - p->dwPos[k] = MPTNOTIFY_POSVALID | pos; - } + // Impulse Tracker envelope handling (see e.g. CSoundFile::IncrementEnvelopePosition in SndMix.cpp for details) + if(pos > 0) + pos--; + else + continue; } + p->pos[k] = pos; } - } else if (m_dwNotifyType & (MPTNOTIFY_VUMETERS)) + } else { - for (UINT k=0; k<MAX_CHANNELS; k++) - { - ModChannel *pChn = &m_pSndFile->Chn[k]; - UINT vul = pChn->nLeftVU; - UINT vur = pChn->nRightVU; - p->dwPos[k] = (vul << 8) | (vur); - } + p->pos[k] = Notification::PosInvalid; } - { - DWORD lVu = (gnLVuMeter >> 11); - DWORD rVu = (gnRVuMeter >> 11); - if (lVu > 0x10000) lVu = 0x10000; - if (rVu > 0x10000) rVu = 0x10000; - p->MasterVuLeft = lVu; - p->MasterVuRight = rVu; - DWORD dwVuDecay = Util::muldiv(dwSamplesRead, 120000, TrackerSettings::Instance().m_dwRate) + 1; - if (lVu >= dwVuDecay) gnLVuMeter = (lVu - dwVuDecay) << 11; else gnLVuMeter = 0; - if (rVu >= dwVuDecay) gnRVuMeter = (rVu - dwVuDecay) << 11; else gnRVuMeter = 0; - } + } + } else if(m_notifyType[Notification::VUMeters]) + { + // Pattern channel VU meters + for(CHANNELINDEX k = 0; k < m_pSndFile->GetNumChannels(); k++) + { + uint32 vul = m_pSndFile->Chn[k].nLeftVU; + uint32 vur = m_pSndFile->Chn[k].nRightVU; + p->pos[k] = (vul << 8) | (vur); + } + } + { + // Master VU meter + uint32 lVu = (gnLVuMeter >> 11); + uint32 rVu = (gnRVuMeter >> 11); + if(lVu > 0x10000) lVu = 0x10000; + if(rVu > 0x10000) rVu = 0x10000; + p->masterVu[0] = lVu; + p->masterVu[1] = rVu; + uint32 dwVuDecay = Util::muldiv(dwSamplesRead, 120000, TrackerSettings::Instance().m_dwRate) + 1; + if (lVu >= dwVuDecay) gnLVuMeter = (lVu - dwVuDecay) << 11; else gnLVuMeter = 0; + if (rVu >= dwVuDecay) gnRVuMeter = (rVu - dwVuDecay) << 11; else gnRVuMeter = 0; + } { Util::lock_guard<Util::mutex> lock(m_NotificationBufferMutex); @@ -1306,9 +1316,8 @@ void CMainFrame::GenerateStopNotification() //----------------------------------------- { - MPTNOTIFICATION mn; - MemsetZero(mn); - mn.dwType = MPTNOTIFY_STOP; + Notification mn; + mn.type = Notification::Stop; SendMessage(WM_MOD_UPDATEPOSITION, 0, (LPARAM)&mn); } @@ -1323,7 +1332,7 @@ m_nAvgMixChn = 0; if(m_pSndFile->GetpModDoc()) { - m_wndTree.UpdatePlayPos(m_pSndFile->GetpModDoc(), NULL); + m_wndTree.UpdatePlayPos(m_pSndFile->GetpModDoc(), nullptr); } m_pSndFile->m_SongFlags.reset(SONG_PAUSED); if(m_pSndFile == &m_WaveFile) @@ -1352,17 +1361,18 @@ } -void CMainFrame::SetPlaybackSoundFile(CSoundFile *pSndFile, HWND hPat, DWORD dwNotifyType) -//---------------------------------------------------------------------------------------- +void CMainFrame::SetPlaybackSoundFile(CSoundFile *pSndFile, HWND hPat, Notification::Type notifyType, Notification::Item notifyItem) +//---------------------------------------------------------------------------------------------------------------------------------- { m_pSndFile = pSndFile; m_hFollowSong = hPat; - m_dwNotifyType = dwNotifyType; + m_notifyType = notifyType; + m_notifyItem = notifyItem; } -bool CMainFrame::PlayMod(CModDoc *pModDoc, HWND hPat, DWORD dwNotifyType) -//----------------------------------------------------------------------- +bool CMainFrame::PlayMod(CModDoc *pModDoc, HWND hPat, Notification::Type notifyType, Notification::Item notifyItem) +//----------------------------------------------------------------------------------------------------------------- { CriticalSection::AssertUnlocked(); if(!pModDoc) return false; @@ -1381,7 +1391,7 @@ // set mixing parameters in CSoundFile ApplyTrackerSettings(pSndFile); - SetPlaybackSoundFile(pSndFile, hPat, dwNotifyType); + SetPlaybackSoundFile(pSndFile, hPat, notifyType, notifyItem); const bool bPaused = m_pSndFile->IsPaused(); const bool bPatLoop = m_pSndFile->m_SongFlags[SONG_PATTERNLOOP]; @@ -1513,7 +1523,7 @@ { CriticalSection cs; InitPreview(); - if(CTrackApp::gpDLSBanks[nDLSBank]->ExtractInstrument(&m_WaveFile, 1, nIns, nRgn)) + if(CTrackApp::gpDLSBanks[nDLSBank]->ExtractInstrument(m_WaveFile, 1, nIns, nRgn)) { PreparePreview(note); ok = true; @@ -1682,24 +1692,28 @@ } -BOOL CMainFrame::SetFollowSong(CModDoc *pDoc, HWND hwnd, BOOL bFollowSong, DWORD dwType) -//-------------------------------------------------------------------------------------- +BOOL CMainFrame::SetFollowSong(CModDoc *pDoc, HWND hwnd, BOOL bFollowSong, Notification::Type type, Notification::Item item) +//-------------------------------------------------------------------------------------------------------------------------- { - if ((!pDoc) || (pDoc != GetModPlaying())) return FALSE; - if (bFollowSong) + if((!pDoc) || (pDoc != GetModPlaying())) return FALSE; + if(bFollowSong) { m_hFollowSong = hwnd; } else { - if (hwnd == m_hFollowSong) m_hFollowSong = NULL; + if(hwnd == m_hFollowSong) m_hFollowSong = NULL; } - if (dwType) m_dwNotifyType = dwType; + if(type != Notification::None) + { + m_notifyType = type; + m_notifyItem = item; + } return TRUE; } BOOL CMainFrame::SetupSoundCard(DWORD q, DWORD rate, UINT nBits, UINT nChns, UINT latency_ms, UINT updateinterval_ms, LONG wd) -//------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------------------------------- { const bool isPlaying = (IsPlaying() != 0); if ((TrackerSettings::Instance().m_dwRate != rate) || ((TrackerSettings::Instance().m_dwSoundSetup & SOUNDSETUP_RESTARTMASK) != (q & SOUNDSETUP_RESTARTMASK)) @@ -1724,7 +1738,7 @@ CriticalSection cs; UpdateAudioParameters(FALSE); } - if (pActiveMod) PlayMod(pActiveMod, hFollow, m_dwNotifyType); + if (pActiveMod) PlayMod(pActiveMod, hFollow, m_notifyType); UpdateWindow(); } else { @@ -2268,7 +2282,7 @@ LRESULT CMainFrame::OnUpdatePositionThreaded(WPARAM, LPARAM) //----------------------------------------------------------------- { - MPTNOTIFICATION * pnotify = &m_PendingNotification; + Notification * pnotify = &m_PendingNotification; LRESULT retval = OnUpdatePosition(0, (LPARAM)pnotify); // for all notifications which were delivered via the notification thread, release the semaphore ReleaseSemaphore(m_PendingNotificationSempahore, 1, NULL); @@ -2278,10 +2292,10 @@ LRESULT CMainFrame::OnUpdatePosition(WPARAM, LPARAM lParam) //--------------------------------------------------------- { - MPTNOTIFICATION *pnotify = (MPTNOTIFICATION *)lParam; + Notification *pnotify = (Notification *)lParam; if (pnotify) { - if(pnotify->dwType & MPTNOTIFY_EOS) + if(pnotify->type[Notification::EOS]) { PostMessage(WM_COMMAND, ID_PLAYER_STOP); } Modified: trunk/OpenMPT/mptrack/Mainbar.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.cpp 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Mainbar.cpp 2013-04-06 14:55:00 UTC (rev 1750) @@ -937,8 +937,8 @@ } -VOID CModTreeBar::UpdatePlayPos(CModDoc *pModDoc, MPTNOTIFICATION *pNotify) -//------------------------------------------------------------------------- +VOID CModTreeBar::UpdatePlayPos(CModDoc *pModDoc, Notification *pNotify) +//---------------------------------------------------------------------- { if (m_pModTree) m_pModTree->UpdatePlayPos(pModDoc, pNotify); } Modified: trunk/OpenMPT/mptrack/Mainbar.h =================================================================== --- trunk/OpenMPT/mptrack/Mainbar.h 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Mainbar.h 2013-04-06 14:55:00 UTC (rev 1750) @@ -116,7 +116,7 @@ VOID OnDocumentCreated(CModDoc *pModDoc); VOID OnDocumentClosed(CModDoc *pModDoc); VOID OnUpdate(CModDoc *pModDoc, DWORD lHint=0, CObject *pHint=NULL); - VOID UpdatePlayPos(CModDoc *pModDoc, MPTNOTIFICATION *pNotify); + VOID UpdatePlayPos(CModDoc *pModDoc, Notification *pNotify); HWND GetModTreeHWND(); //rewbs.customKeys BOOL PostMessageToModTree(UINT cmdID, WPARAM wParam, LPARAM lParam); //rewbs.customKeys Modified: trunk/OpenMPT/mptrack/Mainfrm.h =================================================================== --- trunk/OpenMPT/mptrack/Mainfrm.h 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Mainfrm.h 2013-04-06 14:55:00 UTC (rev 1750) @@ -258,41 +258,9 @@ // Player position notification #define MAX_UPDATE_HISTORY 256 // same as SNDDEV_MAXBUFFERS +#include "Notification.h" -#define MPTNOTIFY_TYPEMASK 0x01FF0000 // HiWord = type, LoWord = subtype (smp/instr #) -#define MPTNOTIFY_DEFAULT 0x00010000 // -#define MPTNOTIFY_POSITION 0x00010000 // -#define MPTNOTIFY_SAMPLE 0x00020000 // dwPos[i] contains sample position -#define MPTNOTIFY_VOLENV 0x00040000 // dwPos[i] contains volume envelope position -#define MPTNOTIFY_PANENV 0x00080000 // dwPos[i] contains panning envelope position -#define MPTNOTIFY_PITCHENV 0x00100000 // dwPos[i] contains pitch envelope position -#define MPTNOTIFY_VUMETERS 0x00200000 // dwPos[i] contains VU meter for every channel -#define MPTNOTIFY_EOS 0x00800000 // end of stream reached, the gui should stop the audio device -#define MPTNOTIFY_STOP 0x01000000 // audio device has been stopped -> reset GUI -#define MPTNOTIFY_POSVALID 0x80000000 // dwPos[i] is valid (if it contains sample or envelope position) -// struct MPTNOTIFICATION requires working copy constructor / copy assignment, keep in mind when extending -struct MPTNOTIFICATION -{ - /* - TimestampSamples is kind of confusing at the moment: - If gpSoundDevice->HasGetStreamPosition(), - then it contains the sample timestamp as when it was generated and the output stream is later queried when this exact timestamp has actually reached the speakers. - If !gpSoundDevice->HasGetStreamPosition(), - then it contains a sample timestamp in the future, incremented by the current latency estimation of the sound buffers. It is later checked against the total number of rendered samples at that time. - */ - int64 TimestampSamples; - DWORD dwType; - ROWINDEX nRow; // Always valid - UINT nTick; // dito - ORDERINDEX nOrder; // dito - PATTERNINDEX nPattern; // dito - DWORD MasterVuLeft; // dito - DWORD MasterVuRight; // dito - DWORD dwPos[MAX_CHANNELS]; // sample/envelope pos for each channel if >= 0 -}; - - ///////////////////////////////////////////////////////////////////////// // Misc. Macros @@ -339,7 +307,6 @@ public: static HMIDIIN shMidiIn; - protected: CModTreeBar m_wndTree; @@ -348,7 +315,9 @@ CImageList m_ImageList; CSoundFile *m_pSndFile; // != NULL only when currently playing or rendering HWND m_hFollowSong, m_hWndMidi; - DWORD m_dwNotifyType; + // Kind of notification that should be generated + FlagSet<Notification::Type, uint16> m_notifyType; + Notification::Item m_notifyItem; CSoundFile::samplecount_t m_dwTimeSec; UINT_PTR m_nTimer; UINT m_nAvgMixChn, m_nMixChn; @@ -360,9 +329,9 @@ // Notification Buffer Util::mutex m_NotificationBufferMutex; // to avoid deadlocks, this mutex should only be taken as a innermost lock, i.e. do not block on anything while holding this mutex int64 m_TotalSamplesRendered; - Util::fixed_size_queue<MPTNOTIFICATION,MAX_UPDATE_HISTORY> m_NotifyBuffer; + Util::fixed_size_queue<Notification,MAX_UPDATE_HISTORY> m_NotifyBuffer; HANDLE m_PendingNotificationSempahore; // protects the one notification that is in flight from the notification thread to the gui thread from being freed while the gui thread still uses it - MPTNOTIFICATION m_PendingNotification; + Notification m_PendingNotification; // Instrument preview in tree view CSoundFile m_WaveFile; @@ -386,14 +355,14 @@ // from ISoundSource void FillAudioBufferLocked(IFillAudioBuffer &callback); ULONG AudioRead(PVOID pData, ULONG MaxSamples); - void AudioDone(ULONG SamplesWritten, ULONG SamplesLatency, bool end_of_stream); + void AudioDone(ULONG SamplesWritten, ULONG SamplesLatency, bool endOfStream); bool audioTryOpeningDevice(UINT channels, UINT bits, UINT samplespersec); bool audioOpenDevice(); bool audioReopenDevice(); void audioCloseDevice(); bool IsAudioDeviceOpen() const; - BOOL DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool end_of_stream); + BOOL DoNotification(DWORD dwSamplesRead, DWORD SamplesLatency, bool endOfStream); // Midi Input Functions public: @@ -475,11 +444,11 @@ bool PausePlayback(); bool IsPlaybackRunning() const { return m_IsPlaybackRunning; } static bool IsValidSoundFile(CSoundFile *pSndFile) { return pSndFile && pSndFile->GetType(); } - void SetPlaybackSoundFile(CSoundFile *pSndFile, HWND hPat=NULL, DWORD dwNotifyType=0); + void SetPlaybackSoundFile(CSoundFile *pSndFile, HWND hPat = NULL, Notification::Type notifyType = Notification::None, Notification::Item notifyItem = 0); void UnsetPlaybackSoundFile(); void GenerateStopNotification(); - bool PlayMod(CModDoc *, HWND hPat=NULL, DWORD dwNotifyType=0); + bool PlayMod(CModDoc *, HWND hPat=NULL, Notification::Type notifyType = Notification::None, Notification::Item notifyItem = 0); bool StopMod(CModDoc *pDoc=NULL); bool PauseMod(CModDoc *pDoc=NULL); @@ -507,7 +476,7 @@ BOOL SetupMidi(DWORD d, LONG n); void SetPreAmp(UINT n); HWND GetFollowSong(const CModDoc *pDoc) const { return (pDoc == GetModPlaying()) ? m_hFollowSong : NULL; } - BOOL SetFollowSong(CModDoc *, HWND hwnd, BOOL bFollowSong=TRUE, DWORD dwType=MPTNOTIFY_DEFAULT); + BOOL SetFollowSong(CModDoc *, HWND hwnd, BOOL bFollowSong=TRUE, Notification::Type type = Notification::Default, Notification::Item item = 0); void ResetNotificationBuffer(); Modified: trunk/OpenMPT/mptrack/Moddoc.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.cpp 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Moddoc.cpp 2013-04-06 14:55:00 UTC (rev 1750) @@ -271,7 +271,7 @@ dwKey, &nDlsIns))) { if (dwKey < 0x80) nDrumRgn = pEmbeddedBank->GetRegionFromKey(nDlsIns, dwKey); - if (pEmbeddedBank->ExtractInstrument(&m_SndFile, nIns, nDlsIns, nDrumRgn)) + if (pEmbeddedBank->ExtractInstrument(m_SndFile, nIns, nDlsIns, nDrumRgn)) { pIns = m_SndFile.Instruments[nIns]; // Reset pIns because ExtractInstrument may delete the previous value. if ((dwKey >= 24) && (dwKey < 100)) @@ -314,7 +314,7 @@ dwKey, &nDlsIns))) { if (dwKey < 0x80) nDrumRgn = pDLSBank->GetRegionFromKey(nDlsIns, dwKey); - pDLSBank->ExtractInstrument(&m_SndFile, nIns, nDlsIns, nDrumRgn); + pDLSBank->ExtractInstrument(m_SndFile, nIns, nDlsIns, nDrumRgn); pIns = m_SndFile.Instruments[nIns]; // Reset pIns because ExtractInstrument may delete the previous value. if ((dwKey >= 24) && (dwKey < 24+61)) { @@ -937,7 +937,7 @@ if (pMainFrm->GetModPlaying() != this) { m_SndFile.m_SongFlags.set(SONG_PAUSED); - pMainFrm->PlayMod(this, m_hWndFollow, m_dwNotifyType); + pMainFrm->PlayMod(this, m_hWndFollow, m_notifyType, m_notifyItem); } CriticalSection cs; @@ -1420,13 +1420,14 @@ } -void CModDoc::SetFollowWnd(HWND hwnd, DWORD dwType) -//------------------------------------------------- +void CModDoc::SetFollowWnd(HWND hwnd, Notification::Type type, Notification::Item item) +//------------------------------------------------------------------------------------- { CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); m_hWndFollow = hwnd; - m_dwNotifyType = dwType; - if(pMainFrm) pMainFrm->SetFollowSong(this, m_hWndFollow, TRUE, m_dwNotifyType); + m_notifyType = type; + m_notifyItem = item; + if(pMainFrm) pMainFrm->SetFollowSong(this, m_hWndFollow, TRUE, m_notifyType, m_notifyItem); } @@ -1926,7 +1927,7 @@ cs.Leave(); m_SndFile.m_SongFlags.reset(SONG_STEP | SONG_PAUSED | SONG_PATTERNLOOP); - pMainFrm->PlayMod(this, m_hWndFollow, m_dwNotifyType); + pMainFrm->PlayMod(this, m_hWndFollow, m_notifyType, m_notifyItem); } } @@ -2011,7 +2012,7 @@ cs.Leave(); - pMainFrm->PlayMod(this, m_hWndFollow, m_dwNotifyType); + pMainFrm->PlayMod(this, m_hWndFollow, m_notifyType, m_notifyItem); } } @@ -2325,7 +2326,7 @@ if(pModPlaying != this) { - pMainFrm->PlayMod(this, followSonghWnd, m_dwNotifyType|MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); //rewbs.fix2977 + pMainFrm->PlayMod(this, followSonghWnd, m_notifyType|Notification::Position|Notification::VUMeters, m_notifyItem); //rewbs.fix2977 } } //SwitchToView(); @@ -2381,7 +2382,7 @@ if(pModPlaying != this) { - pMainFrm->PlayMod(this, followSonghWnd, m_dwNotifyType|MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); //rewbs.fix2977 + pMainFrm->PlayMod(this, followSonghWnd, m_notifyType | Notification::Position | Notification::VUMeters, m_notifyItem); //rewbs.fix2977 } } //SwitchToView(); @@ -2440,7 +2441,7 @@ if(pModPlaying != this) { - pMainFrm->PlayMod(this, followSonghWnd, m_dwNotifyType|MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); //rewbs.fix2977 + pMainFrm->PlayMod(this, followSonghWnd, m_notifyType | Notification::Position | Notification::VUMeters, m_notifyItem); //rewbs.fix2977 } } //SwitchToView(); Modified: trunk/OpenMPT/mptrack/Moddoc.h =================================================================== --- trunk/OpenMPT/mptrack/Moddoc.h 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/Moddoc.h 2013-04-06 14:55:00 UTC (rev 1750) @@ -13,6 +13,7 @@ #include "sndfile.h" #include "../common/misc_util.h" #include "Undo.h" +#include "Notification.h" #include <time.h> @@ -153,7 +154,8 @@ CSoundFile m_SndFile; HWND m_hWndFollow; - DWORD m_dwNotifyType; + FlagSet<Notification::Type, uint16> m_notifyType; + Notification::Item m_notifyItem; CSize m_szOldPatternScrollbarsPos; CPatternUndo m_PatternUndo; @@ -206,7 +208,7 @@ void ViewSample(UINT nSmp); void ViewInstrument(UINT nIns); HWND GetFollowWnd() const { return m_hWndFollow; } - void SetFollowWnd(HWND hwnd, DWORD dwType); + void SetFollowWnd(HWND hwnd, Notification::Type type, Notification::Item item = 0); void ActivateWindow(); Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.h =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.h 2013-04-06 14:55:00 UTC (rev 1750) @@ -60,7 +60,7 @@ void ChangeVolCmd(); public: - CFindReplaceTab(UINT nIDD, bool bReplaceTab, CModDoc *pModDoc) : CPropertyPage(nIDD), effectInfo(*pModDoc->GetSoundFile()) { ASSERT(pModDoc != nullptr); m_bReplace = bReplaceTab; m_pModDoc = pModDoc; } + CFindReplaceTab(UINT nIDD, bool bReplaceTab, CModDoc *pModDoc) : CPropertyPage(nIDD), effectInfo(pModDoc->GetrSoundFile()) { ASSERT(pModDoc != nullptr); m_bReplace = bReplaceTab; m_pModDoc = pModDoc; } protected: virtual BOOL OnInitDialog(); @@ -127,7 +127,7 @@ bool m_bInitialized; public: - CPageEditCommand(CModDoc *pModDoc, CEditCommand *parent, UINT id) : CPropertyPage(id), m_pModDoc(pModDoc), effectInfo(*pModDoc->GetSoundFile()), m_pParent(parent), m_bInitialized(false) {}; + CPageEditCommand(CModDoc *pModDoc, CEditCommand *parent, UINT id) : CPropertyPage(id), m_pModDoc(pModDoc), effectInfo(pModDoc->GetrSoundFile()), m_pParent(parent), m_bInitialized(false) {}; virtual ~CPageEditCommand() {} virtual BOOL OnInitDialog(); Modified: trunk/OpenMPT/mptrack/View_ins.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_ins.cpp 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/View_ins.cpp 2013-04-06 14:55:00 UTC (rev 1750) @@ -124,11 +124,13 @@ m_rcClient.bottom = 2; m_dwStatus = 0; m_nBtnMouseOver = 0xFFFF; - m_dwNotifyPos.assign(MAX_CHANNELS, 0); + for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) + { + m_dwNotifyPos[i] = Notification::PosInvalid; + } MemsetZero(m_NcButtonState); m_bmpEnvBar.Create(IDB_ENVTOOLBAR, 20, 0, RGB(192,192,192)); - m_baPlayingNote.assign(128, false); - m_nPlayingChannel = CHANNELINDEX_INVALID; //rewbs.customKeys + m_baPlayingNote.reset(); //rewbs.envRowGrid m_bGrid=true; m_bGridForceRedraw=false; @@ -190,18 +192,18 @@ //------------------------------------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); - DWORD dwNotify; + Notification::Type type; if ((!pModDoc) || (nIns < 1) || (nIns >= MAX_INSTRUMENTS)) return FALSE; if (nEnv) m_nEnv = nEnv; m_nInstrument = nIns; switch(m_nEnv) { - case ENV_PANNING: dwNotify = MPTNOTIFY_PANENV; break; - case ENV_PITCH: dwNotify = MPTNOTIFY_PITCHENV; break; - default: m_nEnv = ENV_VOLUME; dwNotify = MPTNOTIFY_VOLENV; break; + case ENV_PANNING: type = Notification::PanEnv; break; + case ENV_PITCH: type = Notification::PitchEnv; break; + default: m_nEnv = ENV_VOLUME; type = Notification::VolEnv; break; } - pModDoc->SetFollowWnd(m_hWnd, dwNotify|m_nInstrument); + pModDoc->SetFollowWnd(m_hWnd, type, m_nInstrument); UpdateScrollSize(); UpdateNcButtonState(); InvalidateRect(NULL, FALSE); @@ -356,7 +358,7 @@ //---------------------------------------------------------------- { InstrumentEnvelope *pEnv = GetEnvelopePtr(); - if(pEnv != nullptr && pEnv->dwFlags[dwFlag]) return true; + if(pEnv != nullptr) return pEnv->dwFlags[dwFlag]; return false; } @@ -479,12 +481,12 @@ if(nPoint < 0 || nPoint > (int)EnvGetLastPoint()) return false; // We won't do any security checks here as GetEnvelopePtr() does that for us. - CSoundFile *pSndFile = GetDocument()->GetSoundFile(); + CSoundFile &sndFile = GetDocument()->GetrSoundFile(); if (nPoint != envelope->nSustainStart) { envelope->nSustainStart = (BYTE)nPoint; - if ((envelope->nSustainEnd < nPoint) || (pSndFile->m_nType & MOD_TYPE_XM)) envelope->nSustainEnd = (BYTE)nPoint; + if ((envelope->nSustainEnd < nPoint) || (sndFile.GetType() & MOD_TYPE_XM)) envelope->nSustainEnd = (BYTE)nPoint; return true; } else { @@ -501,12 +503,12 @@ if(nPoint < 0 || nPoint > (int)EnvGetLastPoint()) return false; // We won't do any security checks here as GetEnvelopePtr() does that for us. - CSoundFile *pSndFile = GetDocument()->GetSoundFile(); + CSoundFile &sndFile = GetDocument()->GetrSoundFile(); if (nPoint != envelope->nSustainEnd) { envelope->nSustainEnd = (BYTE)nPoint; - if ((envelope->nSustainStart > nPoint) || (pSndFile->m_nType & MOD_TYPE_XM)) envelope->nSustainStart = (BYTE)nPoint; + if ((envelope->nSustainStart > nPoint) || (sndFile.GetType() & MOD_TYPE_XM)) envelope->nSustainStart = (BYTE)nPoint; return true; } else { @@ -523,7 +525,7 @@ if(nPoint < 1 || nPoint > (int)EnvGetLastPoint()) return false; // Don't allow release nodes in IT/XM. GetDocument()/... nullptr check is done in GetEnvelopePtr, so no need to check twice. - if(!GetDocument()->GetSoundFile()->GetModSpecifications().hasReleaseNode) + if(!GetDocument()->GetrSoundFile().GetModSpecifications().hasReleaseNode) { if(envelope->nReleaseNode != ENV_RELEASE_NODE_UNSET) { @@ -556,16 +558,11 @@ } -bool CViewInstrument::EnvToggleEnv(enmEnvelopeTypes envelope, CSoundFile *pSndFile, ModInstrument *pIns, bool enable, BYTE defaultValue, EnvelopeFlags extraFlags) -//---------------------------------------------------------------------------------------------------------------------------------------------------------------- +bool CViewInstrument::EnvToggleEnv(enmEnvelopeTypes envelope, CSoundFile &sndFile, ModInstrument &ins, bool enable, BYTE defaultValue, EnvelopeFlags extraFlags) +//-------------------------------------------------------------------------------------------------------------------------------------------------------------- { - if(pIns == nullptr || pSndFile == nullptr) - { - return false; - } + InstrumentEnvelope &env = ins.GetEnvelope(envelope); - InstrumentEnvelope &env = pIns->GetEnvelope(envelope); - const EnvelopeFlags flags = (ENV_ENABLED | extraFlags); env.dwFlags.set(flags, enable); @@ -583,9 +580,9 @@ // Update mixing flags... for(CHANNELINDEX nChn = 0; nChn < MAX_CHANNELS; nChn++) { - if(pSndFile->Chn[nChn].pModInstrument == pIns) + if(sndFile.Chn[nChn].pModInstrument == &ins) { - pSndFile->Chn[nChn].GetEnvelope(envelope).flags.set(flags, enable); + sndFile.Chn[nChn].GetEnvelope(envelope).flags.set(flags, enable); } } @@ -598,9 +595,7 @@ { ModInstrument *pIns = GetInstrumentPtr(); if(pIns == nullptr) return false; - CSoundFile *pSndFile = GetDocument()->GetSoundFile(); // security checks are done in GetInstrumentPtr() - - return EnvToggleEnv(ENV_VOLUME, pSndFile, pIns, bEnable, 64); + return EnvToggleEnv(ENV_VOLUME, GetDocument()->GetrSoundFile(), *pIns, bEnable, 64); } @@ -609,9 +604,7 @@ { ModInstrument *pIns = GetInstrumentPtr(); if(pIns == nullptr) return false; - CSoundFile *pSndFile = GetDocument()->GetSoundFile(); // security checks are done in GetInstrumentPtr() - - return EnvToggleEnv(ENV_PANNING, pSndFile, pIns, bEnable, 32); + return EnvToggleEnv(ENV_PANNING, GetDocument()->GetrSoundFile(), *pIns, bEnable, 32); } @@ -620,10 +613,9 @@ { ModInstrument *pIns = GetInstrumentPtr(); if(pIns == nullptr) return false; - CSoundFile *pSndFile = GetDocument()->GetSoundFile(); // security checks are done in GetInstrumentPtr() pIns->PitchEnv.dwFlags.reset(ENV_FILTER); - return EnvToggleEnv(ENV_PITCH, pSndFile, pIns, bEnable, 32); + return EnvToggleEnv(ENV_PITCH, GetDocument()->GetrSoundFile(), *pIns, bEnable, 32); } @@ -632,9 +624,8 @@ { ModInstrument *pIns = GetInstrumentPtr(); if(pIns == nullptr) return false; - CSoundFile *pSndFile = GetDocument()->GetSoundFile(); // security checks are done in GetInstrumentPtr() - return EnvToggleEnv(ENV_PITCH, pSndFile, pIns, bEnable, 64, ENV_FILTER); + return EnvToggleEnv(ENV_PITCH, GetDocument()->GetrSoundFile(), *pIns, bEnable, 64, ENV_FILTER); } @@ -735,11 +726,10 @@ //----------------------------------------- { CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; + if(!pModDoc) return; + CSoundFile &sndFile = pModDoc->GetrSoundFile(); + CDC *pDC = NULL; - - if (!pModDoc) return; - pSndFile = pModDoc->GetSoundFile(); for (UINT i=0; i<ENV_LEFTBAR_BUTTONS; i++) if (cLeftBarButtons[i] != ID_SEPARATOR) { DWORD dwStyle = 0; @@ -748,17 +738,17 @@ { case ID_ENVSEL_VOLUME: if (m_nEnv == ENV_VOLUME) dwStyle |= NCBTNS_CHECKED; break; case ID_ENVSEL_PANNING: if (m_nEnv == ENV_PANNING) dwStyle |= NCBTNS_CHECKED; break; - case ID_ENVSEL_PITCH: if (!(pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; + case ID_ENVSEL_PITCH: if (!(sndFile.GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; else if (m_nEnv == ENV_PITCH) dwStyle |= NCBTNS_CHECKED; break; case ID_ENVELOPE_SETLOOP: if (EnvGetLoop()) dwStyle |= NCBTNS_CHECKED; break; case ID_ENVELOPE_SUSTAIN: if (EnvGetSustain()) dwStyle |= NCBTNS_CHECKED; break; - case ID_ENVELOPE_CARRY: if (!(pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; + case ID_ENVELOPE_CARRY: if (!(sndFile.GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; else if (EnvGetCarry()) dwStyle |= NCBTNS_CHECKED; break; case ID_ENVELOPE_VOLUME: if (EnvGetVolEnv()) dwStyle |= NCBTNS_CHECKED; break; case ID_ENVELOPE_PANNING: if (EnvGetPanEnv()) dwStyle |= NCBTNS_CHECKED; break; - case ID_ENVELOPE_PITCH: if (!(pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; else + case ID_ENVELOPE_PITCH: if (!(sndFile.GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; else if (EnvGetPitchEnv()) dwStyle |= NCBTNS_CHECKED; break; - case ID_ENVELOPE_FILTER: if (!(pSndFile->m_nType & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; else + case ID_ENVELOPE_FILTER: if (!(sndFile.GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT))) dwStyle |= NCBTNS_DISABLED; else if (EnvGetFilterEnv()) dwStyle |= NCBTNS_CHECKED; break; case ID_ENVELOPE_VIEWGRID: if (m_bGrid) dwStyle |= NCBTNS_CHECKED; break; case ID_ENVELOPE_ZOOM_IN: if (m_fZoom >= ENV_MAX_ZOOM) dwStyle |= NCBTNS_DISABLED; break; @@ -826,15 +816,15 @@ m_pbmpOldGrid = m_dcGrid.SelectObject(&m_bmpGrid); //do draw - CSoundFile *pSndFile; int width = m_rcClient.right - m_rcClient.left; int nPrevTick = -1; int nTick, nRow; int nRowsPerBeat = 1, nRowsPerMeasure = 1; - if(GetDocument() != nullptr && (pSndFile = GetDocument()->GetSoundFile()) != nullptr) + CModDoc *modDoc = GetDocument(); + if(modDoc != nullptr) { - nRowsPerBeat = pSndFile->m_nDefaultRowsPerBeat; - nRowsPerMeasure = pSndFile->m_nDefaultRowsPerMeasure; + nRowsPerBeat = modDoc->GetrSoundFile().m_nDefaultRowsPerBeat; + nRowsPerMeasure = modDoc->GetrSoundFile().m_nDefaultRowsPerMeasure; } for (int x = 3; x < width; x++) @@ -869,7 +859,6 @@ RECT rect; int nScrollPos = GetScrollPos(SB_HORZ); CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; HGDIOBJ oldpen; //HDC hdc; UINT maxpoint; @@ -896,13 +885,12 @@ //end rewbs.envRowGrid if ((!pModDoc) || (!pDC)) return; - pSndFile = pModDoc->GetSoundFile(); //hdc = pDC->m_hDC; oldpen = m_dcMemMain.SelectObject(CMainFrame::penDarkGray); m_dcMemMain.FillRect(&m_rcClient, CBrush::FromHandle(CMainFrame::brushBlack)); if (m_bGrid) { - DrawGrid(&m_dcMemMain, pSndFile->m_nMusicSpeed); + DrawGrid(&m_dcMemMain, pModDoc->GetrSoundFile().m_nMusicSpeed); } // Middle line (half volume or pitch / panning center) @@ -1024,8 +1012,7 @@ CModDoc *pModDoc = GetDocument(); if ((pModDoc) && (nPoint <= EnvGetLastPoint())) { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - ModInstrument *pIns = pSndFile->Instruments[m_nInstrument]; + ModInstrument *pIns = pModDoc->GetrSoundFile().Instruments[m_nInstrument]; if (pIns) { InstrumentEnvelope *envelope = GetEnvelopePtr(); @@ -1069,8 +1056,8 @@ CModDoc *pModDoc = GetDocument(); if (pModDoc) { - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - ModInstrument *pIns = pSndFile->Instruments[m_nInstrument]; + CSoundFile &sndFile = pModDoc->GetrSoundFile(); + ModInstrument *pIns = sndFile.Instruments[m_nInstrument]; if (pIns) { if(nTick < 0) return 0; @@ -1103,7 +1090,7 @@ return 0; } - if (envelope->nNodes < pSndFile->GetModSpecifications().envelopePointsMax) + if (envelope->nNodes < sndFile.GetModSpecifications().envelopePointsMax) { if (!envelope->nNodes) { @@ -1143,10 +1130,10 @@ //---------------------------------------------- { CRect rect; - for(UINT i = 0; i < MAX_CHANNELS; i++) if (m_dwNotifyPos[i] & MPTNOTIFY_POSVALID) + for(UINT i = 0; i < MAX_CHANNELS; i++) if (m_dwNotifyPos[i] != Notification::PosInvalid) { rect.top = -2; - rect.left = TickToScreen(m_dwNotifyPos[i] & 0xFFFF); + rect.left = TickToScreen(m_dwNotifyPos[i]); rect.right = rect.left + 1; rect.bottom = m_rcClient.bottom + 1; InvertRect(hdc, &rect); @@ -1154,39 +1141,40 @@ } -LRESULT CViewInstrument::OnPlayerNotify(MPTNOTIFICATION *pnotify) -//--------------------------------------------------------------- +LRESULT CViewInstrument::OnPlayerNotify(Notification *pnotify) +//------------------------------------------------------------ { - DWORD dwType; + Notification::Type type; CModDoc *pModDoc = GetDocument(); if ((!pnotify) || (!pModDoc)) return 0; switch(m_nEnv) { - case ENV_PANNING: dwType = MPTNOTIFY_PANENV; break; - case ENV_PITCH: dwType = MPTNOTIFY_PITCHENV; break; - default: dwType = MPTNOTIFY_VOLENV; break; + case ENV_PANNING: type = Notification::PanEnv; break; + case ENV_PITCH: type = Notification::PitchEnv; break; + default: type = Notification::VolEnv; break; } - if (pnotify->dwType & MPTNOTIFY_STOP) + if (pnotify->type[Notification::Stop]) { + bool invalidate = false; for(CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) { - if(m_dwNotifyPos[i]) + if(m_dwNotifyPos[i] != Notification::PosInvalid) { - m_dwNotifyPos.assign(MAX_CHANNELS, 0); - InvalidateEnvelope(); - break; + m_dwNotifyPos[i] = Notification::PosInvalid; + invalidate = true; } - m_baPlayingNote.assign(128, false); - m_nPlayingChannel = CHANNELINDEX_INVALID; //rewbs.instViewNNA } - } else - if ((pnotify->dwType & dwType) && ((pnotify->dwType & 0xFFFF) == m_nInstrument)) + if(invalidate) + { + InvalidateEnvelope(); + } + m_baPlayingNote.reset(); + } else if(pnotify->type[type] && pnotify->item == m_nInstrument) { BOOL bUpdate = FALSE; for (CHANNELINDEX i = 0; i < MAX_CHANNELS; i++) { - //DWORD newpos = (pSndFile->dwSongFlags & SONG_PAUSED) ? pnotify->dwPos[i] : 0; - DWORD newpos = pnotify->dwPos[i]; + uint32 newpos = pnotify->pos[i]; if (m_dwNotifyPos[i] != newpos) { bUpdate = TRUE; @@ -1200,7 +1188,7 @@ for (CHANNELINDEX j = 0; j < MAX_CHANNELS; j++) { //DWORD newpos = (pSndFile->m_SongFlags[SONG_PAUSED]) ? pnotify->dwPos[j] : 0; - DWORD newpos = pnotify->dwPos[j]; + DWORD newpos = pnotify->pos[j]; m_dwNotifyPos[j] = newpos; } DrawPositionMarks(hdc); @@ -1690,8 +1678,7 @@ { const CModDoc *pModDoc = GetDocument(); if(!pModDoc) return; - const CSoundFile *pSndFile = GetDocument()->GetSoundFile(); - if(!pSndFile) return; + const CSoundFile &sndFile = GetDocument()->GetrSoundFile(); CMenu Menu; if (m_dwStatus & INSSTATUS_DRAGGING) return; @@ -1701,13 +1688,13 @@ if (pSubMenu != NULL) { m_nDragItem = ScreenToPoint(pt.x, pt.y) + 1; - const uint32 maxPoint = (pSndFile->GetType() == MOD_TYPE_XM) ? 11 : 24; + const uint32 maxPoint = (sndFile.GetType() == MOD_TYPE_XM) ? 11 : 24; const uint32 lastpoint = EnvGetLastPoint(); - const bool forceRelease = !pSndFile->GetModSpecifications().hasReleaseNode && (EnvGetReleaseNode() != ENV_RELEASE_NODE_UNSET); + const bool forceRelease = !sndFile.GetModSpecifications().hasReleaseNode && (EnvGetReleaseNode() != ENV_RELEASE_NODE_UNSET); pSubMenu->EnableMenuItem(ID_ENVELOPE_INSERTPOINT, (lastpoint < maxPoint) ? MF_ENABLED : MF_GRAYED); pSubMenu->EnableMenuItem(ID_ENVELOPE_REMOVEPOINT, ((m_nDragItem) && (lastpoint > 0)) ? MF_ENABLED : MF_GRAYED); - pSubMenu->EnableMenuItem(ID_ENVELOPE_CARRY, (pSndFile->GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? MF_ENABLED : MF_GRAYED); - pSubMenu->EnableMenuItem(ID_ENVELOPE_TOGGLERELEASENODE, ((pSndFile->GetModSpecifications().hasReleaseNode && m_nEnv == ENV_VOLUME) || forceRelease) ? MF_ENABLED : MF_GRAYED); + pSubMenu->EnableMenuItem(ID_ENVELOPE_CARRY, (sndFile.GetType() & (MOD_TYPE_IT|MOD_TYPE_MPT)) ? MF_ENABLED : MF_GRAYED); + pSubMenu->EnableMenuItem(ID_ENVELOPE_TOGGLERELEASENODE, ((sndFile.GetModSpecifications().hasReleaseNode && m_nEnv == ENV_VOLUME) || forceRelease) ? MF_ENABLED : MF_GRAYED); pSubMenu->CheckMenuItem(ID_ENVELOPE_SETLOOP, (EnvGetLoop()) ? MF_CHECKED : MF_UNCHECKED); pSubMenu->CheckMenuItem(ID_ENVELOPE_SUSTAIN, (EnvGetSustain()) ? MF_CHECKED : MF_UNCHECKED); pSubMenu->CheckMenuItem(ID_ENVELOPE_CARRY, (EnvGetCarry()) ? MF_CHECKED : MF_UNCHECKED); @@ -1960,14 +1947,14 @@ } } */ - ModInstrument *pIns = pModDoc->GetSoundFile()->Instruments[m_nInstrument]; + ModInstrument *pIns = pModDoc->GetrSoundFile().Instruments[m_nInstrument]; if ((!pIns) || (!pIns->Keyboard[note - NOTE_MIN] && !pIns->nMixPlug)) return; m_baPlayingNote[note] = true; //rewbs.instViewNNA - m_nPlayingChannel = pModDoc->PlayNote(note, m_nInstrument, 0, false); //rewbs.instViewNNA + pModDoc->PlayNote(note, m_nInstrument, 0, false); //rewbs.instViewNNA s[0] = 0; if ((note) && (note <= NOTE_MAX)) { - const std::string temp = pModDoc->GetSoundFile()->GetNoteName(static_cast<int16>(note), m_nInstrument); + const std::string temp = pModDoc->GetrSoundFile().GetNoteName(static_cast<int16>(note), m_nInstrument); if(temp.size() >= sizeofS) wsprintf(s, "%s", "..."); else @@ -2018,19 +2005,18 @@ //----------------------------------------------------------------------- { CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile; BOOL bCanDrop = FALSE; BOOL bUpdate; if ((!lpDropInfo) || (!pModDoc)) return FALSE; - pSndFile = pModDoc->GetSoundFile(); + CSoundFile &sndFile = pModDoc->GetrSoundFile(); switch(lpDropInfo->dwDropType) { case DRAGONDROP_INSTRUMENT: if (lpDropInfo->pModDoc == pModDoc) { bCanDrop = ((lpDropInfo->dwDropItem) - && (lpDropInfo->dwDropItem <= pSndFile->m_nInstruments) + && (lpDropInfo->dwDropItem <= sndFile.m_nInstruments) && (lpDropInfo->pModDoc == pModDoc)); } else { @@ -2051,11 +2037,11 @@ break; } if ((!bCanDrop) || (!bDoDrop)) return bCanDrop; - if ((!pSndFile->m_nInstruments) && (pSndFile->m_nType & (MOD_TYPE_XM|MOD_TYPE_IT|MOD_TYPE_MPT))) + if ((!sndFile.GetNumInstruments()) && sndFile.GetModSpecifications().instrumentsMax > 0) { SendCtrlMessage(CTRLMSG_INS_NEWINSTRUMENT); } - if ((!m_nInstrument) || (m_nInstrument > pSndFile->m_nInstruments)) return FALSE; + if ((!m_nInstrument) || (m_nInstrument > sndFile.GetNumInstruments())) return FALSE; // Do the drop bUpdate = FALSE; BeginWaitCursor(); @@ -2095,7 +2081,7 @@ if (pDlsIns) { CriticalSection cs; - bCanDrop = dlsbank.ExtractInstrument(pSndFile, m_nInstrument, nIns, nRgn); + bCanDrop = dlsbank.ExtractInstrument(sndFile, m_nInstrument, nIns, nRgn); } bUpdate = TRUE; break; @@ -2123,7 +2109,7 @@ CriticalSection cs; - bCanDrop = pDLSBank->ExtractInstrument(pSndFile, m_nInstrument, nIns, nRgn); + bCanDrop = pDLSBank->ExtractInstrument(sndFile, m_nInstrument, nIns, nRgn); bUpdate = TRUE; } break; @@ -2152,12 +2138,15 @@ static BYTE midivolume = 127; CModDoc *pModDoc = GetDocument(); + if(pModDoc == nullptr) + { + return 0; + } + CSoundFile &sndFile = pModDoc->GetrSoundFile(); + BYTE midiByte1 = MIDIEvents::GetDataByte1FromEvent(dwMidiData); BYTE midiByte2 = MIDIEvents::GetDataByte2FromEvent(dwMidiData); - CSoundFile* pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : nullptr; - if(!pSndFile) return 0; - uint8 nNote = midiByte1 + NOTE_MIN; int nVol = midiByte2; MIDIEvents::EventType event = MIDIEvents::GetTypeFromEvent(dwMidiData); @@ -2165,7 +2154,7 @@ BYTE mappedIndex = 0, paramValue = 0; uint32 paramIndex = 0; - bool captured = pSndFile->GetMIDIMapper().OnMIDImsg(dwMidiData, mappedIndex, paramIndex, paramValue); + bool captured = sndFile.GetMIDIMapper().OnMIDImsg(dwMidiData, mappedIndex, paramIndex, paramValue); // Handle MIDI messages assigned to shortcuts CInputHandler *ih = CMainFrame::GetMainFrame()->GetInputHandler(); @@ -2209,13 +2198,13 @@ if((TrackerSettings::Instance().m_dwMidiSetup & MIDISETUP_MIDITOPLUG) && CMainFrame::GetMainFrame()->GetModPlaying() == pModDoc) { const INSTRUMENTINDEX instr = m_nInstrument; - IMixPlugin* plug = pSndFile->GetInstrumentPlugin(instr); + IMixPlugin* plug = sndFile.GetInstrumentPlugin(instr); if(plug) { plug->MidiSend(dwMidiData); // Sending midi may modify the plug. For now, if MIDI data // is not active sensing or aftertouch messages, set modified. - if(dwMidiData != MIDIEvents::System(MIDIEvents::sysActiveSense) && event != MIDIEvents::evPolyAftertouch && event != MIDIEvents::evChannelAftertouch && pSndFile->GetModSpecifications().supportsPlugins) + if(dwMidiData != MIDIEvents::System(MIDIEvents::sysActiveSense) && event != MIDIEvents::evPolyAftertouch && event != MIDIEvents::evChannelAftertouch && sndFile.GetModSpecifications().supportsPlugins) { CMainFrame::GetMainFrame()->ThreadSafeSetModified(pModDoc); } @@ -2263,7 +2252,6 @@ CModDoc *pModDoc = GetDocument(); if(!pModDoc) return NULL; - //CSoundFile *pSndFile = pModDoc->GetSoundFile(); CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); switch(wParam) @@ -2318,13 +2306,13 @@ //-------------------------------------------- { CModDoc *pModDoc = GetDocument(); - CSoundFile *pSndFile = (pModDoc) ? pModDoc->GetSoundFile() : NULL; - if(pSndFile == nullptr) + if(pModDoc == nullptr) return; + const CSoundFile &sndFile = pModDoc->GetrSoundFile(); if(m_nInstrument >= 1 && - m_nInstrument <= pSndFile->GetNumInstruments() && - pSndFile->Instruments[m_nInstrument]) + m_nInstrument <= sndFile.GetNumInstruments() && + sndFile.Instruments[m_nInstrument]) { // "Center" y value of the envelope. For panning and pitch, this is 32, for volume and filter it is 0 (minimum). int nOffset = ((m_nEnv != ENV_VOLUME) && !GetEnvelopePtr()->dwFlags[ENV_FILTER]) ? 32 : 0; @@ -2336,8 +2324,6 @@ pModDoc->UpdateAllViews(NULL, (m_nInstrument << HINT_SHIFT_INS) | HINT_ENVELOPE, NULL); } } - - } @@ -2542,11 +2528,10 @@ { CModDoc *pModDoc = GetDocument(); if(pModDoc == nullptr) return nullptr; - CSoundFile *pSndFile = pModDoc->GetSoundFile(); - if(pSndFile == nullptr) return nullptr; - return pSndFile->Instruments[m_nInstrument]; + return pModDoc->GetrSoundFile().Instruments[m_nInstrument]; } + // Get a pointer to the currently selected envelope. // This function also implicitely validates the moddoc and soundfile pointers. InstrumentEnvelope *CViewInstrument::GetEnvelopePtr() const Modified: trunk/OpenMPT/mptrack/View_ins.h =================================================================== --- trunk/OpenMPT/mptrack/View_ins.h 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/View_ins.h 2013-04-06 14:55:00 UTC (rev 1750) @@ -26,28 +26,32 @@ CImageList m_bmpEnvBar; POINT m_ptMenu; RECT m_rcClient; - vector<bool> m_baPlayingNote; - vector<DWORD> m_dwNotifyPos; - INSTRUMENTINDEX m_nInstrument; + + CBitmap m_bmpGrid; + CBitmap m_bmpMemMain; + CBitmap *m_pbmpOldGrid; + CBitmap *oldBitmap; + enmEnvelopeTypes m_nEnv; - UINT m_nDragItem, m_nBtnMouseOver, m_nPlayingChannel; + UINT m_nDragItem, m_nBtnMouseOver; DWORD m_dwStatus; DWORD m_NcButtonState[ENV_LEFTBAR_BUTTONS]; - //rewbs.envRowGrid - bool m_bGrid; - bool m_bGridForceRedraw; - CBitmap *m_pbmpOldGrid; - CBitmap m_bmpGrid; + + INSTRUMENTINDEX m_nInstrument; + + CDC m_dcMemMain; CDC m_dcGrid; int m_GridScrollPos; int m_GridSpeed; - CDC m_dcMemMain; - CBitmap m_bmpMemMain; - CBitmap* oldBitmap; float m_fZoom; - //rewbs.envRowGrid + bool m_bGrid; + bool m_bGridForceRedraw; + + std::bitset<128> m_baPlayingNote; + uint32 m_dwNotifyPos[MAX_CHANNELS]; + public: CViewInstrument(); DECLARE_SERIAL(CViewInstrument) @@ -101,7 +105,7 @@ bool EnvToggleReleaseNode(int nPoint); // Set envelope status - bool EnvToggleEnv(enmEnvelopeTypes envelope, CSoundFile *pSndFile, ModInstrument *pIns, bool enable, BYTE defaultValue, EnvelopeFlags extraFlags = EnvelopeFlags(0)); + bool EnvToggleEnv(enmEnvelopeTypes envelope, CSoundFile &sndFile, ModInstrument &ins, bool enable, BYTE defaultValue, EnvelopeFlags extraFlags = EnvelopeFlags(0)); bool EnvSetVolEnv(bool bEnable); bool EnvSetPanEnv(bool bEnable); bool EnvSetPitchEnv(bool bEnable); @@ -159,7 +163,7 @@ virtual void UpdateView(DWORD dwHintMask=0, CObject *pObj=NULL); virtual LRESULT OnModViewMsg(WPARAM, LPARAM); virtual BOOL OnDragonDrop(BOOL, LPDRAGONDROP); - virtual LRESULT OnPlayerNotify(MPTNOTIFICATION *); + virtual LRESULT OnPlayerNotify(Notification *); //}}AFX_VIRTUAL protected: Modified: trunk/OpenMPT/mptrack/View_pat.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_pat.cpp 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/View_pat.cpp 2013-04-06 14:55:00 UTC (rev 1750) @@ -767,7 +767,7 @@ CModDoc *pModDoc = GetDocument(); if (pModDoc) { - pModDoc->SetFollowWnd(m_hWnd, MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); + pModDoc->SetFollowWnd(m_hWnd, Notification::Position | Notification::VUMeters); UpdateIndicator(); } } @@ -2467,7 +2467,7 @@ if (pMainFrm->GetModPlaying() != pModDoc) { - pMainFrm->PlayMod(pModDoc, m_hWnd, MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); + pMainFrm->PlayMod(pModDoc, m_hWnd, Notification::Position|Notification::VUMeters); } if(row == ROWINDEX_INVALID) { @@ -3492,8 +3492,8 @@ } -LRESULT CViewPattern::OnPlayerNotify(MPTNOTIFICATION *pnotify) -//------------------------------------------------------------ +LRESULT CViewPattern::OnPlayerNotify(Notification *pnotify) +//--------------------------------------------------------- { CSoundFile *pSndFile = GetSoundFile(); if(pSndFile == nullptr || pnotify == nullptr) @@ -3501,11 +3501,11 @@ return 0; } - if (pnotify->dwType & MPTNOTIFY_POSITION) + if(pnotify->type[Notification::Position]) { - ORDERINDEX nOrd = pnotify->nOrder; - ROWINDEX nRow = pnotify->nRow; - PATTERNINDEX nPat = pnotify->nPattern; //get player pattern + ORDERINDEX nOrd = pnotify->order; + ROWINDEX nRow = pnotify->row; + PATTERNINDEX nPat = pnotify->pattern; //get player pattern bool updateOrderList = false; if(m_nLastPlayedOrder != nOrd) @@ -3559,11 +3559,11 @@ } } SetPlayCursor(nPat, nRow); - m_nPlayTick = pnotify->nTick; + m_nPlayTick = pnotify->tick; - } //Ends condition "if(pnotify->dwType & MPTNOTIFY_POSITION)" + } //Ends condition "if(pnotify->dwType & MPTNotification::_POSITION)" - if((pnotify->dwType & (MPTNOTIFY_VUMETERS|MPTNOTIFY_STOP)) && m_Status[psShowVUMeters]) + if(pnotify->type[Notification::VUMeters | Notification::Stop] && m_Status[psShowVUMeters]) { UpdateAllVUMeters(pnotify); } @@ -3928,8 +3928,8 @@ CMainFrame *pMainFrm = CMainFrame::GetMainFrame(); CModDoc *pModDoc = GetDocument(); m_Status.set(psFollowSong); - if (pModDoc) pModDoc->SetFollowWnd(m_hWnd, MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); - if (pMainFrm) pMainFrm->SetFollowSong(pModDoc, m_hWnd, TRUE, MPTNOTIFY_POSITION|MPTNOTIFY_VUMETERS); + if (pModDoc) pModDoc->SetFollowWnd(m_hWnd, Notification::Position|Notification::VUMeters); + if (pMainFrm) pMainFrm->SetFollowSong(pModDoc, m_hWnd, TRUE, Notification::Position|Notification::VUMeters); SetFocus(); } else { Modified: trunk/OpenMPT/mptrack/View_pat.h =================================================================== --- trunk/OpenMPT/mptrack/View_pat.h 2013-04-06 13:31:47 UTC (rev 1749) +++ trunk/OpenMPT/mptrack/View_pat.h 2013-04-06 14:55:00 UTC (rev 1750) @@ -292,7 +292,7 @@ void DrawInstrument(int x, int y, UINT instr); void DrawVolumeCommand(int x, int y... [truncated message content] |