From e7ca9139c9f89dcbfed348b7e2a26782ddf0fccd Mon Sep 17 00:00:00 2001 From: oakes Date: Tue, 4 Nov 2014 16:43:55 -0500 Subject: [PATCH] Make music* take a string and fix docstrings --- src/play_clj/core_basics.clj | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/play_clj/core_basics.clj b/src/play_clj/core_basics.clj index 86fc1ff..fc91398 100644 --- a/src/play_clj/core_basics.clj +++ b/src/play_clj/core_basics.clj @@ -153,7 +153,7 @@ (audio! :new-sound (files! :internal path)))) (defmacro sound - "Returns a [Sound](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/audio/Sound.html). + "Returns a [Sound](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/audio/Sound.html). Supports wav, mp3, and ogg. (sound \"playerhurt.wav\") (sound \"playerhurt.wav\" :play)" @@ -170,29 +170,25 @@ `(let [^Sound object# ~object] (u/call! object# ~k ~@options))) - (defn music* - [path] - (let [^FileHandle fh (if (string? path) - (files! :internal path) - path)] - (or (u/load-asset (.path fh) Music) - (audio! :new-music fh)))) + [^String path] + (or (u/load-asset path Music) + (audio! :new-music (files! :internal path)))) (defmacro music - "Returns a [Sound](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/audio/Sound.html). + "Returns a [Music](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/audio/Music.html). Supports wav, mp3, and ogg. - (sound \"playerhurt.wav\") - (sound \"playerhurt.wav\" :play)" + (music \"song.wav\") + (music \"song.wav\" :play)" [path & options] `(let [^Music object# (music* ~path)] (u/calls! object# ~@options))) (defmacro music! - "Calls a single method on a `sound`. + "Calls a single method on a `music`. - (sound! object :play) - (sound! object :dispose)" + (music! object :play) + (music! object :dispose)" [object k & options] `(let [^Music object# ~object] (u/call! object# ~k ~@options)))