Skip to content

Commit

Permalink
Some updates for UI
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsukinara committed Apr 10, 2016
1 parent 8d550a1 commit 29c991d
Show file tree
Hide file tree
Showing 18 changed files with 159 additions and 33 deletions.
66 changes: 66 additions & 0 deletions profile/demo_1.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
7-120d::4-137M;1|
F5-10M::4-107m;1|F6-20m;2|4-100M;1|S1-20M;1|CAD64-6m;1|
4-107M::S4-40M;2|5-137M;1|2-107m;5|4-107m;1|S5-40M;1|2-100m;1|6-100m;1|S4-20M;1|4-100M;3|
F2-00m::2-100m;1|5-110M;1|6-100m;1|
F2-20m::F6-00m;1|
S4-47M::4-107M;1|4-100M;1|
S6-27m::4-100M;1|
2-137m::4-110m;2|
F6-10m::6-000M;2|5-100m;3|6-100m;2|F2-00m;1|1-100M;1|7-000M;1|4-120m;1|4-110m;2|
2-117m::4-100M;1|4-100m;1|
5-100M::3-000M;1|6-110m;1|S5-40M;1|6-100m;1|S1-20M;2|3-100m;3|F6-10m;1|F6-00m;1|2-100m;1|5-100M;2|1-100M;6|S4-20M;1|3-107m;1|7-000M;2|4-100m;1|4-100M;2|6-007M;1|
7-000M::3-000M;10|6-000M;7|F5-10M;1|S5-40M;1|S1-40M;1|5-107M;1|F6-10m;1|5-100m;6|5-100M;3|1-100M;2|S4-20M;1|7-000M;1|4-120M;1|4-110M;1|6-007M;1|
F3-00m::F2-10m;1|
6-107m::5-100M;1|S4-20M;1|4-100M;1|
6-007M::5-100m;1|1-100M;1|7-000M;4|
4-110m::F6-10m;2|4-100M;2|
6-110m::5-110M;1|
4-107m::7-000M;1|3-100m;1|
S1-20M::F6-10m;1|5-110M;1|S5-40M;1|1-100M;3|S4-20M;2|
7-107d::3-120m;1|
F6-27m::F2-00m;1|
S1-40M::2-137m;1|F6-10m;1|1-100M;2|4-100m;1|4-120m;1|
5-117M::1-100M;1|S1-40M;1|
3-110m::F5-10M;1|S4-20M;1|4-100M;1|
F3-17m::6-000M;1|
5-137M::F5-10M;1|1-100M;1|S4-20M;1|7-000M;1|
2-100m::F6-00m;3|5-137M;1|2-107m;3|S5-40M;1|5-100M;2|4-100M;1|
5-100m::3-000M;1|6-000M;1|1-100M;1|4-100m;2|7-000M;3|4-100M;1|S1-20M;1|6-007M;1|2-110m;2|S1-40M;1|
1-100M::4-107M;1|S6-27m;1|2-137m;1|F6-10m;1|2-117m;1|5-110M;1|5-100M;3|S4-20M;2|S6-40m;1|7-000M;6|4-100m;3|6-107m;1|6-007M;2|4-137M;1|3-000M;1|F4-07M;1|S5-40M;1|6-100m;2|S5-20M;1|S1-20M;2|S1-40M;1|3-100m;1|5-117M;1|2-100m;1|5-100m;1|1-100M;2|4-100M;1|
4-100M::3-000M;1|4-107M;6|S5-40M;2|6-100m;2|7-137d;1|F3-17m;1|2-107m;1|2-100m;2|5-100M;4|1-100M;5|S4-20M;1|1-110M;1|CAD64-1M;1|
F5-17M::3-000M;1|
4-120M::F2-10m;1|1-100M;1|
CAD64-1M::1-100M;1|3-100m;1|7-137d;1|
S5-47M::5-110M;1|
CAD64-5M::F5-07M;1|
7-110d::F6-00m;1|
F5-20M::5-100M;1|
F2-10m::3-000M;1|6-000M;1|F5-10M;1|7-107d;1|F6-27m;1|
S4-40M::4-107M;1|5-100M;1|4-100M;1|
F6-00m::7-120d;1|7-110d;1|F5-10M;1|S5-40M;1|6-100m;5|3-110m;1|
2-107m::2-107m;8|2-100m;1|S5-40M;1|5-100M;1|1-100M;1|S6-40m;1|3-100m;4|CAD64-6m;1|
F6-20m::6-000M;1|F5-10M;1|
5-110M::F6-00m;1|S6-20m;2|1-100M;1|3-100m;1|5-117M;1|
S6-20m::5-100M;1|6-100m;3|4-100M;1|
S4-20M::5-137M;1|4-107M;1|F5-10M;1|S5-40M;2|5-100M;3|1-100M;3|4-100M;1|7-000M;1|4-100m;1|S1-20M;1|2-110m;1|5-107M;1|
S6-40m::S4-40M;1|2-107m;1|2-100m;1|S6-20m;1|3-110m;1|
3-107m::F6-00m;1|6-107m;1|
4-100m::3-000M;1|S5-40M;2|5-100M;1|1-100M;1|7-000M;5|3-100m;1|
4-120m::4-100M;2|
4-137M::5-110M;1|6-100m;1|CAD64-5M;1|
3-000M::3-000M;3|F6-10m;1|6-000M;4|2-100m;2|S5-40M;2|1-100M;2|4-100M;1|7-000M;6|4-100m;1|F3-00m;1|S1-40M;1|3-100m;1|
3-120m::S1-40M;1|
6-000M::3-000M;2|6-000M;2|F2-10m;3|5-100m;2|S4-20M;1|7-000M;7|4-100M;1|F5-17M;1|6-007M;1|
F4-07M::4-120m;1|
S5-40M::F6-10m;2|5-100M;3|1-100M;4|S4-20M;2|4-100M;1|4-120M;1|S5-47M;1|3-100m;3|7-137d;1|F2-27m;1|
6-100m::F5-20M;1|4-107M;5|S5-40M;2|6-100m;3|F2-00m;2|S5-20M;1|S4-47M;2|2-117m;1|5-100M;2|S6-20m;1|1-100M;1|S4-20M;3|4-100M;3|CAD64-1M;1|
S5-20M::3-100m;1|
5-107M::5-100m;1|6-100m;1|
3-100m::S5-40M;1|6-100m;2|S1-20M;1|3-100m;1|F6-00m;2|S6-20m;1|5-100M;1|1-110M;1|3-107m;1|S6-40m;3|4-100m;1|4-100M;1|6-107m;1|4-137M;1|CAD64-6m;1|
7-137d::6-100m;2|4-100M;1|
F2-27m::3-110m;1|
1-110M::4-107M;1|CAD64-1M;1|
4-110M::7-000M;1|
2-110m::3-000M;2|2-100m;1|
F5-07M::5-137M;1|
CAD64-6m::F6-00m;1|6-100m;1|CAD64-6m;1|3-100m;1|
25 changes: 25 additions & 0 deletions profile/matt_du.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
F2-10m::F3-10m;1|
3-117m::S6-40m;1|
3-127m::6-100m;1|
5-110M::S6-20m;1|S6-40m;1|
5-100M::1-100M;4|4-100M;1|
S6-20m::5-107M;1|
S6-40m::S5-40M;1|4-100M;1|
S4-20M::S5-40M;1|
7-000M::3-000M;2|1-100M;1|4-110m;1|
F3-10m::3-000M;1|
4-120m::2-100m;1|5-100m;1|
F3-00m::F2-10m;1|
4-110m::7-000M;1|
3-000M::6-000M;1|1-100M;1|F3-00m;1|
6-000M::7-000M;1|
S5-40M::5-100M;1|4-100M;1|
6-100m::5-100M;1|4-100M;1|
5-107M::S4-20M;1|
3-100m::2-100m;1|
3-110m::6-100m;1|
2-100m::3-000M;1|5-100M;1|3-117m;1|
5-100m::4-120m;1|
1-100M::5-110M;2|5-100M;2|7-000M;1|3-127m;1|4-120m;1|3-110m;1|
1-110M::2-100m;1|
4-100M::1-100M;2|1-110M;1|3-100m;1|
Binary file modified profile/settings.dat
Binary file not shown.
Binary file added resources/images/icon_bd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icon_fn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icon_lt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icon_na.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icon_ns.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icon_rn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icon_td.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icon_tm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/images/icon_wd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified resources/images/menu_bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
78 changes: 52 additions & 26 deletions src/AppCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ public class AppCore {
private final static Color harm_br = new Color(65, 136, 69);
private final static Color pedal_u = new Color(122, 180, 208);
private final static Color pedal_d = new Color(88, 141, 167);
private final static Color ui_icon = new Color(39, 73, 94);
private final static int w_lookup[] = { 1, 3, 4, 6, 8, 9, 11, 13, 15, 16, 18, 20, 21, 23, 25, 27, 28, 30, 32, 33, 35, 37, 39, 40, 42, 44, 45, 47, 49, 51, 52, 54, 56, 57, 59, 61, 63, 64, 66, 68, 69, 71, 73, 75, 76, 78, 80, 81, 83, 85, 87, 88 };
private final static int b_lookup[] = { 2, 5, 7, 10, 12, 14, 17, 19, 22, 24, 26, 29, 31, 34, 36, 38, 41, 43, 46, 48, 50, 53, 55, 58, 60, 62, 65, 67, 70, 72, 74, 77, 79, 82, 84, 86 };
public enum Mood { M_NEUTRAL, M_CHAOTIC, M_TRANQUIL, M_SAD, M_DRAMATIC, M_HAPPY };

private Color p_color;
private LinearGradientPaint l1, l2, l3;
Expand All @@ -50,7 +52,10 @@ public class AppCore {
private double[] b_tl, b_tr, b_bl, b_br;
private Harmonizer synth;
private Font anal_base;
private int kkey;
private Font mood_base;
private int kkey, c_temp, t_temp, c_fan, t_fan;
private Mood mood;
private String mood_name;
boolean harm;

public AppCore(Display parent) {
Expand All @@ -73,6 +78,8 @@ public void init_values() {
this.curr_state = 0;
this.flag_analysis = false;
this.p_color = pedal_u;
this.mood = Mood.M_NEUTRAL;
this.mood_name = get_mood_name();
this.w_tl = new double[52]; this.w_tr = new double[52];
this.w_bl = new double[52]; this.w_br = new double[52];
this.b_tl = new double[36]; this.b_tr = new double[36];
Expand All @@ -96,6 +103,7 @@ public void init_values() {
}
}
this.anal_base = new Font("Plantin MT Std", Font.PLAIN, sH(40));
this.mood_base = new Font("Plantin MT Std", Font.PLAIN, sH(54));
this.alpha = 255; this.alpha2 = 0; this.alpha3 = 255;

Point2D start = new Point2D.Float(sX(0), sY(0));
Expand Down Expand Up @@ -190,37 +198,25 @@ private void draw_analysis(Graphics2D g) {

if (parent.set.tsig != null) g.drawString(parent.set.tsig.getTS(), sX(nx), sY(308.3));

if (nb.curr_chord != null) nb.curr_chord.draw_roman(g, sX(1920/2), sY(288), sH(154));
g.drawImage(parent.get_images().get("ICON_TM"), sX(672), sY(148), sW(65), sH(65), null);
g.drawImage(parent.get_images().get("ICON_LT"), sX(837), sY(148), sW(65), sH(65), null);
g.drawImage(parent.get_images().get("ICON_FN"), sX(1002), sY(148), sW(65), sH(65), null);
g.drawImage(parent.get_images().get("ICON_NS"), sX(1168), sY(148), sW(65), sH(65), null);
draw_ambiance(g);

g.setColor(new Color(129, 164, 207));
g.fillRect(sX(1320), sY(140), sW(600), sH(66));

g.setColor(parent.bg_color);
g.setFont(anal_base);
fw = g.getFontMetrics().stringWidth("predicted chords");
g.drawString("predicted chords", sX(1320) + (sX(600)-fw)/2, sY(186));
fw = g.getFontMetrics().stringWidth("best guess for mood:");
g.drawString("best guess for mood:", sX(1320) + (sX(600)-fw)/2, sY(186));

if (next_chords != null) {
System.out.println(next_chords.toString());
int i = 1;
System.out.println(next_chords.keySet());
for (Chord c : next_chords.keySet()) {
g.setColor(parent.bg_color);
int x = 1320 + i*600/4;
c.draw_roman(g, sX(x), sY(265), sH(52));
i = i+1;

g.setFont(new Font("Plantin MT Std", Font.PLAIN, sH(44)));
g.setColor(new Color(54, 88, 108));
String prob = (int)(100.0*next_chords.get(c)) + "%";
fw = g.getFontMetrics().stringWidth(prob);
g.drawString(prob, sX(x)-fw/2, sY(325));

if (i > 3) break;
}
}

// g.setFont(new Font("Plantin MT Std", Font.PLAIN, 18));
g.setFont(mood_base);
fw = g.getFontMetrics().stringWidth(mood_name);
g.drawString(mood_name, sX(1320) + (sX(600)-fw)/2, sY(273));

// g.setFont(new Font("Plantin MT Std", Font.PLAIN, 18));
// g.drawString("DOM:" + Music.getNoteName(nb.dom()), sX(1320), sY(220));
// g.drawString(nb.bass.toString(), sX(1320), sY(255));
// g.drawString(nb.rel_buffer.toString(), sX(1320), sY(290));
Expand All @@ -242,6 +238,24 @@ private void draw_ksig(Graphics2D g, KeySignature k) {
}
}

private void draw_ambiance(Graphics2D g) {
switch (this.mood) {
case M_NEUTRAL:

break;
case M_CHAOTIC:
break;
case M_HAPPY:
break;
case M_SAD:
break;
case M_TRANQUIL:
break;
case M_DRAMATIC:
break;
}
}

private void draw_history(Graphics2D g) {
g.setPaint(l2);
g.fillRect(sX(104), sY(anal_s), sW(1712), sH(950-anal_s));
Expand Down Expand Up @@ -345,7 +359,7 @@ private void pedal_color() {
public void handle(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_ESCAPE: case KeyEvent.VK_X: if (curr_state == 1) curr_state = 2; break;
case KeyEvent.VK_R: nb.reinit(); break;
case KeyEvent.VK_R: nb.reinit(); init_values(); break;
case KeyEvent.VK_SPACE: parent.reset(); break;
}
}
Expand Down Expand Up @@ -447,6 +461,18 @@ private int i_of (int[] arr, int val) {
return -1;
}

private String get_mood_name() {
String mname = "";
switch (mood) {
case M_SAD: return "melancholic";
case M_HAPPY: return "jubliant";
case M_TRANQUIL: return "tranquil";
case M_CHAOTIC: return "chaotic";
case M_DRAMATIC: return "dramatic";
default: return "neutral";
}
}

public void note_released(byte id, long timestamp) {}
public void damp_pressed(long timestamp) {}
public void damp_released(long timestamp) {}
Expand Down
12 changes: 11 additions & 1 deletion src/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public enum State {

public Display() {
super(DEFAULT_TITLE);
this.state = State.LOADING;
this.state = State.MENU;
this.sfxplayer = null; this.mscplayer = null;
this.width = s_width; this.height = s_height;
this.set = new Settings(new File(settings));
Expand Down Expand Up @@ -208,6 +208,16 @@ private void initialize_basics() {
images.put("LOAD_BG", ImageIO.read(new File(img_path + "load_bg.png")));
images.put("LOGO_BK", ImageIO.read(new File(img_path + "logo_bk.png")));
images.put("LOGO_WH", ImageIO.read(new File(img_path + "logo_wh.png")));
images.put("ICON_TM", ImageIO.read(new File(img_path + "icon_tm.png")));
images.put("ICON_LT", ImageIO.read(new File(img_path + "icon_lt.png")));
images.put("ICON_FN", ImageIO.read(new File(img_path + "icon_fn.png")));
images.put("ICON_NS", ImageIO.read(new File(img_path + "icon_ns.png")));
images.put("ICON_RN", ImageIO.read(new File(img_path + "icon_rn.png")));
images.put("ICON_TD", ImageIO.read(new File(img_path + "icon_td.png")));
images.put("ICON_WD", ImageIO.read(new File(img_path + "icon_wd.png")));
images.put("ICON_BD", ImageIO.read(new File(img_path + "icon_bd.png")));
images.put("ICON_NA", ImageIO.read(new File(img_path + "icon_na.png")));

images.put("FR_ICON", ImageIO.read(new File("resources\\icons\\icon.png")));

} catch (IOException|FontFormatException e) {
Expand Down
3 changes: 2 additions & 1 deletion src/KeySignature.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ public class KeySignature {

public KeySignature(String name, boolean major) {
this.major = major;

if (name.length() > 0) this.key = name.charAt(0);
else this.key = 'C';
if (major && key > 90) key = (char)(key-32);
if (!major && key < 96) key = (char)(key+32);
if (name.length() > 1)
Expand Down
6 changes: 2 additions & 4 deletions src/MidiHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ public void send(MidiMessage msg, long timeStamp) {
print = false; break;
// add note to buffer when new note is input
case -112:
int tempo = Analyzer.get_tempo(Analyzer.get_time_signature(buffer.history), buffer.history, 10);
System.out.println("Tempo: " + tempo + " BPM");
if (message[2] > 0) {
buffer.add_note(data1, true, data2, timeStamp);
print = true; break;
Expand All @@ -120,10 +122,6 @@ public void send(MidiMessage msg, long timeStamp) {
// Analyzer.get_key_signature(buffer.key_analysis, buffer.curr_key);

}
if (debug){
int tempo = Analyzer.get_tempo(Analyzer.get_time_signature(buffer.history), buffer.history, 10);
System.out.println("Tempo: " + tempo + " BPM");
}
}

public void close() {}
Expand Down
2 changes: 1 addition & 1 deletion src/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private void parse_settings(ArrayList<String> settings) {
if (bgm_vol < 0) bgm_vol = 0;
if (bgm_vol > 100) bgm_vol = 100;
if (tempo < 40 && tempo != -1) tempo = 40;

System.out.println("skey: " + skey + " smaj: " + smaj);
if (skey.equals("null")) this.ksig = null;
else this.ksig = new KeySignature(skey, smaj);
} catch (Exception e) {
Expand Down

0 comments on commit 29c991d

Please sign in to comment.