Skip to content

Commit

Permalink
refactor: #1 keeping codes clean.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroxpepe committed Oct 23, 2022
1 parent 70a330c commit 323fca8
Show file tree
Hide file tree
Showing 20 changed files with 187 additions and 551 deletions.
8 changes: 2 additions & 6 deletions Meowziq.Midi/Midi/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,9 @@ public static Manager GetInstance() {
///////////////////////////////////////////////////////////////////////////////////////////////
// Properties [noun, adjective]

public OutputDevice OutDevice {
get => _out_device;
}
public OutputDevice OutDevice { get => _out_device; }

public List<string> OutDeviceName {
get => _out_device_name_list;
}
public List<string> OutDeviceName { get => _out_device_name_list; }

public int OutDeviceId {
set {
Expand Down
16 changes: 4 additions & 12 deletions Meowziq.Midi/Midi/Message.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,9 @@ static Prime() {
///////////////////////////////////////////////////////////////////////////////////////////
// static Properties [noun, adjective]

public static Item<ChannelMessage> Item {
get => _item; set => _item = value;
}
public static Item<ChannelMessage> Item { get => _item; set => _item = value; }

public static HashSet<int>[] AllNoteOffToAddArray {
get => _all_note_off_to_add_array; set => _all_note_off_to_add_array = value;
}
public static HashSet<int>[] AllNoteOffToAddArray { get => _all_note_off_to_add_array; set => _all_note_off_to_add_array = value; }

///////////////////////////////////////////////////////////////////////////////////////////
// private Methods [verb]
Expand Down Expand Up @@ -290,13 +286,9 @@ static Second() {
///////////////////////////////////////////////////////////////////////////////////////////
// static Properties [noun, adjective]

public static Item<ChannelMessage> Item {
get => _item; set => _item = value;
}
public static Item<ChannelMessage> Item { get => _item; set => _item = value; }

public static HashSet<int>[] AllNoteOffToAddArray {
get => _all_note_off_to_add_array; set => _all_note_off_to_add_array = value;
}
public static HashSet<int>[] AllNoteOffToAddArray { get => _all_note_off_to_add_array; set => _all_note_off_to_add_array = value; }

///////////////////////////////////////////////////////////////////////////////////////////
// private Methods [verb]
Expand Down
4 changes: 1 addition & 3 deletions Meowziq.Midi/Midi/Multi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ static Multi() {
/// <summary>
/// gets the Track list.
/// </summary>
public static List<Track> List {
get => _track_map.Select(selector: x => x.Value).ToList();
}
public static List<Track> List { get => _track_map.Select(selector: x => x.Value).ToList(); }

///////////////////////////////////////////////////////////////////////////////////////////////
// public static Methods [verb]
Expand Down
12 changes: 3 additions & 9 deletions Meowziq.Win64/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -479,17 +479,11 @@ static Sound() {
///////////////////////////////////////////////////////////////////////////////////////////
// static Properties [noun, adjective]

public static bool Playing {
get => _playing; set => _playing = value;
}
public static bool Playing { get => _playing; set => _playing = value; }

public static bool Played {
get => _played; set => _played = value;
}
public static bool Played { get => _played; set => _played = value; }

public static bool Stopping {
get => _stopping; set => _stopping = value;
}
public static bool Stopping { get => _stopping; set => _stopping = value; }
}
}
}
24 changes: 6 additions & 18 deletions Meowziq/Core/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,30 +236,22 @@ public bool HasNextSearch {
/// <summary>
/// index value pointing to the array position.
/// </summary>
public int SearchIndex {
get => _search_index;
}
public int SearchIndex { get => _search_index; }

/// <summary>
/// gets the number that moves the tick of notes forward.
/// </summary>
public int PreLength {
get => _pre_length;
}
public int PreLength { get => _pre_length; }

/// <summary>
/// get the count of syncopation.
/// </summary>
public int PreCount {
get => _pre_count;
}
public int PreCount { get => _pre_count; }

/// <summary>
/// gets the gate value of the note.
/// </summary>
public int Value {
get => To16beatLength(_gate_count + TEXT_VALUE_LENGTH);
}
public int Value { get => To16beatLength(_gate_count + TEXT_VALUE_LENGTH); }

///////////////////////////////////////////////////////////////////////////////////////////
// public Methods [verb]
Expand Down Expand Up @@ -324,16 +316,12 @@ public Index(int beat_count) {
/// <summary>
/// index value of 16 beats.
/// </summary>
public int Idx {
get => _index;
}
public int Idx { get => _index; }

/// <summary>
/// index value of the Span object.
/// </summary>
public int SpanIndex {
get => _span_index;
}
public int SpanIndex { get => _span_index; }

/// <summary>
/// whether has the next 16 beats in this Pattern.
Expand Down
36 changes: 10 additions & 26 deletions Meowziq/Core/Mixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ public static Fader AddFader {
/// <summary>
/// sets the Message object.
/// </summary>
public static IMessage<T, Note> Message {
set => _message = value;
}
public static IMessage<T, Note> Message { set => _message = value; }

///////////////////////////////////////////////////////////////////////////////////////////////
// public static Methods [verb]
Expand Down Expand Up @@ -222,42 +220,28 @@ public class Fader {
/// <note>
/// associates with the Player object.
/// </note>
public string Type {
get => _type; set => _type = value;
}
public string Type { get => _type; set => _type = value; }

/// <note>
/// associates with the Pattern object.
/// </note>
public string Name {
get => _name; set => _name = value;
}
public string Name { get => _name; set => _name = value; }

/// <summary>
/// gets the program number set in mixer.json.
/// provides the program number set in mixer.json.
/// </summary>
public int ProgramNum {
get => _program_num; set => _program_num = value;
}
public int ProgramNum { get => _program_num; set => _program_num = value; }

/// <summary>
/// gets the program number set in player.json.
/// provides the program number set in player.json.
/// </summary>
public int PlayerProgramNum {
get => _player_program_num; set => _player_program_num = value;
}
public int PlayerProgramNum { get => _player_program_num; set => _player_program_num = value; }

public int Vol {
get => _vol; set => _vol = value;
}
public int Vol { get => _vol; set => _vol = value; }

public Pan Pan {
get => _pan; set => _pan = value;
}
public Pan Pan { get => _pan; set => _pan = value; }

public bool Mute {
get => _mute; set => _mute = value;
}
public bool Mute { get => _mute; set => _mute = value; }

///////////////////////////////////////////////////////////////////////////////////////////
// private static Properties [noun, adjective]
Expand Down
24 changes: 6 additions & 18 deletions Meowziq/Core/Note.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,44 +56,32 @@ public Note(int tick, int num, int gate, int velo, int pre_count = 0) {
/// <note>
/// + always an absolute value. <br/>
/// </note>
public int Tick {
get => _tick;
}
public int Tick { get => _tick; }

/// <summary>
/// gets the MIDI note number.
/// </summary>
public int Num {
get => _num;
}
public int Num { get => _num; }

/// <summary>
/// gets the length from a note on to a note off of MIDI.
/// </summary>
public int Gate {
get => _gate;
}
public int Gate { get => _gate; }

/// <summary>
/// gets the MIDI note strength.
/// </summary>
public int Velo {
get => _velo;
}
public int Velo { get => _velo; }

/// <summary>
/// gets whether has a syncopation parameter.
/// </summary>
public bool HasPre {
get => _pre_count > 0;
}
public bool HasPre { get => _pre_count > 0; }

/// <summary>
/// gets the syncopation parameter.
/// </summary>
public int PreCount {
get => _pre_count;
}
public int PreCount { get => _pre_count; }

///////////////////////////////////////////////////////////////////////////////////////////////
// private Methods [verb]
Expand Down
40 changes: 10 additions & 30 deletions Meowziq/Core/Pattern.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,22 @@ public Pattern(string name, List<Meas> meas_list) {
/// <summary>
/// gets the pattern name.
/// </summary>
public string Name {
get => _name;
}
public string Name { get => _name; }

/// <summary>
/// gets the number of beats.
/// </summary>
public int BeatCount {
get => _meas_list.Count * BEAT_COUNT_IN_MEASURE;
}
public int BeatCount { get => _meas_list.Count * BEAT_COUNT_IN_MEASURE; }

/// <summary>
/// gets all Meas objects.
/// </summary>
public List<Meas> AllMeas {
get => _meas_list;
}
public List<Meas> AllMeas { get => _meas_list; }

/// <summary>
/// gets all Span objects.
/// </summary>
public List<Span> AllSpan {
get => _meas_list.SelectMany(selector: x => x.AllSpan).ToList();
}
public List<Span> AllSpan { get => _meas_list.SelectMany(selector: x => x.AllSpan).ToList(); }
}

/// <summary>
Expand Down Expand Up @@ -113,9 +105,7 @@ public Meas(List<Span> spanList) {
/// <summary>
/// gets the list of Span objects.
/// </summary>
public List<Span> AllSpan {
get => _span_list;
}
public List<Span> AllSpan { get => _span_list; }
}

/// <summary>
Expand Down Expand Up @@ -163,36 +153,26 @@ public Span(int beat, Degree degree, Mode span_mode) {
/// <summary>
/// gets the number of beats.
/// </summary>
public int Beat {
get => _beat;
}
public int Beat { get => _beat; }

/// <summary>
/// gets the degree from the key of the song.
/// </summary>
public Degree Degree {
get => _degree;
}
public Degree Degree { get => _degree; }

/// <summary>
/// provides the key of the song.
/// </summary>
public Key Key {
get => _key; set => _key = value;
}
public Key Key { get => _key; set => _key = value; }

/// <summary>
/// provides the church mode of the key of the song.
/// </summary>
public Mode KeyMode {
get => _key_mode; set => _key_mode = value;
}
public Mode KeyMode { get => _key_mode; set => _key_mode = value; }

/// <summary>
/// gets the church mode of this span.
/// </summary>
public Mode SpanMode {
get => _span_mode; // do not change the span mode once set.
}
public Mode SpanMode { get => _span_mode; } // do not change the span mode once set.
}
}
Loading

0 comments on commit 323fca8

Please sign in to comment.