classdef ExampleEQ < audioPlugin
properties
LowCutoff = 20
HighCutoff = 18e3;
LowSlope = '12'
HighSlope = '30'
CenterFrequency1 = 100
CenterFrequency2 = 1000
CenterFrequency3 = 10000
QualityFactor1 = 2
QualityFactor2 = 2
QualityFactor3 = 2
PeakGain1 = 0
PeakGain2 = 0
PeakGain3 = 0
end
properties (Access = private)
pVarSlopeBP
pParamEQ
end
properties (Constant)
PluginInterface = audioPluginInterface( ...
'InputChannels',2,...
'OutputChannels',2,...
'PluginName','Example EQ',...
audioPluginParameter('LowCutoff', ...
'DisplayName', 'Low Cutoff', ...
'Label', 'Hz', ...
'Mapping', { 'log', 20, 20000},...
'Style', 'rotaryknob', 'Layout', [1 1]),...
audioPluginParameter('HighCutoff', ...
'DisplayName', 'High Cutoff', ...
'Label', 'Hz', ...
'Mapping', { 'log', 20, 20000},...
'Style', 'rotaryknob', 'Layout', [1 2]),...
audioPluginParameter('LowSlope', ...
'DisplayName', 'Low Slope', ...
'Label', 'dB/octave', ...
'Mapping', { 'enum', '0','6','12','18','24','30','36','42','48'},...
'Layout', [3 1]),...
audioPluginParameter('HighSlope', ...
'DisplayName', 'High Slope', ...
'Label', 'dB/octave', ...
'Mapping', { 'enum', '0','6','12','18','24','30','36','42','48'},...
'Layout', [3 2]), ...
audioPluginParameter('PeakGain1','DisplayName','Low Gain','Label','dB',...
'Mapping',{'lin',-20,20},'Style','vslider','Layout',[5 1]),...
audioPluginParameter('CenterFrequency1','DisplayName','Low Frequency','Label','Hz',...
'Mapping',{'log',20,20e3},'Style','rotaryknob','Layout',[7 1]),...
audioPluginParameter('QualityFactor1','DisplayName','Low Q',...
'Mapping',{'log',0.2,700},'Style','rotaryknob','Layout',[9 1]),...
audioPluginParameter('PeakGain2','DisplayName','Mid Gain','Label','dB',...
'Mapping',{'lin',-20,20},'Style','vslider','Layout',[5 2]),...
audioPluginParameter('CenterFrequency2','DisplayName','Mid Frequency','Label','Hz',...
'Mapping',{'log',20,20e3},'Style','rotaryknob','Layout',[7 2]),...
audioPluginParameter('QualityFactor2','DisplayName','Mid Q',...
'Mapping',{'log',0.2,700},'Style','rotaryknob','Layout',[9 2]),...
audioPluginParameter('PeakGain3','DisplayName','High Gain','Label','dB',...
'Mapping',{'lin',-20,20},'Style','vslider','Layout',[5 3]),...
audioPluginParameter('CenterFrequency3','DisplayName','High Frequency','Label','Hz',...
'Mapping',{'log',20,20e3},'Style','rotaryknob','Layout',[7 3]),...
audioPluginParameter('QualityFactor3','DisplayName','High Q',...
'Mapping',{'log',0.2,700},'Style','rotaryknob','Layout',[9 3])...
);
end
methods
function plugin = ExampleEQ()
plugin.pVarSlopeBP = audiopluginexample.VarSlopeBandpassFilter;
plugin.pParamEQ = audiopluginexample.ParametricEqualizerWithUDP;
fs = plugin.getSampleRate;
setSampleRate(plugin.pVarSlopeBP, fs);
setSampleRate(plugin.pParamEQ, fs);
end
function set.LowCutoff(plugin,val)
plugin.pVarSlopeBP.LowCutoff = val;
plugin.LowCutoff = val;
end
function set.HighCutoff(plugin,val)
plugin.pVarSlopeBP.HighCutoff = val;
plugin.HighCutoff = val;
end
function set.LowSlope(plugin,val)
plugin.pVarSlopeBP.LowSlope = val;
plugin.LowSlope = val;
end
function set.HighSlope(plugin,val)
plugin.pVarSlopeBP.HighSlope = val;
plugin.HighSlope = val;
end
function set.CenterFrequency1(plugin,val)
plugin.pParamEQ.CenterFrequency1 = val;
plugin.CenterFrequency1 = val;
end
function set.CenterFrequency2(plugin,val)
plugin.pParamEQ.CenterFrequency2 = val;
plugin.CenterFrequency2 = val;
end
function set.CenterFrequency3(plugin,val)
plugin.pParamEQ.CenterFrequency3 = val;
plugin.CenterFrequency3 = val;
end
function set.QualityFactor1(plugin,val)
plugin.pParamEQ.QualityFactor1 = val;
plugin.QualityFactor1 = val;
end
function set.QualityFactor2(plugin,val)
plugin.pParamEQ.QualityFactor2 = val;
plugin.QualityFactor2 = val;
end
function set.QualityFactor3(plugin,val)
plugin.pParamEQ.QualityFactor3 = val;
plugin.QualityFactor3 = val;
end
function set.PeakGain1(plugin,val)
plugin.pParamEQ.PeakGain1 = val;
plugin.PeakGain1 = val;
end
function set.PeakGain2(plugin,val)
plugin.pParamEQ.PeakGain2 = val;
plugin.PeakGain2 = val;
end
function set.PeakGain3(plugin,val)
plugin.pParamEQ.PeakGain3 = val;
plugin.PeakGain3 = val;
end
function y = process(plugin,x)
z = plugin.pVarSlopeBP(x);
y = plugin.pParamEQ(z);
end
function reset(plugin)
fs = plugin.getSampleRate;
setSampleRate(plugin.pVarSlopeBP, fs);
reset(plugin.pVarSlopeBP)
setSampleRate(plugin.pParamEQ, fs);
reset(plugin.pParamEQ)
end
end
end
Best Answer