public override void Visualise(int track, ITimedObject timedMidiEvent)
    {
        if (timedMidiEvent is Note)
        {
            if (lengthOverride != 0)
            {
                transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, lengthOverride);
            }

            Note  note       = timedMidiEvent as Note;
            Color noteColour = ColourUtils.ColourFromNote(note, transposeHue);
            noteColour      = Color.Lerp(PrimaryColour, noteColour, colourMix);
            baseAlpha      *= note.Velocity / 127f;
            noteColour.a    = alphaEnvelope.Evaluate(0f) * baseAlpha;
            line.startColor = line.endColor = noteColour;

            startTime = visualisation.time;
            float noteDuration = durationOverride == 0 ? (note.LengthAs <MetricTimeSpan>(visualisation.MIDITempoMap).TotalMicroseconds / 1000000f) : durationOverride;
            endTime = startTime + noteDuration * durationMult;

            startPos = transform.localPosition;

            line.widthMultiplier = 0f; //This will be updated to correct value next frame.
            line.enabled         = true;
            started = true;
        }
    }
Exemple #2
0
 public override void OnNoteDown(int track, Note note)
 {
     //Buffer colour to skybox based on the note pitch.
     if (overrideColour == Color.clear)
     {
         Color noteColour = ColourUtils.ColourFromNote(note, transposeHue) * intensityMult;
         frameColourBuffer.Add(noteColour);
     }
     else
     {
         frameColourBuffer.Add(overrideColour * intensityMult);
     }
 }