public void DrawWaveFormValues(float[] samples, int offset, int length) { if (samples == null || samples.Length == 0 || !dynTexture.IsInitialized) { return; } dynTexture.ClearTexture(); // Draw the waveform for (int x = 0; x < dynTexture.TextureWidth; x++) { int sampleIndex = offset + length * x / dynTexture.TextureWidth; if (sampleIndex >= samples.Length) { break; } float value = samples[sampleIndex]; // Draw the pixels int y = (int)(dynTexture.TextureHeight * (value + 1f) / 2f); dynTexture.SetPixel(x, y, waveformColor); } // upload to the graphics card dynTexture.ApplyTexture(); }
private void UpdateIssueOverviewImage() { if (dynamicTexture == null) { return; } dynamicTexture.ClearTexture(); foreach (SongIssue issue in issues) { DrawIssue(issue); } dynamicTexture.ApplyTexture(); }
private void UpdateNoteOverviewImage() { if (dynamicTexture == null) { return; } dynamicTexture.ClearTexture(); foreach (Voice voice in songMeta.GetVoices()) { Color color = songEditorSceneControl.GetColorForVoice(voice); DrawNotes(voice, color); } dynamicTexture.ApplyTexture(); }
private void UpdateMidiNoteLines() { dynamicTexture.ClearTexture(); int minMidiNote = noteAreaControl.MinMidiNoteInCurrentViewport; int maxMidiNote = noteAreaControl.MaxMidiNoteInCurrentViewport; for (int midiNote = minMidiNote; midiNote <= maxMidiNote; midiNote++) { // Notes are drawn on lines and between lines alternatingly. bool hasLine = (midiNote % 2 == 0); if (hasLine) { Color color = (MidiUtils.GetRelativePitch(midiNote) == 0) ? NoteAreaHorizontalRulerControl.highlightLineColor : NoteAreaHorizontalRulerControl.normalLineColor; DrawHorizontalGridLine(midiNote, color); } } dynamicTexture.ApplyTexture(); }