Make music* take a string and fix docstrings

This commit is contained in:
oakes
2014-11-04 16:43:55 -05:00
parent eb78a44f79
commit e7ca9139c9

View File

@@ -153,7 +153,7 @@
(audio! :new-sound (files! :internal path)))) (audio! :new-sound (files! :internal path))))
(defmacro sound (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\")
(sound \"playerhurt.wav\" :play)" (sound \"playerhurt.wav\" :play)"
@@ -170,29 +170,25 @@
`(let [^Sound object# ~object] `(let [^Sound object# ~object]
(u/call! object# ~k ~@options))) (u/call! object# ~k ~@options)))
(defn music* (defn music*
[path] [^String path]
(let [^FileHandle fh (if (string? path) (or (u/load-asset path Music)
(files! :internal path) (audio! :new-music (files! :internal path))))
path)]
(or (u/load-asset (.path fh) Music)
(audio! :new-music fh))))
(defmacro music (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\") (music \"song.wav\")
(sound \"playerhurt.wav\" :play)" (music \"song.wav\" :play)"
[path & options] [path & options]
`(let [^Music object# (music* ~path)] `(let [^Music object# (music* ~path)]
(u/calls! object# ~@options))) (u/calls! object# ~@options)))
(defmacro music! (defmacro music!
"Calls a single method on a `sound`. "Calls a single method on a `music`.
(sound! object :play) (music! object :play)
(sound! object :dispose)" (music! object :dispose)"
[object k & options] [object k & options]
`(let [^Music object# ~object] `(let [^Music object# ~object]
(u/call! object# ~k ~@options))) (u/call! object# ~k ~@options)))