Skip to content

Commit

Permalink
Remove demo songs mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Mar 6, 2024
1 parent d990685 commit 5e565e3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 37 deletions.
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,12 @@ <h1 class="lg:mt-12 mt-6 font-semibold rounded-lg justify-center lg:text-center
<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>
</div>
<!--
<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">
<label for="default-checkbox" class="ml-2 text-sm font-medium text-foreground">Load Demo Song</label>
</div>
-->
</div>
</div>

Expand Down
41 changes: 20 additions & 21 deletions src/FileManagement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
Expand All @@ -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;
}
Expand Down Expand Up @@ -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,
};
}

Expand Down Expand Up @@ -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));
}
}
Expand All @@ -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
Expand Down
20 changes: 10 additions & 10 deletions src/InterfaceLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
6 changes: 0 additions & 6 deletions src/documentation/basics/welcome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 5e565e3

Please sign in to comment.