123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- #pragma once
- #include "openmpt/all/BuildSettings.hpp"
- #include "../Snd_defs.h"
- #ifndef NO_PLUGINS
- #include "openmpt/base/Endian.hpp"
- #endif
- OPENMPT_NAMESPACE_BEGIN
- using PlugParamIndex = uint32;
- using PlugParamValue = float;
- struct SNDMIXPLUGINSTATE;
- struct SNDMIXPLUGIN;
- class IMixPlugin;
- class CSoundFile;
- #ifndef NO_PLUGINS
- struct SNDMIXPLUGININFO
- {
-
- enum RoutingFlags
- {
- irApplyToMaster = 0x01,
- irBypass = 0x02,
- irWetMix = 0x04,
- irExpandMix = 0x08,
- irAutoSuspend = 0x10,
- };
- int32le dwPluginId1;
- int32le dwPluginId2;
- uint8le routingFlags;
- uint8le mixMode;
- uint8le gain;
- uint8le reserved;
- uint32le dwOutputRouting;
- uint32le dwReserved[4];
- mpt::modecharbuf<32, mpt::String::nullTerminated> szName;
- mpt::modecharbuf<64, mpt::String::nullTerminated> szLibraryName;
-
- void SetBypass(bool bypass = true) { if(bypass) routingFlags |= irBypass; else routingFlags &= uint8(~irBypass); }
- };
- MPT_BINARY_STRUCT(SNDMIXPLUGININFO, 128)
- struct SNDMIXPLUGIN
- {
- IMixPlugin *pMixPlugin = nullptr;
- std::vector<std::byte> pluginData;
- SNDMIXPLUGININFO Info = {};
- float fDryRatio = 0;
- int32 defaultProgram = 0;
- int32 editorX = 0, editorY = 0;
- #if defined(MPT_ENABLE_CHARSET_LOCALE)
- const char * GetNameLocale() const
- {
- return Info.szName.buf;
- }
- mpt::ustring GetName() const
- {
- return mpt::ToUnicode(mpt::Charset::Locale, Info.szName);
- }
- #endif
- mpt::ustring GetLibraryName() const
- {
- return mpt::ToUnicode(mpt::Charset::UTF8, Info.szLibraryName);
- }
-
- bool IsValidPlugin() const { return (Info.dwPluginId1 | Info.dwPluginId2) != 0; }
-
- uint8 GetGain() const
- { return Info.gain; }
- uint8 GetMixMode() const
- { return Info.mixMode; }
- bool IsMasterEffect() const
- { return (Info.routingFlags & SNDMIXPLUGININFO::irApplyToMaster) != 0; }
- bool IsWetMix() const
- { return (Info.routingFlags & SNDMIXPLUGININFO::irWetMix) != 0; }
- bool IsExpandedMix() const
- { return (Info.routingFlags & SNDMIXPLUGININFO::irExpandMix) != 0; }
- bool IsBypassed() const
- { return (Info.routingFlags & SNDMIXPLUGININFO::irBypass) != 0; }
- bool IsAutoSuspendable() const
- { return (Info.routingFlags & SNDMIXPLUGININFO::irAutoSuspend) != 0; }
-
- void SetGain(uint8 gain);
- void SetMixMode(uint8 mixMode)
- { Info.mixMode = mixMode; }
- void SetMasterEffect(bool master = true)
- { if(master) Info.routingFlags |= SNDMIXPLUGININFO::irApplyToMaster; else Info.routingFlags &= uint8(~SNDMIXPLUGININFO::irApplyToMaster); }
- void SetWetMix(bool wetMix = true)
- { if(wetMix) Info.routingFlags |= SNDMIXPLUGININFO::irWetMix; else Info.routingFlags &= uint8(~SNDMIXPLUGININFO::irWetMix); }
- void SetExpandedMix(bool expanded = true)
- { if(expanded) Info.routingFlags |= SNDMIXPLUGININFO::irExpandMix; else Info.routingFlags &= uint8(~SNDMIXPLUGININFO::irExpandMix); }
- void SetBypass(bool bypass = true);
- void SetAutoSuspend(bool suspend = true)
- { if(suspend) Info.routingFlags |= SNDMIXPLUGININFO::irAutoSuspend; else Info.routingFlags &= uint8(~SNDMIXPLUGININFO::irAutoSuspend); }
-
- bool IsOutputToMaster() const
- { return Info.dwOutputRouting == 0; }
- PLUGINDEX GetOutputPlugin() const
- { return Info.dwOutputRouting >= 0x80 ? static_cast<PLUGINDEX>(Info.dwOutputRouting - 0x80) : PLUGINDEX_INVALID; }
-
- void SetOutputToMaster()
- { Info.dwOutputRouting = 0; }
- void SetOutputPlugin(PLUGINDEX plugin)
- { if(plugin < MAX_MIXPLUGINS) Info.dwOutputRouting = plugin + 0x80; else Info.dwOutputRouting = 0; }
- void Destroy();
- };
- bool CreateMixPluginProc(SNDMIXPLUGIN &mixPlugin, CSoundFile &sndFile);
- #endif
- OPENMPT_NAMESPACE_END
|