Class Pattern
The pattern consists of notes and represents a reusable section of a song.
Inherited Members
Namespace: InsaneScatterbrain.RetroKit.Editor
Syntax
[Serializable]
public class Pattern : EditorSampleSet
Fields
color
The color that is used in the editor to represent this particular pattern.
Declaration
public Color color
Field Value
Type | Description |
---|---|
UnityEngine.Color |
name
Declaration
public string name
Field Value
Type | Description |
---|---|
System.String |
Properties
Beats
The number of beats this pattern consists of.
Declaration
public int Beats { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 |
Notes
Declaration
public IEnumerable<PatternNote> Notes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<PatternNote> |
SampleProvider
The sample provider that is used to generate the samples for this pattern. Basically, this is the "instrument" that is used for this pattern.
Declaration
public ISampleProvider SampleProvider { get; set; }
Property Value
Type | Description |
---|---|
ISampleProvider |
Song
The song of which this pattern is a part.
Declaration
public Song Song { get; set; }
Property Value
Type | Description |
---|---|
Song |
Methods
AddAllNoteSamples()
Adds the sample values to the sample set for all notes.
Declaration
public void AddAllNoteSamples()
AddNote(PatternNote)
Declaration
public void AddNote(PatternNote note)
Parameters
Type | Name | Description |
---|---|---|
PatternNote | note |
ApplyLength()
Needs to be called whenever the length of the sample set might have changed. E.g. the BPM of the song has been changed.
Declaration
public void ApplyLength()
Clear()
Removes all notes and samples from the pattern.
Declaration
public void Clear()
ContainsNote(PatternNote)
Declaration
public bool ContainsNote(PatternNote note)
Parameters
Type | Name | Description |
---|---|---|
PatternNote | note |
Returns
Type | Description |
---|---|
System.Boolean |
Create(String)
Declaration
public static Pattern Create(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name |
Returns
Type | Description |
---|---|
Pattern |
Create(String, Pattern)
Create a copy of the given pattern and give it a new name.
Declaration
public static Pattern Create(string name, Pattern existingPattern)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name. |
Pattern | existingPattern | The pattern. |
Returns
Type | Description |
---|---|
Pattern | Copy of the pattern. |
OnEnable()
Performs actions required when the EditorSampleSet is enabled.
Declaration
public override void OnEnable()
Overrides
Overlaps(PatternNote)
Checks whether the note overlaps with any other note in the pattern.
Declaration
public bool Overlaps(PatternNote note)
Parameters
Type | Name | Description |
---|---|---|
PatternNote | note | The note. |
Returns
Type | Description |
---|---|
System.Boolean | True if it overlaps, false otherwise. |
Regenerate()
Regenerates sample set.
Declaration
public void Regenerate()
RemoveNote(PatternNote)
Declaration
public void RemoveNote(PatternNote note)
Parameters
Type | Name | Description |
---|---|---|
PatternNote | note |
SubtractAllNoteSamples()
Subtracts the sample values from the sample set for all notes.
Declaration
public void SubtractAllNoteSamples()
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |