Remove demo songs mechanism

This commit is contained in:
2024-03-06 11:32:54 +01:00
parent d9906857d3
commit 5e565e3a11
4 changed files with 32 additions and 37 deletions

View File

@ -368,10 +368,12 @@
<input id="show-completions" type="checkbox" value="" class="w-4 h-4 text-blue-600 rounded focus:ring-blue-600 focus:ring-2"> <input id="show-completions" type="checkbox" value="" class="w-4 h-4 text-blue-600 rounded focus:ring-blue-600 focus:ring-2">
<label for="default-checkbox" class="ml-2 text-sm font-medium text-foreground">Show Completions</label> <label for="default-checkbox" class="ml-2 text-sm font-medium text-foreground">Show Completions</label>
</div> </div>
<!--
<div class="flex items-center mb-4 ml-5"> <div class="flex items-center mb-4 ml-5">
<input id="load-demo-songs" type="checkbox" value="" class="w-4 h-4 text-blue-600 rounded focus:ring-blue-600"> <input id="load-demo-songs" type="checkbox" value="" class="w-4 h-4 text-blue-600 rounded focus:ring-blue-600">
<label for="default-checkbox" class="ml-2 text-sm font-medium text-foreground">Load Demo Song</label> <label for="default-checkbox" class="ml-2 text-sm font-medium text-foreground">Load Demo Song</label>
</div> </div>
-->
</div> </div>
</div> </div>

View File

