This commit is contained in:
Chris Johnson 2021-01-17 20:45:17 -05:00
parent e36d8abd86
commit 88454a8389
44 changed files with 11760 additions and 0 deletions

View file

@ -0,0 +1,108 @@
// !$*UTF8*$!
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
activeTarget = 8D01CCC60486CAD60068D4B7 /* Channel9 */;
codeSenseManager = 8B02375F1D42B1C400E1E8C8 /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
364,
20,
48,
43,
43,
20,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
PBXFileDataSource_Target_ColumnID,
);
};
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
324,
60,
20,
48,
43,
43,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXTargetDataSource_PrimaryAttribute,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 632362451;
PBXWorkspaceStateSaveDate = 632362451;
};
sourceControlManager = 8B02375E1D42B1C400E1E8C8 /* Source Control */;
userBuildSettings = {
};
};
2407DEB6089929BA00EB68BF /* Channel9.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {849, 2934}}";
sepNavSelRange = "{3718, 0}";
sepNavVisRange = "{4768, 1710}";
sepNavWindowFrame = "{{12, 47}, {895, 831}}";
};
};
245463B80991757100464AD3 /* Channel9.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1110, 1512}}";
sepNavSelRange = "{2781, 0}";
sepNavVisRange = "{1299, 1539}";
sepNavWindowFrame = "{{20, 47}, {895, 831}}";
};
};
24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {859, 20267}}";
sepNavSelRange = "{10616, 0}";
sepNavVisRange = "{9653, 2414}";
sepNavWindowFrame = "{{15, 42}, {895, 831}}";
};
};
24D8286F09A914000093AEF8 /* Channel9Proc.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {1407, 6516}}";
sepNavSelRange = "{14274, 0}";
sepNavVisRange = "{8825, 1908}";
sepNavWindowFrame = "{{31, 55}, {1021, 818}}";
};
};
8B02375E1D42B1C400E1E8C8 /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
repositoryNamesForRoots = {
"" = "";
};
};
};
8B02375F1D42B1C400E1E8C8 /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
8D01CCC60486CAD60068D4B7 /* Channel9 */ = {
activeExec = 0;
};
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:Sample.xcodeproj">
</FileRef>
</Workspace>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,143 @@
// !$*UTF8*$!
{
089C1669FE841209C02AAC07 /* Project object */ = {
activeBuildConfigurationName = Release;
activeTarget = 8D01CCC60486CAD60068D4B7 /* Gain */;
codeSenseManager = 91857D95148EF55400AAA11B /* Code sense */;
perUserDictionary = {
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
829,
20,
48,
43,
43,
20,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
PBXFileDataSource_Target_ColumnID,
);
};
PBXConfiguration.PBXTargetDataSource.PBXTargetDataSource = {
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
PBXFileTableDataSourceColumnWidthsKey = (
20,
789,
60,
20,
48,
43,
43,
);
PBXFileTableDataSourceColumnsKey = (
PBXFileDataSource_FiletypeID,
PBXFileDataSource_Filename_ColumnID,
PBXTargetDataSource_PrimaryAttribute,
PBXFileDataSource_Built_ColumnID,
PBXFileDataSource_ObjectSize_ColumnID,
PBXFileDataSource_Errors_ColumnID,
PBXFileDataSource_Warnings_ColumnID,
);
};
PBXPerProjectTemplateStateSaveDate = 345089498;
PBXWorkspaceStateSaveDate = 345089498;
};
perUserProjectItems = {
911C2A9D1491A5F600A430AF /* PBXTextBookmark */ = 911C2A9D1491A5F600A430AF /* PBXTextBookmark */;
915DCCBB1491A5B8008574E6 /* PBXTextBookmark */ = 915DCCBB1491A5B8008574E6 /* PBXTextBookmark */;
};
sourceControlManager = 91857D94148EF55400AAA11B /* Source Control */;
userBuildSettings = {
};
};
2407DEB6089929BA00EB68BF /* Gain.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {992, 1768}}";
sepNavSelRange = "{247, 0}";
sepNavVisRange = "{0, 1657}";
};
};
245463B80991757100464AD3 /* Gain.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {992, 975}}";
sepNavSelRange = "{1552, 0}";
sepNavVisRange = "{796, 1857}";
sepNavWindowFrame = "{{15, 465}, {750, 558}}";
};
};
24A2FF9A0F90D1DD003BB5A7 /* adelaymain.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {992, 488}}";
sepNavSelRange = "{0, 0}";
sepNavVisRange = "{0, 798}";
};
};
24A2FFDB0F90D1DD003BB5A7 /* audioeffectx.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {859, 19825}}";
sepNavSelRange = "{10641, 0}";
sepNavVisRange = "{10076, 1095}";
};
};
24D8286F09A914000093AEF8 /* GainProc.cpp */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {992, 482}}";
sepNavSelRange = "{239, 0}";
sepNavVisRange = "{0, 950}";
};
};
24D8287E09A9164A0093AEF8 /* xcode_vst_prefix.h */ = {
uiCtxt = {
sepNavIntBoundsRect = "{{0, 0}, {992, 493}}";
sepNavSelRange = "{249, 0}";
sepNavVisRange = "{0, 249}";
};
};
8D01CCC60486CAD60068D4B7 /* Gain */ = {
activeExec = 0;
};
911C2A9D1491A5F600A430AF /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2407DEB6089929BA00EB68BF /* Gain.cpp */;
name = "Gain.cpp: 10";
rLen = 0;
rLoc = 247;
rType = 0;
vrLen = 1657;
vrLoc = 0;
};
915DCCBB1491A5B8008574E6 /* PBXTextBookmark */ = {
isa = PBXTextBookmark;
fRef = 2407DEB6089929BA00EB68BF /* Gain.cpp */;
name = "Gain.cpp: 10";
rLen = 0;
rLoc = 247;
rType = 0;
vrLen = 1625;
vrLoc = 0;
};
91857D94148EF55400AAA11B /* Source Control */ = {
isa = PBXSourceControlManager;
fallbackIsa = XCSourceControlManager;
isSCMEnabled = 0;
scmConfiguration = {
repositoryNamesForRoots = {
"" = "";
};
};
};
91857D95148EF55400AAA11B /* Code sense */ = {
isa = PBXCodeSenseManager;
indexTemplatePath = "";
};
}

