/// <summary> /// Загружает пресет из Txt-файла. /// </summary> /// <param name = "fileName"> /// Путь к файлу. /// </param> /// <param name = "oscillators"> /// Неинициализированный массив осцилляторов для загрузки в него пресета. /// </param> /// <exception cref = "PresetException"></exception> public void LoadPreset(String fileName, out Oscillator[] oscillators) { try { oscillators = null; using (StreamReader reader = new StreamReader(fileName)) { String first = reader.ReadToEnd().Trim('\n', '\r', ' '); String[] second = first.Split(new Char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); oscillators = new Oscillator[second.Length]; for (Int32 i = 0; i < second.Length; i++) { second[i].Trim('\n', '\r', ' '); String[] third = second[i].Split(new Char[] { ' ' }, StringSplitOptions.None); oscillators[i] = new Oscillator ( Convert.ToBoolean(third[0]), Convert.ToInt32(third[1]), Convert.ToInt32(third[2]), Convert.ToInt32(third[3]), (Waveshape)Convert.ToInt32(third[4]) ); } } } catch { throw new PresetException("Ошибка при загрузке пресета из Txt-файла."); } }
// Use this for initialization void Start() { var gen = new Oscillator(); float[] intervals = _Scales [ScaleIndex % _Scales.Length]; Index = Random.Range(0, intervals.Length); float interval = intervals [Index % intervals.Length]; float octave = (float)Index / (float)intervals.Length; Note = BaseNote + octave * 12 + interval; gen.SetNote(Note); _generator = gen; _samples = new float[_generator.SamplesCount()]; for (int i = 0; i < _samples.Length; ++i) { _samples [i] = _generator.Sample(); } _source = GetComponent <AudioSource> (); _source.loop = true; _source.spatialBlend = 1; _source.clip = AudioClip.Create("", _samples.Length, 1, AudioSettings.outputSampleRate, false); _source.clip.SetData(_samples, 0); _source.Play(); _baseBehaviour = GetComponent <ElementBehaviour> (); }
// Use this for initialization void Start() { _grabber = new GstUnityAudioGrabber(); _grabber2 = new GstCustomAudioGrabber(); _grabber2.Init("filesrc location=\"" + AudioFile + "\" ! decodebin3 ! audioconvert ! audioresample", Channels, SampleRate); _osc = new Oscillator(); _osc.SetNote(70); _grabber.Init(_osc.SamplesCount() * 10, 1, AudioSettings.outputSampleRate); float[] data = new float[_grabber.BufferLength]; for (int i = 0; i < data.Length; ++i) { data [i] = _osc.Sample(); } _data = data; _streamer = new GstAppNetAudioStreamer(); _streamer.AttachGrabber(_grabber2); _grabber2.Start(); _streamer.SetIP("127.0.0.1", 5001); _streamer.CreateStream(); _streamer.Stream(); }
// Use this for initialization private void Start() { // Get SpriteRenderer component _spriteRenderer = GetComponent <SpriteRenderer>(); // Get ParticleSystem component //_particleSystem = GetComponent<ParticleSystem>(); // Get CircleCollider2D component _circleCollider2D = GetComponent <CircleCollider2D>(); // Get AudioSource component _audioSource = GetComponent <AudioSource>(); // Instantiate Stopwatch _stopwatch = new System.Diagnostics.Stopwatch(); // Oscillator // Calculate total movement length _movementSemiLength = Mathf.Abs(_upLimit.localPosition.y - _downLimit.localPosition.y) / 2.0f; // Calculate initial oscillator angle float l_oscillatorAngle_0 = Mathf.Acos(_initialPosition.localPosition.y / _movementSemiLength) * Mathf.Rad2Deg; // If initial platform movement is to the right, recalculate initial oscillator angle if (_reverseInitialDirection) { l_oscillatorAngle_0 = 360.0f - l_oscillatorAngle_0; } // Instantiate new Oscillator object _oscillator = new Oscillator(l_oscillatorAngle_0, _frequency, new CosSqrtbOscillatorFunction(l_oscillatorAngle_0, _frequency, _bMovementParam)); // Translate gem to the initial position transform.Translate(_initialPosition.localPosition.x, 0.0f, 0.0f, Space.Self); // Assing initial gem position 0 _gemPosition_0 = _initialPosition.localPosition.x; }
public void Configure(float sampleRate, int bufferSize) { //Complain if too low if (sampleRate < BAUD_RATE) { throw new Exception($"The sample rate specified, {sampleRate}, is too low to be useful. Must be >= {BAUD_RATE}."); } //Create parts fmDemod = new FmBasebandDemodulator(); fmDemod.Configure(bufferSize, sampleRate); amDemod = new AmBasebandDemodulator(); osc = new Oscillator(sampleRate, -2400); symbolsPerSample = BAUD_RATE / sampleRate; //Make filter var filterBuilder = new LowPassFilterBuilder(sampleRate, 2080) .SetAutomaticTapCount(200) .SetWindow(); filter = RealFirFilter.CreateFirFilter(filterBuilder); //Create buffer buffer?.Dispose(); buffer = UnsafeBuffer.Create(bufferSize, out bufferPtr); }
public void setupChain() { switch (WaveForm) { case waveType.Saw: osc = new Sawtooth(); break; case waveType.Sine: osc = new Sine(); break; case waveType.Square: osc = new Square(); break; case waveType.Tri: osc = new Triangle(); break; } osc.setGain(gain); if (mod != null) { mod.setupChain(); } }
Oscillator oscillator; //oscillator graphical representation and logic // Use this for initialization void Start() { launcher = GetComponent <Launcher>(); oscillator = GetComponent <Oscillator>(); direction = 0; state = launcher.GetState(); }
public void Start_Oscillates_Correct_Number_Of_Times() { // arrange int nExpected = 42; var oscillator = new Oscillator(String.Empty, (uint)nExpected); oscillator.V.V = VoltageSignal.HIGH; int nHighs = 0, nLows = 0; oscillator.Output.Changed += (cp) => { if (cp.V == VoltageSignal.HIGH) { nHighs++; } if (cp.V == VoltageSignal.LOW) { nLows++; } }; // act oscillator.Start(); // assert Assert.AreEqual(nExpected, nHighs, "# times oscillator output should have gone high"); Assert.AreEqual(nExpected, nLows, "# times oscillator output should have gone low"); }
/// <summary> /// Called on each bar update event (incoming tick) /// </summary> protected override void OnBarUpdate() { if (CurrentBar < 1) { OscillatorLine.Set(0); SignalLine.Set(0); Oscillator.Set(0); return; } oscillatorValue = fastSMA[0] - slowSMA[0]; if (ShowLines) { OscillatorLine.Set(oscillatorValue); SignalLine.Set(SMA(OscillatorLine, Smooth)[0]); } else { OscillatorLine.Reset(); SignalLine.Reset(); } Oscillator.Set(oscillatorValue); if (Rising(Oscillator)) { PlotColors[0][0] = UpColor; PlotColors[2][0] = UpColor; } else { PlotColors[0][0] = DownColor; PlotColors[2][0] = DownColor; } }
public void Start_Does_Nothing_When_Oscillator_Off() { // arrange var oscillator = new Oscillator(String.Empty); int nHighs = 0, nLows = 0; oscillator.Output.Changed += (cp) => { if (cp.V == VoltageSignal.HIGH) { nHighs++; } if (cp.V == VoltageSignal.LOW) { nLows++; } }; // act oscillator.Start(); // assert Assert.AreEqual(0, nHighs, "oscillator output should have never gone high"); Assert.AreEqual(0, nLows, "oscillator output should have never gone low"); }
public void Start_Goes_High_Low_When_Oscillator_On() { // arrange var oscillator = new Oscillator(String.Empty, 1); // one cycle oscillator.V.V = VoltageSignal.HIGH; int nHighs = 0, nLows = 0; oscillator.Output.Changed += (cp) => { if (cp.V == VoltageSignal.HIGH) { nHighs++; } if (cp.V == VoltageSignal.LOW) { nLows++; } }; // act oscillator.Start(); // assert Assert.AreEqual(1, nHighs, "oscillator output should have gone high"); Assert.AreEqual(1, nLows, "oscillator output should have gone low"); }
public JointRotations GetRotations() { GetKneeJointPhaseOffset(left, right, ref tPhaseOffset); GetShoulderJointAmp(left, right, ref tAmp); float dt = Time.deltaTime; osc.UpdateKuramoto(dt); // legs stops moving if the shoulder does float a = 1 - Mathf.Exp(-4 * Mathf.Clamp01(Mathf.Max(Mathf.Abs(left), Mathf.Abs(right)))); for (int i = 0; i < N_LEGS; ++i) { // Critically damped second order differential equation // http://mathproofs.blogspot.ca/2013/07/critically-damped-spring-smoothing.html float ddPhaseOffset = smoothing * ((smoothing / 4.0f) * (tPhaseOffset[i] - phaseOffset[i]) - dPhaseOffset[i]); // 2nd derivative dPhaseOffset[i] = dPhaseOffset[i] + dt * ddPhaseOffset; // 1st derivative phaseOffset[i] = phaseOffset[i] + dt * dPhaseOffset[i]; float ddAmp = smoothing * ((smoothing / 4.0f) * (tAmp[i] - amp[i]) - dAmp[i]); // 2nd derivative dAmp[i] = dAmp[i] + dt * ddAmp; // 1st derivative amp[i] = amp[i] + dt * dAmp[i]; float osc = Mathf.Sin(this.osc.phase[i] + PHASE_OFFSET[i]); jr.y[i] = (1.0f / (1.0f + Mathf.Exp(-sig * osc)) - .5f) * 2.0f * amp[i]; osc = Mathf.Sin(this.osc.phase[i] * 1.0f + phaseOffset[i] * Mathf.PI / 2.0f); jr.z[i] = (1.0f / (1.0f + Mathf.Exp(-sig * osc)) - .5f) * 2.0f * a; } return(jr); }
///<summary> /// Variable Moving Average ///</summary> ///<param name="pNav">Navigator</param> ///<param name="pSource">Field Source</param> ///<param name="periods">Periods</param> ///<param name="Alias">Alias</param> ///<returns>Recordset</returns> public Recordset VariableMovingAverage(Navigator pNav, Field pSource, int periods, string Alias) { Oscillator OS = new Oscillator(); int Record; int RecordCount = pNav.RecordCount; Field Field1 = new Field(RecordCount, Alias); //CMO must be overwritten Recordset Results = OS.ChandeMomentumOscillator(pNav, pSource, 9, "CMO"); const int Start = 2; pNav.Position = Start; for (Record = Start; Record < RecordCount + 1; Record++) { pNav.MovePrevious(); double PrevVMA = Field1.ValueEx(pNav.Position); pNav.MoveNext(); double CMO = Results.ValueEx("CMO", pNav.Position) / 100; double Price = pSource.ValueEx(pNav.Position); if (CMO < 0) { CMO = -1 * CMO; } double VMA = (CMO * Price) + (1 - CMO) * PrevVMA; Field1.Value(pNav.Position, VMA); pNav.MoveNext(); }//Record pNav.MoveFirst(); Results.AddField(Field1); return(Results); }
void Start() { myOsc = GetComponent <Oscillator>(); mySynthControl = GetComponent <SynthControl>(); //RightControllerParticleSystem = GameObject.Find("RightControllerParticleSystem"); particles = RightControllerParticleSystem.GetComponent <ParticleSystem>(); }
async void MainPage_Loaded(object sender, RoutedEventArgs e) { this.systemControls = SystemMediaTransportControls.GetForCurrentView(); this.systemControls.ButtonPressed += systemControls_ButtonPressed; this.systemControls.IsPlayEnabled = true; this.systemControls.IsPauseEnabled = true; this.renderer = await AudioRenderer.CreateAsync(); var rootPath = Windows.ApplicationModel.Package.Current.InstalledLocation.Path + "\\Sounds\\"; this.drumPad = new DrumPad(); this.drumPad.SetDrumSound(DrumKind.Bass, rootPath + "Drum-Bass.wav"); this.drumPad.SetDrumSound(DrumKind.Snare, rootPath + "Drum-Snare.wav"); this.drumPad.SetDrumSound(DrumKind.Shaker, rootPath + "Drum-Shaker.wav"); this.drumPad.SetDrumSound(DrumKind.ClosedHiHat, rootPath + "Drum-Closed-Hi-Hat.wav"); this.drumPad.SetDrumSound(DrumKind.Cowbell, rootPath + "Cowbell.wav"); this.drumPad.SetDrumSound(DrumKind.OpenHiHat, rootPath + "Drum-Open-Hi-Hat.wav"); this.drumPad.SetDrumSound(DrumKind.RideCymbal, rootPath + "Drum-Ride-Cymbal.wav"); this.drumPad.SetDrumSound(DrumKind.FloorTom, rootPath + "developer_loud.wav"); this.drumPad.SetDrumSound(DrumKind.HighTom, rootPath + "satya_fantastic.wav"); this.oscillator = new Oscillator(); this.looper = new Looper(); this.demultiplexer = new AudioDemultiplexer(); this.looper.ListenTo(this.drumPad); this.demultiplexer.ListenTo(this.looper); this.demultiplexer.ListenTo(this.oscillator); this.renderer.ListenTo(this.demultiplexer); Play(); }
public Recordset Keltner(Navigator pNav, Recordset pOHLCV, int Periods, double Factor, IndicatorType MAType, string Alias) { // Same as STARC Recordset Results = new Recordset(); int recordCount = pOHLCV.GetField("Close").RecordCount; Field top = new Field(); top.Initialize(recordCount, Alias + " Top"); Field bottom = new Field(); bottom.Initialize(recordCount, Alias + " Bottom"); Oscillator os = new Oscillator(); Field tr = os.TrueRange(pNav, pOHLCV, "atr").GetField("atr"); MovingAverage ma = new MovingAverage(); Field atr = ma.SimpleMovingAverage(pNav, tr, Periods, "atr").GetField("atr"); Field median = ma.MovingAverageSwitch(pNav, pOHLCV.GetField("Close"), Periods, MAType, Alias + " Median").GetField(Alias + " Median"); for (int record = 1; record < recordCount + 1; record++) { double shift = Factor * atr.ValueEx(record); top.SetValue(record, median.Value(record) + shift); bottom.SetValue(record, median.Value(record) - shift); } Results.AddField(top); Results.AddField(median); Results.AddField(bottom); return(Results); }
void Run() { var quit = new ManualResetEvent(false); Console.CancelKeyPress += (s, a) => { quit.Set(); a.Cancel = true; }; using (var fmod = new FmodSystem()) { fmod.Init(); using (oscillator = (Oscillator)fmod.CreateDsp(DspType.Oscillator)) { oscillator.Play(); while (!quit.WaitOne(0)) { ShowPrompt(); ProcessInput(quit); Thread.Sleep(1); } } fmod.CloseSystem(); } }
protected override double Wave(double time, double frequency, double amplitude, double phase) { return(Oscillator.SineWave(time, frequency, amplitude / 2, Math.Sin(time * Math.PI * 2 * 3)) + Oscillator.SineWave(time, frequency * 4, amplitude / 4, Math.Sin(time * Math.PI * 2 * 5)) + Oscillator.SineWave(time, frequency * 8, amplitude / 8, Math.Sin(time * Math.PI * 7)) + Oscillator.Noise(time, amplitude / 8)); }
void AudioChunkTreeView_AfterCheck(object sender, TreeViewEventArgs e) { if (e.Node.Level == 2) { Oscillator osc = e.Node.Tag as Oscillator; osc.Enable = e.Node.Checked; } }
void Start() { oscillatorsList = gameObject.GetComponentsInChildren <Oscillator>(); wavesArray = new wave[oscillatorsList.Length * wavesCount]; for (int i = 0; i < oscillatorsList.Length; i++) { Oscillator osc = oscillatorsList[i]; osc.phase += osc.frequency * framePeriod; for (int j = 0; j < wavesCount; j++) { int wi = i * wavesCount + j; wavesArray[wi].pos = osc.transform.position; wavesArray[wi].phase = 0; } } wavesBuffer = new ComputeBuffer(wavesArray.Length, System.Runtime.InteropServices.Marshal.SizeOf(typeof(wave)), ComputeBufferType.Default); wavesBuffer.SetData(wavesArray); wavesArray = new wave[oscillatorsList.Length]; wavesUpdateBuffer = new ComputeBuffer(wavesArray.Length, System.Runtime.InteropServices.Marshal.SizeOf(typeof(wave)), ComputeBufferType.Default); kiWavesUpdate = mediumCompute.FindKernel("wavesUpdate"); mediumCompute.SetBuffer(kiWavesUpdate, "wavesBuffer", wavesBuffer); mediumCompute.SetBuffer(kiWavesUpdate, "wavesUpdateBuffer", wavesUpdateBuffer); surfersList = gameObject.GetComponentsInChildren <Surfer>(); if (surfersList.Length > 0) { surfersArray = new Vector3[surfersList.Length]; for (int i = 0; i < surfersList.Length; i++) { surfersArray[i] = surfersList[i].transform.position; } surfersBuffer = new ComputeBuffer(surfersArray.Length, System.Runtime.InteropServices.Marshal.SizeOf(typeof(Vector3)), ComputeBufferType.Default); surfersBuffer.SetData(surfersArray); kiSurfersUpdate = mediumCompute.FindKernel("surfersUpdate"); mediumCompute.SetBuffer(kiSurfersUpdate, "wavesBuffer", wavesBuffer); mediumCompute.SetBuffer(kiSurfersUpdate, "surfersBuffer", surfersBuffer); } mediumCompute.SetFloat("waveSpeed", waveSpeed); mediumCompute.SetFloat("framePeriod", framePeriod); mediumCompute.SetInt("oscillatorsCount", oscillatorsList.Length); mediumCompute.SetInt("wavesCount", wavesCount); mediumCompute.SetInt("curWaveIndex", curWaveIndex); for (int i = 0; i < wavesCount; i++) { wavesUpdate(); } Shader.SetGlobalBuffer("wavesBuffer", wavesBuffer); Shader.SetGlobalFloat("waveSpeed", waveSpeed); Shader.SetGlobalFloat("framePeriod", framePeriod); Shader.SetGlobalInt("oscillatorsCount", oscillatorsList.Length); Shader.SetGlobalInt("wavesCount", wavesCount); Shader.SetGlobalInt("curWaveIndex", curWaveIndex); }
// Use this for initialization void Start() { for (int i = 0; i < oscillators.Length; i++) { oscillators[i] = new Oscillator(); spheres[i] = GameObject.CreatePrimitive(PrimitiveType.Sphere); spheres[i].transform.position = new Vector3(UnityEngine.Random.value, UnityEngine.Random.value, UnityEngine.Random.value); } }
public OscillatorModule(Oscillator oscillator, int outputs, float halfToneOffset = 0, float gain = 1f, int sampleRate = 44100) { this.oscillator = oscillator.Clone(sampleRate); frequencyMultiplier = (float)Tone.FrequencyMultiplierFromNoteOffset(halfToneOffset); this.gain = gain; Inputs = new ConnectionsArray(1, 1); Outputs = new ConnectionsArray(outputs); output = new float[outputs]; }
private OscillatorModule(OscillatorModule oscMod, int sampleRate) { oscillator = oscMod.oscillator.Clone(sampleRate); gain = oscMod.gain; frequencyMultiplier = oscMod.frequencyMultiplier; Inputs = new ConnectionsArray(1, 1); Outputs = new ConnectionsArray(oscMod.Outputs.Count); output = new float[Outputs.Count]; }
public void Constructor_Name_Num_Oscillations() { // arrange, act var oscillator = new Oscillator(String.Empty, 0); // assert Assert.AreEqual(VoltageSignal.LOW, oscillator.V.V, "Constructor: Voltage"); Assert.AreEqual(VoltageSignal.LOW, oscillator.Output.V, "Constructor: Output"); }
public override AbstractSoundController PlayNote(Pitch pitch, float volume, int durationTimeQuanta) { Oscillator oscillator = Instantiate(_oscillatorPrefab, gameObject.transform); oscillator.waveForm = _waveForm; oscillator.frequency = PitchFrequencyCalculator.GetFrequency(pitch); oscillator.gain = volume * _masterGain; return(new OscillatorSoundController(oscillator, durationTimeQuanta)); }
/// <summary> /// Action to be executd for calculating indicator /// </summary> /// <returns>for future usage. Must be ignored at this time.</returns> protected override bool TrueAction() { // Validate int size = _chartPanel._chartX.RecordCount; if (size == 0) { return(false); } int paramInt1 = ParamInt(1); if (paramInt1 < 1 || paramInt1 > size / 2) { ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } IndicatorType param2 = (IndicatorType)ParamInt(2); if (param2 < Constants.MA_START || param2 > Constants.MA_END) { ProcessError("Invalid Moving Average Type for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } // Get the data string paramStr0 = ParamStr(0); Field pSource = SeriesToField("Source", paramStr0, size); if (!EnsureField(pSource, paramStr0)) { return(false); } Navigator pNav = new Navigator(); Recordset pRS = new Recordset(); pRS.AddField(pSource); pNav.Recordset_ = pRS; // Calculate the indicator Oscillator ta = new Oscillator(); Recordset pInd = ta.DetrendedPriceOscillator(pNav, pSource, paramInt1, param2, FullName); // Output the indicator values Clear(); for (int n = 0; n < size; ++n) { AppendValue(DM.GetTimeStampByIndex(n), n < paramInt1 * 2 ? null : pInd.Value(FullName, n + 1)); } return(_calculateResult = PostCalculate()); }
/// <summary> /// Action to be executd for calculating indicator /// </summary> /// <returns>for future usage. Must be ignored at this time.</returns> protected override bool TrueAction() { // Validate int size = _chartPanel._chartX.RecordCount; if (size == 0) { return(false); } int paramInt1 = ParamInt(1); if (paramInt1 < 1 || paramInt1 > size) { ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } // Get the data string paramStr0 = ParamStr(0); Field pHigh = SeriesToField("High", paramStr0 + ".high", size); if (!EnsureField(pHigh, paramStr0 + ".high")) { return(false); } Field pLow = SeriesToField("Low", paramStr0 + ".low", size); if (!EnsureField(pLow, paramStr0 + ".low")) { return(false); } Navigator pNav = new Navigator(); Recordset pRS = new Recordset(); pRS.AddField(pHigh); pRS.AddField(pLow); pNav.Recordset_ = pRS; // Calculate the indicator Oscillator ta = new Oscillator(); Recordset pInd = ta.FractalChaosOscillator(pNav, pRS, paramInt1, FullName); // Output the indicator values Clear(); for (int n = 0; n < size; ++n) { AppendValue(DM.GetTimeStampByIndex(n), n < paramInt1 ? null : pInd.Value(FullName, n + 1)); } return(_calculateResult = PostCalculate()); }
public List <Oscillator> GetDatasFromAccess_Oscillator(string path, string sheetName = "Sheet1") { try { workbook = Factory.GetWorkbook(path); worksheet = workbook.Worksheets[sheetName]; if (worksheet == null) { throw new Exception("worksheet为空"); } int count = worksheet.UsedRange.RowCount - 1; List <Oscillator> lstCapacitor = new List <Oscillator>(); for (int i = 0; i < count; i++) { Oscillator obj = new Oscillator(); //从第2行开始为第一个数据 obj.PartNumber = worksheet.Cells[string.Format("A{0}", i + 2)].Value.ToString(); obj.PartType = worksheet.Cells[string.Format("B{0}", i + 2)].Value.ToString(); obj.Value = GetValue(worksheet.Cells[string.Format("C{0}", i + 2)].Value); obj.Description = GetValue(worksheet.Cells[string.Format("D{0}", i + 2)].Value); obj.Rating = GetValue(worksheet.Cells[string.Format("E{0}", i + 2)].Value); obj.Tolerance = GetValue(worksheet.Cells[string.Format("F{0}", i + 2)].Value); obj.SchematicPart = GetValue(worksheet.Cells[string.Format("G{0}", i + 2)].Value); obj.LayoutPCBFootprint = GetValue(worksheet.Cells[string.Format("H{0}", i + 2)].Value); obj.AllegroPCBFootprint = GetValue(worksheet.Cells[string.Format("I{0}", i + 2)].Value); obj.PSpice = GetValue(worksheet.Cells[string.Format("J{0}", i + 2)].Value); obj.ManufacturerPartNumber = GetValue(worksheet.Cells[string.Format("K{0}", i + 2)].Value); obj.Manufacturer = GetValue(worksheet.Cells[string.Format("L{0}", i + 2)].Value); obj.DistributorPartNumber = GetValue(worksheet.Cells[string.Format("M{0}", i + 2)].Value); obj.Distributor = GetValue(worksheet.Cells[string.Format("N{0}", i + 2)].Value); obj.Price = worksheet.Cells[string.Format("O{0}", i + 2)].Value == null?0:Convert.ToDouble(worksheet.Cells[string.Format("O{0}", i + 2)].Value.ToString()); obj.Availability = GetValue(worksheet.Cells[string.Format("P{0}", i + 2)].Value); obj.Datasheet = GetValue(worksheet.Cells[string.Format("Q{0}", i + 2)].Value); obj.ActivepartsID = GetValue(worksheet.Cells[string.Format("R{0}", i + 2)].Value); obj.OperatingTemperatureRange = GetValue(worksheet.Cells[string.Format("S{0}", i + 2)].Value); obj.StorageTemperatureRange = GetValue(worksheet.Cells[string.Format("T{0}", i + 2)].Value); obj.TempratureStability = GetValue(worksheet.Cells[string.Format("U{0}", i + 2)].Value); obj.PhaseNoise_10HZ = GetValue(worksheet.Cells[string.Format("V{0}", i + 2)].Value); obj.PhaseNoise_100HZ = GetValue(worksheet.Cells[string.Format("W{0}", i + 2)].Value); obj.PhaseNoise_1KHZ = GetValue(worksheet.Cells[string.Format("X{0}", i + 2)].Value); obj.PhaseNoise_10KHZ = GetValue(worksheet.Cells[string.Format("Y{0}", i + 2)].Value); obj.PhaseNoise_100KHZ = GetValue(worksheet.Cells[string.Format("Z{0}", i + 2)].Value); lstCapacitor.Add(obj); } workbook.Close(); return(lstCapacitor); } catch (Exception e) { workbook.Close(); string exPath = "exception.txt"; System.IO.File.AppendAllText(exPath, e.Message); throw e; } }
public Phase2Computer(string name, uint nIterations) : base(name) { Oscillator = new Oscillator($"{name}-oscillator", nIterations); DoWireUp(); Components.Record(nameof(Phase2Computer)); }
public BasicSynthOscUi(Oscillator osc) { this.osc = osc; InitializeComponent(); osc.AdsrChanged += Osc_AdsrChanged; osc.TypeChanged += Osc_TypeChanged; osc.Pitchs.CollectionChanged += Pitchs_CollectionChanged; Init(); }
void Start () { angle = 45.0f; gravity = 9.8f; enemy = GameObject.FindWithTag ("Enemy"); enemyOsc = enemy.GetComponent <Oscillator> (); shipTransform = transform; hp = 100; enemyHP = enemyScript.getHP (); }
public OscFMProgrammer(string name, Oscillator osc, EmptyMonoComponent emptyFMSource, AdsrEnvelope env1, AdsrEnvelope env2, Lfo lfo1, Lfo lfo2) { #region Require if (osc == null) { throw new ArgumentNullException("osc"); } else if (emptyFMSource == null) { throw new ArgumentNullException("emptyFMSource"); } else if (env1 == null) { throw new ArgumentNullException("env1"); } else if (env2 == null) { throw new ArgumentNullException("env2"); } else if (lfo1 == null) { throw new ArgumentNullException("lfo1"); } else if (lfo2 == null) { throw new ArgumentNullException("lfo2"); } #endregion this.name = name; this.osc = osc; this.emptyFMSource = emptyFMSource; this.env1 = env1; this.env2 = env2; this.lfo1 = lfo1; this.lfo2 = lfo2; }
private void Initialize(SampleRate sampleRate, StereoBuffer buffer) { emptyFMModulator = new EmptyMonoComponent(sampleRate, new MonoBuffer(0)); slewLimiter = new SlewLimiter(sampleRate, new MonoBuffer(0), "Portamento"); slewLimiter.SynthesizeReplaceEnabled = true; envelope1 = new AdsrEnvelope(sampleRate, new MonoBuffer(0), "Envelope 1"); envelope1.SynthesizeReplaceEnabled = true; envelope2 = new AdsrEnvelope(sampleRate, new MonoBuffer(0), "Envelope 2"); envelope2.SynthesizeReplaceEnabled = true; lfo1 = new Lfo(sampleRate, new MonoBuffer(0), "LFO 1"); lfo1.SynthesizeReplaceEnabled = true; lfo2 = new Lfo(sampleRate, new MonoBuffer(0), "LFO 2"); lfo2.SynthesizeReplaceEnabled = true; Wavetable wave = Wavetable.Load("Sawtooth"); osc1 = new Oscillator(sampleRate, new MonoBuffer(0), "Oscillator 1", wave, emptyFMModulator, slewLimiter); osc1.SynthesizeReplaceEnabled = true; osc2 = new Oscillator(sampleRate, new MonoBuffer(0), "Oscillator 2", wave, emptyFMModulator, slewLimiter); osc2.SynthesizeReplaceEnabled = true; filter = new StateVariableFilter(sampleRate, new MonoBuffer(0), "State Variable Filter", osc1, osc2, envelope2, lfo2, envelope1); filter.SynthesizeReplaceEnabled = true; converter = new MonoToStereoConverter(sampleRate, buffer, filter); converter.SynthesizeReplaceEnabled = false; oscWaveProgrammer1 = new OscWaveProgrammer("Oscillator 1", osc1); oscWaveProgrammer2 = new OscWaveProgrammer("Oscillator 2", osc2); oscFMProgrammer1 = new OscFMProgrammer("Oscillator 1", osc1, emptyFMModulator, envelope1, envelope2, lfo1, lfo2); oscFMProgrammer2 = new OscFMProgrammer("Oscillator 2", osc2, emptyFMModulator, envelope1, envelope2, lfo1, lfo2); AddComponent(emptyFMModulator); AddComponent(slewLimiter); AddComponent(osc1); AddComponent(osc2); AddComponent(envelope1); AddComponent(envelope2); AddComponent(lfo1); AddComponent(lfo2); AddComponent(filter); AddComponent(converter); AddParameters(slewLimiter); AddParameters(osc1); AddParameters(oscWaveProgrammer1); AddParameters(oscFMProgrammer1); AddParameters(osc2); AddParameters(oscWaveProgrammer2); AddParameters(oscFMProgrammer2); AddParameters(envelope1); AddParameters(envelope2); AddParameters(lfo1); AddParameters(lfo2); AddParameters(filter); AddBendable(osc1); AddBendable(osc2); AddControllable(lfo1); AddControllable(lfo2); }
public void OscillatorsCreate(OscillatorsVM oscillatorsVM) { Oscillator oscillator = new Oscillator(); }
public PartialViewResult Oscillators() { CDTEntities db = new CDTEntities(); Oscillator oscillators = new Oscillator(); return PartialView("_OscillatorsPartial", oscillators); }
public Channel() { m_vco = new Envelope(0.0, 60.0 / VELOCITY_MAX2, 30.0 / VELOCITY_MAX2, 1.0 / VELOCITY_MAX2); m_vcf = new Envelope(0.0, 30.0 / VELOCITY_MAX2, 0.0, 1.0); m_osc1 = new Oscillator(); m_mod1 = m_osc1.CurrentModulator; m_osc2 = new Oscillator() { Form = OscillatorForm.Sine }; m_osc2.MakeAsLFO(); m_mod2 = m_osc2.CurrentModulator; m_filter = new Filter(); m_osc2connect = m_enableFilter = false; m_formant = new Formant(); m_volumeMode = 0; m_expression = 0; m_onCounter = 0; m_lfoDelay = 0; m_lfoDepth = 0; m_lfoEnd = 0; m_lpfAmount = 0; m_lpfFrequency = 0; m_lpfResonance = 0; NoteIndex = 0; Detune = 0; m_frequencyIndex = 0; Pan = 64; Expression = 127; Velocity = 100; Input = new Events.Input() { Sens = 0, Pipe = 0 }; Output = new Events.Output() { Mode = ChannelOutputMode.Default, Pipe = 0 }; Ring = new Events.Ring() { Sens = 0, Pipe = 0 }; Sync = new Events.Sync() { Mode = ChannelOutputMode.Default, Pipe = 0 }; }