Skip to content

Commit

Permalink
1st preliminary version of song generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Modrigue committed Jan 8, 2024
1 parent c9a9b7c commit 9c62ac2
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 48 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<button class="button-page" id="button_page_chord_explorer" >Find chords</button>
<button class="button-page" id="button_page_scale_explorer" >Explore scales</button>
<button class="button-page" id="button_page_scale_finder" >Find scales</button>
<!--button class="button-page" id="button_page_song_generator" >Generate a song</button-->
<button class="button-page" id="button_page_song_generator" >Generate a song</button>
<span id="checkboxLanguageSpan" style='float: right;'>
<input type="checkbox" id="checkboxLanguage" name="checkboxLanguage" onchange="updateLocales()">
<label class="input-label" for="checkboxLanguage"><img src="img/french_flag.png" alt="FR"/></label>
Expand Down
22 changes: 3 additions & 19 deletions js/gui/interface.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/gui/interface.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/gui/strings.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 3 additions & 23 deletions ts/gui/interface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
let pagesArray: Array<string> =
["page_scale_explorer", "page_scale_finder", "page_chord_explorer", "page_chord_tester"];
["page_scale_explorer", "page_scale_finder", "page_chord_explorer", "page_chord_tester", "page_song_generator"];
let pageSelected: string = "";


Expand All @@ -13,10 +13,6 @@ let browserSupportsAudio = true;
let languageInitialized = false;
let chordExplorerUpdateMode: string = "";

/* Experimental */
let showSongGeneration = false;
if (showSongGeneration)
pagesArray.push("page_song_generator");

///////////////////////////////// INITIALIZATION //////////////////////////////

Expand All @@ -35,21 +31,8 @@ window.onload = function()
loadDefaultInstrument();

(<HTMLButtonElement>document.getElementById("checkboxLanguage")).addEventListener("change", updateLocales);

//(<HTMLButtonElement>document.getElementById('welcome_button_load_instruments')).addEventListener("click", loadDefaultInstrument);

if (showSongGeneration)
{
let buttonSongGen = document.createElement('button');
buttonSongGen.classList.add("button-page");
buttonSongGen.id = "button_page_song_generator";
buttonSongGen.innerText = "Generate a song";
const checkboxLanguageSpan = <HTMLSpanElement>document.getElementById("checkboxLanguageSpan");
checkboxLanguageSpan.insertAdjacentElement('beforebegin', buttonSongGen);

pagesArray.push("page_song_generator");
}

// pages
for (const page of pagesArray)
(<HTMLButtonElement>document.getElementById(`button_${page}`)).addEventListener("click", () => selectPage(page));
Expand Down Expand Up @@ -773,11 +756,8 @@ function updateLocales(): void
document.title = getString("title");

// pages buttons
(<HTMLButtonElement>document.getElementById("button_page_chord_tester")).innerText = getString("page_chord_tester");
(<HTMLButtonElement>document.getElementById("button_page_chord_explorer")).innerText = getString("page_chord_explorer");
(<HTMLButtonElement>document.getElementById("button_page_scale_explorer")).innerText = getString("page_scale_explorer");
(<HTMLButtonElement>document.getElementById("button_page_scale_finder")).innerText = getString("page_scale_finder");
//(<HTMLButtonElement>document.getElementById("button_page_song_generator")).innerText = getString("page_song_generator");
for (let pageId of pagesArray)
(<HTMLButtonElement>document.getElementById(`button_${pageId}`)).innerText = getString(pageId);

// welcome

Expand Down
4 changes: 2 additions & 2 deletions ts/gui/strings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ stringsDict_int.set("chord", "Chord");
stringsDict_int.set("chord_explorer_nb_strings_max_text", "strings played");
stringsDict_int.set("chord_neapolitan", "Neapolitan chord:");
stringsDict_int.set("chords_aug_6th", "Augmented 6th chords:");
stringsDict_int.set("chords+melody", "Chords + Melody");
stringsDict_int.set("chords+melody", "Chords + melody");
stringsDict_int.set("chords_N_notes", "Chords with {%1} notes");
stringsDict_int.set("chords_N_notes_all", "All chords with {%1} notes:");
stringsDict_int.set("chords_progression", "Chords progression");
Expand Down Expand Up @@ -103,7 +103,7 @@ stringsDict_fr.set("chord_explorer_nb_strings_max_text", "cordes jouées");
stringsDict_fr.set("chord_neapolitan", "Accord napolitain :");
stringsDict_fr.set("chords_progression", "Progression d'accords");
stringsDict_fr.set("chords_aug_6th", "Accords 6e augmentés :");
stringsDict_fr.set("chords+melody", "Accords + Mélodie");
stringsDict_fr.set("chords+melody", "Accords + mélodie");
stringsDict_fr.set("chords_N_notes", "Accords de {%1} notes");
stringsDict_fr.set("chords_N_notes_all", "Tous les accords de {%1} notes :");
stringsDict_fr.set("chords_quartal", "Accords quartaux");
Expand Down

0 comments on commit 9c62ac2

Please sign in to comment.