View file

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "Gain.vst"
BlueprintName = "Gain"
ReferencedContainer = "container:Gain.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "Gain.vst"
BlueprintName = "Gain"
ReferencedContainer = "container:Gain.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "Gain.vst"
BlueprintName = "Gain"
ReferencedContainer = "container:Gain.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>Gain.xcscheme</key>
<dict>
<key>orderHint</key>
<integer>8</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>8D01CCC60486CAD60068D4B7</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>«PROJECTNAME».xcscheme</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
<dict>
<key>8D01CCC60486CAD60068D4B7</key>
<dict>
<key>primary</key>
<true/>
</dict>
</dict>
</dict>
</plist>

View file

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8D01CCC60486CAD60068D4B7"
BuildableName = "&#171;PROJECTNAME&#187;.vst"
BlueprintName = "&#171;PROJECTNAME&#187;"
ReferencedContainer = "container:Sample.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.GDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Channel9</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.airwindows.Channel9</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleSignature</key>
<string>Dthr</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>CSResourcesFileMapped</key>
<true/>
</dict>
</plist>

View file

@ -0,0 +1 @@
BNDL????

View file

@ -0,0 +1,17 @@
#define MAC 1
#define MACX 1
#define USE_NAMESPACE 0
#define TARGET_API_MAC_CARBON 1
#define USENAVSERVICES 1
#define __CF_USE_FRAMEWORK_INCLUDES__
#if __MWERKS__
#define __NOEXTENSIONS__
#endif
#define QUARTZ 1
#include <AvailabilityMacros.h>

View file

