diff --git a/github_pages/res/fonts/Rubik/static/Rubik-Regular.ttf b/assets/fonts/Rubik/static/Rubik-Regular.ttf similarity index 100% rename from github_pages/res/fonts/Rubik/static/Rubik-Regular.ttf rename to assets/fonts/Rubik/static/Rubik-Regular.ttf diff --git a/github_pages/res/loops/breakout-l4-r1.json b/assets/loops/breakout-l4-r1.json similarity index 100% rename from github_pages/res/loops/breakout-l4-r1.json rename to assets/loops/breakout-l4-r1.json diff --git a/github_pages/res/loops/bulls_on_parade_1.json b/assets/loops/bulls_on_parade_1.json similarity index 100% rename from github_pages/res/loops/bulls_on_parade_1.json rename to assets/loops/bulls_on_parade_1.json diff --git a/github_pages/res/loops/bulls_on_parade_1b.json b/assets/loops/bulls_on_parade_1b.json similarity index 100% rename from github_pages/res/loops/bulls_on_parade_1b.json rename to assets/loops/bulls_on_parade_1b.json diff --git a/github_pages/res/loops/bulls_on_parade_2.json b/assets/loops/bulls_on_parade_2.json similarity index 100% rename from github_pages/res/loops/bulls_on_parade_2.json rename to assets/loops/bulls_on_parade_2.json diff --git a/github_pages/res/loops/bulls_on_parade_3.json b/assets/loops/bulls_on_parade_3.json similarity index 100% rename from github_pages/res/loops/bulls_on_parade_3.json rename to assets/loops/bulls_on_parade_3.json diff --git a/github_pages/res/loops/l1-3.json b/assets/loops/l1-3.json similarity index 100% rename from github_pages/res/loops/l1-3.json rename to assets/loops/l1-3.json diff --git a/github_pages/res/loops/l1-3a.json b/assets/loops/l1-3a.json similarity index 100% rename from github_pages/res/loops/l1-3a.json rename to assets/loops/l1-3a.json diff --git a/github_pages/res/loops/l1-3b.json b/assets/loops/l1-3b.json similarity index 100% rename from github_pages/res/loops/l1-3b.json rename to assets/loops/l1-3b.json diff --git a/github_pages/res/loops/l1-3c.json b/assets/loops/l1-3c.json similarity index 100% rename from github_pages/res/loops/l1-3c.json rename to assets/loops/l1-3c.json diff --git a/github_pages/res/loops/samba.json b/assets/loops/samba.json similarity index 100% rename from github_pages/res/loops/samba.json rename to assets/loops/samba.json diff --git a/github_pages/res/loops/use_me_m1.json b/assets/loops/use_me_m1.json similarity index 100% rename from github_pages/res/loops/use_me_m1.json rename to assets/loops/use_me_m1.json diff --git a/github_pages/res/loops/use_me_m2.json b/assets/loops/use_me_m2.json similarity index 100% rename from github_pages/res/loops/use_me_m2.json rename to assets/loops/use_me_m2.json diff --git a/github_pages/res/sounds/click.wav b/assets/sounds/click.wav similarity index 100% rename from github_pages/res/sounds/click.wav rename to assets/sounds/click.wav diff --git a/github_pages/res/sounds/closed-hihat.mp3 b/assets/sounds/closed-hihat.mp3 similarity index 100% rename from github_pages/res/sounds/closed-hihat.mp3 rename to assets/sounds/closed-hihat.mp3 diff --git a/github_pages/res/sounds/closed-hihat.wav b/assets/sounds/closed-hihat.wav similarity index 100% rename from github_pages/res/sounds/closed-hihat.wav rename to assets/sounds/closed-hihat.wav diff --git a/github_pages/res/sounds/crash.wav b/assets/sounds/crash.wav similarity index 100% rename from github_pages/res/sounds/crash.wav rename to assets/sounds/crash.wav diff --git a/github_pages/res/sounds/kick.mp3 b/assets/sounds/kick.mp3 similarity index 100% rename from github_pages/res/sounds/kick.mp3 rename to assets/sounds/kick.mp3 diff --git a/github_pages/res/sounds/kick.wav b/assets/sounds/kick.wav similarity index 100% rename from github_pages/res/sounds/kick.wav rename to assets/sounds/kick.wav diff --git a/github_pages/res/sounds/metronome.mp3 b/assets/sounds/metronome.mp3 similarity index 100% rename from github_pages/res/sounds/metronome.mp3 rename to assets/sounds/metronome.mp3 diff --git a/github_pages/res/sounds/metronome.ogg b/assets/sounds/metronome.ogg similarity index 100% rename from github_pages/res/sounds/metronome.ogg rename to assets/sounds/metronome.ogg diff --git a/github_pages/res/sounds/open-hihat.mp3 b/assets/sounds/open-hihat.mp3 similarity index 100% rename from github_pages/res/sounds/open-hihat.mp3 rename to assets/sounds/open-hihat.mp3 diff --git a/github_pages/res/sounds/open-hihat.wav b/assets/sounds/open-hihat.wav similarity index 100% rename from github_pages/res/sounds/open-hihat.wav rename to assets/sounds/open-hihat.wav diff --git a/github_pages/res/sounds/pedal-hihat.wav b/assets/sounds/pedal-hihat.wav similarity index 100% rename from github_pages/res/sounds/pedal-hihat.wav rename to assets/sounds/pedal-hihat.wav diff --git a/github_pages/res/sounds/ride.wav b/assets/sounds/ride.wav similarity index 100% rename from github_pages/res/sounds/ride.wav rename to assets/sounds/ride.wav diff --git a/github_pages/res/sounds/snare.mp3 b/assets/sounds/snare.mp3 similarity index 100% rename from github_pages/res/sounds/snare.mp3 rename to assets/sounds/snare.mp3 diff --git a/github_pages/res/sounds/snare.wav b/assets/sounds/snare.wav similarity index 100% rename from github_pages/res/sounds/snare.wav rename to assets/sounds/snare.wav diff --git a/github_pages/res/sounds/tom-hi.wav b/assets/sounds/tom-hi.wav similarity index 100% rename from github_pages/res/sounds/tom-hi.wav rename to assets/sounds/tom-hi.wav diff --git a/github_pages/res/sounds/tom-low.wav b/assets/sounds/tom-low.wav similarity index 100% rename from github_pages/res/sounds/tom-low.wav rename to assets/sounds/tom-low.wav diff --git a/github_pages/res/sounds/tom-med.wav b/assets/sounds/tom-med.wav similarity index 100% rename from github_pages/res/sounds/tom-med.wav rename to assets/sounds/tom-med.wav diff --git a/dev-wasm.sh b/dev-wasm.sh index bf4ebbf..d24a965 100755 --- a/dev-wasm.sh +++ b/dev-wasm.sh @@ -6,9 +6,10 @@ set -e rustup target add wasm32-unknown-unknown ./wasm-bindgen-macroquad.sh drum-break -## TODO: Figure out how to properly -# cp -r res dist/ +# copy assets +cp -r assets dist/ +# run pushd dist/ basic-http-server -a 0.0.0.0:4001 . popd diff --git a/res/fonts/Rubik/static/Rubik-Regular.ttf b/github_pages/assets/fonts/Rubik/static/Rubik-Regular.ttf similarity index 100% rename from res/fonts/Rubik/static/Rubik-Regular.ttf rename to github_pages/assets/fonts/Rubik/static/Rubik-Regular.ttf diff --git a/res/loops/breakout-l4-r1.json b/github_pages/assets/loops/breakout-l4-r1.json similarity index 100% rename from res/loops/breakout-l4-r1.json rename to github_pages/assets/loops/breakout-l4-r1.json diff --git a/res/loops/bulls_on_parade_1.json b/github_pages/assets/loops/bulls_on_parade_1.json similarity index 100% rename from res/loops/bulls_on_parade_1.json rename to github_pages/assets/loops/bulls_on_parade_1.json diff --git a/res/loops/bulls_on_parade_1b.json b/github_pages/assets/loops/bulls_on_parade_1b.json similarity index 100% rename from res/loops/bulls_on_parade_1b.json rename to github_pages/assets/loops/bulls_on_parade_1b.json diff --git a/res/loops/bulls_on_parade_2.json b/github_pages/assets/loops/bulls_on_parade_2.json similarity index 100% rename from res/loops/bulls_on_parade_2.json rename to github_pages/assets/loops/bulls_on_parade_2.json diff --git a/res/loops/bulls_on_parade_3.json b/github_pages/assets/loops/bulls_on_parade_3.json similarity index 100% rename from res/loops/bulls_on_parade_3.json rename to github_pages/assets/loops/bulls_on_parade_3.json diff --git a/res/loops/l1-3.json b/github_pages/assets/loops/l1-3.json similarity index 100% rename from res/loops/l1-3.json rename to github_pages/assets/loops/l1-3.json diff --git a/res/loops/l1-3a.json b/github_pages/assets/loops/l1-3a.json similarity index 100% rename from res/loops/l1-3a.json rename to github_pages/assets/loops/l1-3a.json diff --git a/res/loops/l1-3b.json b/github_pages/assets/loops/l1-3b.json similarity index 100% rename from res/loops/l1-3b.json rename to github_pages/assets/loops/l1-3b.json diff --git a/res/loops/l1-3c.json b/github_pages/assets/loops/l1-3c.json similarity index 100% rename from res/loops/l1-3c.json rename to github_pages/assets/loops/l1-3c.json diff --git a/res/loops/samba.json b/github_pages/assets/loops/samba.json similarity index 100% rename from res/loops/samba.json rename to github_pages/assets/loops/samba.json diff --git a/res/loops/use_me_m1.json b/github_pages/assets/loops/use_me_m1.json similarity index 100% rename from res/loops/use_me_m1.json rename to github_pages/assets/loops/use_me_m1.json diff --git a/res/loops/use_me_m2.json b/github_pages/assets/loops/use_me_m2.json similarity index 100% rename from res/loops/use_me_m2.json rename to github_pages/assets/loops/use_me_m2.json diff --git a/res/sounds/click.wav b/github_pages/assets/sounds/click.wav similarity index 100% rename from res/sounds/click.wav rename to github_pages/assets/sounds/click.wav diff --git a/res/sounds/closed-hihat.mp3 b/github_pages/assets/sounds/closed-hihat.mp3 similarity index 100% rename from res/sounds/closed-hihat.mp3 rename to github_pages/assets/sounds/closed-hihat.mp3 diff --git a/res/sounds/closed-hihat.wav b/github_pages/assets/sounds/closed-hihat.wav similarity index 100% rename from res/sounds/closed-hihat.wav rename to github_pages/assets/sounds/closed-hihat.wav diff --git a/res/sounds/crash.wav b/github_pages/assets/sounds/crash.wav similarity index 100% rename from res/sounds/crash.wav rename to github_pages/assets/sounds/crash.wav diff --git a/res/sounds/kick.mp3 b/github_pages/assets/sounds/kick.mp3 similarity index 100% rename from res/sounds/kick.mp3 rename to github_pages/assets/sounds/kick.mp3 diff --git a/res/sounds/kick.wav b/github_pages/assets/sounds/kick.wav similarity index 100% rename from res/sounds/kick.wav rename to github_pages/assets/sounds/kick.wav diff --git a/res/sounds/metronome.mp3 b/github_pages/assets/sounds/metronome.mp3 similarity index 100% rename from res/sounds/metronome.mp3 rename to github_pages/assets/sounds/metronome.mp3 diff --git a/res/sounds/metronome.ogg b/github_pages/assets/sounds/metronome.ogg similarity index 100% rename from res/sounds/metronome.ogg rename to github_pages/assets/sounds/metronome.ogg diff --git a/res/sounds/open-hihat.mp3 b/github_pages/assets/sounds/open-hihat.mp3 similarity index 100% rename from res/sounds/open-hihat.mp3 rename to github_pages/assets/sounds/open-hihat.mp3 diff --git a/res/sounds/open-hihat.wav b/github_pages/assets/sounds/open-hihat.wav similarity index 100% rename from res/sounds/open-hihat.wav rename to github_pages/assets/sounds/open-hihat.wav diff --git a/res/sounds/pedal-hihat.wav b/github_pages/assets/sounds/pedal-hihat.wav similarity index 100% rename from res/sounds/pedal-hihat.wav rename to github_pages/assets/sounds/pedal-hihat.wav diff --git a/res/sounds/ride.wav b/github_pages/assets/sounds/ride.wav similarity index 100% rename from res/sounds/ride.wav rename to github_pages/assets/sounds/ride.wav diff --git a/res/sounds/snare.mp3 b/github_pages/assets/sounds/snare.mp3 similarity index 100% rename from res/sounds/snare.mp3 rename to github_pages/assets/sounds/snare.mp3 diff --git a/res/sounds/snare.wav b/github_pages/assets/sounds/snare.wav similarity index 100% rename from res/sounds/snare.wav rename to github_pages/assets/sounds/snare.wav diff --git a/res/sounds/tom-hi.wav b/github_pages/assets/sounds/tom-hi.wav similarity index 100% rename from res/sounds/tom-hi.wav rename to github_pages/assets/sounds/tom-hi.wav diff --git a/res/sounds/tom-low.wav b/github_pages/assets/sounds/tom-low.wav similarity index 100% rename from res/sounds/tom-low.wav rename to github_pages/assets/sounds/tom-low.wav diff --git a/res/sounds/tom-med.wav b/github_pages/assets/sounds/tom-med.wav similarity index 100% rename from res/sounds/tom-med.wav rename to github_pages/assets/sounds/tom-med.wav diff --git a/github_pages/drum-break_bg.wasm b/github_pages/drum-break_bg.wasm index 2846c7e..f550039 100644 Binary files a/github_pages/drum-break_bg.wasm and b/github_pages/drum-break_bg.wasm differ diff --git a/migrate_loops.py b/migrate_loops.py index ea2f5c4..f2a497f 100644 --- a/migrate_loops.py +++ b/migrate_loops.py @@ -8,7 +8,7 @@ import os import json -names = os.listdir("./res/loops") +names = os.listdir("./assets/loops") # This migration adds `voices.ride = []` diff --git a/migrate_loops2.py b/migrate_loops2.py index e3be383..dcfeb79 100644 --- a/migrate_loops2.py +++ b/migrate_loops2.py @@ -8,7 +8,7 @@ import os import json -prefix = "./res/loops" +prefix = "./assets/loops" names = os.listdir(prefix) # This migration adds `voices.crash = []` diff --git a/migrate_loops3.py b/migrate_loops3.py index f1cb60e..1c0bf0f 100644 --- a/migrate_loops3.py +++ b/migrate_loops3.py @@ -9,7 +9,7 @@ import json import uuid -prefix = "./res/loops" +prefix = "./assets/loops" names = os.listdir(prefix) # This migration adds diff --git a/release-wasm.sh b/release-wasm.sh index 0685859..503e5be 100755 --- a/release-wasm.sh +++ b/release-wasm.sh @@ -7,6 +7,8 @@ rustup target add wasm32-unknown-unknown ./wasm-bindgen-macroquad.sh --release drum-break rm -rf github_pages -## TODO: Figure out how to properly handle resources, like audio files and images -# cp -r res dist/ +# copy assets +cp -r assets dist/ + +# put it into a folder that will be committed and pushed cp -r dist github_pages diff --git a/release.sh b/release.sh index 8ecd71c..c6af949 100755 --- a/release.sh +++ b/release.sh @@ -21,7 +21,7 @@ cp target/aarch64-apple-darwin/release/drum-break ./release/drum-break-aarch64 chmod 700 ./release/drum-break-aarch64 # add assets -cp -r res/ ./release/res/ +cp -r assets/ ./release/assets/ # zip it up and ship the release version="$(cat VERSION)" diff --git a/src/audio.rs b/src/audio.rs index 584275a..54a31ae 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -163,7 +163,7 @@ impl Audio { // TODO: play a different sound at start of each measure // clicks on quarter notes let metronome_notes = vec![0., 2., 4., 6., 8., 10., 12., 14.]; - let sound_path = "res/sounds/click.wav"; // TODO: metronome.ogg? + let sound_path = "assets/sounds/click.wav"; // TODO: metronome.ogg? let f = load_file(sound_path).await?; let sound = StaticSoundData::from_cursor(Cursor::new(f))?; let volume = 1.; diff --git a/src/main.rs b/src/main.rs index ed2223f..e63bc00 100644 --- a/src/main.rs +++ b/src/main.rs @@ -165,7 +165,7 @@ fn process_cli_args() -> String { std::env::args() .nth(1) - .unwrap_or_else(|| "res/loops/".to_string()) + .unwrap_or_else(|| "assets/loops/".to_string()) } async fn read_loops(dir_name: &str) -> Result, Box> { diff --git a/src/voices.rs b/src/voices.rs index ec107c9..24f799e 100644 --- a/src/voices.rs +++ b/src/voices.rs @@ -135,17 +135,17 @@ impl Voices { pub fn get_audio_file_for_instrument(ins: &Instrument) -> &str { // TODO: verify required sound files exist on startup- right now it fails during runtime match ins { - Instrument::ClosedHihat => "res/sounds/closed-hihat.wav", - Instrument::Snare => "res/sounds/snare.wav", - Instrument::Kick => "res/sounds/kick.wav", - Instrument::OpenHihat => "res/sounds/open-hihat.wav", - Instrument::Ride => "res/sounds/ride.wav", - Instrument::Crash => "res/sounds/crash.wav", - Instrument::Tom1 => "res/sounds/tom-hi.wav", - Instrument::Tom2 => "res/sounds/tom-med.wav", - Instrument::Tom3 => "res/sounds/tom-low.wav", - Instrument::PedalHiHat => "res/sounds/pedal-hihat.wav", - // Instrument::Metronome => "res/sounds/click.wav", + Instrument::ClosedHihat => "assets/sounds/closed-hihat.wav", + Instrument::Snare => "assets/sounds/snare.wav", + Instrument::Kick => "assets/sounds/kick.wav", + Instrument::OpenHihat => "assets/sounds/open-hihat.wav", + Instrument::Ride => "assets/sounds/ride.wav", + Instrument::Crash => "assets/sounds/crash.wav", + Instrument::Tom1 => "assets/sounds/tom-hi.wav", + Instrument::Tom2 => "assets/sounds/tom-med.wav", + Instrument::Tom3 => "assets/sounds/tom-low.wav", + Instrument::PedalHiHat => "assets/sounds/pedal-hihat.wav", + // Instrument::Metronome => "assets/sounds/click.wav", } } @@ -206,7 +206,7 @@ mod tests { #[test] fn it_can_load_a_loop_from_file() { - let result = Loop::new_from_file("res/loops/samba.json"); + let result = Loop::new_from_file("assets/loops/samba.json"); let loop_data = result.unwrap(); assert_eq!(loop_data.bpm, 120); let voices = Voices::new_from_voices_old_model(&loop_data.voices);