public void Initialize() { this.IsPlaying = false; this.Zoom = 1f; this.PanOffset = 0f; this.beatsPerMeasureField.text = "4"; this.bpmField.text = "80"; audioEngine.Initialize(); timeSlider.Initialize(source.clip.length); trackEditor.Initialize(this, source.clip.length); minimapTrack.Initialize(this, 0); minimapTrack.InitializeWaveData(audioEngine.Samples, 1024 * 8, Color.white); trackEditor.InstantiateWaveformTrack(audioEngine.Samples, 1024, Color.yellow, "Waveform"); trackEditor.InstantiateWaveformTrack(audioEngine.BeatSamples, 1, Color.red, "Beat"); Duration = source.clip.length; // Add a blank image Image image = this.gameObject.AddComponent <Image>(); image.color = new Color(1f, 1f, 1f, 0f); image.raycastTarget = true; }
public WaveformTrack InstantiateWaveformTrack(float[] samples, int downsample, Color trackColor, string name) { WaveformTrack track = InstantiateTrack <WaveformTrack>(waveformTrackPrefab, name); track.Initialize(timeline, 0); track.InitializeWaveData(samples, downsample, trackColor); return(track); }