@ -63,7 +63,7 @@ export interface Settings {
selected_universe: string; selected_universe: string;
line_numbers: boolean; line_numbers: boolean;
time_position: boolean; time_position: boolean;
load_demo_songs: boolean; // load_demo_songs: boolean;
tips: boolean; tips: boolean;
completions: boolean; completions: boolean;
send_clock: boolean; send_clock: boolean;
@ -150,7 +150,7 @@ export class AppSettings {
public midi_clock_input: string | undefined = undefined; public midi_clock_input: string | undefined = undefined;
public default_midi_input: string | undefined = undefined; public default_midi_input: string | undefined = undefined;
public midi_clock_ppqn: number = 24; public midi_clock_ppqn: number = 24;
public load_demo_songs: boolean = true; // public load_demo_songs: boolean = true;
constructor() { constructor() {
const settingsFromStorage = JSON.parse( const settingsFromStorage = JSON.parse(
@ -174,7 +174,7 @@ export class AppSettings {
this.midi_clock_input = settingsFromStorage.midi_clock_input; this.midi_clock_input = settingsFromStorage.midi_clock_input;
this.midi_clock_ppqn = settingsFromStorage.midi_clock_ppqn || 24; this.midi_clock_ppqn = settingsFromStorage.midi_clock_ppqn || 24;
this.default_midi_input = settingsFromStorage.default_midi_input; this.default_midi_input = settingsFromStorage.default_midi_input;
this.load_demo_songs = settingsFromStorage.load_demo_songs; // this.load_demo_songs = settingsFromStorage.load_demo_songs;
} else { } else {
this.universes = template_universes; this.universes = template_universes;
} }
@ -204,7 +204,7 @@ export class AppSettings {
midi_clock_input: this.midi_clock_input, midi_clock_input: this.midi_clock_input,
midi_clock_ppqn: this.midi_clock_ppqn, midi_clock_ppqn: this.midi_clock_ppqn,
default_midi_input: this.default_midi_input, default_midi_input: this.default_midi_input,
load_demo_songs: this.load_demo_songs, // load_demo_songs: this.load_demo_songs,
}; };
} }
@ -232,7 +232,7 @@ export class AppSettings {
this.midi_clock_input = settings.midi_clock_input; this.midi_clock_input = settings.midi_clock_input;
this.midi_clock_ppqn = settings.midi_clock_ppqn; this.midi_clock_ppqn = settings.midi_clock_ppqn;
this.default_midi_input = settings.default_midi_input; this.default_midi_input = settings.default_midi_input;
this.load_demo_songs = settings.load_demo_songs; // this.load_demo_songs = settings.load_demo_songs;
localStorage.setItem("topos", JSON.stringify(this.data)); localStorage.setItem("topos", JSON.stringify(this.data));
} }
} }
@ -245,13 +245,13 @@ export const initializeSelectedUniverse = (app: Editor): void => {
* @param app - The main application * @param app - The main application
* @returns void * @returns void
*/ */
if (app.settings.load_demo_songs) { // if (app.settings.load_demo_songs) {
let random_example = examples[Math.floor(Math.random() * examples.length)]; // let random_example = examples[Math.floor(Math.random() * examples.length)];
app.selected_universe = "Demo"; // app.selected_universe = "Demo";
app.universes[app.selected_universe] = structuredClone(template_universe); // app.universes[app.selected_universe] = structuredClone(template_universe);
app.universes[app.selected_universe].global.committed = random_example; // app.universes[app.selected_universe].global.committed = random_example;
app.universes[app.selected_universe].global.candidate = random_example; // app.universes[app.selected_universe].global.candidate = random_example;
} else { // } else {
try { try {
app.selected_universe = app.settings.selected_universe; app.selected_universe = app.settings.selected_universe;
if (app.universes[app.selected_universe] === undefined) if (app.universes[app.selected_universe] === undefined)
@ -262,7 +262,6 @@ export const initializeSelectedUniverse = (app: Editor): void => {
app.selected_universe = app.settings.selected_universe; app.selected_universe = app.settings.selected_universe;
app.universes[app.selected_universe] = structuredClone(template_universe); app.universes[app.selected_universe] = structuredClone(template_universe);
} }
}
( (
app.interface.universe_viewer as HTMLInputElement app.interface.universe_viewer as HTMLInputElement
).placeholder! = `${app.selected_universe}`; ).placeholder! = `${app.selected_universe}`;

View File

@ -44,8 +44,8 @@ export const installInterfaceLogic = (app: Editor) => {
app.settings.midi_channels_scripts; app.settings.midi_channels_scripts;
(app.interface.midi_clock_ppqn as HTMLInputElement).value = (app.interface.midi_clock_ppqn as HTMLInputElement).value =
app.settings.midi_clock_ppqn.toString(); app.settings.midi_clock_ppqn.toString();
(app.interface.load_demo_songs as HTMLInputElement).checked = // (app.interface.load_demo_songs as HTMLInputElement).checked =
app.settings.load_demo_songs; // app.settings.load_demo_songs;
const tabs = document.querySelectorAll('[id^="tab-"]'); const tabs = document.querySelectorAll('[id^="tab-"]');
// Iterate over the tabs with an index // Iterate over the tabs with an index
@ -373,8 +373,8 @@ export const installInterfaceLogic = (app: Editor) => {
midiChannelsScripts.checked = app.settings.midi_channels_scripts; midiChannelsScripts.checked = app.settings.midi_channels_scripts;
const midiClockPpqn = app.interface.midi_clock_ppqn as HTMLInputElement; const midiClockPpqn = app.interface.midi_clock_ppqn as HTMLInputElement;
midiClockPpqn.value = app.settings.midi_clock_ppqn.toString(); midiClockPpqn.value = app.settings.midi_clock_ppqn.toString();
const loadDemoSongs = app.interface.load_demo_songs as HTMLInputElement; // const loadDemoSongs = app.interface.load_demo_songs as HTMLInputElement;
loadDemoSongs.checked = app.settings.load_demo_songs; // loadDemoSongs.checked = app.settings.load_demo_songs;
const vimModeCheckbox = app.interface.vim_mode_checkbox as HTMLInputElement; const vimModeCheckbox = app.interface.vim_mode_checkbox as HTMLInputElement;
vimModeCheckbox.checked = app.settings.vimMode; vimModeCheckbox.checked = app.settings.vimMode;
@ -502,12 +502,12 @@ export const installInterfaceLogic = (app: Editor) => {
app.settings.midi_clock_ppqn = value; app.settings.midi_clock_ppqn = value;
}); });
app.interface.load_demo_songs.addEventListener("change", () => { // app.interface.load_demo_songs.addEventListener("change", () => {
let checked = (app.interface.load_demo_songs as HTMLInputElement).checked // let checked = (app.interface.load_demo_songs as HTMLInputElement).checked
? true // ? true
: false; // : false;
app.settings.load_demo_songs = checked; // app.settings.load_demo_songs = checked;
}); // });
app.interface.universe_creator.addEventListener("submit", (event) => { app.interface.universe_creator.addEventListener("submit", (event) => {
event.preventDefault(); event.preventDefault();

View File

@ -63,12 +63,6 @@ beat(.25) :: sound('sid').note(
Topos is deeply inspired by the [Monome Teletype](https://monome.org/). The Teletype is/was an open source hardware module for Eurorack synthesizers. While the Teletype was initially born as an hardware module, Topos aims to be a web-browser based cousin of it! It is a sequencer, a scriptable interface, a companion for algorithmic music-making. Topos wishes to fullfill the same goal as the Teletype, keeping the same spirit alive on the web. It is free, open-source, and made to be shared and used by everyone. Learn more about live coding on [livecoding.fr](https://livecoding.fr). Topos is deeply inspired by the [Monome Teletype](https://monome.org/). The Teletype is/was an open source hardware module for Eurorack synthesizers. While the Teletype was initially born as an hardware module, Topos aims to be a web-browser based cousin of it! It is a sequencer, a scriptable interface, a companion for algorithmic music-making. Topos wishes to fullfill the same goal as the Teletype, keeping the same spirit alive on the web. It is free, open-source, and made to be shared and used by everyone. Learn more about live coding on [livecoding.fr](https://livecoding.fr).
## Demo Songs
Reloading the application will get you one random song example to study every time. Press ${key_shortcut(
"F5",
)} and listen to them all! The demo songs are also used a bit everywhere in the documentation to illustrate some of the working principles :).
## Alternative documentation source (.pdf) ## Alternative documentation source (.pdf)
You can also find a .pdf version listing the principal commands and functions [here](https://github.com/Bubobubobubobubo/topos/blob/main/src/documentation/basics/TOPOS_COMMANDS.pdf). This document has been generated by Chris Collis. It recaps the main sections of this documentation and can be a good companion while learning Topos. You can also find a .pdf version listing the principal commands and functions [here](https://github.com/Bubobubobubobubo/topos/blob/main/src/documentation/basics/TOPOS_COMMANDS.pdf). This document has been generated by Chris Collis. It recaps the main sections of this documentation and can be a good companion while learning Topos.