public Voice() { wave_zero = 0x380; voice_DC = 0x800 * 0xff; Envelope = new EnvelopeGenerator(); Wave = new WaveformGenerator(); }
public void UpdateMesh(float[][] data, int chunkID, WaveformGenerator gen) { localData = data; this.chunkID = chunkID; waveform = gen; ReCalculateMesh(); }
private void OnEnable() { titleContent = new GUIContent("Waveform", CinemachineSettings.CinemachineLogoTexture); mWaveformGenerator = new WaveformGenerator(); mScreenshotFilename = Path.GetFullPath(FileUtil.GetUniqueTempPathInProject() + ".png"); ScreenCapture.CaptureScreenshot(mScreenshotFilename); EditorApplication.update += UpdateScreenshot; }
private async Task RenderWaveformAsync(bool withDelay) { // Note: This function does not set CurrentWaveform to null to allow the old // one to stay visible until the new calculation is complete (when called by InvalidateWaveform). renderWaveformCts?.Cancel(); renderWaveformCts?.Dispose(); renderWaveformCts = new CancellationTokenSource(); try { IsLoading = true; if (withDelay) { await Task.Delay(300, renderWaveformCts.Token); } if (audioFile == null) // no longer available { IsLoading = false; return; } double viewLeft = sequencer.CurrentViewLeftPositionTime - MusicTimeOffset; double viewRight = sequencer.CurrentViewRightPositionTime - MusicTimeOffset; double padding = (viewRight - viewLeft) / 4; // use the width of one viewport on each side as padding double waveformLeft = Math.Max(0, viewLeft - padding); double waveformRight = viewRight + padding; Waveform result = await WaveformGenerator.CreateWaveformAsync(audioFile.CreateStream(), sequencer.TimePixelScale, waveformLeft, waveformRight, renderWaveformCts.Token); Debug.WriteLine($"Time per sample: {result.TimePerSample}, Sample count: {result.Minimums.Length}"); CurrentWaveform = result; IsLoading = false; } catch (OperationCanceledException) { } }
protected override void BodyGUI() { showSize = false; showRotation = false; base.BodyGUI(); WaveformGenerator user = (WaveformGenerator)target; serializedObject.Update(); SerializedProperty axis = serializedObject.FindProperty("_axis"); SerializedProperty slices = serializedObject.FindProperty("_slices"); SerializedProperty symmetry = serializedObject.FindProperty("_symmetry"); SerializedProperty uvWrapMode = serializedObject.FindProperty("_uvWrapMode"); SerializedProperty uvOffset = serializedObject.FindProperty("_uvOffset"); SerializedProperty uvScale = serializedObject.FindProperty("_uvScale"); EditorGUI.BeginChangeCheck(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Axis", EditorStyles.boldLabel); EditorGUILayout.PropertyField(axis, new GUIContent("Axis")); EditorGUILayout.Space(); EditorGUILayout.LabelField("Shape", EditorStyles.boldLabel); EditorGUILayout.PropertyField(slices, new GUIContent("Slices")); if (slices.intValue < 1) { slices.intValue = 1; } EditorGUILayout.PropertyField(symmetry, new GUIContent("Use Symmetry")); EditorGUILayout.Space(); EditorGUILayout.LabelField("Uv Coordinates", EditorStyles.boldLabel); EditorGUILayout.PropertyField(uvWrapMode, new GUIContent("Wrap Mode")); EditorGUILayout.PropertyField(uvOffset, new GUIContent("UV Offset")); EditorGUILayout.PropertyField(uvScale, new GUIContent("UV Scale")); if (EditorGUI.EndChangeCheck()) { serializedObject.ApplyModifiedProperties(); } }
private void InstantAoForm_Load(object sender, EventArgs e) { //The default device of project is demo device, users can choose other devices according to their needs. //initialize a timer which drive the data acquisition. timer_outputData.Interval = 50; //initialize the scrollbar trackBar_Scroll.Maximum = 1000; trackBar_Scroll.Minimum = 10; trackBar_Scroll.Value = 50; //initialize the checkbox m_waveSelectCheckBox[0] = checkBox_sineA; m_waveSelectCheckBox[1] = checkBox_squareA; m_waveSelectCheckBox[2] = checkBox_triangleA; m_waveSelectCheckBox[3] = checkBox_sineB; m_waveSelectCheckBox[4] = checkBox_squareB; m_waveSelectCheckBox[5] = checkBox_triangleB; // no device is selected if (!m_instantAoCtrl.Initialized) { MessageBox.Show("No device be selected or device open failed!", "StaticAO"); this.Close(); return; } m_waveformGenerator = new WaveformGenerator(m_PointCountPerWave); //set title of the form. string text = m_instantAoCtrl.SelectedDevice.Description; this.Text = "Static AO(" + text + ")"; this.comboBox1.SelectedIndex = 0; textBox3.Enabled = false; button2.Enabled = false; button3.Enabled = false; ConfigurePanel(); timer_file.Stop(); }
public void SetSyncSource(WaveformGenerator source) { sync_source = source; source.sync_dest = this; }
private void button1_Click(object sender, EventArgs e) { m_PointCountPerWave = Convert.ToUInt32(textBox1.Text); m_waveformGenerator = new WaveformGenerator(m_PointCountPerWave); }