From 5e565e3a118debca84c0e1c6ab4186b5f1f2d5aa Mon Sep 17 00:00:00 2001 From: Raphael Forment Date: Wed, 6 Mar 2024 11:32:54 +0100 Subject: [PATCH] Remove demo songs mechanism --- index.html | 2 ++ src/FileManagement.ts | 41 ++++++++++++++--------------- src/InterfaceLogic.ts | 20 +++++++------- src/documentation/basics/welcome.ts | 6 ----- 4 files changed, 32 insertions(+), 37 deletions(-) diff --git a/index.html b/index.html index 80dfea5..999c4aa 100644 --- a/index.html +++ b/index.html @@ -368,10 +368,12 @@ + diff --git a/src/FileManagement.ts b/src/FileManagement.ts index d87be58..0eecc2a 100644 --- a/src/FileManagement.ts +++ b/src/FileManagement.ts @@ -63,7 +63,7 @@ export interface Settings { selected_universe: string; line_numbers: boolean; time_position: boolean; - load_demo_songs: boolean; + // load_demo_songs: boolean; tips: boolean; completions: boolean; send_clock: boolean; @@ -150,7 +150,7 @@ export class AppSettings { public midi_clock_input: string | undefined = undefined; public default_midi_input: string | undefined = undefined; public midi_clock_ppqn: number = 24; - public load_demo_songs: boolean = true; + // public load_demo_songs: boolean = true; constructor() { const settingsFromStorage = JSON.parse( @@ -174,7 +174,7 @@ export class AppSettings { this.midi_clock_input = settingsFromStorage.midi_clock_input; this.midi_clock_ppqn = settingsFromStorage.midi_clock_ppqn || 24; 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 { this.universes = template_universes; } @@ -204,7 +204,7 @@ export class AppSettings { midi_clock_input: this.midi_clock_input, midi_clock_ppqn: this.midi_clock_ppqn, 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_ppqn = settings.midi_clock_ppqn; 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)); } } @@ -245,23 +245,22 @@ export const initializeSelectedUniverse = (app: Editor): void => { * @param app - The main application * @returns void */ - if (app.settings.load_demo_songs) { - let random_example = examples[Math.floor(Math.random() * examples.length)]; - app.selected_universe = "Demo"; + // if (app.settings.load_demo_songs) { + // let random_example = examples[Math.floor(Math.random() * examples.length)]; + // app.selected_universe = "Demo"; + // app.universes[app.selected_universe] = structuredClone(template_universe); + // app.universes[app.selected_universe].global.committed = random_example; + // app.universes[app.selected_universe].global.candidate = random_example; + // } else { + try { + app.selected_universe = app.settings.selected_universe; + if (app.universes[app.selected_universe] === undefined) + app.universes[app.selected_universe] = + structuredClone(template_universe); + } catch (error) { + app.settings.selected_universe = "Welcome"; + app.selected_universe = app.settings.selected_universe; app.universes[app.selected_universe] = structuredClone(template_universe); - app.universes[app.selected_universe].global.committed = random_example; - app.universes[app.selected_universe].global.candidate = random_example; - } else { - try { - app.selected_universe = app.settings.selected_universe; - if (app.universes[app.selected_universe] === undefined) - app.universes[app.selected_universe] = - structuredClone(template_universe); - } catch (error) { - app.settings.selected_universe = "Welcome"; - app.selected_universe = app.settings.selected_universe; - app.universes[app.selected_universe] = structuredClone(template_universe); - } } ( app.interface.universe_viewer as HTMLInputElement diff --git a/src/InterfaceLogic.ts b/src/InterfaceLogic.ts index 7b5dec8..f9ad983 100644 --- a/src/InterfaceLogic.ts +++ b/src/InterfaceLogic.ts @@ -44,8 +44,8 @@ export const installInterfaceLogic = (app: Editor) => { app.settings.midi_channels_scripts; (app.interface.midi_clock_ppqn as HTMLInputElement).value = app.settings.midi_clock_ppqn.toString(); - (app.interface.load_demo_songs as HTMLInputElement).checked = - app.settings.load_demo_songs; + // (app.interface.load_demo_songs as HTMLInputElement).checked = + // app.settings.load_demo_songs; const tabs = document.querySelectorAll('[id^="tab-"]'); // Iterate over the tabs with an index @@ -373,8 +373,8 @@ export const installInterfaceLogic = (app: Editor) => { midiChannelsScripts.checked = app.settings.midi_channels_scripts; const midiClockPpqn = app.interface.midi_clock_ppqn as HTMLInputElement; midiClockPpqn.value = app.settings.midi_clock_ppqn.toString(); - const loadDemoSongs = app.interface.load_demo_songs as HTMLInputElement; - loadDemoSongs.checked = app.settings.load_demo_songs; + // const loadDemoSongs = app.interface.load_demo_songs as HTMLInputElement; + // loadDemoSongs.checked = app.settings.load_demo_songs; const vimModeCheckbox = app.interface.vim_mode_checkbox as HTMLInputElement; vimModeCheckbox.checked = app.settings.vimMode; @@ -502,12 +502,12 @@ export const installInterfaceLogic = (app: Editor) => { app.settings.midi_clock_ppqn = value; }); - app.interface.load_demo_songs.addEventListener("change", () => { - let checked = (app.interface.load_demo_songs as HTMLInputElement).checked - ? true - : false; - app.settings.load_demo_songs = checked; - }); + // app.interface.load_demo_songs.addEventListener("change", () => { + // let checked = (app.interface.load_demo_songs as HTMLInputElement).checked + // ? true + // : false; + // app.settings.load_demo_songs = checked; + // }); app.interface.universe_creator.addEventListener("submit", (event) => { event.preventDefault(); diff --git a/src/documentation/basics/welcome.ts b/src/documentation/basics/welcome.ts index 6d2f86d..85e352f 100644 --- a/src/documentation/basics/welcome.ts +++ b/src/documentation/basics/welcome.ts @@ -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). -## 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) 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.