Advertisement
Guest User

Untitled

a guest
Jan 1st, 2012
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. namespace Jeskola.Gain
  2. {
  3.     [MachineDecl(Name = "Jeskola Gain", ShortName = "Gain", Author = "Oskari Tammelin")]
  4.     public class GainMachine : IBuzzMachine
  5.     {
  6.         IBuzzMachineHost host;
  7.  
  8.         public GainMachine(IBuzzMachineHost host)
  9.         {
  10.             this.host = host;
  11.             Gain = new Interpolator();
  12.         }
  13.  
  14.         [ParameterDecl(ResponseTime = 5, MaxValue = 127, DefValue = 80, Transformation = Transformations.Cubic, TransformUnityValue = 80, ValueDescriptor = Descriptors.Decibel)]
  15.         public Interpolator Gain { get; private set; }
  16.  
  17.         [ParameterDecl(ValueDescriptions = new[] { "no", "yes" })]
  18.         public bool Bypass { get; set; }
  19.  
  20.         public Sample Work(Sample s)
  21.         {
  22.             return Bypass ? s : s * Gain.Tick();
  23.         }
  24.  
  25.         /*
  26.         public bool Work(Sample[] output, Sample[] input, int numsamples, WorkModes mode)
  27.         {
  28.             if (mode == WorkModes.WM_READWRITE)
  29.             {
  30.                 for (int i = 0; i < numsamples; i++)
  31.                     output[i] = Bypass ? input[i] : input[i] * Gain.Tick();
  32.  
  33.                 return true;
  34.             }
  35.            
  36.             return false;
  37.         }
  38.         */
  39.     }
  40.  
  41.     public class MachineGUIFactory : IMachineGUIFactory
  42.     {
  43.         public IMachineGUI CreateGUI(IMachineGUIHost host) { return new GainGUI(); }
  44.     }
  45.  
  46.     public partial class GainGUI : UserControl, IMachineGUI
  47.     {
  48.         IMachine machine;
  49.         GainMachine gainMachine;
  50.  
  51.         public IMachine Machine
  52.         {
  53.             get { return machine; }
  54.             set
  55.             {
  56.                 machine = value;
  57.                 gainMachine = (GainMachine)machine.ManagedMachine;
  58.             }
  59.         }
  60.  
  61.         public GainGUI()
  62.         {
  63.             Height = 100;
  64.         }
  65.  
  66.     }
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement