Skip to content

Commit

Permalink
probably fixed channels - 0th is now present and when exporting midi,…
Browse files Browse the repository at this point in the history
… instruments stay same
  • Loading branch information
klesun committed Oct 16, 2015
1 parent 73334eb commit 0a1646e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/org/shmidusic/sheet_music/staff/Staff.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public enum aMode { insert, passive }

public Staff()
{
this.staffConfig = new StaffConfig(this);
this.staffConfig = new StaffConfig();
}

public Chord addNewAccord()
Expand Down
2 changes: 1 addition & 1 deletion src/org/shmidusic/sheet_music/staff/chord/nota/Nota.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Nota extends AbstractModel implements INote

// TODO: normalization rules maybe ???
final public Field<Integer> tune = new Field<>("tune", Integer.class, true, this, n -> limit(n, 0, 127));
final protected Field<Integer> channel = new Field<>("channel", Integer.class, true, this, n -> limit(n, 1, 16));
final protected Field<Integer> channel = new Field<>("channel", Integer.class, true, this, n -> limit(n, 0, 15));

final public Field<Fraction> length = new Field<>("length", new Fraction(1, 4), this, INote::legnthNorm);
final public Field<Boolean> isTriplet = new Field<>("isTriplet", false, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

public class Channel extends AbstractModel implements Comparable<Channel> {

final public static int CHANNEL_COUNT = 15; // 1-15. 0th ignores volume change; 16th throws MidiDataChannelOutOfRangeBlaBla exception
final public static int CHANNEL_COUNT = 16; // 1-15. 0th ignores volume change; 16th throws MidiDataChannelOutOfRangeBlaBla exception

// TODO: 0-th channel does not exist - do something with that
final public Field<Integer> channelNumber = new Field<>("channelNumber", Integer.class, true, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ public class StaffConfig extends AbstractModel
final public Field<Integer> keySignature = addField("keySignature", 0);
final public Field<Boolean> useHardcoreSynthesizer = addField("useHardcoreSynthesizer", false);

final private Staff staff;

// TODO: make it ordered Set instead of List
final public Arr<Channel> channelList = new Arr<>("channelList", makeChannelList(), this, Channel.class).setOmitDefaultFromJson(true);

private TreeSet<Channel> makeChannelList() {
TreeSet<Channel> list = new TreeSet<>();

for (int i = 0; i < Channel.CHANNEL_COUNT; ++i) {
JSONObject state = new JSONObject().put("channelNumber", i + 1);
JSONObject state = new JSONObject().put("channelNumber", i);
Channel channel = new Channel();
channel.reconstructFromJson(state);

Expand All @@ -50,10 +48,6 @@ private TreeSet<Channel> makeChannelList() {
return list;
}

public StaffConfig(Staff staff) {
this.staff = staff;
}

public ConfigDialog getDialog() { return new ConfigDialog(this); }

// temporary solution
Expand Down

0 comments on commit 0a1646e

Please sign in to comment.