Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Jeskola.Gain
- {
- [MachineDecl(Name = "Jeskola Gain", ShortName = "Gain", Author = "Oskari Tammelin")]
- public class GainMachine : IBuzzMachine
- {
- IBuzzMachineHost host;
- public GainMachine(IBuzzMachineHost host)
- {
- this.host = host;
- Gain = new Interpolator();
- }
- [ParameterDecl(ResponseTime = 5, MaxValue = 127, DefValue = 80, Transformation = Transformations.Cubic, TransformUnityValue = 80, ValueDescriptor = Descriptors.Decibel)]
- public Interpolator Gain { get; private set; }
- [ParameterDecl(ValueDescriptions = new[] { "no", "yes" })]
- public bool Bypass { get; set; }
- public Sample Work(Sample s)
- {
- return Bypass ? s : s * Gain.Tick();
- }
- /*
- public bool Work(Sample[] output, Sample[] input, int numsamples, WorkModes mode)
- {
- if (mode == WorkModes.WM_READWRITE)
- {
- for (int i = 0; i < numsamples; i++)
- output[i] = Bypass ? input[i] : input[i] * Gain.Tick();
- return true;
- }
- return false;
- }
- */
- }
- public class MachineGUIFactory : IMachineGUIFactory
- {
- public IMachineGUI CreateGUI(IMachineGUIHost host) { return new GainGUI(); }
- }
- public partial class GainGUI : UserControl, IMachineGUI
- {
- IMachine machine;
- GainMachine gainMachine;
- public IMachine Machine
- {
- get { return machine; }
- set
- {
- machine = value;
- gainMachine = (GainMachine)machine.ManagedMachine;
- }
- }
- public GainGUI()
- {
- Height = 100;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement