File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ public AudioPluginParameter()
9292 ValueFormat = "{0:0.0}" ;
9393 }
9494
95+ public static double DbToLinear ( double db )
96+ {
97+ return Math . Pow ( 10.0 , 0.05 * db ) ;
98+ }
99+
95100 public double GetValueNormalized ( double value )
96101 {
97102 return ( value - MinValue ) / ( MaxValue - MinValue ) ;
Original file line number Diff line number Diff line change @@ -215,10 +215,12 @@ public void BeginEdit(int parameter)
215215
216216 public void EndEdit ( int parameter )
217217 {
218+ PerformEdit ( parameter , ( Plugin as IAudioPluginEditor ) . Parameters [ parameter ] . NormalizedEditValue ) ;
218219 }
219220
220221 public void PerformEdit ( int parameter , double normalizedValue )
221222 {
223+ ( Plugin as IAudioPluginProcessor ) . Parameters [ parameter ] . NormalizedProcessValue = normalizedValue ;
222224 }
223225
224226 public void ProcessAllEvents ( )
Original file line number Diff line number Diff line change 66 <Nullable >enable</Nullable >
77 <AllowUnsafeBlocks >True</AllowUnsafeBlocks >
88 <UseWindowsForms >true</UseWindowsForms >
9- <Version >0.7.4 </Version >
9+ <Version >0.7.5 </Version >
1010 <Authors >Mike Oliphant</Authors >
1111 <Description >Stand-alone ASIO host for AudioPlugSharp plugins.</Description >
1212 <PackageLicenseExpression >MIT</PackageLicenseExpression >
Original file line number Diff line number Diff line change 44 <TargetFramework >net8.0</TargetFramework >
55 <ImplicitUsings >enable</ImplicitUsings >
66 <Nullable >enable</Nullable >
7- <Version >0.7.4 </Version >
7+ <Version >0.7.5 </Version >
88 <Authors >Mike Oliphant</Authors >
99 <Description >Jack Audio host for AudioPlugSharp plugins.</Description >
1010 <PackageLicenseExpression >MIT</PackageLicenseExpression >
Original file line number Diff line number Diff line change @@ -162,10 +162,12 @@ public void BeginEdit(int parameter)
162162
163163 public void EndEdit ( int parameter )
164164 {
165+ PerformEdit ( parameter , ( Plugin as IAudioPluginEditor ) . Parameters [ parameter ] . NormalizedEditValue ) ;
165166 }
166167
167168 public void PerformEdit ( int parameter , double normalizedValue )
168169 {
170+ ( Plugin as IAudioPluginProcessor ) . Parameters [ parameter ] . NormalizedProcessValue = normalizedValue ;
169171 }
170172
171173 public void ProcessAllEvents ( )
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ public override void Process()
7676 {
7777 base . Process ( ) ;
7878
79- linearGain = Math . Pow ( 10.0 , 0.05 * gainParameter . ProcessValue ) ;
79+ linearGain = AudioPluginParameter . DbToLinear ( gainParameter . ProcessValue ) ;
8080
8181 Span < double > outSamples = monoOutput . GetAudioBuffer ( 0 ) ;
8282
@@ -102,7 +102,7 @@ public override void Process()
102102 // If we need to update our gain paramter, get the sample-accurate interpolated value
103103 if ( needGainUpdate )
104104 {
105- linearGain = Math . Pow ( 10.0 , 0.05 * gainParameter . GetInterpolatedProcessValue ( i ) ) ;
105+ linearGain = AudioPluginParameter . DbToLinear ( gainParameter . GetInterpolatedProcessValue ( i ) ) ;
106106 }
107107
108108 outSamples [ i ] = Math . Sin ( ( ( double ) samplesSoFar * 2 * Math . PI * freq ) / Host . SampleRate ) * noteVolume * linearGain ;
Original file line number Diff line number Diff line change @@ -46,12 +46,12 @@ public override void Process()
4646 {
4747 base . Process ( ) ;
4848
49- // This will trigger all Midi note events and parameter changes that happend during this process window
49+ // This will trigger all Midi note events and parameter changes that happened during this process window
5050 // For sample-accurate tracking, see the WPFExample or MidiExample plugins
5151 Host . ProcessAllEvents ( ) ;
5252
53- double gain = GetParameter ( "gain" ) . ProcessValue ;
54- float linearGain = ( float ) Math . Pow ( 10.0 , 0.05 * gain ) ;
53+ double gainDb = GetParameter ( "gain" ) . ProcessValue ;
54+ float linearGain = ( float ) AudioPluginParameter . DbToLinear ( gainDb ) ;
5555
5656 ReadOnlySpan < float > inSamples = monoInput . GetAudioBuffer ( 0 ) ;
5757 Span < float > outSamples = monoOutput . GetAudioBuffer ( 0 ) ;
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ public override void Process()
7272 int currentSample = 0 ;
7373 int nextSample = 0 ;
7474
75- double linearGain = Math . Pow ( 10.0 , 0.05 * gainParameter . ProcessValue ) ;
75+ double linearGain = AudioPluginParameter . DbToLinear ( gainParameter . ProcessValue ) ;
7676 double pan = panParameter . ProcessValue ;
7777
7878 do
@@ -86,7 +86,7 @@ public override void Process()
8686 {
8787 if ( needGainUpdate )
8888 {
89- linearGain = Math . Pow ( 10.0 , 0.05 * gainParameter . GetInterpolatedProcessValue ( i ) ) ;
89+ linearGain = AudioPluginParameter . DbToLinear ( gainParameter . GetInterpolatedProcessValue ( i ) ) ;
9090 }
9191
9292 if ( needPanUpdate )
You can’t perform that action at this time.
0 commit comments