Stepp
(editor)
prop
Tempo
Count
Step
Pitch
Pitches
Audio Files
Voice
func
(Stepp.cs)
//can be run while sequencer is active
AddPitchAtStep(pitch, step)
RemovePitchAtStep(pitch,step)
private
Voice[]
voices;
class
Voice
{ ... }
(var)
public
readonly
AudioSource
audioSource;
int
pitch
step
(func)
public
(constructor)
Voice (AudioSource inAudioSource, int inPitch, int inStep){ ... }
(init)
audioSource = inAudioSource;
pitch = inPitch;
step = inStep;
int
(step)
double
stepDuration;
The duration of a single step at the current temp;
lastStep;
//The last step that the sequencer was on. Used to determine when step boundaries are crossed.
currentStep;
//The current step that the sequencer is on.
advancedStepDelegate
(define)
public
delegate
void
SteppCallback(int step);
SteppCallback
advancedStepDelegate;
(path/config)
(call)
private void Updat(){ ... }
if ((currentStep >= 0) && (advancedStepDelegate != null)) { ... }
advancedStepDelegate(currentStep);
(passes int currentStep)
(Sequencer)
StartSequencer()
StopSequencer()
ClearAllPitches()
(example scene)
SequencerController.cs
(var)
public
Stepp
stepSequencer
Button
playButton
GameObject
stepIndicator
(func)
private
void
Start(){ ... }
stepSequencer.advancedStepDelegate += HandleSequencerStepAdvance;
playButton.MouseUpAsButton += HandlePowerButtonPressed;
HandleSequencerStepAdvance( int step ){ ... }
if (stepIndicator.GetComponent<Renderer>().enabled == false) { ... }
stepIndicator.GetComponent<Renderer>().enabled = true;
Vector3 position = stepIndicator.transform.position;
position.x = (step*2.0f) - 7.0f;
stepIndicator.transform.position = position;
HandlePowerButtonPressed( bool selected ){ ... }
if (selected) { ... }
stepSequencer.StartSequencer();
else { ... }
stepSequencer.StopSequencer();
stepIndicator.GetComponent<Renderer>().enabled = false;
Button.cs
(var)
public
Stepp
stepSequencer
Sprite
selectedSprite
deselectedSprite
delegate
void
ButtonHandler(bool selected);
ButtonHandler
MouseUpAsButton;
bool
Selected{ ... }
//wth is this???
get{ ... }
return selected;
set{ ... }
selected = value;
//wth is value defined???
//special in the language
SpriteRenderer spriteRenderer = (SpriteRenderer)GetComponent<Renderer>();
spriteRenderer.sprite = (Selected) ? selectedSprite : deselectedSprite;
private
bool
selected = false;
(func)
private
void
OnMouseUpAsButton(){ ... }
Selected = !Selected;
if (MouseUpAsButton != null) { ... }
MouseUpAsButton(Selected);
Trigger.cs
:Button
(var)
public
int
pitch
step
(func)
private
void
Awake(){ ... }
MouseUpAsButton += HandleMouseUpAsButton;
stepSequencer.advancedStepDelegate += HandleSequencerAdvancedStep;
HandleMouseUpAsButton(bool selected){ ... }
if (selected) { ... }
stepSequencer.AddPitchAtStep(pitch, step);
else { ... }
stepSequencer.RemovePitchAtStep(pitch, step);
HandleSequencerAdvancedStep(int inStep){ ... }
if ((inStep == step) && Selected) { ... }
StopCoroutine("TriggerAnimation");
StartCoroutine("TriggerAnimation");
IEnumerator
//wth is IEnumerator
TriggerAnimation(){ ... }
yield return new WaitForSeconds(0.3f);
Vector3 targetScale = transform.localScale;
targetScale.x = 1.2f;
targetScale.y = 1.2f;
transform.localScale = targetScale;
yield return null;
targetScale = transform.localScale;
targetScale.x = 1.0f;
targetScale.y = 1.0f;
transform.localScale = targetScale;
//Why return null??? As opposed to doing nothing???