Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add basic Linux support #8

Merged
merged 6 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ MacOS Build Chain.docx
*.vst*
*.au
*.aax
.DS_Store
.DS_Store
/.clangd
11 changes: 6 additions & 5 deletions VASTvaporizer/Source/Engine/FX/VASTBitcrush.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ All modulators tested: OK
#include "../../Plugin/VASTAudioProcessor.h"
#include "VASTEffect.h"
#include <ctime>
#include <cmath>

CVASTBitcrush::CVASTBitcrush(VASTAudioProcessor* processor, int busnr) {
my_processor = processor;
Expand Down Expand Up @@ -170,7 +171,7 @@ void CVASTBitcrush::processBlock(AudioSampleBuffer& buffer, MidiBuffer& midiMess
checkSoftFade();

inputState = ((VASTAudioProcessor*)my_processor)->m_pVASTXperience.m_Poly.getOldestNotePlayedInputState(currentFrameOSAdjusted); // make parameter oldest or newest

m_fBitcrushDryWet_smoothed.setValue(m_Set->getParameterValueWithMatrixModulation(m_fBitcrushDryWet, MODMATDEST::BitcrushDryWet, &inputState));
float lBitcrushDryWet = m_fBitcrushDryWet_smoothed.getNextValue();

Expand All @@ -189,7 +190,7 @@ void CVASTBitcrush::processBlock(AudioSampleBuffer& buffer, MidiBuffer& midiMess
float lBitcrushBitrate = m_Set->getParameterValueWithMatrixModulation(m_fBitcrushBitrate, MODMATDEST::BitcrushBitrate, &inputState);
float lBitcrushGain = m_Set->getParameterValueWithMatrixModulation(m_fBitcrushGain, MODMATDEST::BitcrushGain, &inputState);

//https://github.com/hosackm/Bitcrusher/blob/master/Bitcrusher/bitcrusher.c
//https://github.com/hosackm/Bitcrusher/blob/master/Bitcrusher/bitcrusher.c


float fIn[2];
Expand All @@ -198,7 +199,7 @@ void CVASTBitcrush::processBlock(AudioSampleBuffer& buffer, MidiBuffer& midiMess

fIn[0] = m_lowCutBiquadL.doBiQuad(fIn[0]); //do pre filter
fIn[1] = m_lowCutBiquadR.doBiQuad(fIn[1]); //do pre filter

float fOut[2];
#define ROUND(f) ((float) ((f > 0.0f) ? floor(f+0.5f) : ceil(f-0.5f)))
float max = ROUND(powf(2.0f, lBitcrushBitdepth) - 1);
Expand All @@ -210,7 +211,7 @@ void CVASTBitcrush::processBlock(AudioSampleBuffer& buffer, MidiBuffer& midiMess
m_rightFirstSample = fOut[1];
m_repeatLength = (100.f - lBitcrushBitrate) * (m_iSampleRate / 44100.f);
if (lfBitcrushJitter > 0)
m_repeatLength += (m_rand.nextInt64() % int(std::ceilf((lfBitcrushJitter + 1.f) * (float(m_iSampleRate) / 44100.f))));
m_repeatLength += (m_rand.nextInt64() % int(ceilf((lfBitcrushJitter + 1.f) * (float(m_iSampleRate) / 44100.f))));
}

//different approach
Expand Down Expand Up @@ -247,7 +248,7 @@ void CVASTBitcrush::processBlock(AudioSampleBuffer& buffer, MidiBuffer& midiMess
outR = 10.0f;
reset();
}

bufferWritePointerL[currentFrame] = outL * lBitcrushGain * 0.01f;
bufferWritePointerR[currentFrame] = outR * lBitcrushGain * 0.01f;
}
Expand Down
4 changes: 2 additions & 2 deletions VASTvaporizer/Source/Engine/Filter/VASTQFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ VASTQFilter::VASTQFilter() {
}

VASTQFilter::~VASTQFilter() {
#ifdef _MACOSX
#if defined _MACOSX || defined JUCE_LINUX
if (FBQ[0]) //can be that it was not even started yet
delete FBQ[0];
if (FBQ[1])
Expand Down Expand Up @@ -57,7 +57,7 @@ void VASTQFilter::initQuadFilter(CVASTSettings* m_Set) {

QFirstRun = true;

#ifdef _MACOSX
#if defined _MACOSX || defined JUCE_LINUX
FBQ[0] =
(VASTQFilterProcessState*)malloc((C_MAX_POLY >> 2) * sizeof(VASTQFilterProcessState));
FBQ[1] =
Expand Down
12 changes: 6 additions & 6 deletions VASTvaporizer/Source/Engine/Oversampler/VASTDecimator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ VAST Dynamics Audio Software (TM)
#include "VASTDecimator.h"
#include <stdio.h>

#ifdef _MACOSX
#if defined _MACOSX || defined JUCE_LINUX
#include <pmmintrin.h>
#include <cstddef>
#else
Expand All @@ -20,15 +20,15 @@ VAST Dynamics Audio Software (TM)
CDecimator::CDecimator(void)
{
//FACTOR4
#ifdef _MACOSX
#if defined _MACOSX || defined JUCE_LINUX
m_pIRBuffer = new float[C_FACTOR4_IR_LENGTH];
#else
m_pIRBuffer = (float*)_aligned_malloc(C_FACTOR4_IR_LENGTH*sizeof(float), 16);
#endif
// flush buffer
memset(m_pIRBuffer, 0, C_FACTOR4_IR_LENGTH*sizeof(float));

#ifdef _MACOSX
#if defined _MACOSX || defined JUCE_LINUX
m_pLeftInputBuffer = new float[C_FACTOR4_IR_LENGTH * 2];
m_pRightInputBuffer = new float[C_FACTOR4_IR_LENGTH * 2];
#else
Expand Down Expand Up @@ -56,7 +56,7 @@ CDecimator::CDecimator(void)
CDecimator::~CDecimator(void)
{
// free up our input buffers
#ifdef _MACOSX
#if defined _MACOSX || defined JUCE_LINUX
if (m_pLeftInputBuffer) delete[] m_pLeftInputBuffer;
if (m_pRightInputBuffer) delete[] m_pRightInputBuffer;
if (m_pIRBuffer) delete[] m_pIRBuffer;
Expand Down Expand Up @@ -434,7 +434,7 @@ bool CDecimator::decimateNextOutputSample4(float xnL, float xnR, float& fLeftOut

// Don't have to convolve on the first L-1, only need one convolution at the end
if (i == 0) {
#ifdef _WIN64
#if defined _WIN64 || defined JUCE_LINUX
//Auto vectorizable version Windows AVX/SSE
int offset = C_FACTOR4_IR_LENGTH - m_nReadIndexDL;
for (int j = 0; j < C_FACTOR4_IR_LENGTH; j++)
Expand Down Expand Up @@ -516,7 +516,7 @@ bool CDecimator::decimateNextOutputSample4(float xnL, float xnR, float& fLeftOut
//MacOSX intrinsic version with SSE, works with WIN32/64 as well
if (i == 0) {
//see http://www.drdobbs.com/optimizing-cc-with-inline-assembly-progr/184401967?pgno=3
#ifdef _MACOSX
#if defined _MACOSX
typedef float Sse[4] __attribute__ ((aligned(16)));
Sse sse4 __attribute__ ((aligned(16))) = { 0.0, 0.0, 0.0, 0.0 };
#elif _WIN32 || _WIN64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ VAST Dynamics Audio Software (TM)

#pragma once
#include "../VASTPluginConstants.h"
#include <cstring>

class CRateConvertor
{
Expand Down
3 changes: 2 additions & 1 deletion VASTvaporizer/Source/Engine/VASTSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Global settings for AUDIO THREAD!
#include "VASTSettings.h"
#include "VASTPluginConstants.h"
#include "../Plugin/VASTAudioProcessor.h"
#include <cmath>
#include <string>

#ifdef _WINDOWS
Expand Down Expand Up @@ -59,7 +60,7 @@ CVASTSettings::~CVASTSettings(void) {
}

float CVASTSettings::getFrequencyFactorFromLUT(float octave) {
int intpart = std::floorf(octave);
int intpart = floorf(octave);
float fracpart = octave - intpart;
jassert((intpart >= -11) && (intpart <= 11)); //m_lookupTable_OctaveFreqFactor[22] //-11...11
float factor = m_lookupTable_OctaveFreqFactor[intpart + 11] * m_lookupTable_CentsFreqFactor[int(fracpart * M_CENTS_LUT_SIZE)]; //-11...11
Expand Down
4 changes: 2 additions & 2 deletions VASTvaporizer/Source/Plugin/VASTAudioProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1598,7 +1598,7 @@ String VASTAudioProcessor::getVSTPath() {
return "";

#elif JUCE_LINUX
return "/usr/lib/vst";
return "/tmp/";

#elif JUCE_WINDOWS
String Vaporizer2InstallPath = "";
Expand Down Expand Up @@ -1699,7 +1699,7 @@ String VASTAudioProcessor::getVSTPathAlternative() {
return "";

#elif JUCE_LINUX
return "/usr/lib/vst";
return "/tmp/";

#elif JUCE_WINDOWS
const String currentDll(File::getSpecialLocation(File::currentApplicationFile).getFullPathName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "../VASTAudioProcessor.h"
#include "../VASTControls/VASTParameterSlider.h"
#include "../VASTWTEditor/VASTFreqDomainViewport.h"
#include "../VASTWavetableEditorComponent.h"
#include "../VASTWaveTableEditorComponent.h"
//[/Headers]

#include "VASTManualFreqdomainValueEditor.h"
Expand Down
6 changes: 5 additions & 1 deletion VASTvaporizer/Source/Plugin/VASTMasterVoicingComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,11 @@ VASTMasterVoicingComponent::~VASTMasterVoicingComponent()
void VASTMasterVoicingComponent::paint (juce::Graphics& g)
{
//[UserPrePaint] Add your own custom painting code here..
oscilloscopeOLG2D->setVisible(!myProcessor->m_disableOpenGLGFX);
#if defined JUCE_LINUX
oscilloscopeOLG2D->setVisible(false);
#else
oscilloscopeOLG2D->setVisible(!myProcessor->m_disableOpenGLGFX);
#endif

//[/UserPrePaint]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,8 @@ void VASTOscilloscope::singleCycleFromMSEG(int msegNo) {
float lastval = 0.f;

float* envptr;
envptr = new float[ceil(skips) * C_WAVE_TABLE_SIZE];
int arraySize = static_cast<int>(ceil(skips) * C_WAVE_TABLE_SIZE);
envptr = new float[arraySize];
envelope.getEnvelopeRange(envptr, 0, ceil(skips) * C_WAVE_TABLE_SIZE, true); //no sustain
for (int i = 0; i < C_WAVE_TABLE_SIZE; i++) {
float frac = skips * i;
Expand Down
15 changes: 14 additions & 1 deletion VASTvaporizer/Source/Plugin/VASTVUMeterSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ class VASTVUMeterSource
rmsSum(0.0),
rmsPtr(0)
{}

ChannelData &operator=(const ChannelData &other) {
if (this == &other)
return *this;

max = other.max.load();
maxOverall = other.maxOverall.load();
clip = other.clip.load();
reduction = other.reduction.load();
hold = other.hold.load();

return *this;
}
std::atomic<float> max;
std::atomic<float> maxOverall;
std::atomic<bool> clip;
Expand Down Expand Up @@ -300,4 +313,4 @@ class VASTVUMeterSource

bool suspended;
};
#endif
#endif
63 changes: 44 additions & 19 deletions VASTvaporizer/VASTvaporizer.jucer
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<JUCERPROJECT id="wPTx8T" name="VASTvaporizer2" projectType="audioplug" version="3.3.0"
bundleIdentifier="com.vastdynamics.VAST2" includeBinaryInAppConfig="1"
buildVST="1" buildVST3="1" buildAU="1" buildRTAS="0" buildAAX="1"
buildVST="0" buildVST3="1" buildAU="1" buildRTAS="0" buildAAX="1"
pluginName="Vaporizer2" pluginDesc="VAST Dynamics Vaporizer2 Hybrid Synthesizer Plug-in"
pluginManufacturer="VAST Dynamics" pluginManufacturerCode="Vast"
pluginCode="Vap2" pluginIsSynth="1" pluginWantsMidiIn="1" pluginProducesMidiOut="0"
Expand All @@ -13,10 +13,10 @@
buildAUv3="0" displaySplashScreen="0" reportAppUsage="0" splashScreenColour="Dark"
buildStandalone="1" enableIAA="0" cppLanguageStandard="latest"
companyCopyright="VAST Dynamics" headerPath="..\..\Source\Engine; ..\..\Source\Plugin; ..\..\Source; ..\..\Source\muFFT"
pluginFormats="buildAAX,buildAU,buildLV2,buildStandalone,buildVST,buildVST3"
pluginFormats="buildAAX,buildAU,buildLV2,buildStandalone,buildVST3"
pluginCharacteristicsValue="pluginIsSynth,pluginWantsMidiIn"
pluginAUMainType="'aumu'" pluginChannelConfigs="{2,2}" maxBinaryFileSize="20971520"
jucerFormatVersion="1">
jucerFormatVersion="1" lv2Uri="https://www.vast-dynamics.com/plugins/VASTvaporizer2">
<MAINGROUP id="xqLnpn" name="VASTvaporizer2">
<GROUP id="{DD9ED2B8-D8FE-19B6-7641-38F05EF355A6}" name="Documentation"/>
<GROUP id="{6680AC59-1EE2-8456-E1A0-9C30F1100D44}" name="Resources">
Expand Down Expand Up @@ -722,28 +722,53 @@
<MODULEPATH id="juce_audio_basics"/>
</MODULEPATHS>
</VS2019>
<LINUX_MAKE targetFolder="Builds/LinuxMakefile" externalLibraries="atomic">
<CONFIGURATIONS>
<CONFIGURATION isDebug="1" name="Debug" enablePluginBinaryCopyStep="0"/>
<CONFIGURATION isDebug="0" name="Release" extraLinkerFlags="-latomic&#10;-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,-O1 -Wl,--as-needed -Wl,--strip-all"
extraCompilerFlags="-fvisibility=hidden" enablePluginBinaryCopyStep="0"/>
</CONFIGURATIONS>
<MODULEPATHS>
<MODULEPATH id="juce_audio_basics" path="../../juce"/>
<MODULEPATH id="juce_audio_devices" path="../../juce"/>
<MODULEPATH id="juce_audio_formats" path="../../juce"/>
<MODULEPATH id="juce_audio_plugin_client" path="../../juce"/>
<MODULEPATH id="juce_audio_processors" path="../../juce"/>
<MODULEPATH id="juce_audio_utils" path="../../juce"/>
<MODULEPATH id="juce_core" path="../../juce"/>
<MODULEPATH id="juce_cryptography" path="../../juce"/>
<MODULEPATH id="juce_data_structures" path="../../juce"/>
<MODULEPATH id="juce_dsp" path="../../juce"/>
<MODULEPATH id="juce_events" path="../../juce"/>
<MODULEPATH id="juce_graphics" path="../../juce"/>
<MODULEPATH id="juce_gui_basics" path="../../juce"/>
<MODULEPATH id="juce_gui_extra" path="../../juce"/>
<MODULEPATH id="juce_opengl" path="../../juce"/>
</MODULEPATHS>
</LINUX_MAKE>
</EXPORTFORMATS>
<MODULES>
<MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_audio_devices" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_audio_formats" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_audio_plugin_client" showAllCode="1" useLocalCopy="1"
<MODULES id="juce_audio_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_audio_devices" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_audio_formats" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_audio_plugin_client" showAllCode="1" useLocalCopy="0"
useGlobalPath="1"/>
<MODULES id="juce_audio_processors" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_audio_utils" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_core" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_cryptography" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_data_structures" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULE id="juce_dsp" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_events" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_graphics" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_gui_basics" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_gui_extra" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULE id="juce_opengl" showAllCode="1" useLocalCopy="1" useGlobalPath="1"/>
<MODULES id="juce_audio_processors" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_audio_utils" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_core" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_cryptography" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_data_structures" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_dsp" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_events" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_graphics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_gui_basics" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULES id="juce_gui_extra" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
<MODULE id="juce_opengl" showAllCode="1" useLocalCopy="0" useGlobalPath="1"/>
</MODULES>
<JUCEOPTIONS DROWAUDIO_USE_FFTREAL="disabled" DROWAUDIO_USE_SOUNDTOUCH="disabled"
DROWAUDIO_USE_CURL="disabled" JUCE_WEB_BROWSER="0" JUCE_PLUGINHOST_AU="0"
JUCE_USE_MP3AUDIOFORMAT="1" JUCE_ASIO="1" JUCE_WIN_PER_MONITOR_DPI_AWARE="0"/>
JUCE_USE_MP3AUDIOFORMAT="1" JUCE_ASIO="1" JUCE_WIN_PER_MONITOR_DPI_AWARE="0"
JUCE_USE_CURL="0" JUCE_JACK="1" JUCE_VST3_CAN_REPLACE_VST2="0"/>
<LIVE_SETTINGS>
<WINDOWS buildEnabled="0"/>
<OSX/>
Expand Down