Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Buzz.MachineInterface;
- 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;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement