Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Instrument: Triangle #494

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added images/triangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
<span i18n="Tambourine">Tambourine</span>
<span class="key">B</span>
</div>
<div>
<span i18n="Triangle">Triangle</span>
<span class="key">S</span>
</div>
<div>
<span i18n="Meow">Meow</span>
<span i18n="SPACE" class="key key-wide">SPACE</span>
Expand Down Expand Up @@ -116,6 +120,7 @@
<div id="cymbal"></div>
<div id="marimba"></div>
<div id="tambourine"></div>
<div id="triangle"></div>
<div id="cowbell"></div>
</div>
</div>
Expand All @@ -128,6 +133,7 @@
<option value="layer-cymbal" i18n="Cymbal">Cymbal</option>
<option value="layer-marimba" i18n="Marimba">Marimba</option>
<option value="layer-tambourine" i18n="Tambourine">Tambourine</option>
<option value="layer-triangle" i18n="Triangle">Triangle</option>
<option value="layer-cowbell" i18n="Cowbell">Cowbell</option>
</select>
</div>
Expand Down
18 changes: 14 additions & 4 deletions js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ const InstrumentEnum = Object.freeze({
CYMBAL: 4,
MARIMBA: 5,
TAMBOURINE: 6,
COWBELL: 7
COWBELL: 7,
TRIANGLE: 8,
})
const KeyEnum = Object.freeze({
"A": 1,
Expand Down Expand Up @@ -37,7 +38,8 @@ const KeyEnum = Object.freeze({
"O": 9,
"P": 0,
"B": 1,
"F": 1
"F": 1,
"S": 1,
})
const InstrumentPerKeyEnum = Object.freeze({
"A": InstrumentEnum.BONGO,
Expand Down Expand Up @@ -66,7 +68,8 @@ const InstrumentPerKeyEnum = Object.freeze({
"O": InstrumentEnum.MARIMBA,
"P": InstrumentEnum.MARIMBA,
"B": InstrumentEnum.TAMBOURINE,
"F": InstrumentEnum.COWBELL
"F": InstrumentEnum.COWBELL,
"S": InstrumentEnum.TRIANGLE,
})
const ClickKeyEquivalentEnum = Object.freeze({
"1": "A",
Expand All @@ -81,6 +84,7 @@ const TapKeyEquivalentEnum = Object.freeze({
"BONGO": ["D"],
"CYMBAL": ["C"],
"TAMBOURINE": ["B"],
"TRIANGLE": ["S"],
"COWBELL": ["F"]
},
"tap-space": {
Expand Down Expand Up @@ -134,6 +138,7 @@ const TapKeysPerLayerEnum = Object.freeze({
"layer-cymbal": ["tap-right"],
"layer-marimba": ["tap-keys"],
"layer-tambourine": ["tap-right"],
"layer-triangle": ["tap-right"],
"layer-cowbell": ["tap-right"]
})
const LayersPerInstrumentEnum = Object.freeze({
Expand All @@ -143,7 +148,8 @@ const LayersPerInstrumentEnum = Object.freeze({
"layer-cymbal": InstrumentEnum.CYMBAL,
"layer-marimba": InstrumentEnum.MARIMBA,
"layer-tambourine": InstrumentEnum.TAMBOURINE,
"layer-cowbell": InstrumentEnum.COWBELL
"layer-cowbell": InstrumentEnum.COWBELL,
"layer-triangle": InstrumentEnum.TRIANGLE
})
var pressed = [];
var currentLayer;
Expand All @@ -163,6 +169,7 @@ $(document).ready(function() {
$.loadSimple("meow");
$.loadSimple("cymbal");
$.loadSimple("tambourine");
$.loadSimple("triangle");
$.loadSimple("cowbell");
$.layers("layer-bongo");
$("select#select-instrument").on("change", function() {
Expand Down Expand Up @@ -298,6 +305,9 @@ var i18n_map = {
"Tambourine": {
"en": "Tambourine",
"ca": "Pandereta"},
"Triangle": {
"en": "Triangle",
"ca": "Triangle"},
"Meow": {
"en": "Meow",
"ca": "Miol"},
Expand Down
Binary file added sounds/triangle.mp3
Binary file not shown.
Binary file added sounds/triangle.wav
Binary file not shown.
4 changes: 4 additions & 0 deletions style/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ select#select-instrument option {
background-image: url(../images/cowbell.png)
}

.instruments>#triangle, #layer-triangle {
background-image: url(../images/triangle.png);
}

.instruments>#keyboard, .instruments>#cymbal, .instruments>#marimba, .instruments>#tambourine, .instruments>#cowbell {
visibility: hidden
}
Expand Down