From: <sag...@us...> - 2012-03-07 18:56:09
|
Revision: 1206 http://modplug.svn.sourceforge.net/modplug/?rev=1206&view=rev Author: saga-games Date: 2012-03-07 18:55:58 +0000 (Wed, 07 Mar 2012) Log Message: ----------- [New] Plugins can now send MIDI events to follow-up plugins. [Mod] OpenMPT: Version is now 1.20.00.75 Modified Paths: -------------- trunk/OpenMPT/mptrack/CleanupSong.cpp trunk/OpenMPT/mptrack/View_gen.cpp trunk/OpenMPT/mptrack/Vstplug.cpp trunk/OpenMPT/mptrack/Vstplug.h trunk/OpenMPT/mptrack/mptrack.vcproj trunk/OpenMPT/mptrack/mptrack_08.vcproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters trunk/OpenMPT/mptrack/version.h trunk/OpenMPT/soundlib/Fastmix.cpp trunk/OpenMPT/soundlib/PlugInterface.h trunk/OpenMPT/soundlib/Snd_defs.h Added Paths: ----------- trunk/OpenMPT/soundlib/PluginEventQueue.h Modified: trunk/OpenMPT/mptrack/CleanupSong.cpp =================================================================== --- trunk/OpenMPT/mptrack/CleanupSong.cpp 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/CleanupSong.cpp 2012-03-07 18:55:58 UTC (rev 1206) @@ -866,7 +866,7 @@ if(!pSndFile->m_MixPlugins[nPlug].IsOutputToMaster()) { PLUGINDEX output = pSndFile->m_MixPlugins[nPlug].GetOutputPlugin(); - if(output < MAX_MIXPLUGINS) + if(output != PLUGINDEX_INVALID) { usedmap[output] = true; } Modified: trunk/OpenMPT/mptrack/View_gen.cpp =================================================================== --- trunk/OpenMPT/mptrack/View_gen.cpp 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/View_gen.cpp 2012-03-07 18:55:58 UTC (rev 1206) @@ -550,7 +550,7 @@ int n = m_CbnOutput.AddString(s); m_CbnOutput.SetItemData(n, 0x80 + iOut); if (!pSndFile->m_MixPlugins[m_nCurrentPlugin].IsOutputToMaster() - && (pSndFile->m_MixPlugins[m_nCurrentPlugin].GetOutputPlugin() == iOut)) + && (pSndFile->m_MixPlugins[m_nCurrentPlugin].GetOutputPlugin() == iOut)) { outputsel = n; } @@ -1356,7 +1356,7 @@ if(!pSndFile->m_MixPlugins[dest].IsOutputToMaster()) { PLUGINDEX nOutput = pSndFile->m_MixPlugins[dest].GetOutputPlugin(); - if (nOutput <= dest) + if (nOutput <= dest && nOutput != PLUGINDEX_INVALID) { pSndFile->m_MixPlugins[dest].SetOutputToMaster(); } Modified: trunk/OpenMPT/mptrack/Vstplug.cpp =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.cpp 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/Vstplug.cpp 2012-03-07 18:55:58 UTC (rev 1206) @@ -836,10 +836,13 @@ return ToVstPtr(&timeInfo); } - // VstEvents* in <ptr> - // We don't support plugs that send VSTEvents to the host + // Receive MIDI events from plugin case audioMasterProcessEvents: - Log("VST plugin to host: Process Events\n"); + if(pVstPlugin != nullptr && ptr != nullptr) + { + pVstPlugin->ReceiveVSTEvents(reinterpret_cast<VstEvents *>(ptr)); + return 1; + } break; // DEPRECATED in VST 2.4 @@ -1011,8 +1014,6 @@ // string in ptr, see below case audioMasterCanDo: //Other possible Can Do strings are: - //"receiveVstEvents", - //"receiveVstMidiEvent", //"receiveVstTimeInfo", //"asyncProcessing", //"offline", @@ -1025,6 +1026,8 @@ if ((strcmp((char*)ptr,"sendVstEvents") == 0 || strcmp((char*)ptr,"sendVstMidiEvent") == 0 || strcmp((char*)ptr,"sendVstTimeInfo") == 0 || + strcmp((char*)ptr,"receiveVstEvents") == 0 || + strcmp((char*)ptr,"receiveVstMidiEvent") == 0 || strcmp((char*)ptr,"supplyIdle") == 0 || strcmp((char*)ptr,"sizeWindow") == 0 || strcmp((char*)ptr,"openFileSelector") == 0 || @@ -1342,7 +1345,6 @@ m_pEditor = nullptr; m_nInputs = m_nOutputs = 0; m_nEditorX = m_nEditorY = -1; - m_pEvList = nullptr; m_pModDoc = nullptr; //rewbs.plugDocAware m_nPreviousMidiChan = nInvalidMidiChan; //rewbs.VSTCompliance m_pProcessFP = nullptr; @@ -1383,15 +1385,6 @@ void CVstPlugin::Initialize(CSoundFile* pSndFile) //----------------------------------------------- { - if (!m_pEvList) - { - m_pEvList = (VstEvents *)new char[sizeof(VstEvents)+sizeof(VstEvent*)*VSTEVENT_QUEUE_LEN]; - } - if (m_pEvList) - { - m_pEvList->numEvents = 0; - m_pEvList->reserved = 0; - } m_bNeedIdle=false; m_bRecordAutomation=false; m_bPassKeypressesToPlug=false; @@ -1553,9 +1546,6 @@ m_hLibrary = NULL; } - delete[] (char *)m_pEvList; - m_pEvList = nullptr; - CloseHandle(processCalled); } @@ -2004,38 +1994,57 @@ } +// Send events to plugin void CVstPlugin::ProcessVSTEvents() //--------------------------------- { // Process VST events - if ((m_pEffect) && (m_pEffect->dispatcher) && (m_pEvList) && (m_pEvList->numEvents > 0)) + if(m_pEffect != nullptr && m_pEffect->dispatcher != nullptr && vstEvents.Finalise() > 0) { try { - m_pEffect->dispatcher(m_pEffect, effProcessEvents, 0, 0, m_pEvList, 0); + m_pEffect->dispatcher(m_pEffect, effProcessEvents, 0, 0, &vstEvents, 0); } catch (...) { - CVstPluginManager::ReportPlugException("Exception in ProcessVSTEvents() (Plugin=%s, pEventList:%p, numEvents:%d, MidicodeCh:%d, MidicodeEv:%d, MidicodeNote:%d, MidiCodeVel:%d)\n", - m_pFactory->szLibraryName, m_pEvList, m_pEvList->numEvents, - (((VstMidiEvent *)(m_pEvList->events[0]))->midiData[0])&0x0f, - (((VstMidiEvent *)(m_pEvList->events[0]))->midiData[0])&0xf0, - (((VstMidiEvent *)(m_pEvList->events[0]))->midiData[1])&0xff, - (((VstMidiEvent *)(m_pEvList->events[0]))->midiData[2])&0xff); + CVstPluginManager::ReportPlugException("Exception in ProcessVSTEvents() (Plugin=%s, numEvents:%d, MidicodeCh:%d, MidicodeEv:%d, MidicodeNote:%d, MidiCodeVel:%d)\n", + m_pFactory->szLibraryName, vstEvents.numEvents, + (((VstMidiEvent *)(vstEvents.events[0]))->midiData[0]) & 0x0f, + (((VstMidiEvent *)(vstEvents.events[0]))->midiData[0]) & 0xf0, + (((VstMidiEvent *)(vstEvents.events[0]))->midiData[1]) & 0xff, + (((VstMidiEvent *)(vstEvents.events[0]))->midiData[2]) & 0xff); } } - } -void CVstPlugin::ClearVSTEvents() -//------------------------------- + +// Receive events from plugin and send them to the next plugin in the chain. +void CVstPlugin::ReceiveVSTEvents(const VstEvents *events) const +//-------------------------------------------------------------- { - // Clear VST events - if ((m_pEvList) && (m_pEvList->numEvents > 0)) + if(m_pSndFile == nullptr || m_pMixStruct == nullptr) { - m_pEvList->numEvents = 0; + return; } + + // I think we should only route events to plugins that are explicitely specified as output plugins of the current plugin. + PLUGINDEX receiver = m_pMixStruct->GetOutputPlugin(); + + if(receiver != PLUGINDEX_INVALID) + { + SNDMIXPLUGIN &mixPlug = m_pSndFile->m_MixPlugins[receiver]; + CVstPlugin *vstPlugin = dynamic_cast<CVstPlugin *>(mixPlug.pMixPlugin); + if(vstPlugin != nullptr) + { + // Add all events to the plugin's queue. + for(VstInt32 i = 0; i < events->numEvents; i++) + { + vstPlugin->vstEvents.Enqueue(*events->events[i]); + } + } + } } + void CVstPlugin::RecalculateGain() //-------------------------------- { @@ -2093,7 +2102,7 @@ Bypass(); CString processMethod = (m_pEffect->flags & effFlagsCanReplacing) ? "processReplacing" : "process"; CVstPluginManager::ReportPlugException("The plugin %s threw an exception in %s. It has automatically been set to \"Bypass\".", m_pMixStruct->GetName(), processMethod); - ClearVSTEvents(); + vstEvents.Clear(); // SetEvent(processCalled); } @@ -2143,7 +2152,7 @@ } } - ClearVSTEvents(); + vstEvents.Clear(); //SetEvent(processCalled); } @@ -2271,52 +2280,28 @@ bool CVstPlugin::MidiSend(DWORD dwMidiCode) //----------------------------------------- { - if ((m_pEvList) && (m_pEvList->numEvents < VSTEVENT_QUEUE_LEN-1)) - { - int insertPos; - if ((dwMidiCode & 0xF0) == 0x80) - { - // noteoffs go at the start of the queue. - if (m_pEvList->numEvents) - { - for (int i=m_pEvList->numEvents; i>=1; i--) - { - m_pEvList->events[i] = m_pEvList->events[i-1]; - } - } - insertPos=0; - } else - { - insertPos=m_pEvList->numEvents; - } + // Note-Offs go at the start of the queue. + bool insertAtFront = ((dwMidiCode & 0xF0) == 0x80); - VstMidiEvent *pev = &m_ev_queue[m_pEvList->numEvents]; - m_pEvList->events[insertPos] = (VstEvent *)pev; - pev->type = kVstMidiType; - pev->byteSize = 24; - pev->deltaFrames = 0; - pev->flags = 0; - pev->noteLength = 0; - pev->noteOffset = 0; - pev->detune = 0; - pev->noteOffVelocity = 0; - pev->reserved1 = 0; - pev->reserved2 = 0; - *(DWORD *)pev->midiData = dwMidiCode; - m_pEvList->numEvents++; + VstMidiEvent event; + MemsetZero(event); + event.type = kVstMidiType; + event.byteSize = 24; + event.deltaFrames = 0; + event.flags = 0; + event.noteLength = 0; + event.noteOffset = 0; + event.detune = 0; + event.noteOffVelocity = 0; + event.reserved1 = 0; + event.reserved2 = 0; + *(DWORD *)event.midiData = dwMidiCode; + #ifdef VST_LOG - Log("Sending Midi %02X.%02X.%02X\n", pev->midiData[0]&0xff, pev->midiData[1]&0xff, pev->midiData[2]&0xff); + Log("Sending Midi %02X.%02X.%02X\n", event.midiData[0]&0xff, event.midiData[1]&0xff, event.midiData[2]&0xff); #endif - return true; //rewbs.instroVST - } - else - { - Log("VST Event queue overflow!\n"); - m_pEvList->numEvents = VSTEVENT_QUEUE_LEN-1; - - return false; //rewbs.instroVST - } + return vstEvents.Enqueue(event, insertAtFront); } //rewbs.VSTiNoteHoldonStopFix @@ -2523,7 +2508,7 @@ } else { // VST event queue overflow, no point in submitting more note offs. - break; //todo: secondary buffer? + break; //todo: secondary buffer? } } } @@ -2962,10 +2947,10 @@ list.RemoveAll(); CVstPlugin *pOutputPlug = NULL; - if (!m_pMixStruct->IsOutputToMaster()) + if(!m_pMixStruct->IsOutputToMaster()) { PLUGINDEX nOutput = m_pMixStruct->GetOutputPlugin(); - if (m_pSndFile && (nOutput > m_nSlot) && (nOutput < MAX_MIXPLUGINS)) + if(m_pSndFile && nOutput > m_nSlot && nOutput != PLUGINDEX_INVALID) { pOutputPlug = reinterpret_cast<CVstPlugin *>(m_pSndFile->m_MixPlugins[nOutput].pMixPlugin); } Modified: trunk/OpenMPT/mptrack/Vstplug.h =================================================================== --- trunk/OpenMPT/mptrack/Vstplug.h 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/Vstplug.h 2012-03-07 18:55:58 UTC (rev 1206) @@ -64,6 +64,11 @@ } VSTINSTCH, *PVSTINSTCH; +#ifndef NO_VST +#include "../soundlib/PluginEventQueue.h" +#endif // NO_VST + + //================================= class CVstPlugin: public IMixPlugin //================================= @@ -72,8 +77,12 @@ friend class CVstPluginManager; #ifndef NO_VST protected: - enum {VSTEVENT_QUEUE_LEN=256}; + enum + { + VstEventQueueLength = 256, + }; + ULONG m_nRefCount; CVstPlugin *m_pNext, *m_pPrev; HINSTANCE m_hLibrary; @@ -87,14 +96,9 @@ bool m_bIsVst2; SNDMIXPLUGINSTATE m_MixState; UINT m_nInputs, m_nOutputs; - VstEvents *m_pEvList; VSTINSTCH m_MidiCh[16]; short m_nMidiPitchBendPos[16]; - int m_MixBuffer[MIXBUFFERSIZE * 2 + 2]; // Stereo interleaved - PluginMixBuffer<float, MIXBUFFERSIZE> mixBuffer; // Float buffers (input and output) for plugins - - VstMidiEvent m_ev_queue[VSTEVENT_QUEUE_LEN]; CModDoc* m_pModDoc; //rewbs.plugDocAware CSoundFile* m_pSndFile; //rewbs.plugDocAware // PSNDMIXPLUGIN m_pSndMixPlugin; //rewbs.plugDocAware @@ -111,6 +115,10 @@ int m_nEditorX, m_nEditorY; + PluginMixBuffer<float, MIXBUFFERSIZE> mixBuffer; // Float buffers (input and output) for plugins + int m_MixBuffer[MIXBUFFERSIZE * 2 + 2]; // Stereo interleaved + VSTEventBlock<VstEventQueueLength> vstEvents; // MIDI events that should be sent to the plugin + public: CVstPlugin(HINSTANCE hLibrary, VSTPLUGINLIB *pFactory, SNDMIXPLUGIN *pMixPlugin, AEffect *pEffect); virtual ~CVstPlugin(); @@ -177,8 +185,6 @@ int Release(); void SaveAllParameters(); void RestoreAllParameters(long nProg=-1); //rewbs.plugDefaultProgram - added param - void ProcessVSTEvents(); //rewbs.VSTiNoteHoldonStopFix - void ClearVSTEvents(); //rewbs.VSTiNoteHoldonStopFix void RecalculateGain(); void Process(float *pOutL, float *pOutR, size_t nSamples); void Init(unsigned long nFreq, int bReset); @@ -218,6 +224,10 @@ // Set up input / output buffers. bool InitializeIOBuffers(); + // Process incoming and outgoing VST events. + void ProcessVSTEvents(); + void ReceiveVSTEvents(const VstEvents *events) const; + void ProcessMixOps(float *pOutL, float *pOutR, size_t nSamples); #else // case: NO_VST Modified: trunk/OpenMPT/mptrack/mptrack.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack.vcproj 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/mptrack.vcproj 2012-03-07 18:55:58 UTC (rev 1206) @@ -849,6 +849,9 @@ RelativePath=".\PSRatioCalc.h"> </File> <File + RelativePath=".\soundlib\PluginEventQueue.h"> + </File> + <File RelativePath=".\soundlib\PluginMixBuffer.h"> </File> <File Modified: trunk/OpenMPT/mptrack/mptrack_08.vcproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_08.vcproj 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/mptrack_08.vcproj 2012-03-07 18:55:58 UTC (rev 1206) @@ -1127,6 +1127,10 @@ > </File> <File + RelativePath=".\soundlib\PluginEventQueue.h" + > + </File> + <File RelativePath=".\soundlib\PluginMixBuffer.h" > </File> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj 2012-03-07 18:55:58 UTC (rev 1206) @@ -333,6 +333,7 @@ <ClInclude Include="..\soundlib\ModChannel.h" /> <ClInclude Include="..\soundlib\ModInstrument.h" /> <ClInclude Include="..\soundlib\ModSample.h" /> + <ClInclude Include="..\soundlib\PluginEventQueue.h" /> <ClInclude Include="..\soundlib\PluginMixBuffer.h" /> <ClInclude Include="..\soundlib\PlugInterface.h" /> <ClInclude Include="ACMConvert.h" /> Modified: trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters =================================================================== --- trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/mptrack_10.vcxproj.filters 2012-03-07 18:55:58 UTC (rev 1206) @@ -783,6 +783,9 @@ <ClInclude Include="PatternCursor.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="..\soundlib\PluginEventQueue.h"> + <Filter>Header Files</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <None Include="res\bitmap1.bmp"> Modified: trunk/OpenMPT/mptrack/version.h =================================================================== --- trunk/OpenMPT/mptrack/version.h 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/mptrack/version.h 2012-03-07 18:55:58 UTC (rev 1206) @@ -19,7 +19,7 @@ #define VER_MAJORMAJOR 1 #define VER_MAJOR 20 #define VER_MINOR 00 -#define VER_MINORMINOR 74 +#define VER_MINORMINOR 75 //Creates version number from version parts that appears in version string. //For example MAKE_VERSION_NUMERIC(1,17,02,28) gives version number of Modified: trunk/OpenMPT/soundlib/Fastmix.cpp =================================================================== --- trunk/OpenMPT/soundlib/Fastmix.cpp 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/soundlib/Fastmix.cpp 2012-03-07 18:55:58 UTC (rev 1206) @@ -1772,8 +1772,8 @@ if (!plugin.IsOutputToMaster()) { PLUGINDEX nOutput = plugin.GetOutputPlugin(); - if ((nOutput > iDoPlug) && (nOutput < MAX_MIXPLUGINS) - && (m_MixPlugins[nOutput].pMixState)) + if(nOutput > iDoPlug && nOutput != PLUGINDEX_INVALID + && m_MixPlugins[nOutput].pMixState != nullptr) { SNDMIXPLUGINSTATE *pOutState = m_MixPlugins[nOutput].pMixState; Modified: trunk/OpenMPT/soundlib/PlugInterface.h =================================================================== --- trunk/OpenMPT/soundlib/PlugInterface.h 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/soundlib/PlugInterface.h 2012-03-07 18:55:58 UTC (rev 1206) @@ -171,7 +171,7 @@ bool IsOutputToMaster() const { return Info.dwOutputRouting == 0; }; PLUGINDEX GetOutputPlugin() const - { return Info.dwOutputRouting >= 0x80 ? static_cast<PLUGINDEX>(Info.dwOutputRouting - 0x80) : MAX_MIXPLUGINS; }; + { return Info.dwOutputRouting >= 0x80 ? static_cast<PLUGINDEX>(Info.dwOutputRouting - 0x80) : PLUGINDEX_INVALID; }; // Output routing setters void SetOutputToMaster() Added: trunk/OpenMPT/soundlib/PluginEventQueue.h =================================================================== --- trunk/OpenMPT/soundlib/PluginEventQueue.h (rev 0) +++ trunk/OpenMPT/soundlib/PluginEventQueue.h 2012-03-07 18:55:58 UTC (rev 1206) @@ -0,0 +1,108 @@ +/* + * PluginEventQueue.h + * ------------------ + * Purpose: Alternative, easy to use implementation of the VST event queue mechanism. + * Notes : (currently none) + * Authors: OpenMPT Devs + * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. + */ + + +#pragma once + +// Copied packing options from affectx.h +#if TARGET_API_MAC_CARBON + #ifdef __LP64__ + #pragma options align=power + #else + #pragma options align=mac68k + #endif +#elif defined __BORLANDC__ + #pragma -a8 +#elif defined(__GNUC__) + #pragma pack(push,8) +#elif defined(WIN32) || defined(__FLAT__) + #pragma pack(push) + #pragma pack(8) +#endif + +#include <deque> + +// Alternative, easy to use implementation of VstEvents struct. +template <size_t N> +struct VSTEventBlock +{ + typedef VstMidiEvent BiggestVstEvent; + static_assert(sizeof(BiggestVstEvent) >= sizeof(VstEvent) + && sizeof(BiggestVstEvent) >= sizeof(VstMidiEvent) + && sizeof(BiggestVstEvent) >= sizeof(VstMidiSysexEvent), + "Check typedef above, BiggestVstEvent must be the biggest VstEvent struct."); + + VstInt32 numEvents; ///< number of Events in array + VstIntPtr reserved; ///< zero (Reserved for future use) + VstEvent* events[N]; ///< event pointer array + std::deque<BiggestVstEvent> eventQueue; // Here we store our events. + + VSTEventBlock() + { + numEvents = 0; + reserved = nullptr; + MemsetZero(events); + } + + // Add a VST event to the queue. Returns true on success. + bool Enqueue(const VstEvent &event, bool insertFront = false) + { + VstMidiEvent midiEvent; + memcpy(&midiEvent, &event, sizeof(event)); + return Enqueue(midiEvent, insertFront); + } + bool Enqueue(const VstMidiEvent &event, bool insertFront = false) + { + static_assert(sizeof(BiggestVstEvent) <= sizeof(VstMidiEvent), "Also check implementation here."); + if(insertFront) + { + eventQueue.push_front(event); + } else + { + eventQueue.push_back(event); + } + return true; + } + bool Enqueue(const VstMidiSysexEvent &event, bool insertFront = false) + { + VstMidiEvent midiEvent; + memcpy(&midiEvent, &event, sizeof(event)); + return Enqueue(midiEvent, insertFront); + } + + // Set up the queue for transmitting to the plugin. Returns number of elements that are going to be transmitted. + VstInt32 Finalise() + { + numEvents = min(eventQueue.size(), N); + for(VstInt32 i = 0; i < numEvents; i++) + { + events[i] = reinterpret_cast<VstEvent *>(&eventQueue[i]); + } + return numEvents; + } + + // Remove transmitted events from the queue + void Clear() + { + if(numEvents) + { + eventQueue.erase(eventQueue.begin(), eventQueue.begin() + numEvents); + numEvents = 0; + } + } + +}; + +#if TARGET_API_MAC_CARBON + #pragma options align=reset +#elif defined(WIN32) || defined(__FLAT__) || defined(__GNUC__) + #pragma pack(pop) +#elif defined __BORLANDC__ + #pragma -a- +#endif Modified: trunk/OpenMPT/soundlib/Snd_defs.h =================================================================== --- trunk/OpenMPT/soundlib/Snd_defs.h 2012-03-07 14:42:40 UTC (rev 1205) +++ trunk/OpenMPT/soundlib/Snd_defs.h 2012-03-07 18:55:58 UTC (rev 1206) @@ -30,6 +30,7 @@ const PATTERNINDEX PATTERNINDEX_MAX = uint16_max; const PATTERNINDEX PATTERNINDEX_INVALID = PATTERNINDEX_MAX; typedef uint8 PLUGINDEX; + const PLUGINDEX PLUGINDEX_INVALID = uint8_max; typedef uint16 TEMPO; typedef uint16 SAMPLEINDEX; const SAMPLEINDEX SAMPLEINDEX_MAX = uint16_max; @@ -293,31 +294,34 @@ #define SYSMIX_SSE 0x20 // Processor supports SSE instructions // Module flags -#define SONG_EMBEDMIDICFG 0x0001 // Embed macros in file -#define SONG_FASTVOLSLIDES 0x0002 // Old Scream Tracker 3.0 volume slides -#define SONG_ITOLDEFFECTS 0x0004 // Old Impulse Tracker effect implementations -#define SONG_ITCOMPATGXX 0x0008 // IT "Compatible Gxx" (IT's flag to behave more like other trackers w/r/t portamento effects) -#define SONG_LINEARSLIDES 0x0010 // Linear slides vs. Amiga slides -#define SONG_PATTERNLOOP 0x0020 // Loop current pattern (pattern editor) -#define SONG_STEP 0x0040 // Song is in "step" mode (pattern editor) -#define SONG_PAUSED 0x0080 // Song is paused -#define SONG_FADINGSONG 0x0100 // Song is fading out -#define SONG_ENDREACHED 0x0200 // Song is finished -#define SONG_GLOBALFADE 0x0400 // Song is fading out -#define SONG_CPUVERYHIGH 0x0800 // High CPU usage -#define SONG_FIRSTTICK 0x1000 // Is set when the current tick is the first tick of the row -#define SONG_MPTFILTERMODE 0x2000 // Local filter mode (reset filter on each note) -#define SONG_SURROUNDPAN 0x4000 // Pan in the rear channels -#define SONG_EXFILTERRANGE 0x8000 // Cutoff Filter has double frequency range (up to ~10Khz) -#define SONG_AMIGALIMITS 0x10000 // Enforce amiga frequency limits -// -> CODE#0023 -// -> DESC="IT project files (.itp)" -#define SONG_ITPROJECT 0x20000 // Is a project file -#define SONG_ITPEMBEDIH 0x40000 // Embed instrument headers in project file -// -! NEW_FEATURE#0023 -#define SONG_BREAKTOROW 0x80000 // Break to row command encountered (internal flag, do not touch) -#define SONG_POSJUMP 0x100000 // Position jump encountered (internal flag, do not touch) -#define SONG_PT1XMODE 0x200000 // ProTracker 1.x playback mode +enum SongFlags +{ + SONG_EMBEDMIDICFG = 0x0001, // Embed macros in file + SONG_FASTVOLSLIDES = 0x0002, // Old Scream Tracker 3.0 volume slides + SONG_ITOLDEFFECTS = 0x0004, // Old Impulse Tracker effect implementations + SONG_ITCOMPATGXX = 0x0008, // IT "Compatible Gxx" (IT's flag to behave more like other trackers w/r/t portamento effects) + SONG_LINEARSLIDES = 0x0010, // Linear slides vs. Amiga slides + SONG_PATTERNLOOP = 0x0020, // Loop current pattern (pattern editor) + SONG_STEP = 0x0040, // Song is in "step" mode (pattern editor) + SONG_PAUSED = 0x0080, // Song is paused + SONG_FADINGSONG = 0x0100, // Song is fading out + SONG_ENDREACHED = 0x0200, // Song is finished + SONG_GLOBALFADE = 0x0400, // Song is fading out + SONG_CPUVERYHIGH = 0x0800, // High CPU usage + SONG_FIRSTTICK = 0x1000, // Is set when the current tick is the first tick of the row + SONG_MPTFILTERMODE = 0x2000, // Local filter mode (reset filter on each note) + SONG_SURROUNDPAN = 0x4000, // Pan in the rear channels + SONG_EXFILTERRANGE = 0x8000, // Cutoff Filter has double frequency range (up to ~10Khz) + SONG_AMIGALIMITS = 0x10000, // Enforce amiga frequency limits + // -> CODE#0023 + // -> DESC="IT project files (.itp)" + SONG_ITPROJECT = 0x20000, // Is a project file + SONG_ITPEMBEDIH = 0x40000, // Embed instrument headers in project file + // -! NEW_FEATURE#0023 + SONG_BREAKTOROW = 0x80000, // Break to row command encountered (internal flag, do not touch) + SONG_POSJUMP = 0x100000, // Position jump encountered (internal flag, do not touch) + SONG_PT1XMODE = 0x200000, // ProTracker 1.x playback mode +}; #define SONG_FILE_FLAGS (SONG_EMBEDMIDICFG|SONG_FASTVOLSLIDES|SONG_ITOLDEFFECTS|SONG_ITCOMPATGXX|SONG_LINEARSLIDES|SONG_EXFILTERRANGE|SONG_AMIGALIMITS|SONG_ITPROJECT|SONG_ITPEMBEDIH|SONG_PT1XMODE) #define SONG_PLAY_FLAGS (~SONG_FILE_FLAGS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |