summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/include_lua/audio.lua
diff options
context:
space:
mode:
authorWilliam Wilgus <me.theuser@yahoo.com>2018-10-24 10:49:52 -0400
committerWilliam Wilgus <me.theuser@yahoo.com>2018-10-24 12:37:29 -0400
commitb670fcd50d42085a2db978bbcf2ccfd889d740ef (patch)
tree926ae29bf659c7ad93b274d6f7e4989fa3f32350 /apps/plugins/lua/include_lua/audio.lua
parent20b98f6fd0e5916bffe9561ebd324acdfbabf61a (diff)
downloadrockbox-b670fcd50d42085a2db978bbcf2ccfd889d740ef.tar.gz
rockbox-b670fcd50d42085a2db978bbcf2ccfd889d740ef.zip
lua add audio_play consolidate audio_ functions
audio_play was removed from the rocklib I assume due to inconsistent behavior I've readded it with a check for audio paused which instead uses rewind/ff and then resumes audio the way to call the audio functions has changed as well rb.audio("option", var) so rb.audio_play(0, 0) becomes rb.audio("play", 0, 0) audio_audio_flush_and_reload_tracks becomes rb.audio("flushandreloadtracks") all functions except audio("getfilepos") return the previous (or still current) status added audio.lua to the includes for conversion to old functions if your script is broken by this change you simply add `require("audio")` to the top for the old functionality Change-Id: I364adf0c85d9c12b98cde29c26fbe5ee05b9d331
Diffstat (limited to 'apps/plugins/lua/include_lua/audio.lua')
-rw-r--r--apps/plugins/lua/include_lua/audio.lua36
1 files changed, 36 insertions, 0 deletions
diff --git a/apps/plugins/lua/include_lua/audio.lua b/apps/plugins/lua/include_lua/audio.lua
new file mode 100644
index 0000000000..51e5fbe228
--- /dev/null
+++ b/apps/plugins/lua/include_lua/audio.lua
@@ -0,0 +1,36 @@
1--[[ Lua RB Audio Operations
2/***************************************************************************
3 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * \/ \/ \/ \/ \/
9 * $Id$
10 *
11 * Copyright (C) 2017 William Wilgus
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22]]
23
24-- [[ conversion to old style audio_ functions ]]
25if not rb.audio then rb.splash(rb.HZ, "No Support!") return nil end
26
27rb.audio_status = function() return rb.audio("status") end
28rb.audio_play = function (elapsed, offset) rb.audio("play", elapsed, offset) end
29rb.audio_stop = function() rb.audio("stop") end
30rb.audio_pause = function() rb.audio("pause") end
31rb.audio_resume = function() rb.audio("resume") end
32rb.audio_next = function() rb.audio("next") end
33rb.audio_prev = function() rb.audio("prev") end
34rb.audio_ff_rewind = function (newtime) rb.audio("ffrewind", newtime) end
35rb.audio_flush_and_reload_tracks = function() rb.audio("flushandreloadtracks") end
36rb.audio_get_file_pos = function() return rb.audio("getfilepos") end