@ -0,0 +1,163 @@
/* ========================================
* Channel9 - Channel9.h
* Copyright (c) 2016 airwindows, All rights reserved
* ======================================== */
#ifndef __Channel9_H
#include "Channel9.h"
#endif
AudioEffect* createEffectInstance(audioMasterCallback audioMaster) {return new Channel9(audioMaster);}
Channel9::Channel9(audioMasterCallback audioMaster) :
AudioEffectX(audioMaster, kNumPrograms, kNumParameters)
{
A = 0.0;
B = 0.0;
C = 1.0;
for (int x = 0; x < 15; x++) {biquadA[x] = 0.0; biquadB[x] = 0.0;}
fpdL = 1.0; while (fpdL < 16386) fpdL = rand()*UINT32_MAX;
fpdR = 1.0; while (fpdR < 16386) fpdR = rand()*UINT32_MAX;
iirSampleLA = 0.0;
iirSampleRA = 0.0;
iirSampleLB = 0.0;
iirSampleRB = 0.0;
lastSampleAL = lastSampleBL = lastSampleCL = 0.0;
lastSampleAR = lastSampleBR = lastSampleCR = 0.0;
flip = false;
iirAmount = 0.005832;
threshold = 0.33362176; //instantiating with Neve values
cutoff = 28811.0;
//this is reset: values being initialized only once. Startup values, whatever they are.
_canDo.insert("plugAsChannelInsert"); // plug-in can be used as a channel insert effect.
_canDo.insert("plugAsSend"); // plug-in can be used as a send effect.
_canDo.insert("x2in2out");
setNumInputs(kNumInputs);
setNumOutputs(kNumOutputs);
setUniqueID(kUniqueId);
canProcessReplacing(); // supports output replacing
canDoubleReplacing(); // supports double precision processing
programsAreChunks(true);
vst_strncpy (_programName, "Default", kVstMaxProgNameLen); // default program name
}
Channel9::~Channel9() {}
VstInt32 Channel9::getVendorVersion () {return 1000;}
void Channel9::setProgramName(char *name) {vst_strncpy (_programName, name, kVstMaxProgNameLen);}
void Channel9::getProgramName(char *name) {vst_strncpy (name, _programName, kVstMaxProgNameLen);}
//airwindows likes to ignore this stuff. Make your own programs, and make a different plugin rather than
//trying to do versioning and preventing people from using older versions. Maybe they like the old one!
static float pinParameter(float data)
{
if (data < 0.0f) return 0.0f;
if (data > 1.0f) return 1.0f;
return data;
}
VstInt32 Channel9::getChunk (void** data, bool isPreset)
{
float *chunkData = (float *)calloc(kNumParameters, sizeof(float));
chunkData[0] = A;
chunkData[1] = B;
chunkData[2] = C;
/* Note: The way this is set up, it will break if you manage to save settings on an Intel
machine and load them on a PPC Mac. However, it's fine if you stick to the machine you
started with. */
*data = chunkData;
return kNumParameters * sizeof(float);
}
VstInt32 Channel9::setChunk (void* data, VstInt32 byteSize, bool isPreset)
{
float *chunkData = (float *)data;
A = pinParameter(chunkData[0]);
B = pinParameter(chunkData[1]);
C = pinParameter(chunkData[2]);
/* We're ignoring byteSize as we found it to be a filthy liar */
/* calculate any other fields you need here - you could copy in
code from setParameter() here. */
return 0;
}
void Channel9::setParameter(VstInt32 index, float value) {
switch (index) {
case kParamA: A = value; break;
case kParamB: B = value; break;
case kParamC: C = value; break;
default: throw; // unknown parameter, shouldn't happen!
}
switch((VstInt32)( A * 4.999 ))
{
case 0: iirAmount = 0.005832; threshold = 0.33362176; cutoff = 28811.0; break; //Neve
case 1: iirAmount = 0.004096; threshold = 0.59969536; cutoff = 27216.0; break; //API
case 2: iirAmount = 0.004913; threshold = 0.84934656; cutoff = 23011.0; break; //SSL
case 3: iirAmount = 0.009216; threshold = 0.149; cutoff = 18544.0; break; //Teac
case 4: iirAmount = 0.011449; threshold = 0.092; cutoff = 19748.0; break; //Mackie
default: break; //should not happen
}
}
float Channel9::getParameter(VstInt32 index) {
switch (index) {
case kParamA: return A; break;
case kParamB: return B; break;
case kParamC: return C; break;
default: break; // unknown parameter, shouldn't happen!
} return 0.0; //we only need to update the relevant name, this is simple to manage
}
void Channel9::getParameterName(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "Console Type", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "Drive", kVstMaxParamStrLen); break;
case kParamC: vst_strncpy (text, "Output", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this is our labels for displaying in the VST host
}
void Channel9::getParameterDisplay(VstInt32 index, char *text) {
switch (index) {
case kParamA: switch((VstInt32)( A * 4.999 )) //0 to almost edge of # of params
{ case 0: vst_strncpy (text, "Neve", kVstMaxParamStrLen); break;
case 1: vst_strncpy (text, "API", kVstMaxParamStrLen); break;
case 2: vst_strncpy (text, "SSL", kVstMaxParamStrLen); break;
case 3: vst_strncpy (text, "Teac", kVstMaxParamStrLen); break;
case 4: vst_strncpy (text, "Mackie", kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} break; //completed consoletype 'popup' parameter, exit
case kParamB: int2string ((VstInt32)(B*200), text, kVstMaxParamStrLen); break;
case kParamC: float2string (C, text, kVstMaxParamStrLen); break;
default: break; // unknown parameter, shouldn't happen!
} //this displays the values and handles 'popups' where it's discrete choices
}
void Channel9::getParameterLabel(VstInt32 index, char *text) {
switch (index) {
case kParamA: vst_strncpy (text, "", kVstMaxParamStrLen); break;
case kParamB: vst_strncpy (text, "%", kVstMaxParamStrLen); break; //the percent
case kParamC: vst_strncpy (text, "", kVstMaxParamStrLen); break; //the percent
default: break; // unknown parameter, shouldn't happen!
}
}
VstInt32 Channel9::canDo(char *text)
{ return (_canDo.find(text) == _canDo.end()) ? -1: 1; } // 1 = yes, -1 = no, 0 = don't know
bool Channel9::getEffectName(char* name) {
vst_strncpy(name, "Channel9", kVstMaxProductStrLen); return true;
}
VstPlugCategory Channel9::getPlugCategory() {return kPlugCategEffect;}
bool Channel9::getProductString(char* text) {
vst_strncpy (text, "airwindows Channel9", kVstMaxProductStrLen); return true;
}
bool Channel9::getVendorString(char* text) {
vst_strncpy (text, "airwindows", kVstMaxVendorStrLen); return true;
}

View file

@ -0,0 +1,83 @@
/* ========================================
* Channel9 - Channel9.h
* Created 8/12/11 by SPIAdmin
* Copyright (c) 2011 __MyCompanyName__, All rights reserved
* ======================================== */
#ifndef __Channel9_H
#define __Channel9_H
#ifndef __audioeffect__
#include "audioeffectx.h"
#endif
#include <set>
#include <string>
#include <math.h>
enum {
kParamA = 0,
kParamB = 1,
kParamC = 2,
kNumParameters = 3
}; //
const int kNumPrograms = 0;
const int kNumInputs = 2;
const int kNumOutputs = 2;
const unsigned long kUniqueId = 'cha9'; //Change this to what the AU identity is!
class Channel9 :
public AudioEffectX
{
public:
Channel9(audioMasterCallback audioMaster);
~Channel9();
virtual bool getEffectName(char* name); // The plug-in name
virtual VstPlugCategory getPlugCategory(); // The general category for the plug-in
virtual bool getProductString(char* text); // This is a unique plug-in string provided by Steinberg
virtual bool getVendorString(char* text); // Vendor info
virtual VstInt32 getVendorVersion(); // Version number
virtual void processReplacing (float** inputs, float** outputs, VstInt32 sampleFrames);
virtual void processDoubleReplacing (double** inputs, double** outputs, VstInt32 sampleFrames);
virtual void getProgramName(char *name); // read the name from the host
virtual void setProgramName(char *name); // changes the name of the preset displayed in the host
virtual VstInt32 getChunk (void** data, bool isPreset);
virtual VstInt32 setChunk (void* data, VstInt32 byteSize, bool isPreset);
virtual float getParameter(VstInt32 index); // get the parameter value at the specified index
virtual void setParameter(VstInt32 index, float value); // set the parameter at index to value
virtual void getParameterLabel(VstInt32 index, char *text); // label for the parameter (eg dB)
virtual void getParameterName(VstInt32 index, char *text); // name of the parameter
virtual void getParameterDisplay(VstInt32 index, char *text); // text description of the current value
virtual VstInt32 canDo(char *text);
private:
char _programName[kVstMaxProgNameLen + 1];
std::set< std::string > _canDo;
uint32_t fpdL;
uint32_t fpdR;
//default stuff
double iirSampleLA;
double iirSampleRA;
double iirSampleLB;
double iirSampleRB;
double lastSampleAL;
double lastSampleBL;
double lastSampleCL;
double lastSampleAR;
double lastSampleBR;
double lastSampleCR;
long double biquadA[15];
long double biquadB[15];
double iirAmount;
double threshold;
double cutoff;
bool flip;
float A;
float B;
float C;
};
#endif

View file

@ -0,0 +1,344 @@
/* ========================================
* Channel9 - Channel9.h
* Copyright (c) 2016 airwindows, All rights reserved
* ======================================== */
#ifndef __Channel9_H
#include "Channel9.h"
#endif
void Channel9::processReplacing(float **inputs, float **outputs, VstInt32 sampleFrames)
{
float* in1 = inputs[0];
float* in2 = inputs[1];
float* out1 = outputs[0];
float* out2 = outputs[1];
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
double localiirAmount = iirAmount / overallscale;
double localthreshold = threshold; //we've learned not to try and adjust threshold for sample rate
double density = B*2.0; //0-2
double phattity = density - 1.0;
if (density > 1.0) density = 1.0; //max out at full wet for Spiral aspect
if (phattity < 0.0) phattity = 0.0; //
double nonLin = 5.0-density; //number is smaller for more intense, larger for more subtle
biquadB[0] = biquadA[0] = cutoff / getSampleRate();
biquadA[1] = 1.618033988749894848204586;
biquadB[1] = 0.618033988749894848204586;
double K = tan(M_PI * biquadA[0]); //lowpass
double norm = 1.0 / (1.0 + K / biquadA[1] + K * K);
biquadA[2] = K * K * norm;
biquadA[3] = 2.0 * biquadA[2];
biquadA[4] = biquadA[2];
biquadA[5] = 2.0 * (K * K - 1.0) * norm;
biquadA[6] = (1.0 - K / biquadA[1] + K * K) * norm;
K = tan(M_PI * biquadA[0]);
norm = 1.0 / (1.0 + K / biquadB[1] + K * K);
biquadB[2] = K * K * norm;
biquadB[3] = 2.0 * biquadB[2];
biquadB[4] = biquadB[2];
biquadB[5] = 2.0 * (K * K - 1.0) * norm;
biquadB[6] = (1.0 - K / biquadB[1] + K * K) * norm;
while (--sampleFrames >= 0)
{
long double inputSampleL = *in1;
long double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-37) inputSampleL = fpdL * 1.18e-37;
if (fabs(inputSampleR)<1.18e-37) inputSampleR = fpdR * 1.18e-37;
long double tempSample;
if (biquadA[0] < 0.49999) {
tempSample = biquadA[2]*inputSampleL+biquadA[3]*biquadA[7]+biquadA[4]*biquadA[8]-biquadA[5]*biquadA[9]-biquadA[6]*biquadA[10];
biquadA[8] = biquadA[7]; biquadA[7] = inputSampleL; inputSampleL = tempSample;
biquadA[10] = biquadA[9]; biquadA[9] = inputSampleL; //DF1 left
tempSample = biquadA[2]*inputSampleR+biquadA[3]*biquadA[11]+biquadA[4]*biquadA[12]-biquadA[5]*biquadA[13]-biquadA[6]*biquadA[14];
biquadA[12] = biquadA[11]; biquadA[11] = inputSampleR; inputSampleR = tempSample;
biquadA[14] = biquadA[13]; biquadA[13] = inputSampleR; //DF1 right
}
double dielectricScaleL = fabs(2.0-((inputSampleL+nonLin)/nonLin));
double dielectricScaleR = fabs(2.0-((inputSampleR+nonLin)/nonLin));
if (flip)
{
iirSampleLA = (iirSampleLA * (1.0 - (localiirAmount * dielectricScaleL))) + (inputSampleL * localiirAmount * dielectricScaleL);
inputSampleL = inputSampleL - iirSampleLA;
iirSampleRA = (iirSampleRA * (1.0 - (localiirAmount * dielectricScaleR))) + (inputSampleR * localiirAmount * dielectricScaleR);
inputSampleR = inputSampleR - iirSampleRA;
}
else
{
iirSampleLB = (iirSampleLB * (1.0 - (localiirAmount * dielectricScaleL))) + (inputSampleL * localiirAmount * dielectricScaleL);
inputSampleL = inputSampleL - iirSampleLB;
iirSampleRB = (iirSampleRB * (1.0 - (localiirAmount * dielectricScaleR))) + (inputSampleR * localiirAmount * dielectricScaleR);
inputSampleR = inputSampleR - iirSampleRB;
}
//highpass section
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
if (inputSampleL > 1.0) inputSampleL = 1.0;
if (inputSampleL < -1.0) inputSampleL = -1.0;
long double phatSampleL = sin(inputSampleL * 1.57079633);
inputSampleL *= 1.2533141373155;
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
inputSampleL = distSampleL; //purest form is full Spiral
if (density < 1.0) inputSampleL = (drySampleL*(1-density))+(distSampleL*density); //fade Spiral aspect
if (phattity > 0.0) inputSampleL = (inputSampleL*(1-phattity))+(phatSampleL*phattity); //apply original Density on top
if (inputSampleR > 1.0) inputSampleR = 1.0;
if (inputSampleR < -1.0) inputSampleR = -1.0;
long double phatSampleR = sin(inputSampleR * 1.57079633);
inputSampleR *= 1.2533141373155;
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
inputSampleR = distSampleR; //purest form is full Spiral
if (density < 1.0) inputSampleR = (drySampleR*(1-density))+(distSampleR*density); //fade Spiral aspect
if (phattity > 0.0) inputSampleR = (inputSampleR*(1-phattity))+(phatSampleR*phattity); //apply original Density on top
//begin L
double clamp = (lastSampleBL - lastSampleCL) * 0.381966011250105;
clamp -= (lastSampleAL - lastSampleBL) * 0.6180339887498948482045;
clamp += inputSampleL - lastSampleAL; //regular slew clamping added
lastSampleCL = lastSampleBL;
lastSampleBL = lastSampleAL;
lastSampleAL = inputSampleL; //now our output relates off lastSampleB
if (clamp > localthreshold)
inputSampleL = lastSampleBL + localthreshold;
if (-clamp > localthreshold)
inputSampleL = lastSampleBL - localthreshold;
lastSampleAL = (lastSampleAL*0.381966011250105)+(inputSampleL*0.6180339887498948482045); //split the difference between raw and smoothed for buffer
//end L
//begin R
clamp = (lastSampleBR - lastSampleCR) * 0.381966011250105;
clamp -= (lastSampleAR - lastSampleBR) * 0.6180339887498948482045;
clamp += inputSampleR - lastSampleAR; //regular slew clamping added
lastSampleCR = lastSampleBR;
lastSampleBR = lastSampleAR;
lastSampleAR = inputSampleR; //now our output relates off lastSampleB
if (clamp > localthreshold)
inputSampleR = lastSampleBR + localthreshold;
if (-clamp > localthreshold)
inputSampleR = lastSampleBR - localthreshold;
lastSampleAR = (lastSampleAR*0.381966011250105)+(inputSampleR*0.6180339887498948482045); //split the difference between raw and smoothed for buffer
//end R
flip = !flip;
if (C < 1.0) {
inputSampleL *= C;
inputSampleR *= C;
}
if (biquadB[0] < 0.49999) {
tempSample = biquadB[2]*inputSampleL+biquadB[3]*biquadB[7]+biquadB[4]*biquadB[8]-biquadB[5]*biquadB[9]-biquadB[6]*biquadB[10];
biquadB[8] = biquadB[7]; biquadB[7] = inputSampleL; inputSampleL = tempSample;
biquadB[10] = biquadB[9]; biquadB[9] = inputSampleL; //DF1 left
tempSample = biquadB[2]*inputSampleR+biquadB[3]*biquadB[11]+biquadB[4]*biquadB[12]-biquadB[5]*biquadB[13]-biquadB[6]*biquadB[14];
biquadB[12] = biquadB[11]; biquadB[11] = inputSampleR; inputSampleR = tempSample;
biquadB[14] = biquadB[13]; biquadB[13] = inputSampleR; //DF1 right
}
//begin 32 bit stereo floating point dither
int expon; frexpf((float)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
frexpf((float)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 5.5e-36l * pow(2,expon+62));
//end 32 bit stereo floating point dither
*out1 = inputSampleL;
*out2 = inputSampleR;
*in1++;
*in2++;
*out1++;
*out2++;
}
}
void Channel9::processDoubleReplacing(double **inputs, double **outputs, VstInt32 sampleFrames)
{
double* in1 = inputs[0];
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
double overallscale = 1.0;
overallscale /= 44100.0;
overallscale *= getSampleRate();
double localiirAmount = iirAmount / overallscale;
double localthreshold = threshold; //we've learned not to try and adjust threshold for sample rate
double density = B*2.0; //0-2
double phattity = density - 1.0;
if (density > 1.0) density = 1.0; //max out at full wet for Spiral aspect
if (phattity < 0.0) phattity = 0.0; //
double nonLin = 5.0-density; //number is smaller for more intense, larger for more subtle
biquadB[0] = biquadA[0] = cutoff / getSampleRate();
biquadA[1] = 1.618033988749894848204586;
biquadB[1] = 0.618033988749894848204586;
double K = tan(M_PI * biquadA[0]); //lowpass
double norm = 1.0 / (1.0 + K / biquadA[1] + K * K);
biquadA[2] = K * K * norm;
biquadA[3] = 2.0 * biquadA[2];
biquadA[4] = biquadA[2];
biquadA[5] = 2.0 * (K * K - 1.0) * norm;
biquadA[6] = (1.0 - K / biquadA[1] + K * K) * norm;
K = tan(M_PI * biquadA[0]);
norm = 1.0 / (1.0 + K / biquadB[1] + K * K);
biquadB[2] = K * K * norm;
biquadB[3] = 2.0 * biquadB[2];
biquadB[4] = biquadB[2];
biquadB[5] = 2.0 * (K * K - 1.0) * norm;
biquadB[6] = (1.0 - K / biquadB[1] + K * K) * norm;
while (--sampleFrames >= 0)
{
long double inputSampleL = *in1;
long double inputSampleR = *in2;
if (fabs(inputSampleL)<1.18e-43) inputSampleL = fpdL * 1.18e-43;
if (fabs(inputSampleR)<1.18e-43) inputSampleR = fpdR * 1.18e-43;
long double tempSample;
if (biquadA[0] < 0.49999) {
tempSample = biquadA[2]*inputSampleL+biquadA[3]*biquadA[7]+biquadA[4]*biquadA[8]-biquadA[5]*biquadA[9]-biquadA[6]*biquadA[10];
biquadA[8] = biquadA[7]; biquadA[7] = inputSampleL; inputSampleL = tempSample;
biquadA[10] = biquadA[9]; biquadA[9] = inputSampleL; //DF1 left
tempSample = biquadA[2]*inputSampleR+biquadA[3]*biquadA[11]+biquadA[4]*biquadA[12]-biquadA[5]*biquadA[13]-biquadA[6]*biquadA[14];
biquadA[12] = biquadA[11]; biquadA[11] = inputSampleR; inputSampleR = tempSample;
biquadA[14] = biquadA[13]; biquadA[13] = inputSampleR; //DF1 right
}
double dielectricScaleL = fabs(2.0-((inputSampleL+nonLin)/nonLin));
double dielectricScaleR = fabs(2.0-((inputSampleR+nonLin)/nonLin));
if (flip)
{
iirSampleLA = (iirSampleLA * (1.0 - (localiirAmount * dielectricScaleL))) + (inputSampleL * localiirAmount * dielectricScaleL);
inputSampleL = inputSampleL - iirSampleLA;
iirSampleRA = (iirSampleRA * (1.0 - (localiirAmount * dielectricScaleR))) + (inputSampleR * localiirAmount * dielectricScaleR);
inputSampleR = inputSampleR - iirSampleRA;
}
else
{
iirSampleLB = (iirSampleLB * (1.0 - (localiirAmount * dielectricScaleL))) + (inputSampleL * localiirAmount * dielectricScaleL);
inputSampleL = inputSampleL - iirSampleLB;
iirSampleRB = (iirSampleRB * (1.0 - (localiirAmount * dielectricScaleR))) + (inputSampleR * localiirAmount * dielectricScaleR);
inputSampleR = inputSampleR - iirSampleRB;
}
//highpass section
long double drySampleL = inputSampleL;
long double drySampleR = inputSampleR;
if (inputSampleL > 1.0) inputSampleL = 1.0;
if (inputSampleL < -1.0) inputSampleL = -1.0;
long double phatSampleL = sin(inputSampleL * 1.57079633);
inputSampleL *= 1.2533141373155;
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
long double distSampleL = sin(inputSampleL * fabs(inputSampleL)) / ((fabs(inputSampleL) == 0.0) ?1:fabs(inputSampleL));
inputSampleL = distSampleL; //purest form is full Spiral
if (density < 1.0) inputSampleL = (drySampleL*(1-density))+(distSampleL*density); //fade Spiral aspect
if (phattity > 0.0) inputSampleL = (inputSampleL*(1-phattity))+(phatSampleL*phattity); //apply original Density on top
if (inputSampleR > 1.0) inputSampleR = 1.0;
if (inputSampleR < -1.0) inputSampleR = -1.0;
long double phatSampleR = sin(inputSampleR * 1.57079633);
inputSampleR *= 1.2533141373155;
//clip to 1.2533141373155 to reach maximum output, or 1.57079633 for pure sine 'phat' version
long double distSampleR = sin(inputSampleR * fabs(inputSampleR)) / ((fabs(inputSampleR) == 0.0) ?1:fabs(inputSampleR));
inputSampleR = distSampleR; //purest form is full Spiral
if (density < 1.0) inputSampleR = (drySampleR*(1-density))+(distSampleR*density); //fade Spiral aspect
if (phattity > 0.0) inputSampleR = (inputSampleR*(1-phattity))+(phatSampleR*phattity); //apply original Density on top
//begin L
double clamp = (lastSampleBL - lastSampleCL) * 0.381966011250105;
clamp -= (lastSampleAL - lastSampleBL) * 0.6180339887498948482045;
clamp += inputSampleL - lastSampleAL; //regular slew clamping added
lastSampleCL = lastSampleBL;
lastSampleBL = lastSampleAL;
lastSampleAL = inputSampleL; //now our output relates off lastSampleB
if (clamp > localthreshold)
inputSampleL = lastSampleBL + localthreshold;
if (-clamp > localthreshold)
inputSampleL = lastSampleBL - localthreshold;
lastSampleAL = (lastSampleAL*0.381966011250105)+(inputSampleL*0.6180339887498948482045); //split the difference between raw and smoothed for buffer
//end L
//begin R
clamp = (lastSampleBR - lastSampleCR) * 0.381966011250105;
clamp -= (lastSampleAR - lastSampleBR) * 0.6180339887498948482045;
clamp += inputSampleR - lastSampleAR; //regular slew clamping added
lastSampleCR = lastSampleBR;
lastSampleBR = lastSampleAR;
lastSampleAR = inputSampleR; //now our output relates off lastSampleB
if (clamp > localthreshold)
inputSampleR = lastSampleBR + localthreshold;
if (-clamp > localthreshold)
inputSampleR = lastSampleBR - localthreshold;
lastSampleAR = (lastSampleAR*0.381966011250105)+(inputSampleR*0.6180339887498948482045); //split the difference between raw and smoothed for buffer
//end R
flip = !flip;
if (C < 1.0) {
inputSampleL *= C;
inputSampleR *= C;
}
if (biquadB[0] < 0.49999) {
tempSample = biquadB[2]*inputSampleL+biquadB[3]*biquadB[7]+biquadB[4]*biquadB[8]-biquadB[5]*biquadB[9]-biquadB[6]*biquadB[10];
biquadB[8] = biquadB[7]; biquadB[7] = inputSampleL; inputSampleL = tempSample;
biquadB[10] = biquadB[9]; biquadB[9] = inputSampleL; //DF1 left
tempSample = biquadB[2]*inputSampleR+biquadB[3]*biquadB[11]+biquadB[4]*biquadB[12]-biquadB[5]*biquadB[13]-biquadB[6]*biquadB[14];
biquadB[12] = biquadB[11]; biquadB[11] = inputSampleR; inputSampleR = tempSample;
biquadB[14] = biquadB[13]; biquadB[13] = inputSampleR; //DF1 right
}
//begin 64 bit stereo floating point dither
int expon; frexp((double)inputSampleL, &expon);
fpdL ^= fpdL << 13; fpdL ^= fpdL >> 17; fpdL ^= fpdL << 5;
inputSampleL += ((double(fpdL)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
frexp((double)inputSampleR, &expon);
fpdR ^= fpdR << 13; fpdR ^= fpdR >> 17; fpdR ^= fpdR << 5;
inputSampleR += ((double(fpdR)-uint32_t(0x7fffffff)) * 1.1e-44l * pow(2,expon+62));
//end 64 bit stereo floating point dither
*out1 = inputSampleL;
*out2 = inputSampleR;
*in1++;
*in2++;
*out1++;
*out2++;
}
}