AudioFilePlayerPlugin
AudioFilePlayerPlugin copied to clipboard
Exception when opening plugin interface and update to JUCE 5.4.6
The exception is only thrown in debug mode since it is triggered by a valid coordinates assertion during currentPositionMarker.setRectangle()
in AudioThumbnailComp.cpp
, caused by timeToX()
returning -nan(ind) and therefore the new Rectangle having an x value of -nan(ind).
timeToX()
is returning that because for some reason visibleRange.getLength()
is 0 at that point.
A possible fix would be this:
float AudioThumbnailComp::timeToX(const double time) const
{
if (visibleRange.getLength() == 0)
return 0.0f;
return getWidth() * (float)((time - visibleRange.getStart()) / (visibleRange.getLength()));
}
Furthermore a little change in PluginProcessor.cpp
is needed, since getXmlFromBinary (now?) returns std::unique_ptr:
void AudioFilePlayerProcessor::setStateInformation(const void* data, int sizeInBytes)
{
std::unique_ptr<XmlElement> xmlState(getXmlFromBinary(data, sizeInBytes));
Last, I was getting Cannot open include file: 'pluginterfaces/vst2.x/vstfxstore.h': No such file or directory
, adding JUCE_VST3_CAN_REPLACE_VST2 = 0
to preprocessor definitions in the projucer fixed that.
Aditionally to steps proposed by @cornzz, you will also need to download Steinberg VST SDK and modify your header search paths in Projucer to include VST2_SDK and VST3_SDK folder.