TopDown Engine  v4.2
MoreMountains.Feedbacks.MMSequencer Class Reference

This class lets you design a quantized MMSequence using a sequencer interface, and lets you play a quantized sequence, triggering events on beats if specified More...

Inheritance diagram for MoreMountains.Feedbacks.MMSequencer:
MoreMountains.Feedbacks.MMAudioSourceSequencer MoreMountains.Feedbacks.MMFeedbacksSequencer MoreMountains.Feedbacks.MMSoundSequencer

Public Types

enum  TimeScales { TimeScales.Scaled, TimeScales.Unscaled }
 

Public Member Functions

virtual void ToggleSequence ()
 Plays or stops the sequence based on its current state More...
 
virtual void PlaySequence ()
 Starts playing the sequence More...
 
virtual void StopSequence ()
 Stops the playback of the sequence More...
 
virtual void ClearSequence ()
 Clears the contents of the sequence More...
 
virtual void PlayBeat ()
 Triggers events on the beat if needed More...
 
virtual void PlayTrackEvent (int index)
 Plays the track event supposed to happen for the specified track More...
 
virtual void ToggleActive (int trackIndex)
 Turns a sequence track active (will play its notes) or inactive (won't do it) More...
 
virtual void ToggleStep (int stepIndex)
 Toggles a whole step column, turning all its notes active or inactive More...
 
virtual void IncrementLength ()
 Adds one column at the end of the sequence More...
 
virtual void DecrementLength ()
 Removes the last column of the sequence More...
 
virtual void UpdateTimestampsToMatchNewBPM ()
 Parses the sequence contents and updates timestamps to match the new BPM More...
 
virtual void ApplySequencerLengthToSequence ()
 Rebuilds the sequence properties to match length and track count - will destroy contents More...
 
virtual void EditorMaintenance ()
 Performed every frame by the editor to handle potential changes More...
 
virtual void SetupTrackEvents ()
 Adds or rebuilds to the event list More...
 

Public Attributes

MMSequence Sequence
 the sequence to design on or to play More...
 
int BPM = 160
 the intended BPM for playback and design More...
 
int SequencerLength = 8
 the number of notes in the sequence More...
 
TimeScales TimeScale = TimeScales.Scaled
 the timescale on which this sequencer should play More...
 
bool Loop = true
 whether the sequence should loop or not when played back More...
 
bool RandomSequence = false
 if this is true the sequence will play in random order More...
 
bool PlayOnStart = false
 whether that sequencer should start playing on application start More...
 
AudioClip MetronomeSound
 a sound to play every beat More...
 
float MetronomeVolume = 0.2f
 the volume of the metronome sound More...
 
List< UnityEvent > TrackEvents
 a list of events to play every time an active beat is found on each track (one event per track) More...
 
bool Playing = false
 true if the sequencer is playing right now More...
 
bool PlayedOnce = false
 true if the sequencer has been played once More...
 
bool BeatThisFrame = false
 true if a perfect beat was found this frame More...
 
int LastBeatIndex = 0
 the index of the last played bit (our position in the playing sequence) More...
 
float InternalTime => TimeScale == TimeScales.Scaled ? Time.time : Time.unscaledTime
 
int LastBPM = -1
 
int LastTracksCount = -1
 
int LastSequencerLength = -1
 
MMSequence LastSequence
 
int CurrentSequenceIndex = 0
 
float LastBeatTimestamp = 0f
 

Protected Member Functions

virtual void Start ()
 On Start we initialize our sequencer More...
 
virtual void Initialization ()
 On init, initializes the metronome and plays the sequence if needed More...
 
virtual void Update ()
 On update we handle our beat More...
 
virtual void HandleBeat ()
 Determines if we're on a beat, and plays the beat if needed More...
 
virtual void OnBeat ()
 Triggered every time a beat is found, meant to be overriden More...
 
virtual void PlayMetronomeSound ()
 Plays the sound of the metronome More...
 

Protected Attributes

float _beatInterval
 
AudioSource _beatSoundAudiosource
 

Detailed Description

This class lets you design a quantized MMSequence using a sequencer interface, and lets you play a quantized sequence, triggering events on beats if specified

Member Enumeration Documentation

◆ TimeScales

Enumerator
Scaled 
Unscaled 

Member Function Documentation

◆ ApplySequencerLengthToSequence()

virtual void MoreMountains.Feedbacks.MMSequencer.ApplySequencerLengthToSequence ( )
virtual

Rebuilds the sequence properties to match length and track count - will destroy contents

◆ ClearSequence()

virtual void MoreMountains.Feedbacks.MMSequencer.ClearSequence ( )
virtual

Clears the contents of the sequence

◆ DecrementLength()

virtual void MoreMountains.Feedbacks.MMSequencer.DecrementLength ( )
virtual

Removes the last column of the sequence

◆ EditorMaintenance()

virtual void MoreMountains.Feedbacks.MMSequencer.EditorMaintenance ( )
virtual

Performed every frame by the editor to handle potential changes

Reimplemented in MoreMountains.Feedbacks.MMSoundSequencer, MoreMountains.Feedbacks.MMAudioSourceSequencer, and MoreMountains.Feedbacks.MMFeedbacksSequencer.

◆ HandleBeat()

virtual void MoreMountains.Feedbacks.MMSequencer.HandleBeat ( )
protectedvirtual

Determines if we're on a beat, and plays the beat if needed

◆ IncrementLength()

virtual void MoreMountains.Feedbacks.MMSequencer.IncrementLength ( )
virtual

Adds one column at the end of the sequence

◆ Initialization()

virtual void MoreMountains.Feedbacks.MMSequencer.Initialization ( )
protectedvirtual

On init, initializes the metronome and plays the sequence if needed

Reimplemented in MoreMountains.Feedbacks.MMSoundSequencer.

◆ OnBeat()

virtual void MoreMountains.Feedbacks.MMSequencer.OnBeat ( )
protectedvirtual

Triggered every time a beat is found, meant to be overriden

Reimplemented in MoreMountains.Feedbacks.MMSoundSequencer, MoreMountains.Feedbacks.MMAudioSourceSequencer, and MoreMountains.Feedbacks.MMFeedbacksSequencer.

◆ PlayBeat()

virtual void MoreMountains.Feedbacks.MMSequencer.PlayBeat ( )
virtual

Triggers events on the beat if needed

◆ PlayMetronomeSound()

virtual void MoreMountains.Feedbacks.MMSequencer.PlayMetronomeSound ( )
protectedvirtual

Plays the sound of the metronome

◆ PlaySequence()

virtual void MoreMountains.Feedbacks.MMSequencer.PlaySequence ( )
virtual

Starts playing the sequence

◆ PlayTrackEvent()

virtual void MoreMountains.Feedbacks.MMSequencer.PlayTrackEvent ( int  index)
virtual

Plays the track event supposed to happen for the specified track

Parameters
index

Reimplemented in MoreMountains.Feedbacks.MMSoundSequencer, MoreMountains.Feedbacks.MMAudioSourceSequencer, and MoreMountains.Feedbacks.MMFeedbacksSequencer.

◆ SetupTrackEvents()

virtual void MoreMountains.Feedbacks.MMSequencer.SetupTrackEvents ( )
virtual

Adds or rebuilds to the event list

◆ Start()

virtual void MoreMountains.Feedbacks.MMSequencer.Start ( )
protectedvirtual

On Start we initialize our sequencer

◆ StopSequence()

virtual void MoreMountains.Feedbacks.MMSequencer.StopSequence ( )
virtual

Stops the playback of the sequence

◆ ToggleActive()

virtual void MoreMountains.Feedbacks.MMSequencer.ToggleActive ( int  trackIndex)
virtual

Turns a sequence track active (will play its notes) or inactive (won't do it)

Parameters
trackIndex

◆ ToggleSequence()

virtual void MoreMountains.Feedbacks.MMSequencer.ToggleSequence ( )
virtual

Plays or stops the sequence based on its current state

◆ ToggleStep()

virtual void MoreMountains.Feedbacks.MMSequencer.ToggleStep ( int  stepIndex)
virtual

Toggles a whole step column, turning all its notes active or inactive

Parameters
stepIndex

◆ Update()

virtual void MoreMountains.Feedbacks.MMSequencer.Update ( )
protectedvirtual

On update we handle our beat

◆ UpdateTimestampsToMatchNewBPM()

virtual void MoreMountains.Feedbacks.MMSequencer.UpdateTimestampsToMatchNewBPM ( )
virtual

Parses the sequence contents and updates timestamps to match the new BPM

Member Data Documentation

◆ _beatInterval

float MoreMountains.Feedbacks.MMSequencer._beatInterval
protected

◆ _beatSoundAudiosource

AudioSource MoreMountains.Feedbacks.MMSequencer._beatSoundAudiosource
protected

◆ BeatThisFrame

bool MoreMountains.Feedbacks.MMSequencer.BeatThisFrame = false

true if a perfect beat was found this frame

◆ BPM

int MoreMountains.Feedbacks.MMSequencer.BPM = 160

the intended BPM for playback and design

◆ CurrentSequenceIndex

int MoreMountains.Feedbacks.MMSequencer.CurrentSequenceIndex = 0

◆ InternalTime

float MoreMountains.Feedbacks.MMSequencer.InternalTime => TimeScale == TimeScales.Scaled ? Time.time : Time.unscaledTime

◆ LastBeatIndex

int MoreMountains.Feedbacks.MMSequencer.LastBeatIndex = 0

the index of the last played bit (our position in the playing sequence)

◆ LastBeatTimestamp

float MoreMountains.Feedbacks.MMSequencer.LastBeatTimestamp = 0f

◆ LastBPM

int MoreMountains.Feedbacks.MMSequencer.LastBPM = -1

◆ LastSequence

MMSequence MoreMountains.Feedbacks.MMSequencer.LastSequence

◆ LastSequencerLength

int MoreMountains.Feedbacks.MMSequencer.LastSequencerLength = -1

◆ LastTracksCount

int MoreMountains.Feedbacks.MMSequencer.LastTracksCount = -1

◆ Loop

bool MoreMountains.Feedbacks.MMSequencer.Loop = true

whether the sequence should loop or not when played back

◆ MetronomeSound

AudioClip MoreMountains.Feedbacks.MMSequencer.MetronomeSound

a sound to play every beat

◆ MetronomeVolume

float MoreMountains.Feedbacks.MMSequencer.MetronomeVolume = 0.2f

the volume of the metronome sound

◆ PlayedOnce

bool MoreMountains.Feedbacks.MMSequencer.PlayedOnce = false

true if the sequencer has been played once

◆ Playing

bool MoreMountains.Feedbacks.MMSequencer.Playing = false

true if the sequencer is playing right now

◆ PlayOnStart

bool MoreMountains.Feedbacks.MMSequencer.PlayOnStart = false

whether that sequencer should start playing on application start

◆ RandomSequence

bool MoreMountains.Feedbacks.MMSequencer.RandomSequence = false

if this is true the sequence will play in random order

◆ Sequence

MMSequence MoreMountains.Feedbacks.MMSequencer.Sequence

the sequence to design on or to play

◆ SequencerLength

int MoreMountains.Feedbacks.MMSequencer.SequencerLength = 8

the number of notes in the sequence

◆ TimeScale

TimeScales MoreMountains.Feedbacks.MMSequencer.TimeScale = TimeScales.Scaled

the timescale on which this sequencer should play

◆ TrackEvents

List<UnityEvent> MoreMountains.Feedbacks.MMSequencer.TrackEvents

a list of events to play every time an active beat is found on each track (one event per track)


The documentation for this class was generated from the following file: