Skip to content

Commit bfe102b

Browse files
committed
Added a permanent copy of the 3.0.13 version for people to use alongside the existing 2.3 version. Made the links between versions preserve the song data where possible.
1 parent f38c8e6 commit bfe102b

File tree

13 files changed

+21982
-16
lines changed

13 files changed

+21982
-16
lines changed

.gitignore

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
.dropbox
22
.DS_Store
3-
/website/**/beepbox*.js
4-
/website/**/beepbox*.js.map
3+
/website/beepbox*.js
4+
/website/beepbox*.js.map
5+
/website/player/beepbox*.js
6+
/website/player/beepbox*.js.map
7+
/website/player/beepbox*.js
8+
/website/player/beepbox*.js.map
9+
/website/competition/**/beepbox*.js
10+
/website/competition/**/beepbox*.js.map
511
/website/beepbox_offline.html
612
/build
713
/node_modules

editor/TipPrompt.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,15 @@ export class TipPrompt implements Prompt {
274274
message = div(
275275
h2("String sustain"),
276276
p("This setting controls how quickly the picked string vibration decays."),
277+
p("Unlike most of BeepBox's instrument synthesizer features, a picked string cannot change frequency suddenly while maintaining its decay. If a tone's pitch changes suddenly (e.g. if the chord type is set to \"arpeggio\" or the transition type is set to \"continues\") then the string will be re-picked and start decaying from the beginning again, even if the envelopes don't otherwise restart."),
277278
);
278279
} break;
279280
case "envelopes": {
280281
message = div(
281282
h2("Envelopes"),
282-
p("Envelopes are a way to dynamically adjust various other settings over time. Press the + button to add an envelope, then select which setting to control and the curve of the envelope. Try different combinations to see how they sound!"),
283+
p("Envelopes are a way to dynamically adjust various other settings over time, usually based on how long the note lasts. Press the + button to add an envelope, then use the menus below to select which setting to control and the curve of the envelope. Try different combinations to see how they sound!"),
283284
p("Most envelope curves restart from the beginning every time a new note plays. The \"note size\" option is based on the note width as drawn in the pattern editor."),
284-
p("Envelope curves move in a range from 0 to 1. If multiple envelopes are targetting the same setting, they are multiplied before applying to the setting."),
285+
p("Envelope curves move in the range from 0 to 1 (or vice versa), where 0 means as quiet as possible and 1 is the same as the corresponding position selected in the instrument settings above. If multiple envelopes are targetting the same setting, they are multiplied before applying to the setting."),
285286
);
286287
} break;
287288
default: throw new Error("Unhandled TipPrompt type: " + type);

player/main.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ document.body.appendChild(
207207
),
208208
);
209209

210+
function loadSong(songString: string, reuseParams: boolean): void {
211+
synth.setSong(songString);
212+
synth.snapToStart();
213+
const updatedSongString: string = synth.song!.toBase64String();
214+
editLink.href = "../#" + updatedSongString;
215+
const hashQueryParams = new URLSearchParams(reuseParams ? location.hash.slice(1) : "");
216+
hashQueryParams.set("song", updatedSongString);
217+
location.hash = hashQueryParams.toString();
218+
}
219+
210220
function hashUpdatedExternally(): void {
211221
let myHash: string = location.hash;
212222
if (prevHash == myHash || myHash == "") return;
@@ -219,7 +229,7 @@ function hashUpdatedExternally(): void {
219229

220230
//titleText.textContent = "";
221231

222-
fullscreenLink.setAttribute("href", location.href);
232+
fullscreenLink.href = location.href;
223233

224234
for (const parameter of myHash.split("&")) {
225235
let equalsIndex: number = parameter.indexOf("=");
@@ -228,9 +238,7 @@ function hashUpdatedExternally(): void {
228238
let value: string = parameter.substring(equalsIndex + 1);
229239
switch (paramName) {
230240
case "song":
231-
synth.setSong(value);
232-
synth.snapToStart();
233-
editLink.setAttribute("href", "../#" + value);
241+
loadSong(value, true);
234242
break;
235243
//case "title":
236244
// titleText.textContent = decodeURIComponent(value);
@@ -241,9 +249,7 @@ function hashUpdatedExternally(): void {
241249
break;
242250
}
243251
} else {
244-
synth.setSong(myHash);
245-
synth.snapToStart();
246-
editLink.setAttribute("href", "../#" + myHash);
252+
loadSong(myHash, false);
247253
}
248254
}
249255

website/2_3/index.html

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,22 @@
2929
#beepboxEditorContainer {
3030
min-height: 645px;
3131
}
32+
.donation form {
33+
display: inline;
34+
}
35+
.donation input[type="submit"] {
36+
-webkit-appearance: none;
37+
appearance: none;
38+
background: none;
39+
border: none;
40+
font-family: inherit;
41+
font-size: inherit;
42+
color: var(--link-accent, #98f);
43+
text-decoration: underline;
44+
cursor: pointer;
45+
padding: 0;
46+
margin: 0;
47+
}
3248

3349
/* wide screen */
3450
@media (min-width: 701px) {
@@ -76,8 +92,18 @@ <h1>
7692
When you are satisfied with your song, just copy and paste the URL to save and share your song!
7793
</p>
7894
<p>
79-
The latest version of BeepBox is <a href="/" target="_blank">here</a>.
95+
The latest version of BeepBox is <a id="linkToLatestVersion" href="../" target="_blank">here</a>.
8096
</p>
97+
<div class="donation">
98+
BeepBox is a passion project, and will always be free to use. If you find it valuable and have the means, any gratuity via
99+
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
100+
<input type="hidden" name="cmd" value="_donations" />
101+
<input type="hidden" name="business" value="QZJTX9GRYEV9N" />
102+
<input type="hidden" name="currency_code" value="USD" />
103+
<input type="submit" name="submit" value="Paypal"/>
104+
</form>
105+
would be appreciated!
106+
</div>
81107

82108
<div class="column-container">
83109
<div class="instructions-column">
@@ -186,5 +212,15 @@ <h1>
186212
document.getElementById("beepboxEditorContainer").innerHTML = "Sorry, BeepBox doesn't support your browser. Try a recent version of Chrome, Firefox, or Opera.";
187213
}
188214

215+
// Just before the user is about to use the link to the latest version, update it to
216+
// contain the song data so that the current song will open in that version.
217+
var linkToLatestVersion = document.getElementById("linkToLatestVersion");
218+
function updateLinkToLatestVersion() {
219+
linkToLatestVersion.href = location.origin + location.pathname.slice(0, location.pathname.lastIndexOf('/') + 1) + ".." + location.hash;
220+
}
221+
linkToLatestVersion.addEventListener("focus", updateLinkToLatestVersion);
222+
linkToLatestVersion.addEventListener("mouseenter", updateLinkToLatestVersion);
223+
linkToLatestVersion.addEventListener("touchstart", updateLinkToLatestVersion);
224+
189225
</script>
190-
</body></html>
226+
</body></html>

0 commit comments

Comments
 (0)