diff --git a/desktop/src-common/advent/actions.clj b/desktop/src-common/advent/actions.clj index 45a4b8b8..1c957b46 100644 --- a/desktop/src-common/advent/actions.clj +++ b/desktop/src-common/advent/actions.clj @@ -533,7 +533,7 @@ (defn give [entities item] (run-action entities (begin [this screen entities] - (sound! (sound "pickup.mp3") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "pickup.mp3") :play (utils/current-sound-volume)) (-> entities (update-in [:state :inventory] #(conj % item)) diff --git a/desktop/src-common/advent/screens/rooms/cat_tree.clj b/desktop/src-common/advent/screens/rooms/cat_tree.clj index fcb9a89a..d60e84bb 100644 --- a/desktop/src-common/advent/screens/rooms/cat_tree.clj +++ b/desktop/src-common/advent/screens/rooms/cat_tree.clj @@ -313,7 +313,7 @@ (if (get-in @entities [:room :entities :ladder]) (do (actions/talk entities :ego "I think he's going for it!") (actions/play-animation entities :ego :cat-toy-first-half :stop? false) - (sound! (sound "cat-tree/cat.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "cat-tree/cat.ogg") :play (utils/current-sound-volume)) (actions/walk-straight-to entities :cat [138 40] :update-baseline? false :speed 3) (actions/play-animation entities :ego :cat-toy-last-half) (actions/play-animation entities :grandma :squat-1 :stop? false) @@ -328,7 +328,7 @@ :grandma "Come here young man.") (actions/walk-straight-to entities :ego [133 35]) (actions/talk entities :grandma "For your impressive display of courage and bravery, I give you this. ") - (sound! (sound "cat-tree/kiss.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "cat-tree/kiss.ogg") :play (utils/current-sound-volume)) (actions/play-animation entities :grandma :kiss) (actions/play-animation entities :ego :get-sick :stop? false) (actions/walk-straight-to entities :ego [165 45]) diff --git a/desktop/src-common/advent/screens/rooms/dream.clj b/desktop/src-common/advent/screens/rooms/dream.clj index 3c895126..6688ea00 100644 --- a/desktop/src-common/advent/screens/rooms/dream.clj +++ b/desktop/src-common/advent/screens/rooms/dream.clj @@ -178,7 +178,7 @@ "Show yourself!" {:run #(actions/talk entities :ego %)}]}) (actions/talk entities :fairy-godfather "Taaaaaaaaaaaaaaaaaa-") - (sound! (sound "dream/appear.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "dream/appear.ogg") :play (utils/current-sound-volume)) (particle-effect! (get-in @entities [:room :entities :magic]) :reset) (particle-effect! (get-in @entities [:room :entities :magic]) :start) (fade-in entities) @@ -197,7 +197,7 @@ :fairy-godfather "Behold!") (particle-effect! (get-in @entities [:room :entities :magic]) :reset) (particle-effect! (get-in @entities [:room :entities :magic]) :start) - (sound! (sound "dream/appear.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "dream/appear.ogg") :play (utils/current-sound-volume)) (fade-in-tools entities) (Thread/sleep 2500) @@ -374,7 +374,7 @@ (assoc (utils/get-texture "dream/corner-l.png") :x -10 :y -10 :baseline 240 :parallax 2.0 ) (assoc (utils/get-texture "dream/corner-r.png") :x (- 320 80) :y -20 :baseline 240 :parallax 3.2) (assoc (utils/get-texture "dream/pedestals.png") :x 0 :y 0 :baseline 139)] - :wind-sound {:sound (sound "dream/wind.ogg") + :wind-sound {:sound (utils/load-sound "dream/wind.ogg") :id nil} :entities {:magic (assoc (particle-effect "particles/dream-magic") :x 160 :y 80 :baseline 240) diff --git a/desktop/src-common/advent/screens/rooms/inside_antique.clj b/desktop/src-common/advent/screens/rooms/inside_antique.clj index 11c13bc4..3f693c72 100644 --- a/desktop/src-common/advent/screens/rooms/inside_antique.clj +++ b/desktop/src-common/advent/screens/rooms/inside_antique.clj @@ -335,7 +335,7 @@ (actions/talk entities :ego "I'll just try another one of these mints.")) (actions/play-animation entities :ego :reach) (actions/update-state entities (fn [s] (assoc s :mints-eaten (inc (s :mints-eaten))))) - (sound! (sound (str "inside-antique/fire-" (get-in @entities [:state :mints-eaten]) ".ogg")) :play (utils/current-sound-volume)) + (sound! (utils/load-sound (str "inside-antique/fire-" (get-in @entities [:state :mints-eaten]) ".ogg")) :play (utils/current-sound-volume)) (cond (= 2 (get-in @entities [:state :mints-eaten])) (do (particle-effect! (get-in @entities [:room :entities :smoke-particle]) :reset) diff --git a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj index 637558e4..4584c6cc 100644 --- a/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj +++ b/desktop/src-common/advent/screens/rooms/inside_cafeteria.clj @@ -73,7 +73,7 @@ (if (actions/has-item? @entities :flask-1-strength) (do (actions/do-dialogue entities :ego "One sec.") - (sound! (sound "ego/potion.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "ego/potion.ogg") :play (utils/current-sound-volume)) (actions/play-animation entities :ego :grow :stop? false) (play-battle entities :win) (actions/do-dialogue entities diff --git a/desktop/src-common/advent/screens/rooms/inside_castle.clj b/desktop/src-common/advent/screens/rooms/inside_castle.clj index 410a7f68..7e57ce32 100644 --- a/desktop/src-common/advent/screens/rooms/inside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/inside_castle.clj @@ -54,7 +54,7 @@ (begin [this screen entities] (particle-effect! (get-in entities [:room :entities :appear]) :reset) (particle-effect! (get-in entities [:room :entities :appear]) :start) - (sound! (sound "inside-house/disappear.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "inside-house/disappear.ogg") :play (utils/current-sound-volume)) (-> entities (assoc-in [:tweens :bloodclot-head-appear] (tween/tween :bloodclot-head-appear screen [:room :entities :bloodclot-head :opacity] 0.0 1.0 1.0 :ease tween/ease-in-quadratic)) @@ -208,7 +208,7 @@ :game-player "But I'm not much of a hero." :game-player "The knights of Remington have muscles the size of tree trunks." :game-player "But me...") - (sound! (sound "inside-castle/flex.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "inside-castle/flex.ogg") :play (utils/current-sound-volume)) (actions/play-animation entities :game-player :flex) (actions/do-dialogue entities :game-player "I'd never be able to prove my strength.")) :choices actions/previous-choices} @@ -621,7 +621,7 @@ (actions/give entities :monocle) (actions/talk entities :ego "It looks like a monocle."))})) - :chorus {:sound (sound "inside-castle/chorus.ogg")} + :chorus {:sound (utils/load-sound "inside-castle/chorus.ogg")} :collision "inside-castle/collision.png" :scale-fn (utils/scaler-fn-from-image "inside-castle/scale.png" 0.25 1.00) :apply-state (fn [_ entities] diff --git a/desktop/src-common/advent/screens/rooms/inside_house.clj b/desktop/src-common/advent/screens/rooms/inside_house.clj index 7be74e59..c875a1f7 100644 --- a/desktop/src-common/advent/screens/rooms/inside_house.clj +++ b/desktop/src-common/advent/screens/rooms/inside_house.clj @@ -123,7 +123,7 @@ :wizard "Ok, I'll deliver some more myself. Don't touch anything while I'm gone.") (actions/update-state entities (fn [s] (assoc s :mints-eaten 0 :wizard-left? true))) - (sound! (sound "inside-house/disappear.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "inside-house/disappear.ogg") :play (utils/current-sound-volume)) (actions/play-animation entities :wizard :disappear :stop? false) (actions/remove-entity entities :wizard))} "Nevermind." diff --git a/desktop/src-common/advent/screens/rooms/inside_jail.clj b/desktop/src-common/advent/screens/rooms/inside_jail.clj index 7814457a..0d3458ad 100644 --- a/desktop/src-common/advent/screens/rooms/inside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/inside_jail.clj @@ -340,8 +340,8 @@ :anim warden-stand :anim-start 0 :night-profile :none - :inhale (sound "inside-jail/inhale.ogg") - :exhale (sound "inside-jail/exhale.ogg") + :inhale (utils/load-sound "inside-jail/inhale.ogg") + :exhale (utils/load-sound "inside-jail/exhale.ogg") :talk-color (color 0.9 0.3 0.9 1.0) :anim-sound-frames {warden-stand {31 [:blink 0.15] 51 [:blink 0.15]} diff --git a/desktop/src-common/advent/screens/rooms/outside_castle.clj b/desktop/src-common/advent/screens/rooms/outside_castle.clj index eb0b714f..25a52542 100644 --- a/desktop/src-common/advent/screens/rooms/outside_castle.clj +++ b/desktop/src-common/advent/screens/rooms/outside_castle.clj @@ -320,7 +320,7 @@ (actions/play-animation entities :ego :squat) (actions/talk entities :ego "No one will notice one missing.") (actions/give entities :carrot))))}} - :flies-sound {:sound (sound "outside-castle/flies2.ogg") + :flies-sound {:sound (utils/load-sound "outside-castle/flies2.ogg") :id nil} :layers {:day [(assoc (utils/get-texture "outside-castle/background.png") :x 0 :y 0 :baseline 0) (assoc (utils/get-texture "outside-castle/blanket.png") :x 60 :y (- 240 173) :baseline 1) @@ -336,7 +336,7 @@ (assoc (utils/get-texture "outside-castle/peddler.png") :x 110 :y 90 :baseline 150 :anim nil :anim-sound-frames {peddler-stand {23 [:scratch 1.0]} peddler-talk {23 [:scratch 1.0]}} - :scratch (sound "outside-castle/scratch.ogg") + :scratch (utils/load-sound "outside-castle/scratch.ogg") :talk peddler-talk :stand peddler-stand :talk-color (color 1.0 0.9 0.4 1.0) :script (actions/get-script diff --git a/desktop/src-common/advent/screens/rooms/outside_house.clj b/desktop/src-common/advent/screens/rooms/outside_house.clj index f12a371b..6624e1e4 100644 --- a/desktop/src-common/advent/screens/rooms/outside_house.clj +++ b/desktop/src-common/advent/screens/rooms/outside_house.clj @@ -716,7 +716,7 @@ :door (assoc (animation->texture screen door) :x 253 :y 88 :baseline 122 :open door - :door-sound (sound "door.ogg") + :door-sound (utils/load-sound "door.ogg") :anim-sound-frames {door {1 [:door-sound 1.0]}} ) :lamb (assoc (utils/get-texture "outsidehouse/lamb.png") diff --git a/desktop/src-common/advent/screens/rooms/outside_jail.clj b/desktop/src-common/advent/screens/rooms/outside_jail.clj index d1c799ce..122f495c 100644 --- a/desktop/src-common/advent/screens/rooms/outside_jail.clj +++ b/desktop/src-common/advent/screens/rooms/outside_jail.clj @@ -244,7 +244,7 @@ :bent-bar-window (assoc (utils/get-texture "outside-jail/bent-bar-window.png") :x 69 :y (- 240 63) :baseline 2) :outside-particles (common/make-outside-particles)} - :fountain-sound {:sound (sound "outside-jail/fountain-2.ogg") + :fountain-sound {:sound (utils/load-sound "outside-jail/fountain-2.ogg") :id nil} diff --git a/desktop/src-common/advent/screens/rooms/space.clj b/desktop/src-common/advent/screens/rooms/space.clj index d542506d..2bfd8cc9 100644 --- a/desktop/src-common/advent/screens/rooms/space.clj +++ b/desktop/src-common/advent/screens/rooms/space.clj @@ -34,7 +34,7 @@ (not (get-in entities [:state :blergh-dead?])) (actions/has-item? entities :magic-slingshot)) ((actions/get-script entities - (sound! (sound "space/shock.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "space/shock.ogg") :play (utils/current-sound-volume)) (actions/play-animation entities :bloodclot-head :shoot :stop? false) (actions/begin-animation entities :bloodclot-head :keep-shoot) (actions/do-dialogue entities :bloodclot-head "Dang! Come a little closer!")) @@ -58,7 +58,7 @@ (begin [this screen entities] (particle-effect! (get-in entities [:room :entities :appear]) :reset) (particle-effect! (get-in entities [:room :entities :appear]) :start) - (sound! (sound "inside-house/disappear.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "inside-house/disappear.ogg") :play (utils/current-sound-volume)) (-> entities (assoc-in [:tweens :bloodclot-head-appear] (tween/tween :bloodclot-head-appear screen [:room :entities :bloodclot-head :opacity] 1.0 0.0 1.0 :ease tween/ease-in-cubic)) @@ -87,7 +87,7 @@ (actions/run-action entities (begin [this screen entities] - (sound! (sound "space/jump.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "space/jump.ogg") :play (utils/current-sound-volume)) (-> entities (assoc-in [:room :entities :cloud] (assoc (utils/get-texture "space/cloud.png") :x (- (get-in entities [:room :entities :ego :x]) 10) @@ -134,7 +134,7 @@ (actions/run-action entities (begin [this screen entities] - (sound! (sound "space/swingsword.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "space/swingsword.ogg") :play (utils/current-sound-volume)) (-> entities (update-in [:room :entities :ego] #(actions/start-animation screen % :swing)) @@ -243,7 +243,7 @@ (actions/do-dialogue entities :bloodclot-head "Ha ha ha! Is that the best you can do?" :bloodclot-head "Take this!") - (sound! (sound "space/shock.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "space/shock.ogg") :play (utils/current-sound-volume)) (actions/play-animation entities :bloodclot-head :shoot :stop? false) (actions/begin-animation entities :bloodclot-head :keep-shoot) (actions/play-animation entities :ego :shock :stop? false) diff --git a/desktop/src-common/advent/screens/safe.clj b/desktop/src-common/advent/screens/safe.clj index 41e716b7..f1ab2efd 100644 --- a/desktop/src-common/advent/screens/safe.clj +++ b/desktop/src-common/advent/screens/safe.clj @@ -32,11 +32,11 @@ (first (filter (fn [{:keys [in?] :as button}] (when (in? x y) button)) - [{:in? (button-box 9 17) :sound (sound "inside-house/safe-1.ogg") :id 1 } - {:in? (button-box 29 17) :sound (sound "inside-house/safe-2.ogg") :id 2} - {:in? (button-box 49 17) :sound (sound "inside-house/safe-3.ogg") :id 3} - {:in? (button-box 70 17) :sound (sound "inside-house/safe-4.ogg") :id 4} - {:in? (button-box 91 17) :sound (sound "inside-house/safe-5.ogg") :id 5}]))) + [{:in? (button-box 9 17) :sound (utils/load-sound "inside-house/safe-1.ogg") :id 1 } + {:in? (button-box 29 17) :sound (utils/load-sound "inside-house/safe-2.ogg") :id 2} + {:in? (button-box 49 17) :sound (utils/load-sound "inside-house/safe-3.ogg") :id 3} + {:in? (button-box 70 17) :sound (utils/load-sound "inside-house/safe-4.ogg") :id 4} + {:in? (button-box 91 17) :sound (utils/load-sound "inside-house/safe-5.ogg") :id 5}]))) (defscreen safe-screen :on-show @@ -67,7 +67,7 @@ entities) :show-screen (fn [{:keys [success failure]} [entities]] - (sound! (sound "inside-house/open-safe.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "inside-house/open-safe.ogg") :play (utils/current-sound-volume)) (assoc entities :shown? true :button-choices [] @@ -103,7 +103,7 @@ (< y start-y) (> y (+ start-y 75))) (do - (sound! (sound "inside-house/close-safe.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "inside-house/close-safe.ogg") :play (utils/current-sound-volume)) (close entities))))))) :on-resize (fn [{:keys [width height viewport]} entities] diff --git a/desktop/src-common/advent/screens/scene.clj b/desktop/src-common/advent/screens/scene.clj index 70ef7805..66ba9d0a 100644 --- a/desktop/src-common/advent/screens/scene.clj +++ b/desktop/src-common/advent/screens/scene.clj @@ -301,7 +301,7 @@ void main() (get-in @entities [:room :entities :warden]) (do (actions/talk entities :ego "I'll just take a sip!") - (sound! (sound "ego/potion.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "ego/potion.ogg") :play (utils/current-sound-volume)) (actions/play-animation entities :ego :grow :stop? false) (actions/talk entities :warden "Huh? What was that?!") (Thread/sleep 1000) @@ -314,7 +314,7 @@ void main() :else (do (actions/talk entities :ego "I'll just take a sip!") - (sound! (sound "ego/potion.ogg") :play (utils/current-sound-volume)) + (sound! (utils/load-sound "ego/potion.ogg") :play (utils/current-sound-volume)) (actions/play-animation entities :ego :grow :stop? false)))) :recipe @@ -677,13 +677,13 @@ void main() :origin-x 9 :origin-y 0 :scaled true - :milk-sound (sound "outsidehouse/milk.ogg") - :step-sound-1 (sound "ego/step-1.ogg") - :step-sound-2 (sound "ego/step-2.ogg") - :sigh-sound (sound "ego/sigh.ogg") - :breakglass-sound (sound "ego/breakglass.ogg") - :idea-sound (sound "ego/idea.ogg") - :blink (sound "ego/blink2.ogg") + :milk-sound (utils/load-sound "outsidehouse/milk.ogg") + :step-sound-1 (utils/load-sound "ego/step-1.ogg") + :step-sound-2 (utils/load-sound "ego/step-2.ogg") + :sigh-sound (utils/load-sound "ego/sigh.ogg") + :breakglass-sound (utils/load-sound "ego/breakglass.ogg") + :idea-sound (utils/load-sound "ego/idea.ogg") + :blink (utils/load-sound "ego/blink2.ogg") :scale-x start-scale :scale-y start-scale :talk-color (color 0.6 1.0 1.0 1.0) @@ -996,7 +996,7 @@ void main() :closing? {:object nil :value false} - :sounds {:blink (sound "blink-other.ogg") + :sounds {:blink (utils/load-sound "blink-other.ogg") :object nil} :fade {:object nil :opacity 0.0} diff --git a/desktop/src-common/advent/utils.clj b/desktop/src-common/advent/utils.clj index da56e7cd..ab515929 100644 --- a/desktop/src-common/advent/utils.clj +++ b/desktop/src-common/advent/utils.clj @@ -225,7 +225,13 @@ (try (doto (music r) (music! :set-looping true)) (catch Exception _ - (doto (music (str/replace r #"\.ogg" ".mp3")) (music! :set-looping true))))) + (doto (music (str r ".mp3")) (music! :set-looping true))))) + +(defn load-sound [f] + (try + (sound (str f ".mp3")) + (catch Exception _ + (sound (str f ".mp3"))))) diff --git a/ios/project.clj b/ios/project.clj index 8a9851d6..f022d51a 100644 --- a/ios/project.clj +++ b/ios/project.clj @@ -16,6 +16,7 @@ "-libs" "libs/libObjectAL.a:libs/libgdx.a:libs/libgdx-box2d.a:libs/libgdx-bullet.a" "-frameworks" "UIKit:OpenGLES:QuartzCore:CoreGraphics:OpenAL:AudioToolbox:AVFoundation" "-resources" "../desktop/resources/**"] - :robovm-path "/Users/brycecovert/dev/robovm/robovm-1.7.0/"} + :robovm-path "/Users/brycecovert/dev/robovm/robovm-1.7.0/" + :versionn 1.1} :aot :all :main advent.core.IOSLauncher)