From: <sag...@us...> - 2013-03-26 19:15:33
|
Revision: 1698 http://sourceforge.net/p/modplug/code/1698 Author: saga-games Date: 2013-03-26 19:15:25 +0000 (Tue, 26 Mar 2013) Log Message: ----------- [Fix] Fixed instrument name display (broke with string refactoring) [Fix] Fixed instrument plugin preview (broke with sample map fixes) [Mod] VST: Send offline rendering state to plugins Modified Paths: -------------- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp trunk/OpenMPT/mptrack/View_tre.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/soundlib/Snd_fx.cpp trunk/OpenMPT/soundlib/Sndfile.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp =================================================================== --- trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2013-03-25 23:18:25 UTC (rev 1697) +++ trunk/OpenMPT/mptrack/PatternEditorDialogs.cpp 2013-03-26 19:15:25 UTC (rev 1698) @@ -192,7 +192,7 @@ { if (pSndFile->m_nInstruments) { - wsprintf(s, "%03d:%s", n, (pSndFile->Instruments[n]) ? (LPCTSTR)pSndFile->GetInstrumentName(n) : ""); + wsprintf(s, "%03d:%s", n, pSndFile->GetInstrumentName(n)); } else { wsprintf(s, "%03d:%s", n, pSndFile->m_szNames[n]); Modified: trunk/OpenMPT/mptrack/View_tre.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-25 23:18:25 UTC (rev 1697) +++ trunk/OpenMPT/mptrack/View_tre.cpp 2013-03-26 19:15:25 UTC (rev 1698) @@ -1010,10 +1010,10 @@ // path info for ITP instruments const bool pathOk = !sndFile.m_szInstrumentPath[nIns - 1].empty(); const bool instMod = pDoc->m_bsInstrumentModified.test(nIns - 1); - wsprintf(s, pathOk ? (instMod ? "%3d: * %s" : "%3d: %s") : "%3d: ? %s", nIns, (LPCTSTR)sndFile.GetInstrumentName(nIns)); + wsprintf(s, pathOk ? (instMod ? "%3d: * %s" : "%3d: %s") : "%3d: ? %s", nIns, sndFile.GetInstrumentName(nIns)); } else { - wsprintf(s, "%3d: %s", nIns, (LPCTSTR)sndFile.GetInstrumentName(nIns)); + wsprintf(s, "%3d: %s", nIns, sndFile.GetInstrumentName(nIns)); } int nImage = IMAGE_INSTRUMENTS; Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-25 23:18:25 UTC (rev 1697) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2013-03-26 19:15:25 UTC (rev 1698) @@ -905,14 +905,10 @@ return 1; //we replace. case audioMasterGetCurrentProcessLevel: - //Log("VST plugin to host: Get Current Process Level\n"); - //TODO: Support offline processing -/* if (CMainFrame::GetMainFrame()->IsRendering()) { - return 4; //Offline - } else { - return 2; //Unknown. - } -*/ + if(CMainFrame::GetMainFrame()->IsRendering()) + return kVstProcessLevelOffline; + else + return kVstProcessLevelRealtime; break; // returns 0: not supported, 1: off, 2:read, 3:write, 4:read/write @@ -1028,7 +1024,7 @@ case audioMasterUpdateDisplay: if (pVstPlugin != nullptr) { - // Note to self for testing: Electri-Q sends opcode. Korg M1 sends this when switchin between Combi and Multi mode to update the preset names. + // Note to self for testing: Electri-Q sends opcode. Korg M1 sends this when switching between Combi and Multi mode to update the preset names. CAbstractVstEditor *pVstEditor = pVstPlugin->GetEditor(); if (pVstEditor && ::IsWindow(pVstEditor->m_hWnd)) { @@ -1904,10 +1900,10 @@ CString CVstPlugin::GetFormattedParamName(PlugParamIndex param) //------------------------------------------------------------- { - static VstParameterProperties properties; - CString paramName; + VstParameterProperties properties; + MemsetZero(properties.label); if(Dispatch(effGetParameterProperties, param, 0, &properties, 0.0f) == 1) { StringFixer::SetNullTerminator(properties.label); @@ -2145,7 +2141,7 @@ { for(size_t i = 0; i < nSamples; i++) { - outputBuffers[iOut % 2][i] += outputBuffers[iOut][i]; // assumed stereo. + outputBuffers[iOut % 2u][i] += outputBuffers[iOut][i]; // assumed stereo. } } @@ -2343,8 +2339,8 @@ { VSTInstrChannel &channel = m_MidiCh[mc]; - MidiPitchBend(mc, EncodePitchBendParam(MIDIEvents::pitchBendCentre)); // centre pitch bend - MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllControllersOff, mc, 0)); // reset all controllers + MidiPitchBend(mc, EncodePitchBendParam(MIDIEvents::pitchBendCentre)); // centre pitch bend + MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllControllersOff, mc, 0)); // reset all controllers MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllNotesOff, mc, 0)); // all notes off MidiSend(MIDIEvents::CC(MIDIEvents::MIDICC_AllSoundOff, mc, 0)); // all sounds off Modified: trunk/OpenMPT/soundlib/Snd_fx.cpp =================================================================== --- trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-03-25 23:18:25 UTC (rev 1697) +++ trunk/OpenMPT/soundlib/Snd_fx.cpp 2013-03-26 19:15:25 UTC (rev 1698) @@ -880,6 +880,8 @@ if(pSmp == nullptr) { + pChn->pModSample = nullptr; + pChn->nLength = 0; return; } Modified: trunk/OpenMPT/soundlib/Sndfile.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-25 23:18:25 UTC (rev 1697) +++ trunk/OpenMPT/soundlib/Sndfile.cpp 2013-03-26 19:15:25 UTC (rev 1698) @@ -1285,14 +1285,14 @@ } -mpt::String CSoundFile::GetInstrumentName(UINT nInstr) const -//------------------------------------------------------ +const char *CSoundFile::GetInstrumentName(INSTRUMENTINDEX nInstr) const +//--------------------------------------------------------------------- { - if ((nInstr >= MAX_INSTRUMENTS) || (!Instruments[nInstr])) + if((nInstr >= MAX_INSTRUMENTS) || (!Instruments[nInstr])) return TEXT(""); ASSERT(nInstr <= GetNumInstruments()); - return mpt::String(Instruments[nInstr]->name); + return Instruments[nInstr]->name; } Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2013-03-25 23:18:25 UTC (rev 1697) +++ trunk/OpenMPT/soundlib/Sndfile.h 2013-03-26 19:15:25 UTC (rev 1698) @@ -92,15 +92,19 @@ #define INTERNAL_LINEENDING '\r' // The character that represents line endings internally +#ifdef MODPLUG_TRACKER + // For WAV export (writing pattern positions to file) struct PatternCuePoint { - ULONGLONG offset; // offset in the file (in samples) - ORDERINDEX order; // which order is this? - bool processed; // has this point been processed by the main WAV render function yet? + uint64 offset; // offset in the file (in samples) + ORDERINDEX order; // which order is this? + bool processed; // has this point been processed by the main WAV render function yet? }; +#endif // MODPLUG_TRACKER + // Return values for GetLength() struct GetLengthType { @@ -315,7 +319,9 @@ DWORD m_dwCreatedWithVersion; DWORD m_dwLastSavedWithVersion; +#ifdef MODPLUG_TRACKER vector<PatternCuePoint> m_PatternCuePoints; // For WAV export (writing pattern positions to file) +#endif // MODPLUG_TRACKER // For handling backwards jumps and stuff to prevent infinite loops when counting the mod length or rendering to wav. RowVisitor visitedSongRows; @@ -365,7 +371,7 @@ void SetCurrentOrder(ORDERINDEX nOrder); LPCSTR GetTitle() const { return m_szNames[0]; } LPCTSTR GetSampleName(UINT nSample) const; - mpt::String GetInstrumentName(UINT nInstr) const; + const char *GetInstrumentName(INSTRUMENTINDEX nInstr) const; UINT GetMusicSpeed() const { return m_nMusicSpeed; } UINT GetMusicTempo() const { return m_nMusicTempo; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |