Browse Source

Bring back just vst2 support

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 5 years ago
parent
commit
d5cebe287b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
6 changed files with 963 additions and 433 deletions
  1. +1
    -1
      source/modules/AppConfig.h
  2. +131
    -131
      source/modules/juce_audio_processors/format_types/juce_VSTCommon.h
  3. +529
    -0
      source/modules/juce_audio_processors/format_types/juce_VSTInterface.h
  4. +38
    -38
      source/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h
  5. +260
    -263
      source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
  6. +4
    -0
      source/modules/juce_core/native/juce_posix_SharedCode.h

+ 1
- 1
source/modules/AppConfig.h View File

@@ -216,7 +216,7 @@
@see VSTPluginFormat, AudioPluginFormat, AudioPluginFormatManager, JUCE_PLUGINHOST_AU
*/
#if defined(APPCONFIG_OS_MAC) || defined(APPCONFIG_OS_WIN)
# define JUCE_PLUGINHOST_VST 0 /* FIXME use old juce vst2 code or vestige */
# define JUCE_PLUGINHOST_VST 1
#else
# define JUCE_PLUGINHOST_VST 0
#endif


+ 131
- 131
source/modules/juce_audio_processors/format_types/juce_VSTCommon.h View File

@@ -58,25 +58,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
static AudioChannelSet vstArrangementTypeToChannelSet (int32 arr, int fallbackNumChannels)
{
if (arr == Vst2::kSpeakerArrEmpty) return AudioChannelSet::disabled();
else if (arr == Vst2::kSpeakerArrMono) return AudioChannelSet::mono();
else if (arr == Vst2::kSpeakerArrStereo) return AudioChannelSet::stereo();
else if (arr == Vst2::kSpeakerArr30Cine) return AudioChannelSet::createLCR();
else if (arr == Vst2::kSpeakerArr30Music) return AudioChannelSet::createLRS();
else if (arr == Vst2::kSpeakerArr40Cine) return AudioChannelSet::createLCRS();
else if (arr == Vst2::kSpeakerArr50) return AudioChannelSet::create5point0();
else if (arr == Vst2::kSpeakerArr51) return AudioChannelSet::create5point1();
else if (arr == Vst2::kSpeakerArr60Cine) return AudioChannelSet::create6point0();
else if (arr == Vst2::kSpeakerArr61Cine) return AudioChannelSet::create6point1();
else if (arr == Vst2::kSpeakerArr60Music) return AudioChannelSet::create6point0Music();
else if (arr == Vst2::kSpeakerArr61Music) return AudioChannelSet::create6point1Music();
else if (arr == Vst2::kSpeakerArr70Music) return AudioChannelSet::create7point0();
else if (arr == Vst2::kSpeakerArr70Cine) return AudioChannelSet::create7point0SDDS();
else if (arr == Vst2::kSpeakerArr71Music) return AudioChannelSet::create7point1();
else if (arr == Vst2::kSpeakerArr71Cine) return AudioChannelSet::create7point1SDDS();
else if (arr == Vst2::kSpeakerArr40Music) return AudioChannelSet::quadraphonic();
for (const Mapping* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m)
if (arr == Vst2::vstSpeakerConfigTypeEmpty) return AudioChannelSet::disabled();
else if (arr == Vst2::vstSpeakerConfigTypeMono) return AudioChannelSet::mono();
else if (arr == Vst2::vstSpeakerConfigTypeLR) return AudioChannelSet::stereo();
else if (arr == Vst2::vstSpeakerConfigTypeLRC) return AudioChannelSet::createLCR();
else if (arr == Vst2::vstSpeakerConfigTypeLRS) return AudioChannelSet::createLRS();
else if (arr == Vst2::vstSpeakerConfigTypeLRCS) return AudioChannelSet::createLCRS();
else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRs) return AudioChannelSet::create5point0();
else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRs) return AudioChannelSet::create5point1();
else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsCs) return AudioChannelSet::create6point0();
else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs) return AudioChannelSet::create6point1();
else if (arr == Vst2::vstSpeakerConfigTypeLRLsRsSlSr) return AudioChannelSet::create6point0Music();
else if (arr == Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr) return AudioChannelSet::create6point1Music();
else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsSlSr) return AudioChannelSet::create7point0();
else if (arr == Vst2::vstSpeakerConfigTypeLRCLsRsLcRc) return AudioChannelSet::create7point0SDDS();
else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr) return AudioChannelSet::create7point1();
else if (arr == Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc) return AudioChannelSet::create7point1SDDS();
else if (arr == Vst2::vstSpeakerConfigTypeLRLsRs) return AudioChannelSet::quadraphonic();
for (const Mapping* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m)
{
if (m->vst2 == arr)
{
@@ -92,53 +92,53 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
return AudioChannelSet::discreteChannels (fallbackNumChannels);
}
static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerArrangement& arr)
static AudioChannelSet vstArrangementTypeToChannelSet (const Vst2::VstSpeakerConfiguration& arr)
{
return vstArrangementTypeToChannelSet (arr.type, arr.numChannels);
return vstArrangementTypeToChannelSet (arr.type, arr.numberOfChannels);
}
static int32 channelSetToVstArrangementType (AudioChannelSet channels)
{
if (channels == AudioChannelSet::disabled()) return Vst2::kSpeakerArrEmpty;
else if (channels == AudioChannelSet::mono()) return Vst2::kSpeakerArrMono;
else if (channels == AudioChannelSet::stereo()) return Vst2::kSpeakerArrStereo;
else if (channels == AudioChannelSet::createLCR()) return Vst2::kSpeakerArr30Cine;
else if (channels == AudioChannelSet::createLRS()) return Vst2::kSpeakerArr30Music;
else if (channels == AudioChannelSet::createLCRS()) return Vst2::kSpeakerArr40Cine;
else if (channels == AudioChannelSet::create5point0()) return Vst2::kSpeakerArr50;
else if (channels == AudioChannelSet::create5point1()) return Vst2::kSpeakerArr51;
else if (channels == AudioChannelSet::create6point0()) return Vst2::kSpeakerArr60Cine;
else if (channels == AudioChannelSet::create6point1()) return Vst2::kSpeakerArr61Cine;
else if (channels == AudioChannelSet::create6point0Music()) return Vst2::kSpeakerArr60Music;
else if (channels == AudioChannelSet::create6point1Music()) return Vst2::kSpeakerArr61Music;
else if (channels == AudioChannelSet::create7point0()) return Vst2::kSpeakerArr70Music;
else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::kSpeakerArr70Cine;
else if (channels == AudioChannelSet::create7point1()) return Vst2::kSpeakerArr71Music;
else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::kSpeakerArr71Cine;
else if (channels == AudioChannelSet::quadraphonic()) return Vst2::kSpeakerArr40Music;
if (channels == AudioChannelSet::disabled()) return Vst2::vstSpeakerConfigTypeEmpty;
else if (channels == AudioChannelSet::mono()) return Vst2::vstSpeakerConfigTypeMono;
else if (channels == AudioChannelSet::stereo()) return Vst2::vstSpeakerConfigTypeLR;
else if (channels == AudioChannelSet::createLCR()) return Vst2::vstSpeakerConfigTypeLRC;
else if (channels == AudioChannelSet::createLRS()) return Vst2::vstSpeakerConfigTypeLRS;
else if (channels == AudioChannelSet::createLCRS()) return Vst2::vstSpeakerConfigTypeLRCS;
else if (channels == AudioChannelSet::create5point0()) return Vst2::vstSpeakerConfigTypeLRCLsRs;
else if (channels == AudioChannelSet::create5point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRs;
else if (channels == AudioChannelSet::create6point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsCs;
else if (channels == AudioChannelSet::create6point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs;
else if (channels == AudioChannelSet::create6point0Music()) return Vst2::vstSpeakerConfigTypeLRLsRsSlSr;
else if (channels == AudioChannelSet::create6point1Music()) return Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr;
else if (channels == AudioChannelSet::create7point0()) return Vst2::vstSpeakerConfigTypeLRCLsRsSlSr;
else if (channels == AudioChannelSet::create7point0SDDS()) return Vst2::vstSpeakerConfigTypeLRCLsRsLcRc;
else if (channels == AudioChannelSet::create7point1()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr;
else if (channels == AudioChannelSet::create7point1SDDS()) return Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc;
else if (channels == AudioChannelSet::quadraphonic()) return Vst2::vstSpeakerConfigTypeLRLsRs;
if (channels == AudioChannelSet::disabled())
return Vst2::kSpeakerArrEmpty;
return Vst2::vstSpeakerConfigTypeEmpty;
auto chans = channels.getChannelTypes();
for (auto* m = getMappings(); m->vst2 != Vst2::kSpeakerArrEmpty; ++m)
for (auto* m = getMappings(); m->vst2 != Vst2::vstSpeakerConfigTypeEmpty; ++m)
if (m->matches (chans))
return m->vst2;
return Vst2::kSpeakerArrUserDefined;
return Vst2::vstSpeakerConfigTypeUser;
}
static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerArrangement& result)
static void channelSetToVstArrangement (const AudioChannelSet& channels, Vst2::VstSpeakerConfiguration& result)
{
result.type = channelSetToVstArrangementType (channels);
result.numChannels = channels.size();
result.numberOfChannels = channels.size();
for (int i = 0; i < result.numChannels; ++i)
for (int i = 0; i < result.numberOfChannels; ++i)
{
auto& speaker = result.speakers[i];
zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties));
zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo));
speaker.type = getSpeakerType (channels.getTypeOfChannel (i));
}
}
@@ -152,7 +152,7 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
clear();
}
VstSpeakerConfigurationHolder (const Vst2::VstSpeakerArrangement& vstConfig)
VstSpeakerConfigurationHolder (const Vst2::VstSpeakerConfiguration& vstConfig)
{
operator= (vstConfig);
}
@@ -171,29 +171,29 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
VstSpeakerConfigurationHolder (const AudioChannelSet& channels)
{
auto numberOfChannels = channels.size();
Vst2::VstSpeakerArrangement& dst = *allocate (numberOfChannels);
Vst2::VstSpeakerConfiguration& dst = *allocate (numberOfChannels);
dst.type = channelSetToVstArrangementType (channels);
dst.numChannels = numberOfChannels;
dst.numberOfChannels = numberOfChannels;
for (int i = 0; i < dst.numChannels; ++i)
for (int i = 0; i < dst.numberOfChannels; ++i)
{
Vst2::VstSpeakerProperties& speaker = dst.speakers[i];
Vst2::VstIndividualSpeakerInfo& speaker = dst.speakers[i];
zeromem (&speaker, sizeof (Vst2::VstSpeakerProperties));
zeromem (&speaker, sizeof (Vst2::VstIndividualSpeakerInfo));
speaker.type = getSpeakerType (channels.getTypeOfChannel (i));
}
}
VstSpeakerConfigurationHolder& operator= (const VstSpeakerConfigurationHolder& vstConfig) { return operator=(vstConfig.get()); }
VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerArrangement& vstConfig)
VstSpeakerConfigurationHolder& operator= (const Vst2::VstSpeakerConfiguration& vstConfig)
{
Vst2::VstSpeakerArrangement& dst = *allocate (vstConfig.numChannels);
Vst2::VstSpeakerConfiguration& dst = *allocate (vstConfig.numberOfChannels);
dst.type = vstConfig.type;
dst.numChannels = vstConfig.numChannels;
dst.numberOfChannels = vstConfig.numberOfChannels;
for (int i = 0; i < dst.numChannels; ++i)
for (int i = 0; i < dst.numberOfChannels; ++i)
dst.speakers[i] = vstConfig.speakers[i];
return *this;
@@ -207,17 +207,17 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
return *this;
}
const Vst2::VstSpeakerArrangement& get() const { return *storage.get(); }
const Vst2::VstSpeakerConfiguration& get() const { return *storage.get(); }
private:
JUCE_LEAK_DETECTOR (VstSpeakerConfigurationHolder)
HeapBlock<Vst2::VstSpeakerArrangement> storage;
HeapBlock<Vst2::VstSpeakerConfiguration> storage;
Vst2::VstSpeakerArrangement* allocate (int numChannels)
Vst2::VstSpeakerConfiguration* allocate (int numChannels)
{
auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstSpeakerProperties)
+ sizeof (Vst2::VstSpeakerArrangement);
auto arrangementSize = (size_t) (jmax (8, numChannels) - 8) * sizeof (Vst2::VstIndividualSpeakerInfo)
+ sizeof (Vst2::VstSpeakerConfiguration);
storage.malloc (1, arrangementSize);
return storage.get();
@@ -225,10 +225,10 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
void clear()
{
Vst2::VstSpeakerArrangement& dst = *allocate (0);
Vst2::VstSpeakerConfiguration& dst = *allocate (0);
dst.type = Vst2::kSpeakerArrEmpty;
dst.numChannels = 0;
dst.type = Vst2::vstSpeakerConfigTypeEmpty;
dst.numberOfChannels = 0;
}
};
@@ -236,36 +236,36 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
{
static const Mapping mappings[] =
{
{ Vst2::kSpeakerArrMono, { centre, unknown } },
{ Vst2::kSpeakerArrStereo, { left, right, unknown } },
{ Vst2::kSpeakerArrStereoSurround, { leftSurround, rightSurround, unknown } },
{ Vst2::kSpeakerArrStereoCenter, { leftCentre, rightCentre, unknown } },
{ Vst2::kSpeakerArrStereoSide, { leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::kSpeakerArrStereoCLfe, { centre, LFE, unknown } },
{ Vst2::kSpeakerArr30Cine, { left, right, centre, unknown } },
{ Vst2::kSpeakerArr30Music, { left, right, surround, unknown } },
{ Vst2::kSpeakerArr31Cine, { left, right, centre, LFE, unknown } },
{ Vst2::kSpeakerArr31Music, { left, right, LFE, surround, unknown } },
{ Vst2::kSpeakerArr40Cine, { left, right, centre, surround, unknown } },
{ Vst2::kSpeakerArr40Music, { left, right, leftSurround, rightSurround, unknown } },
{ Vst2::kSpeakerArr41Cine, { left, right, centre, LFE, surround, unknown } },
{ Vst2::kSpeakerArr41Music, { left, right, LFE, leftSurround, rightSurround, unknown } },
{ Vst2::kSpeakerArr50, { left, right, centre, leftSurround, rightSurround, unknown } },
{ Vst2::kSpeakerArr51, { left, right, centre, LFE, leftSurround, rightSurround, unknown } },
{ Vst2::kSpeakerArr60Cine, { left, right, centre, leftSurround, rightSurround, surround, unknown } },
{ Vst2::kSpeakerArr60Music, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::kSpeakerArr61Cine, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } },
{ Vst2::kSpeakerArr61Music, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::kSpeakerArr70Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
{ Vst2::kSpeakerArr70Music, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::kSpeakerArr71Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
{ Vst2::kSpeakerArr71Music, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::kSpeakerArr80Cine, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
{ Vst2::kSpeakerArr80Music, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::kSpeakerArr81Cine, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
{ Vst2::kSpeakerArr81Music, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::kSpeakerArr102, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } },
{ Vst2::kSpeakerArrEmpty, { unknown } }
{ Vst2::vstSpeakerConfigTypeMono, { centre, unknown } },
{ Vst2::vstSpeakerConfigTypeLR, { left, right, unknown } },
{ Vst2::vstSpeakerConfigTypeLsRs, { leftSurround, rightSurround, unknown } },
{ Vst2::vstSpeakerConfigTypeLcRc, { leftCentre, rightCentre, unknown } },
{ Vst2::vstSpeakerConfigTypeSlSr, { leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::vstSpeakerConfigTypeCLfe, { centre, LFE, unknown } },
{ Vst2::vstSpeakerConfigTypeLRC, { left, right, centre, unknown } },
{ Vst2::vstSpeakerConfigTypeLRS, { left, right, surround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfe, { left, right, centre, LFE, unknown } },
{ Vst2::vstSpeakerConfigTypeLRLfeS, { left, right, LFE, surround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCS, { left, right, centre, surround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRLsRs, { left, right, leftSurround, rightSurround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfeS, { left, right, centre, LFE, surround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRLfeLsRs, { left, right, LFE, leftSurround, rightSurround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLsRs, { left, right, centre, leftSurround, rightSurround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfeLsRs, { left, right, centre, LFE, leftSurround, rightSurround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLsRsCs, { left, right, centre, leftSurround, rightSurround, surround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRLsRsSlSr, { left, right, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfeLsRsCs, { left, right, centre, LFE, leftSurround, rightSurround, surround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRLfeLsRsSlSr, { left, right, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLsRsLcRc, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLsRsSlSr, { left, right, centre, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRc, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfeLsRsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLsRsLcRcCs, { left, right, centre, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLsRsCsSlSr, { left, right, centre, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfeLsRsLcRcCs, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontRight, surround, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfeLsRsCsSlSr, { left, right, centre, LFE, leftSurround, rightSurround, surround, leftSurroundRear, rightSurroundRear, unknown } },
{ Vst2::vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2, { left, right, centre, LFE, leftSurround, rightSurround, topFrontLeft, topFrontCentre, topFrontRight, topRearLeft, topRearRight, LFE2, unknown } },
{ Vst2::vstSpeakerConfigTypeEmpty, { unknown } }
};
return mappings;
@@ -275,25 +275,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
{
static const std::map<AudioChannelSet::ChannelType, int32> speakerTypeMap =
{
{ AudioChannelSet::left, Vst2::kSpeakerL },
{ AudioChannelSet::right, Vst2::kSpeakerR },
{ AudioChannelSet::centre, Vst2::kSpeakerC },
{ AudioChannelSet::LFE, Vst2::kSpeakerLfe },
{ AudioChannelSet::leftSurround, Vst2::kSpeakerLs },
{ AudioChannelSet::rightSurround, Vst2::kSpeakerRs },
{ AudioChannelSet::leftCentre, Vst2::kSpeakerLc },
{ AudioChannelSet::rightCentre, Vst2::kSpeakerRc },
{ AudioChannelSet::surround, Vst2::kSpeakerS },
{ AudioChannelSet::leftSurroundRear, Vst2::kSpeakerSl },
{ AudioChannelSet::rightSurroundRear, Vst2::kSpeakerSr },
{ AudioChannelSet::topMiddle, Vst2::kSpeakerTm },
{ AudioChannelSet::topFrontLeft, Vst2::kSpeakerTfl },
{ AudioChannelSet::topFrontCentre, Vst2::kSpeakerTfc },
{ AudioChannelSet::topFrontRight, Vst2::kSpeakerTfr },
{ AudioChannelSet::topRearLeft, Vst2::kSpeakerTrl },
{ AudioChannelSet::topRearCentre, Vst2::kSpeakerTrc },
{ AudioChannelSet::topRearRight, Vst2::kSpeakerTrr },
{ AudioChannelSet::LFE2, Vst2::kSpeakerLfe2 }
{ AudioChannelSet::left, Vst2::vstIndividualSpeakerTypeLeft },
{ AudioChannelSet::right, Vst2::vstIndividualSpeakerTypeRight },
{ AudioChannelSet::centre, Vst2::vstIndividualSpeakerTypeCentre },
{ AudioChannelSet::LFE, Vst2::vstIndividualSpeakerTypeLFE },
{ AudioChannelSet::leftSurround, Vst2::vstIndividualSpeakerTypeLeftSurround },
{ AudioChannelSet::rightSurround, Vst2::vstIndividualSpeakerTypeRightSurround },
{ AudioChannelSet::leftCentre, Vst2::vstIndividualSpeakerTypeLeftCentre },
{ AudioChannelSet::rightCentre, Vst2::vstIndividualSpeakerTypeRightCentre },
{ AudioChannelSet::surround, Vst2::vstIndividualSpeakerTypeSurround },
{ AudioChannelSet::leftSurroundRear, Vst2::vstIndividualSpeakerTypeLeftRearSurround },
{ AudioChannelSet::rightSurroundRear, Vst2::vstIndividualSpeakerTypeRightRearSurround },
{ AudioChannelSet::topMiddle, Vst2::vstIndividualSpeakerTypeTopMiddle },
{ AudioChannelSet::topFrontLeft, Vst2::vstIndividualSpeakerTypeTopFrontLeft },
{ AudioChannelSet::topFrontCentre, Vst2::vstIndividualSpeakerTypeTopFrontCentre },
{ AudioChannelSet::topFrontRight, Vst2::vstIndividualSpeakerTypeTopFrontRight },
{ AudioChannelSet::topRearLeft, Vst2::vstIndividualSpeakerTypeTopRearLeft },
{ AudioChannelSet::topRearCentre, Vst2::vstIndividualSpeakerTypeTopRearCentre },
{ AudioChannelSet::topRearRight, Vst2::vstIndividualSpeakerTypeTopRearRight },
{ AudioChannelSet::LFE2, Vst2::vstIndividualSpeakerTypeLFE2 }
};
if (speakerTypeMap.find (type) == speakerTypeMap.end())
@@ -306,25 +306,25 @@ struct SpeakerMappings : private AudioChannelSet // (inheritance only to give e
{
switch (type)
{
case Vst2::kSpeakerL: return AudioChannelSet::left;
case Vst2::kSpeakerR: return AudioChannelSet::right;
case Vst2::kSpeakerC: return AudioChannelSet::centre;
case Vst2::kSpeakerLfe: return AudioChannelSet::LFE;
case Vst2::kSpeakerLs: return AudioChannelSet::leftSurround;
case Vst2::kSpeakerRs: return AudioChannelSet::rightSurround;
case Vst2::kSpeakerLc: return AudioChannelSet::leftCentre;
case Vst2::kSpeakerRc: return AudioChannelSet::rightCentre;
case Vst2::kSpeakerS: return AudioChannelSet::surround;
case Vst2::kSpeakerSl: return AudioChannelSet::leftSurroundRear;
case Vst2::kSpeakerSr: return AudioChannelSet::rightSurroundRear;
case Vst2::kSpeakerTm: return AudioChannelSet::topMiddle;
case Vst2::kSpeakerTfl: return AudioChannelSet::topFrontLeft;
case Vst2::kSpeakerTfc: return AudioChannelSet::topFrontCentre;
case Vst2::kSpeakerTfr: return AudioChannelSet::topFrontRight;
case Vst2::kSpeakerTrl: return AudioChannelSet::topRearLeft;
case Vst2::kSpeakerTrc: return AudioChannelSet::topRearCentre;
case Vst2::kSpeakerTrr: return AudioChannelSet::topRearRight;
case Vst2::kSpeakerLfe2: return AudioChannelSet::LFE2;
case Vst2::vstIndividualSpeakerTypeLeft: return AudioChannelSet::left;
case Vst2::vstIndividualSpeakerTypeRight: return AudioChannelSet::right;
case Vst2::vstIndividualSpeakerTypeCentre: return AudioChannelSet::centre;
case Vst2::vstIndividualSpeakerTypeLFE: return AudioChannelSet::LFE;
case Vst2::vstIndividualSpeakerTypeLeftSurround: return AudioChannelSet::leftSurround;
case Vst2::vstIndividualSpeakerTypeRightSurround: return AudioChannelSet::rightSurround;
case Vst2::vstIndividualSpeakerTypeLeftCentre: return AudioChannelSet::leftCentre;
case Vst2::vstIndividualSpeakerTypeRightCentre: return AudioChannelSet::rightCentre;
case Vst2::vstIndividualSpeakerTypeSurround: return AudioChannelSet::surround;
case Vst2::vstIndividualSpeakerTypeLeftRearSurround: return AudioChannelSet::leftSurroundRear;
case Vst2::vstIndividualSpeakerTypeRightRearSurround: return AudioChannelSet::rightSurroundRear;
case Vst2::vstIndividualSpeakerTypeTopMiddle: return AudioChannelSet::topMiddle;
case Vst2::vstIndividualSpeakerTypeTopFrontLeft: return AudioChannelSet::topFrontLeft;
case Vst2::vstIndividualSpeakerTypeTopFrontCentre: return AudioChannelSet::topFrontCentre;
case Vst2::vstIndividualSpeakerTypeTopFrontRight: return AudioChannelSet::topFrontRight;
case Vst2::vstIndividualSpeakerTypeTopRearLeft: return AudioChannelSet::topRearLeft;
case Vst2::vstIndividualSpeakerTypeTopRearCentre: return AudioChannelSet::topRearCentre;
case Vst2::vstIndividualSpeakerTypeTopRearRight: return AudioChannelSet::topRearRight;
case Vst2::vstIndividualSpeakerTypeLFE2: return AudioChannelSet::LFE2;
default: break;
}


+ 529
- 0
source/modules/juce_audio_processors/format_types/juce_VSTInterface.h View File

@@ -0,0 +1,529 @@
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2017 - ROLI Ltd.
JUCE is an open source library subject to commercial or open-source
licensing.
By using JUCE, you agree to the terms of both the JUCE 5 End-User License
Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
27th April 2017).
End User License Agreement: www.juce.com/juce-5-licence
Privacy Policy: www.juce.com/juce-5-privacy-policy
Or: You may also use this code under the terms of the GPL v3 (see
www.gnu.org/licenses).
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
#define JUCE_VSTINTERFACE_H_INCLUDED
using namespace juce;
#if JUCE_MSVC
#define VSTINTERFACECALL __cdecl
#pragma pack(push)
#pragma pack(8)
#elif JUCE_MAC || JUCE_IOS
#define VSTINTERFACECALL
#if JUCE_64BIT
#pragma options align=power
#else
#pragma options align=mac68k
#endif
#else
#define VSTINTERFACECALL
#pragma pack(push, 8)
#endif
const int32 juceVstInterfaceVersion = 2400;
const int32 juceVstInterfaceIdentifier = 0x56737450; // The "magic" identifier in the SDK is 'VstP'.
//==============================================================================
/** Structure used for VSTs
@tags{Audio}
*/
struct VstEffectInterface
{
int32 interfaceIdentifier;
pointer_sized_int (VSTINTERFACECALL* dispatchFunction) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt);
void (VSTINTERFACECALL* processAudioFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples);
void (VSTINTERFACECALL* setParameterValueFunction) (VstEffectInterface*, int32 parameterIndex, float value);
float (VSTINTERFACECALL* getParameterValueFunction) (VstEffectInterface*, int32 parameterIndex);
int32 numPrograms;
int32 numParameters;
int32 numInputChannels;
int32 numOutputChannels;
int32 flags;
pointer_sized_int hostSpace1;
pointer_sized_int hostSpace2;
int32 latency;
int32 deprecated1;
int32 deprecated2;
float deprecated3;
void* effectPointer;
void* userPointer;
int32 plugInIdentifier;
int32 plugInVersion;
void (VSTINTERFACECALL* processAudioInplaceFunction) (VstEffectInterface*, float** inputs, float** outputs, int32 numSamples);
void (VSTINTERFACECALL* processDoubleAudioInplaceFunction) (VstEffectInterface*, double** inputs, double** outputs, int32 numSamples);
char emptySpace[56];
};
typedef pointer_sized_int (VSTINTERFACECALL* VstHostCallback) (VstEffectInterface*, int32 op, int32 index, pointer_sized_int value, void* ptr, float opt);
enum VstEffectInterfaceFlags
{
vstEffectFlagHasEditor = 1,
vstEffectFlagInplaceAudio = 16,
vstEffectFlagDataInChunks = 32,
vstEffectFlagIsSynth = 256,
vstEffectFlagInplaceDoubleAudio = 4096
};
//==============================================================================
enum VstHostToPlugInOpcodes
{
plugInOpcodeOpen,
plugInOpcodeClose,
plugInOpcodeSetCurrentProgram,
plugInOpcodeGetCurrentProgram,
plugInOpcodeSetCurrentProgramName,
plugInOpcodeGetCurrentProgramName,
plugInOpcodeGetParameterLabel,
plugInOpcodeGetParameterText,
plugInOpcodeGetParameterName,
plugInOpcodeSetSampleRate = plugInOpcodeGetParameterName + 2,
plugInOpcodeSetBlockSize,
plugInOpcodeResumeSuspend,
plugInOpcodeGetEditorBounds,
plugInOpcodeOpenEditor,
plugInOpcodeCloseEditor,
plugInOpcodeDrawEditor,
plugInOpcodeGetMouse,
plugInOpcodeEditorIdle = plugInOpcodeGetMouse + 2,
plugInOpcodeeffEditorTop,
plugInOpcodeSleepEditor,
plugInOpcodeIdentify,
plugInOpcodeGetData,
plugInOpcodeSetData,
plugInOpcodePreAudioProcessingEvents,
plugInOpcodeIsParameterAutomatable,
plugInOpcodeParameterValueForText,
plugInOpcodeGetProgramName = plugInOpcodeParameterValueForText + 2,
plugInOpcodeConnectInput = plugInOpcodeGetProgramName + 2,
plugInOpcodeConnectOutput,
plugInOpcodeGetInputPinProperties,
plugInOpcodeGetOutputPinProperties,
plugInOpcodeGetPlugInCategory,
plugInOpcodeSetSpeakerConfiguration = plugInOpcodeGetPlugInCategory + 7,
plugInOpcodeSetBypass = plugInOpcodeSetSpeakerConfiguration + 2,
plugInOpcodeGetPlugInName,
plugInOpcodeGetManufacturerName = plugInOpcodeGetPlugInName + 2,
plugInOpcodeGetManufacturerProductName,
plugInOpcodeGetManufacturerVersion,
plugInOpcodeManufacturerSpecific,
plugInOpcodeCanPlugInDo,
plugInOpcodeGetTailSize,
plugInOpcodeIdle,
plugInOpcodeKeyboardFocusRequired = plugInOpcodeIdle + 4,
plugInOpcodeGetVstInterfaceVersion,
plugInOpcodeGetCurrentMidiProgram = plugInOpcodeGetVstInterfaceVersion + 5,
plugInOpcodeGetSpeakerArrangement = plugInOpcodeGetCurrentMidiProgram + 6,
plugInOpcodeNextPlugInUniqueID,
plugInOpcodeStartProcess,
plugInOpcodeStopProcess,
plugInOpcodeSetNumberOfSamplesToProcess,
plugInOpcodeSetSampleFloatType = plugInOpcodeSetNumberOfSamplesToProcess + 4,
pluginOpcodeGetNumMidiInputChannels,
pluginOpcodeGetNumMidiOutputChannels,
plugInOpcodeMaximum = pluginOpcodeGetNumMidiOutputChannels
};
enum VstPlugInToHostOpcodes
{
hostOpcodeParameterChanged,
hostOpcodeVstVersion,
hostOpcodeCurrentId,
hostOpcodeIdle,
hostOpcodePinConnected,
hostOpcodePlugInWantsMidi = hostOpcodePinConnected + 2,
hostOpcodeGetTimingInfo,
hostOpcodePreAudioProcessingEvents,
hostOpcodeSetTime,
hostOpcodeTempoAt,
hostOpcodeGetNumberOfAutomatableParameters,
hostOpcodeGetParameterInterval,
hostOpcodeIOModified,
hostOpcodeNeedsIdle,
hostOpcodeWindowSize,
hostOpcodeGetSampleRate,
hostOpcodeGetBlockSize,
hostOpcodeGetInputLatency,
hostOpcodeGetOutputLatency,
hostOpcodeGetPreviousPlugIn,
hostOpcodeGetNextPlugIn,
hostOpcodeWillReplace,
hostOpcodeGetCurrentAudioProcessingLevel,
hostOpcodeGetAutomationState,
hostOpcodeOfflineStart,
hostOpcodeOfflineReadSource,
hostOpcodeOfflineWrite,
hostOpcodeOfflineGetCurrentPass,
hostOpcodeOfflineGetCurrentMetaPass,
hostOpcodeSetOutputSampleRate,
hostOpcodeGetOutputSpeakerConfiguration,
hostOpcodeGetManufacturerName,
hostOpcodeGetProductName,
hostOpcodeGetManufacturerVersion,
hostOpcodeManufacturerSpecific,
hostOpcodeSetIcon,
hostOpcodeCanHostDo,
hostOpcodeGetLanguage,
hostOpcodeOpenEditorWindow,
hostOpcodeCloseEditorWindow,
hostOpcodeGetDirectory,
hostOpcodeUpdateView,
hostOpcodeParameterChangeGestureBegin,
hostOpcodeParameterChangeGestureEnd,
};
//==============================================================================
enum VstProcessingSampleType
{
vstProcessingSampleTypeFloat,
vstProcessingSampleTypeDouble
};
//==============================================================================
// These names must be identical to the Steinberg SDK so JUCE users can set
// exactly what they want.
enum VstPlugInCategory
{
kPlugCategUnknown,
kPlugCategEffect,
kPlugCategSynth,
kPlugCategAnalysis,
kPlugCategMastering,
kPlugCategSpacializer,
kPlugCategRoomFx,
kPlugSurroundFx,
kPlugCategRestoration,
kPlugCategOfflineProcess,
kPlugCategShell,
kPlugCategGenerator
};
//==============================================================================
/** Structure used for VSTs
@tags{Audio}
*/
struct VstEditorBounds
{
int16 upper;
int16 leftmost;
int16 lower;
int16 rightmost;
};
//==============================================================================
enum VstMaxStringLengths
{
vstMaxNameLength = 64,
vstMaxParameterOrPinLabelLength = 64,
vstMaxParameterOrPinShortLabelLength = 8,
vstMaxCategoryLength = 24,
vstMaxManufacturerStringLength = 64,
vstMaxPlugInNameStringLength = 64
};
//==============================================================================
/** Structure used for VSTs
@tags{Audio}
*/
struct VstPinInfo
{
char text[vstMaxParameterOrPinLabelLength];
int32 flags;
int32 configurationType;
char shortText[vstMaxParameterOrPinShortLabelLength];
char unused[48];
};
enum VstPinInfoFlags
{
vstPinInfoFlagIsActive = 1,
vstPinInfoFlagIsStereo = 2,
vstPinInfoFlagValid = 4
};
//==============================================================================
/** Structure used for VSTs
@tags{Audio}
*/
struct VstEvent
{
int32 type;
int32 size;
int32 sampleOffset;
int32 flags;
char content[16];
};
enum VstEventTypes
{
vstMidiEventType = 1,
vstSysExEventType = 6
};
/** Structure used for VSTs
@tags{Audio}
*/
struct VstEventBlock
{
int32 numberOfEvents;
pointer_sized_int future;
VstEvent* events[2];
};
/** Structure used for VSTs
@tags{Audio}
*/
struct VstMidiEvent
{
int32 type;
int32 size;
int32 sampleOffset;
int32 flags;
int32 noteSampleLength;
int32 noteSampleOffset;
char midiData[4];
char tuning;
char noteVelocityOff;
char future1;
char future2;
};
enum VstMidiEventFlags
{
vstMidiEventIsRealtime = 1
};
/** Structure used for VSTs
@tags{Audio}
*/
struct VstSysExEvent
{
int32 type;
int32 size;
int32 offsetSamples;
int32 flags;
int32 sysExDumpSize;
pointer_sized_int future1;
char* sysExDump;
pointer_sized_int future2;
};
//==============================================================================
/** Structure used for VSTs
@tags{Audio}
*/
struct VstTimingInformation
{
double samplePosition;
double sampleRate;
double systemTimeNanoseconds;
double musicalPosition;
double tempoBPM;
double lastBarPosition;
double loopStartPosition;
double loopEndPosition;
int32 timeSignatureNumerator;
int32 timeSignatureDenominator;
int32 smpteOffset;
int32 smpteRate;
int32 samplesToNearestClock;
int32 flags;
};
enum VstTimingInformationFlags
{
vstTimingInfoFlagTransportChanged = 1,
vstTimingInfoFlagCurrentlyPlaying = 2,
vstTimingInfoFlagLoopActive = 4,
vstTimingInfoFlagCurrentlyRecording = 8,
vstTimingInfoFlagAutomationWriteModeActive = 64,
vstTimingInfoFlagAutomationReadModeActive = 128,
vstTimingInfoFlagNanosecondsValid = 256,
vstTimingInfoFlagMusicalPositionValid = 512,
vstTimingInfoFlagTempoValid = 1024,
vstTimingInfoFlagLastBarPositionValid = 2048,
vstTimingInfoFlagLoopPositionValid = 4096,
vstTimingInfoFlagTimeSignatureValid = 8192,
vstTimingInfoFlagSmpteValid = 16384,
vstTimingInfoFlagNearestClockValid = 32768
};
//==============================================================================
enum VstSmpteRates
{
vstSmpteRateFps24,
vstSmpteRateFps25,
vstSmpteRateFps2997,
vstSmpteRateFps30,
vstSmpteRateFps2997drop,
vstSmpteRateFps30drop,
vstSmpteRate16mmFilm,
vstSmpteRate35mmFilm,
vstSmpteRateFps239 = vstSmpteRate35mmFilm + 3,
vstSmpteRateFps249 ,
vstSmpteRateFps599,
vstSmpteRateFps60
};
//==============================================================================
/** Structure used for VSTs
@tags{Audio}
*/
struct VstIndividualSpeakerInfo
{
float azimuthalAngle;
float elevationAngle;
float radius;
float reserved;
char label[vstMaxNameLength];
int32 type;
char unused[28];
};
enum VstIndividualSpeakerType
{
vstIndividualSpeakerTypeUndefined = 0x7fffffff,
vstIndividualSpeakerTypeMono = 0,
vstIndividualSpeakerTypeLeft,
vstIndividualSpeakerTypeRight,
vstIndividualSpeakerTypeCentre,
vstIndividualSpeakerTypeLFE,
vstIndividualSpeakerTypeLeftSurround,
vstIndividualSpeakerTypeRightSurround,
vstIndividualSpeakerTypeLeftCentre,
vstIndividualSpeakerTypeRightCentre,
vstIndividualSpeakerTypeSurround,
vstIndividualSpeakerTypeCentreSurround = vstIndividualSpeakerTypeSurround,
vstIndividualSpeakerTypeLeftRearSurround,
vstIndividualSpeakerTypeRightRearSurround,
vstIndividualSpeakerTypeTopMiddle,
vstIndividualSpeakerTypeTopFrontLeft,
vstIndividualSpeakerTypeTopFrontCentre,
vstIndividualSpeakerTypeTopFrontRight,
vstIndividualSpeakerTypeTopRearLeft,
vstIndividualSpeakerTypeTopRearCentre,
vstIndividualSpeakerTypeTopRearRight,
vstIndividualSpeakerTypeLFE2
};
/** Structure used for VSTs
@tags{Audio}
*/
struct VstSpeakerConfiguration
{
int32 type;
int32 numberOfChannels;
VstIndividualSpeakerInfo speakers[8];
};
enum VstSpeakerConfigurationType
{
vstSpeakerConfigTypeUser = -2,
vstSpeakerConfigTypeEmpty = -1,
vstSpeakerConfigTypeMono = 0,
vstSpeakerConfigTypeLR,
vstSpeakerConfigTypeLsRs,
vstSpeakerConfigTypeLcRc,
vstSpeakerConfigTypeSlSr,
vstSpeakerConfigTypeCLfe,
vstSpeakerConfigTypeLRC,
vstSpeakerConfigTypeLRS,
vstSpeakerConfigTypeLRCLfe,
vstSpeakerConfigTypeLRLfeS,
vstSpeakerConfigTypeLRCS,
vstSpeakerConfigTypeLRLsRs,
vstSpeakerConfigTypeLRCLfeS,
vstSpeakerConfigTypeLRLfeLsRs,
vstSpeakerConfigTypeLRCLsRs,
vstSpeakerConfigTypeLRCLfeLsRs,
vstSpeakerConfigTypeLRCLsRsCs,
vstSpeakerConfigTypeLRLsRsSlSr,
vstSpeakerConfigTypeLRCLfeLsRsCs,
vstSpeakerConfigTypeLRLfeLsRsSlSr,
vstSpeakerConfigTypeLRCLsRsLcRc,
vstSpeakerConfigTypeLRCLsRsSlSr,
vstSpeakerConfigTypeLRCLfeLsRsLcRc,
vstSpeakerConfigTypeLRCLfeLsRsSlSr,
vstSpeakerConfigTypeLRCLsRsLcRcCs,
vstSpeakerConfigTypeLRCLsRsCsSlSr,
vstSpeakerConfigTypeLRCLfeLsRsLcRcCs,
vstSpeakerConfigTypeLRCLfeLsRsCsSlSr,
vstSpeakerConfigTypeLRCLfeLsRsTflTfcTfrTrlTrrLfe2
};
#if JUCE_BIG_ENDIAN
#define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (a | (((uint32) b) << 8) | (((uint32) c) << 16) | (((uint32) d) << 24))
#else
#define JUCE_MULTICHAR_CONSTANT(a, b, c, d) (d | (((uint32) c) << 8) | (((uint32) b) << 16) | (((uint32) a) << 24))
#endif
enum PresonusExtensionConstants
{
presonusVendorID = JUCE_MULTICHAR_CONSTANT ('P', 'r', 'e', 'S'),
presonusSetContentScaleFactor = JUCE_MULTICHAR_CONSTANT ('A', 'e', 'C', 's')
};
//==============================================================================
/** Structure used for VSTs
@tags{Audio}
*/
struct vst2FxBank
{
int32 magic1;
int32 size;
int32 magic2;
int32 version1;
int32 fxID;
int32 version2;
int32 elements;
int32 current;
char shouldBeZero[124];
int32 chunkSize;
char chunk[1];
};
#if JUCE_MSVC
#pragma pack(pop)
#elif JUCE_MAC || JUCE_IOS
#pragma options align=reset
#else
#pragma pack(pop)
#endif

+ 38
- 38
source/modules/juce_audio_processors/format_types/juce_VSTMidiEventList.h View File

@@ -50,7 +50,7 @@ public:
numEventsUsed = 0;
if (events != nullptr)
events->numEvents = 0;
events->numberOfEvents = 0;
}
void addEvent (const void* const midiData, int numBytes, int frameOffset)
@@ -59,50 +59,50 @@ public:
void* const ptr = (Vst2::VstMidiEvent*) (events->events [numEventsUsed]);
auto* const e = (Vst2::VstMidiEvent*) ptr;
events->numEvents = ++numEventsUsed;
events->numberOfEvents = ++numEventsUsed;
if (numBytes <= 4)
{
if (e->type == Vst2::kVstSysExType)
if (e->type == Vst2::vstSysExEventType)
{
delete[] (((Vst2::VstMidiSysexEvent*) ptr)->sysexDump);
e->type = Vst2::kVstMidiType;
e->byteSize = sizeof (Vst2::VstMidiEvent);
e->noteLength = 0;
e->noteOffset = 0;
e->detune = 0;
e->noteOffVelocity = 0;
delete[] (((Vst2::VstSysExEvent*) ptr)->sysExDump);
e->type = Vst2::vstMidiEventType;
e->size = sizeof (Vst2::VstMidiEvent);
e->noteSampleLength = 0;
e->noteSampleOffset = 0;
e->tuning = 0;
e->noteVelocityOff = 0;
}
e->deltaFrames = frameOffset;
e->sampleOffset = frameOffset;
memcpy (e->midiData, midiData, (size_t) numBytes);
}
else
{
auto* const se = (Vst2::VstMidiSysexEvent*) ptr;
auto* const se = (Vst2::VstSysExEvent*) ptr;
if (se->type == Vst2::kVstSysExType)
delete[] se->sysexDump;
if (se->type == Vst2::vstSysExEventType)
delete[] se->sysExDump;
se->sysexDump = new char [(size_t) numBytes];
memcpy (se->sysexDump, midiData, (size_t) numBytes);
se->sysExDump = new char [(size_t) numBytes];
memcpy (se->sysExDump, midiData, (size_t) numBytes);
se->type = Vst2::kVstSysExType;
se->byteSize = sizeof (Vst2::VstMidiSysexEvent);
se->deltaFrames = frameOffset;
se->type = Vst2::vstSysExEventType;
se->size = sizeof (Vst2::VstSysExEvent);
se->offsetSamples = frameOffset;
se->flags = 0;
se->dumpBytes = numBytes;
se->resvd1 = 0;
se->resvd2 = 0;
se->sysExDumpSize = numBytes;
se->future1 = 0;
se->future2 = 0;
}
}
//==============================================================================
// Handy method to pull the events out of an event buffer supplied by the host
// or plugin.
static void addEventsToMidiBuffer (const Vst2::VstEvents* events, MidiBuffer& dest)
static void addEventsToMidiBuffer (const Vst2::VstEventBlock* events, MidiBuffer& dest)
{
for (int i = 0; i < events->numEvents; ++i)
for (int i = 0; i < events->numberOfEvents; ++i)
{
const Vst2::VstEvent* const e = events->events[i];
@@ -110,17 +110,17 @@ public:
{
const void* const ptr = events->events[i];
if (e->type == Vst2::kVstMidiType)
if (e->type == Vst2::vstMidiEventType)
{
dest.addEvent ((const juce::uint8*) ((const Vst2::VstMidiEvent*) ptr)->midiData,
4, e->deltaFrames);
4, e->sampleOffset);
}
else if (e->type == Vst2::kVstSysExType)
else if (e->type == Vst2::vstSysExEventType)
{
const auto* se = (const Vst2::VstMidiSysexEvent*) ptr;
dest.addEvent ((const juce::uint8*) se->sysexDump,
(int) se->dumpBytes,
e->deltaFrames);
const auto* se = (const Vst2::VstSysExEvent*) ptr;
dest.addEvent ((const juce::uint8*) se->sysExDump,
(int) se->sysExDumpSize,
e->sampleOffset);
}
}
}
@@ -161,25 +161,25 @@ public:
}
//==============================================================================
HeapBlock<Vst2::VstEvents> events;
HeapBlock<Vst2::VstEventBlock> events;
private:
int numEventsUsed, numEventsAllocated;
static Vst2::VstEvent* allocateVSTEvent()
{
auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstMidiSysexEvent) ? sizeof (Vst2::VstMidiEvent)
: sizeof (Vst2::VstMidiSysexEvent));
e->type = Vst2::kVstMidiType;
e->byteSize = sizeof (Vst2::VstMidiEvent);
auto e = (Vst2::VstEvent*) std::calloc (1, sizeof (Vst2::VstMidiEvent) > sizeof (Vst2::VstSysExEvent) ? sizeof (Vst2::VstMidiEvent)
: sizeof (Vst2::VstSysExEvent));
e->type = Vst2::vstMidiEventType;
e->size = sizeof (Vst2::VstMidiEvent);
return e;
}
static void freeVSTEvent (Vst2::VstEvent* e)
{
if (e->type == Vst2::kVstSysExType)
if (e->type == Vst2::vstSysExEventType)
{
delete[] (reinterpret_cast<Vst2::VstMidiSysexEvent*> (e)->sysexDump);
delete[] (reinterpret_cast<Vst2::VstSysExEvent*> (e)->sysExDump);
}
std::free (e);


+ 260
- 263
source/modules/juce_audio_processors/format_types/juce_VSTPluginFormat.cpp
File diff suppressed because it is too large
View File


+ 4
- 0
source/modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -977,7 +977,11 @@ bool Thread::setThreadPriority (void* handle, int priority)
if (pthread_getschedparam ((pthread_t) handle, &policy, &param) != 0)
return false;
#if JUCE_LINUX
policy = priority < 9 ? SCHED_OTHER : SCHED_RR;
#else
policy = priority == 0 ? SCHED_OTHER : SCHED_RR;
#endif
const int minPriority = sched_get_priority_min (policy);
const int maxPriority = sched_get_priority_max (policy);


Loading…
Cancel
Save