Skip to content

Commit

Permalink
Merge pull request #52 from SubhadeepJasu/settings
Browse files Browse the repository at this point in the history
Implement Settings UI and prepare next alpha
  • Loading branch information
SubhadeepJasu authored Nov 20, 2021
2 parents 467de16 + cbf1c76 commit 15f0d10
Show file tree
Hide file tree
Showing 22 changed files with 669 additions and 675 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Ensembles is a realtime musical performance arranger app. Its built using Vala a
* Play a one-person band along with a Auto Accompaniment Style from over 100 [WIP] built-in styles based on various genres of music
* Automate your band with Registration Memory
* Record and play audio files using 12 assignable Sampling Pads
* Record your playback in a multitrack recorder (10 tracks)
* Play MIDI files using the inbuilt synthesizer
* Connect to external MIDI keyboard/controller with General MIDI Standard compatibility

Expand Down
44 changes: 41 additions & 3 deletions data/Application.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
border-radius: 50%;
}

.splash-background {
background: #202020;
}

.display-background {
background-color: #000;
}
Expand All @@ -33,7 +37,9 @@
}

.home-screen-panel-top {
background-color: alpha(#007367, 0.75);
background-image: linear-gradient(alpha(#007367, 0.6),alpha(#007367, 0.6)),url("resource://com/github/subhadeepjasu/ensembles/images/display_unit/catalin-sandru-7SxSkCvVM1U-unsplash-blurred.jpg");
background-size: auto 600%;
background-position: 50% 0;
border-bottom: 1px solid alpha(#000, 0.5);
}

Expand All @@ -60,7 +66,9 @@
}

.home-screen-panel-bottom {
background: alpha(#273445, 0.8);
background-image: linear-gradient(alpha(#273445, 0.6),alpha(#273445, 0.6)),url("resource://com/github/subhadeepjasu/ensembles/images/display_unit/catalin-sandru-7SxSkCvVM1U-unsplash-blurred.jpg");
background-size: auto 250%;
background-position: 50% 100%;
border-top: 1px solid alpha(#000, 0.5);
}

Expand Down Expand Up @@ -337,7 +345,7 @@
}

.toggle-switch {
font-size: 0.8em;
font-size: 0.9em;
}

.toggle-indicator {
Expand Down Expand Up @@ -841,3 +849,33 @@
box-shadow: inset -6px 0 4px alpha (#0f0, 0.4);
border-right: 1px solid alpha (#0f0, 0.8);
}

.setings-input-item-key-label {
color: #f3f3f3;
background: alpha(#000, 0.5);
border: 1px solid alpha(#ccc, 0.5);
border-radius: 4px;
font-size: 0.9em;
}

.setings-input-item-white {
background: #444;
box-shadow: inset 0 1px #666, inset 0 -1px #000;
}

.setings-input-item-black {
background: #222;
box-shadow: inset 0 1px #444, inset 0 -1px #000;
}

.input-key-box > .activatable:selected {
background-color: alpha(@accent_color, 0.25);
background-image: -gtk-icontheme('edit-symbolic');
background-repeat: no-repeat;
background-position: 10% 50%;
background-size: 16px;
}

.input-key-box > .activatable:selected > .horizontal > .keycap {
color: #666;
}
Binary file modified data/Images/catalin-sandru-7SxSkCvVM1U-unsplash-blurred.jpg
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 data/Images/catalin-sandru-7SxSkCvVM1U-unsplash.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions data/Images/ensembles_splash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 30 additions & 2 deletions data/com.github.subhadeepjasu.ensembles.appdata.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<li>Touch based on-screen assignable joystick</li>
<li>Play a one-person band along with Auto Accompaniment Styles based on various genres of music</li>
<li>Automate your band with Registration Memory and 12 assignable Multipad Variables</li>
<li>Record your playback using a 10-track recorder</li>
<li>Connect to external MIDI keyboard/controller with General MIDI Standard compatibility</li>
</ul>
</description>
Expand All @@ -36,8 +37,25 @@
<launchable type="desktop-id">com.github.subhadeepjasu.ensembles.desktop</launchable>
<screenshots>
<screenshot type="default">
<caption>Instant Playback</caption>
<image>https://raw.githubusercontent.com/SubhadeepJasu/Ensembles/master/screenshots/Screenshot.png</image>
</screenshot>
<screenshot>
<caption>Style Menu</caption>
<image>https://raw.githubusercontent.com/SubhadeepJasu/Ensembles/master/screenshots/ScreenshotStyles.png</image>
</screenshot>
<screenshot>
<caption>Per Channel Modulators</caption>
<image>https://raw.githubusercontent.com/SubhadeepJasu/Ensembles/master/screenshots/ScreenshotChannelModulators.png</image>
</screenshot>
<screenshot>
<caption>Master Knob LFO</caption>
<image>https://raw.githubusercontent.com/SubhadeepJasu/Ensembles/master/screenshots/ScreenshotLFO.png</image>
</screenshot>
<screenshot>
<caption>Multi-track Recorder</caption>
<image>https://raw.githubusercontent.com/SubhadeepJasu/Ensembles/master/screenshots/ScreenshotMultiTrackRecorder.png</image>
</screenshot>
</screenshots>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">none</content_attribute>
Expand Down Expand Up @@ -69,12 +87,22 @@
<content_attribute id="money-gambling">none</content_attribute>
</content_rating>
<releases>
<release version="0.0.15" date="2021-11-05">
<release version="0.0.15" date="2021-11-21">
<description>
<p>New:</p>
<ul>
<li>Make settings UI</li>
<li>Add Rudimentary LV2 Plugin Support</li>
<li>Ability to choose audio driver</li>
<li>Ability to change PC keyboard layout</li>
<li>Add multitrack recorder with upto 10 tracks, (along with recording style events in the first track)</li>
<li>Multi-touch support for on-screen keyboard</li>
<li>Add Rudimentary LV2 Plugin Support (Not yet available in the UI)</li>
</ul>
<p>Fixed:</p>
<ul>
<li>Fix grid and font rendering in HiDPI screens</li>
<li>Make app translatable</li>
<li>More memory bugs swatted</li>
</ul>
</description>
</release>
Expand Down
6 changes: 6 additions & 0 deletions data/com.github.subhadeepjasu.ensembles.gschema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,11 @@
<default>64</default>
<summary>Size of buffer to be processed by the driver</summary>
</key>

<!-- Input Bindings -->
<key name="pc-input-bindings" type="s">
<default>"ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_Z_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_X_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_C_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_V_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_B_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_N_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_M_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_KEYPAD_COMMA,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_KEYPAD_RADIX,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_SEMICOLON,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_SINGLEQUOTE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_SQ_BRACKETS_L,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_Z_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_X_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_C_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_V_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_B_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_N_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_M_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_LT,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_GT,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_COLON,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_DOUBLEQUOTE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_FL_BRACKETS_L,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_A_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_W_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_S_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_E_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_D_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_F_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_T_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_G_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_Y_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_H_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_U_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_J_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_K_LOWER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_A_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_W_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_S_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_E_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_F_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_T_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_G_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_Y_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_H_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_U_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_J_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_K_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_O_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_P_UPPER,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE,ENSEMBLES_SHELL_KEYBOARD_CONSTANTS_KEY_MAP_NONE"</default>
<summary>PC Keyboard input bindings</summary>
</key>
</schema>
</schemalist>
Binary file modified screenshots/Screenshot.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 screenshots/ScreenshotChannelModulators.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 screenshots/ScreenshotLFO.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 screenshots/ScreenshotMultiTrackRecorder.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 screenshots/ScreenshotStyles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions src/Core/Synthesizer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,18 @@ namespace Ensembles.Core {
return synthesizer_get_velocity_levels (synth_index, channel);
}

public static int get_transpose () {
return synthesizer_transpose;
}

public static void set_transpose (int transpose) {
synthesizer_transpose = transpose;
}

public static bool get_transpose_active () {
return synthesizer_transpose_enable == 1;
}

public static void set_transpose_active (bool active) {
if (active) {
synthesizer_transpose_enable = 1;
Expand All @@ -165,10 +173,18 @@ namespace Ensembles.Core {
}
}

public static int get_octave () {
return synthesizer_octave;
}

public static void set_octave (int octave) {
synthesizer_octave = octave;
}

public static bool get_octave_shifted () {
return synthesizer_octave_shifted == 1;
}

public static void set_octave_shifted (bool active) {
if (active) {
synthesizer_octave_shifted = 1;
Expand Down
140 changes: 139 additions & 1 deletion src/Shell/Common/KeyboardConstants.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
// vala-lint=skip-file

namespace Ensembles.Shell {
public errordomain EnumError {
UNKNOWN_VALUE
}
public class KeyboardConstants {
public enum KeyMap {
NUMPAD_0 = 65456,
Expand All @@ -44,6 +47,10 @@
KEYPAD_9 = 57,
KEYPAD_RADIX = 46,
KEYPAD_COMMA = 44,
SEMICOLON = 59,
SINGLEQUOTE = 39,
COLON = 58,
DOUBLEQUOTE = 34,
F1 = 65470,
F2 = 65471,
F3 = 65472,
Expand Down Expand Up @@ -150,8 +157,21 @@
SPACE_BAR = 32,

CTRL = 65507,
SHIFT = 65505
SHIFT = 65505,
SHIFTALT = 65506,

NONE = 0;

public static KeyMap parse (string value) throws EnumError {
EnumValue? a;
a = ((EnumClass)typeof (KeyMap).class_ref ()).get_value_by_name (value);
if (a == null) {
throw new EnumError.UNKNOWN_VALUE (@"String $(value) is not a valid value for $(typeof(KeyMap).name())");
}
return (KeyMap)a.value;
}
}
public static KeyMap[] key_bindings;
public static bool key_is_number_numpad (uint key) {
if ((key >= KeyMap.NUMPAD_0) && (key <= KeyMap.NUMPAD_9))
return true;
Expand All @@ -162,5 +182,123 @@
return true;
return false;
}
public static string keycode_to_string (KeyboardConstants.KeyMap key) {
string all_labels = _("abcdefghijklmnopqrstuvwxyz,./[]ABCDEFGHIJKLMNOPQRSTUVWXYZ<>{}");
string label = "";
uint index = key;
if (index > 64 && index < 91) {
label = all_labels.get_char (index - 34).to_string ();
} else if (index > 96 && index < 123) {
label = all_labels.get_char (index - 97).to_string ();
} else if (index == 44) {
label = _("Comma");
} else if (index == 46) {
label = _("Radix");
} else if (index == 47) {
label = "/";
} else if (index == 91) {
label = "[";
} else if (index == 93) {
label = "]";
} else if (index == 123) {
label = "{";
} else if (index == 125) {
label = "}";
} else if (index == 60) {
label = "<";
} else if (index == 62) {
label = ">";
} else if (index == 63) {
label = "?";
} else if (index == 59) {
label = ";";
} else if (index == 39) {
label = "\'";
} else if (index == 34) {
label ="\"";
} else if (index == 58) {
label = ":";
} else {
label = _("Empty");
}
return label;
}

public static int get_note_from_keycode (uint key) {
for (int i = 0; i < 60; i++) {
if (key_bindings[i] == key) {
return i;
}
}
return -1;
}

public static void save_mapping (Settings settings, string? path = null) {
string csv = "";

for (int i = 0; i < 60; i++) {
csv += key_bindings[i].to_string ();
if (i < 59) {
csv += ",";
}
}

settings.set_string ("pc-input-bindings", csv);

if (path != null) {
try {
var file = File.new_for_path (path);
if (file.query_exists ()) {
file.delete ();
}
var fs = file.create (GLib.FileCreateFlags.NONE);

var ds = new DataOutputStream (fs);
ds.put_string (csv);
} catch (Error e) {
warning (e.message);
}
}
}

public static void load_mapping (Settings settings, string? path = null) {
key_bindings = new KeyMap[60];
string csv = "";
if (path != null) {
try {
var file = File.new_for_path (path);
if (!file.query_exists ()) {
error ("Cannot open file");
}
var dis = new DataInputStream (file.read ());

csv = dis.read_line (null);

settings.set_string ("pc-input-bindings", csv);
} catch (Error e) {
warning (e.message);
}
} else {
csv = settings.get_string ("pc-input-bindings");
}

var binds = csv.split (",", 60);
if (binds.length == 60) {
try {
for (int i = 0; i < 60; i++) {
key_bindings[i] = KeyMap.parse (binds[i]);
}
} catch (Error e) {
print ("Failed To get bindings: %s\n", e.message);
for (int i = 0; i < 60; i++){
key_bindings[i] = KeyMap.NONE;
}
}
} else {
for (int i = 0; i < 60; i++){
key_bindings[i] = KeyMap.NONE;
}
}
}
}
}
Loading

0 comments on commit 15f0d10

Please sign in to comment.