// private const int AD9833_APPLY_SIGNAL = (AD9833_BASE + 1); public void ApplySignal(WaveformType waveType, Registers freqReg, double frequencyInHz, Registers phaseReg = Registers.SAME_AS_REG0, double phaseInDeg = 0.0) { Esp32If.GpioExtent[] exts = new Esp32If.GpioExtent[] { new Esp32If.GpioExtent(), new Esp32If.GpioExtent(), new Esp32If.GpioExtent() }; /* * p1=waveType * p2=freqReg ## extension ## ##double frequencyInHz ##Registers phaseReg ##double phaseInDeg */ exts[0].Contents = esp32If.IntToBytes((int)(frequencyInHz * 10)); exts[1].Contents = esp32If.IntToBytes((int)phaseReg); exts[2].Contents = esp32If.IntToBytes((int)(phaseInDeg * 1000)); esp32If.GpioCommandExt(AD9833_APPLY_SIGNAL, (int)waveType, (int)freqReg, exts); }
public WaveformControllerFunction(WaveformType type, float baseVal, float frequency) : base(true) { this.type = type; this.baseVal = baseVal; this.frequency = frequency; }
public WaveformControllerFunction(WaveformType wType, float arg1, float frequency, float phase, float amplitude, bool deltaInput) : this(OgrePINVOKE.new_WaveformControllerFunction__SWIG_1((int)wType, arg1, frequency, phase, amplitude, deltaInput), true) { if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public WaveformControllerFunction(WaveformType wType, float arg1, float frequency) : this(OgrePINVOKE.new_WaveformControllerFunction__SWIG_4((int)wType, arg1, frequency), true) { if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public WaveformControllerFunction(WaveformType wType) : this(OgrePINVOKE.new_WaveformControllerFunction__SWIG_6((int)wType), true) { if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } }
public FunctionGenerator( string desiredFrequency, string samplesPerBuffer, string cyclesPerBuffer, string type, string amplitude) { WaveformType t = new WaveformType(); if (type == "Sine") { t = WaveformType.SineWave; } else { Debug.Assert(false, "Invalid Waveform Type"); } Init( Double.Parse(desiredFrequency), Double.Parse(samplesPerBuffer), Double.Parse(cyclesPerBuffer), t, Double.Parse(amplitude)); }
public WaveformControllerFunction(WaveformType type, float baseVal, float frequency, float phase) : base(true) { this.type = type; this.baseVal = baseVal; this.frequency = frequency; this.phase = phase; }
public WaveformControllerFunction(WaveformType type, Real baseVal, Real frequency) : base(true) { this.type = type; this.baseVal = baseVal; this.frequency = frequency; }
public WaveformControllerFunction(WaveformType type, float baseVal, float frequency, float phase, float amplitude, bool useDelta) : base(useDelta) { this.type = type; this.baseVal = baseVal; this.frequency = frequency; this.phase = phase; this.amplitude = amplitude; }
public WaveformControllerFunction(WaveformType type, Real baseVal, Real frequency, Real phase, Real amplitude) : base(true) { this.type = type; this.baseVal = baseVal; this.frequency = frequency; this.phase = phase; this.amplitude = amplitude; }
public override void SetWaveformType(WaveformType waveType, int channel) { // all waveform types in the enum are specified for this function generator CheckChannelParam(channel); int waveNum = (int)waveType; string waveName = Enum.GetName(typeof(WaveformType), waveNum); WriteRawCommand("C" + channel + ":BSWV WVTP," + waveName); }
public void SetWaveformType(WaveformType type, int channel) { using (StreamWriter streamWriter = new StreamWriter(filePath, true)) { streamWriter.WriteLine("SetWaveformType(" + type.ToString() + ", " + channel + ") " // can't forget that space + string.Format("{0:yyyy-MM-dd_hh-mm-ss-fff}", DateTime.Now)); } channelWaveData[channel - 1].waveformType = type; }
private void Init( Timing timingSubobject, double desiredFrequency, double samplesPerBuffer, double cyclesPerBuffer, WaveformType type, double amplitude) { if (desiredFrequency <= 0) { throw new ArgumentOutOfRangeException("desiredFrequency", desiredFrequency, "This parameter must be a positive number"); } if (samplesPerBuffer <= 0) { throw new ArgumentOutOfRangeException("samplesPerBuffer", samplesPerBuffer, "This parameter must be a positive number"); } if (cyclesPerBuffer <= 0) { throw new ArgumentOutOfRangeException("cyclesPerBuffer", cyclesPerBuffer, "This parameter must be a positive number"); } // First configure the Task timing parameters if (timingSubobject.SampleTimingType == SampleTimingType.OnDemand) { timingSubobject.SampleTimingType = SampleTimingType.SampleClock; } _desiredSampleClockRate = (desiredFrequency * samplesPerBuffer) / cyclesPerBuffer; _samplesPerCycle = samplesPerBuffer / cyclesPerBuffer; // Determine the actual sample clock rate timingSubobject.SampleClockRate = _desiredSampleClockRate; _resultingSampleClockRate = timingSubobject.SampleClockRate; _resultingFrequency = _resultingSampleClockRate / (samplesPerBuffer / cyclesPerBuffer); switch (type) { case WaveformType.SineWave: _data = GenerateSineWave(_resultingFrequency, amplitude, _resultingSampleClockRate, samplesPerBuffer); break; case WaveformType.ChirpWave: _data = GenerateChirpWave(0.01, 1, 10, 0, amplitude, _resultingSampleClockRate, samplesPerBuffer); break; case WaveformType.PseudoRandomBinomial: _data = GeneratePseudoRandomBinomial(0.5, 50, amplitude, _resultingSampleClockRate, samplesPerBuffer); break; default: // Invalid type value Debug.Assert(false); break; } }
public static ControllerFunctionPtr create(WaveformType wType) { ControllerFunctionPtr ret = new ControllerFunctionPtr(OgrePINVOKE.WaveformControllerFunction_create__SWIG_6((int)wType), true); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static ControllerFunctionPtr create(WaveformType wType, float arg1, float frequency, float phase) { ControllerFunctionPtr ret = new ControllerFunctionPtr(OgrePINVOKE.WaveformControllerFunction_create__SWIG_3((int)wType, arg1, frequency, phase), true); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public void Init(ushort hue, ushort saturation, ushort brightness, ushort kelvin, uint period, float cycles, short dutyCycles, WaveformType waveform) { _hue = hue; _saturation = saturation; _brightness = brightness; _kelvin = kelvin; _period = period; _cycles = cycles; _dutyCycles = dutyCycles; _waveform = waveform; }
public WaveformControllerFunction(WaveformType type, Real baseVal, Real frequency, Real phase, Real amplitude, bool useDelta) : base(useDelta) { this.type = type; this.baseVal = baseVal; this.frequency = frequency; this.phase = phase; this.amplitude = amplitude; deltaCount = phase; }
public GargleSoundFx() : base(SoundFxType.Gargle) { _rate = new MathValue(); _rate.Min = 0; // DSFXGARGLE_RATEHZ_MIN _rate.Max = 1000; // DSFXGARGLE_RATEHZ_MAX _rate.Default = 20; _rate.Unit = MathUnitType.hz; _rate.FriendlyName = "Rate"; _rate.Step = 0.1f; _waveform = WaveformType.Triangle; }
/// <summary> /// Control for playing notes of track /// </summary> public TrackManager(ToDoTrack onPlayTrack, int initialTact) { Instrument = onPlayTrack.Instrument.Waveform; OnPlayNotes = new Queue <ToDoNote>(); PlayedNotes = new List <ToDoNote>(); foreach (var note in onPlayTrack.Samples.OrderBy(x => x.InitialTact) .Select(sample => sample.Notes.Where(x => x.Tact >= initialTact).OrderBy(x => x.Tact).ThenBy(x => x.Position)) .SelectMany(notes => notes)) { OnPlayNotes.Enqueue(note); } }
public FunctionGenerator( double desiredFrequency, double samplesPerBuffer, double cyclesPerBuffer, WaveformType type, double amplitude) { Init( desiredFrequency, samplesPerBuffer, cyclesPerBuffer, type, amplitude); }
private void SetWaveformFromUi() { if (SineRadioButton.Checked) { _waveform = WaveformType.Sine; } else if (SquareRadioButton.Checked) { _waveform = WaveformType.Square; } else if (TriangleRadioButton.Checked) { _waveform = WaveformType.Triangle; } }
public Digital_WaveformGenerator(WaveformType type, IPAddress deviceAddress, string line, bool periodic) { waveformType = type; periodicWaveform = periodic; waveform = new SignalState[2]; waveform[0] = new SignalState(); waveform[0].state = true; waveform[0].durationMicroSec = onDuration; waveform[1] = new SignalState(); waveform[1].state = false; waveform[1].durationMicroSec = offDuration; transitionevent = new WaveformEventArgs(); stateevent = new WaveformEventArgs(); lastStateIdx = 0; digitalLine = line; activeTransitionCounter = 0; startCounter = 0; if (waveformType == WaveformType.DigitalIO) { try { DAQTask = new Task(); DOChannel outputChannel = DAQTask.DOChannels.CreateChannel(digitalLine, "waveform", ChannelLineGrouping.OneChannelForAllLines); //outputChannel.OutputDriveType = DOOutputDriveType.ActiveDrive; DAQTask.Start(); writer = new DigitalSingleChannelWriter(DAQTask.Stream); } catch (DaqException ex) { MessageBox.Show(ex.Message); if (DAQTask != null) { DAQTask.Dispose(); DAQTask = null; } } } if (waveformType == WaveformType.TCP) { Int32 hostport; Int32.TryParse(line, out hostport); tcpClientGenerator = new ClientConnection(deviceAddress.ToString(), hostport); tcpClientGeneratorThread = new Thread(new ThreadStart(DoTCPConnection)); } if (waveformType == WaveformType.Serial) { } }
public FunctionGenerator( Timing timingSubobject, double desiredFrequency, double samplesPerBuffer, double cyclesPerBuffer, WaveformType type, double amplitude) { Init( timingSubobject, desiredFrequency, samplesPerBuffer, cyclesPerBuffer, type, amplitude); }
public ChorusSoundFx() : base(SoundFxType.Chorus) { _wetDryMix = new MathValue(); _depth = new MathValue(); _feedback = new MathValue(); _frequency = new MathValue(); _delay = new MathValue(); _wetDryMix.Min = 0; // DSFXCHORUS_WETDRYMIX_MIN _wetDryMix.Max = 100; // DSFXCHORUS_WETDRYMIX_MAX _wetDryMix.Default = 50; _wetDryMix.Unit = MathUnitType.percent; _wetDryMix.FriendlyName = "Wet/Dry mix"; _wetDryMix.Step = 0.1f; _depth.Min = 0; // DSFXCHORUS_DEPTH_MIN _depth.Max = 100; // DSFXCHORUS_DEPTH_MAX _depth.Default = 10; _depth.Unit = MathUnitType.percent; _depth.FriendlyName = "Depth"; _depth.Step = 0.1f; _feedback.Min = -99; // DSFXCHORUS_FEEDBACK_MIN _feedback.Max = 99; // DSFXCHORUS_FEEDBACK_MAX _feedback.Default = 25; _feedback.Unit = MathUnitType.percent; _feedback.FriendlyName = "Feedback"; _feedback.Step = 0.1f; _frequency.Min = 0; // DSFXCHORUS_FREQUENCY_MIN _frequency.Max = 10; // DSFXCHORUS_FREQUENCY_MAX _frequency.Default = 1.1f; _frequency.Unit = MathUnitType.hz; _frequency.FriendlyName = "Frequency"; _frequency.Step = 0.1f; _delay.Min = 0; // DSFXCHORUS_DELAY_MIN _delay.Max = 20; // DSFXCHORUS_DELAY_MAX _delay.Default = 16; _delay.Unit = MathUnitType.ms; _delay.FriendlyName = "Delay"; _delay.Step = 0.1f; _waveform = WaveformType.Sine; _phase = PhaseType.Plus90; }
public FlangerSoundFx() : base(SoundFxType.Flanger) { _wetDryMix = new MathValue();; _depth = new MathValue(); _feedback = new MathValue(); _frequency = new MathValue();; _delay = new MathValue(); _wetDryMix.Min = 0; // DSFXFLANGER_WETDRYMIX_MIN _wetDryMix.Max = 100; // DSFXFLANGER_WETDRYMIX_MAX _wetDryMix.Default = 50; _wetDryMix.Unit = MathUnitType.percent; _wetDryMix.FriendlyName = "Wet/Dry Mix"; _wetDryMix.Step = 0.1f; _depth.Min = 0; // DSFXFLANGER_DEPTH_MIN _depth.Max = 100; // DSFXFLANGER_DEPTH_MAX _depth.Default = 100; _depth.Unit = MathUnitType.percent; _depth.FriendlyName = "Depth"; _depth.Step = 0.1f; _feedback.Min = -99; // DSFXFLANGER_FEEDBACK_MIN _feedback.Max = 99; // DSFXFLANGER_FEEDBACK_MAX _feedback.Default = -50; _feedback.Unit = MathUnitType.percent; _feedback.FriendlyName = "Feedback"; _feedback.Step = 0.1f; _frequency.Min = 0; // DSFXFLANGER_FREQUENCY_MIN _frequency.Max = 10; // DSFXFLANGER_FREQUENCY_MAX _frequency.Default = 0.25f; _frequency.Unit = MathUnitType.hz; _frequency.FriendlyName = "Frequency"; _frequency.Step = 0.01f; _delay.Min = 0; // DSFXFLANGER_DELAY_MIN _delay.Max = 4; // DSFXFLANGER_DELAY_MAX _delay.Default = 2; _delay.Unit = MathUnitType.ms; _delay.FriendlyName = "Delay"; _delay.Step = 0.01f; _waveform = WaveformType.Sine; _phase = PhaseType.Zero; }
public void DisableType(WaveformType type) { switch (type) { case WaveformType.Sine: SineRadioButton.Enabled = false; break; case WaveformType.Square: SquareRadioButton.Enabled = false; break; case WaveformType.Triangle: TriangleRadioButton.Enabled = false; break; default: break; } }
public Simulator(WaveformType dataType) { CurrWaveformType = dataType; switch (CurrWaveformType) { case WaveformType.ECG: for (int i = 0; i < ecg_data.Length; i++) { ecg_data[i] = 0.0d; } break; case WaveformType.PPG: for (int i = 0; i < ppg_data.Length; i++) { ppg_data[i] = 0.0d; } break; } }
void WaveformChangedEvent(WaveformType waveform) { switch (_soundFx.Type) { case SoundFxType.Flanger: ((FlangerSoundFx)_soundFx).Waveform = waveform; break; case SoundFxType.Gargle: ((GargleSoundFx)_soundFx).Waveform = waveform; break; case SoundFxType.Chorus: ((ChorusSoundFx)_soundFx).Waveform = waveform; break; default: break; } NotifySoundFxChanged(); }
private void Init( double desiredFrequency, double samplesPerBuffer, double cyclesPerBuffer, WaveformType type, double amplitude) { if (desiredFrequency <= 0) { throw new ArgumentOutOfRangeException("desiredFrequency", desiredFrequency, "This parameter must be a positive number"); } if (samplesPerBuffer <= 0) { throw new ArgumentOutOfRangeException("samplesPerBuffer", samplesPerBuffer, "This parameter must be a positive number"); } if (cyclesPerBuffer <= 0) { throw new ArgumentOutOfRangeException("cyclesPerBuffer", cyclesPerBuffer, "This parameter must be a positive number"); } _resultingSampleClockRate = (desiredFrequency * samplesPerBuffer) / cyclesPerBuffer; _samplesPerCycle = samplesPerBuffer / cyclesPerBuffer; // Determine the actual sample clock rate _resultingFrequency = _resultingSampleClockRate / (samplesPerBuffer / cyclesPerBuffer); switch (type) { case WaveformType.SineWave: _data = GenerateSineWave(_resultingFrequency, amplitude, _resultingSampleClockRate, samplesPerBuffer); break; default: // Invalid type value Debug.Assert(false); break; } }
/// <summary> /// Creates a very flexible time-based texture transformation which can alter the scale, position or /// rotation of a texture based on a wave function. /// </summary> /// <param name="layer">The texture unit to effect.</param> /// <param name="type">The type of transform, either translate (scroll), scale (stretch) or rotate (spin).</param> /// <param name="waveType">The shape of the wave, see WaveformType enum for details.</param> /// <param name="baseVal">The base value of the output.</param> /// <param name="frequency">The speed of the wave in cycles per second.</param> /// <param name="phase">The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.</param> /// <param name="amplitude">Scales the output so that instead of lying within 0..1 it lies within 0..(1 * amplitude) for exaggerated effects</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller <Real> CreateTextureWaveTransformer(TextureUnitState layer, TextureTransform type, WaveformType waveType, Real baseVal, Real frequency, Real phase, Real amplitude) { IControllerValue <Real> val = null; IControllerFunction <Real> function = null; // determine which type of controller value this layer needs switch (type) { case TextureTransform.TranslateU: val = new TexCoordModifierControllerValue(layer, true, false); break; case TextureTransform.TranslateV: val = new TexCoordModifierControllerValue(layer, false, true); break; case TextureTransform.ScaleU: val = new TexCoordModifierControllerValue(layer, false, false, true, false, false); break; case TextureTransform.ScaleV: val = new TexCoordModifierControllerValue(layer, false, false, false, true, false); break; case TextureTransform.Rotate: val = new TexCoordModifierControllerValue(layer, false, false, false, false, true); break; } // switch // create a new waveform controller function function = new WaveformControllerFunction(waveType, baseVal, frequency, phase, amplitude, true); // finally, create the controller using frame time as the source value return(CreateController(this.frameTimeController, val, function)); }
public FunctionGenerator( Timing timingSubobject, string desiredFrequency, string samplesPerBuffer, string cyclesPerBuffer, string type, string amplitude) { WaveformType t = new WaveformType(); t = WaveformType.SineWave; if (type == "Sine Wave") { t = WaveformType.SineWave; } else if (type == "Chirp Wave") { t = WaveformType.ChirpWave; } else if (type == "Pseudo Random Binomial") { t = WaveformType.PseudoRandomBinomial; } else { Debug.Assert(false, "Invalid Waveform Type"); } Init( timingSubobject, Double.Parse(desiredFrequency), Double.Parse(samplesPerBuffer), Double.Parse(cyclesPerBuffer), t, Double.Parse(amplitude)); }
/// <summary> /// Sets up a general time-relative texture modification effect. /// </summary> /// <remarks> /// This can be called multiple times for different values of <paramref name="transType"/>, but only the latest effect /// applies if called multiple time for the same <paramref name="transType"/>. /// <p/> /// This option has no effect in the programmable pipeline. /// </remarks> /// <param name="transType">The type of transform, either translate (scroll), scale (stretch) or rotate (spin).</param> /// <param name="waveType">The shape of the wave, see <see cref="WaveformType"/> enum for details</param> /// <param name="baseVal">The base value for the function (range of output = {base, base + amplitude}).</param> /// <param name="frequency">The speed of the wave in cycles per second.</param> /// <param name="phase">The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.</param> /// <param name="amplitude">Scales the output so that instead of lying within [0..1] it lies within [0..(1 * amplitude)] for exaggerated effects.</param> public void SetTransformAnimation( TextureTransform transType, WaveformType waveType, float baseVal, float frequency, float phase, float amplitude ) { var effect = new TextureEffect(); effect.type = TextureEffectType.Transform; effect.subtype = transType; effect.waveType = waveType; effect.baseVal = baseVal; effect.frequency = frequency; effect.phase = phase; effect.amplitude = amplitude; AddEffect( effect ); }
public static void FromDeviceData(byte[] settings) { _channel1Offset = (sbyte)(ChannelBottomPosition - (sbyte)settings[MCh1Pos]); _channel2Offset = (sbyte)(ChannelBottomPosition - (sbyte)settings[MCh2Pos]); _horizontalFrequency = settings[GPIO0SRate]; _autoTriggerTime = ((decimal)settings[MTriggerTimeout] + 1) * 40.96M; _channelTriggerSource = settings[MTSource]; _channel1Gain = settings[MCh1Gain]; _channel2Gain = settings[MCh2Gain]; _horizontalPosition = settings[MHPos]; _waveformType = (WaveformType)settings[MWaveForm]; _isStopped = ((settings[GPIOBMStatus] & 16) != 0); // M 36 Amplitude range: [-128,0] _amplitude = (byte)(-settings[MAmplitude]); // 38 Duty cycle range: [1,255] _dutyCycle = settings[MDutyCycle]; if (_dutyCycle == 0) _dutyCycle++; // M 39 Offset _offset = settings[MOffset]; // M 21 Trigger Hold _holdTime = settings[MTriggerHold]; // 40 Desired frequency _desiredFrequency = ((16777216 * ((UInt32)settings[43])) + (65536 * ((UInt32)settings[42])) + (256 * ((UInt32)settings[41])) + (1 * ((UInt32)settings[40]))) / 100; UpdateActualFrequency(_desiredFrequency * 100); ProcessChannel1Option(settings[GPIO1Ch1Option]); ProcessChannel2Option(settings[GPIO1Ch2Option]); ProcessChannelDOption(settings[GPIO1ChDOption]); ProcessTriggerOption(settings[GPIO5Trigger]); OnSettingChanged("Amplitude"); OnSettingChanged("Offset"); OnSettingChanged("DutyCycle"); OnSettingChanged("Channel1Gain"); OnSettingChanged("Channel2Gain"); OnSettingChanged("ChannelTriggerSource"); OnSettingChanged("Channel1Offset"); OnSettingChanged("Channel2Offset"); OnSettingChanged("HorizontalFrequency"); OnSettingChanged("AutoTriggerTimeout"); OnSettingChanged("HorizontalPosition"); OnSettingChanged("WaveformType"); OnSettingChanged("DesiredFrequency"); OnSettingChanged("ActualFrequency"); OnSettingChanged("IsStopped"); }
/// <summary> /// Creates a very flexible time-based texture transformation which can alter the scale, position or /// rotation of a texture based on a wave function. /// </summary> /// <param name="layer">The texture unit to effect.</param> /// <param name="type">The type of transform, either translate (scroll), scale (stretch) or rotate (spin).</param> /// <param name="waveType">The shape of the wave, see WaveformType enum for details.</param> /// <param name="baseVal">The base value of the output.</param> /// <param name="frequency">The speed of the wave in cycles per second.</param> /// <param name="phase">The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.</param> /// <param name="amplitude">Scales the output so that instead of lying within 0..1 it lies within 0..(1 * amplitude) for exaggerated effects</param> /// <returns>A newly created controller object that will be updated during the main render loop.</returns> public Controller<Real> CreateTextureWaveTransformer( TextureUnitState layer, TextureTransform type, WaveformType waveType, Real baseVal, Real frequency, Real phase, Real amplitude ) { IControllerValue<Real> val = null; IControllerFunction<Real> function = null; // determine which type of controller value this layer needs switch ( type ) { case TextureTransform.TranslateU: val = new TexCoordModifierControllerValue( layer, true, false ); break; case TextureTransform.TranslateV: val = new TexCoordModifierControllerValue( layer, false, true ); break; case TextureTransform.ScaleU: val = new TexCoordModifierControllerValue( layer, false, false, true, false, false ); break; case TextureTransform.ScaleV: val = new TexCoordModifierControllerValue( layer, false, false, false, true, false ); break; case TextureTransform.Rotate: val = new TexCoordModifierControllerValue( layer, false, false, false, false, true ); break; } // switch // create a new waveform controller function function = new WaveformControllerFunction( waveType, baseVal, frequency, phase, amplitude, true ); // finally, create the controller using frame time as the source value return CreateController( this.frameTimeController, val, function ); }
public WaveformControllerFunction(WaveformType type, float baseVal) : base(true) { this.type = type; this.baseVal = baseVal; }
public WaveformControllerFunction(WaveformType type) : base(true) { this.type = type; }