From bbfe4778114c76e23e9c391225da2d6f74812735 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 31 Oct 2018 09:23:00 -0400 Subject: [PATCH] Lua Add underscores in audio, pcm, playlist functions Lessen confusion for end users looking for the underlying function names in plugin.h Change-Id: I6662dc7bd9f22d83af372b3d3c5af53d9a1eac9a --- apps/plugins/lua/include_lua/audio.lua | 6 +++--- apps/plugins/lua/include_lua/pcm.lua | 20 ++++++++++---------- apps/plugins/lua/include_lua/playlist.lua | 8 ++++---- apps/plugins/lua/rocklib.c | 19 ++++++++----------- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/apps/plugins/lua/include_lua/audio.lua b/apps/plugins/lua/include_lua/audio.lua index 51e5fbe228..8f343c8486 100644 --- a/apps/plugins/lua/include_lua/audio.lua +++ b/apps/plugins/lua/include_lua/audio.lua @@ -31,6 +31,6 @@ rb.audio_pause = function() rb.audio("pause") end rb.audio_resume = function() rb.audio("resume") end rb.audio_next = function() rb.audio("next") end rb.audio_prev = function() rb.audio("prev") end -rb.audio_ff_rewind = function (newtime) rb.audio("ffrewind", newtime) end -rb.audio_flush_and_reload_tracks = function() rb.audio("flushandreloadtracks") end -rb.audio_get_file_pos = function() return rb.audio("getfilepos") end +rb.audio_ff_rewind = function (newtime) rb.audio("ff_rewind", newtime) end +rb.audio_flush_and_reload_tracks = function() rb.audio("flush_and_reload_tracks") end +rb.audio_get_file_pos = function() return rb.audio("get_file_pos") end diff --git a/apps/plugins/lua/include_lua/pcm.lua b/apps/plugins/lua/include_lua/pcm.lua index 318669bd67..6b2b6db204 100644 --- a/apps/plugins/lua/include_lua/pcm.lua +++ b/apps/plugins/lua/include_lua/pcm.lua @@ -24,13 +24,13 @@ -- [[ conversion to old style pcm_ functions ]] if not rb.pcm then rb.splash(rb.HZ, "No Support!") return nil end -rb.pcm_apply_settings = function() rb.pcm("applysettings") end -rb.pcm_set_frequency = function(freq) rb.pcm("setfrequency", freq) end -rb.pcm_play_pause = function(bplay) rb.pcm("playpause", bplay) end -rb.pcm_play_stop = function() rb.pcm("playstop") end -rb.pcm_play_lock = function() rb.pcm("playlock") end -rb.pcm_play_unlock = function() rb.pcm("playunlock") end -rb.pcm_is_playing = function() return rb.pcm("isplaying") end -rb.pcm_is_paused = function() return rb.pcm("ispaused") end -rb.pcm_calculate_peaks = function() return rb.pcm("calculatepeaks") end -rb.pcm_get_bytes_waiting = function() return rb.pcm("getbyteswaiting") end +rb.pcm_apply_settings = function() rb.pcm("apply_settings") end +rb.pcm_set_frequency = function(freq) rb.pcm("set_frequency", freq) end +rb.pcm_play_pause = function(bplay) rb.pcm("play_pause", bplay) end +rb.pcm_play_stop = function() rb.pcm("play_stop") end +rb.pcm_play_lock = function() rb.pcm("play_lock") end +rb.pcm_play_unlock = function() rb.pcm("play_unlock") end +rb.pcm_is_playing = function() return rb.pcm("is_playing") end +rb.pcm_is_paused = function() return rb.pcm("is_paused") end +rb.pcm_calculate_peaks = function() return rb.pcm("calculate_peaks") end +rb.pcm_get_bytes_waiting = function() return rb.pcm("get_bytes_waiting") end diff --git a/apps/plugins/lua/include_lua/playlist.lua b/apps/plugins/lua/include_lua/playlist.lua index 3952334d9b..e11b30fe7d 100644 --- a/apps/plugins/lua/include_lua/playlist.lua +++ b/apps/plugins/lua/include_lua/playlist.lua @@ -37,19 +37,19 @@ rb.playlist_start = function(index, elapsed, offset) rb.playlist("start", index, elapsed, offset) end rb.playlist_resume_track = function(index, crc, elapsed, offset) - rb.playlist("resumetrack", index, crc, elapsed, offset) + rb.playlist("resume_track", index, crc, elapsed, offset) end rb.playlist_resume = function() return rb.playlist("resume") end rb.playlist_shuffle = function(random_seed, index) rb.playlist("shuffle", random_seed, index) end rb.playlist_sync = function () rb.playlist("sync") end -rb.playlist_remove_all_tracks = function() return rb.playlist("removealltracks") end +rb.playlist_remove_all_tracks = function() return rb.playlist("remove_all_tracks") end rb.playlist_insert_track = function(filename, pos, bqueue, bsync) - return rb.playlist("inserttrack", filename, pos, bqueue, bsync) + return rb.playlist("insert_track", filename, pos, bqueue, bsync) end rb.playlist_insert_directory = function(dir, pos, bqueue, brecurse) - return rb.playlist("insertdirectory", dir, pos, bqueue, brecurse) + return rb.playlist("insert_directory", dir, pos, bqueue, brecurse) end rb.playlist_tracks = function(dir, filename) local tracks = {} diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c index ed76122118..54c2bc0c03 100644 --- a/apps/plugins/lua/rocklib.c +++ b/apps/plugins/lua/rocklib.c @@ -197,9 +197,9 @@ RB_WRAP(playlist) PLAYL_SHUFFLE, PLAYL_SYNC, PLAYL_REMOVEALLTRACKS, PLAYL_INSERTTRACK, PLAYL_INSERTDIRECTORY, PLAYL_ECOUNT}; - const char *playlist_option[] = {"amount", "add", "create", "start", "resumetrack", - "resume", "shuffle", "sync", "removealltracks", - "inserttrack", "insertdirectory", NULL}; + const char *playlist_option[] = {"amount", "add", "create", "start", "resume_track", + "resume", "shuffle", "sync", "remove_all_tracks", + "insert_track", "insert_directory", NULL}; const char *filename, *dir; int result = 0; @@ -210,7 +210,6 @@ RB_WRAP(playlist) int option = luaL_checkoption (L, 1, NULL, playlist_option); switch(option) { - default: case PLAYL_AMOUNT: result = rb->playlist_amount(); break; @@ -277,15 +276,14 @@ RB_WRAP(audio) AUDIO_RESUME, AUDIO_NEXT, AUDIO_PREV, AUDIO_FFREWIND, AUDIO_FLUSHANDRELOADTRACKS, AUDIO_GETPOS, AUDIO_ECOUNT}; const char *audio_option[] = {"status", "play", "stop", "pause", - "resume", "next", "prev", "ffrewind", - "flushandreloadtracks", "getfilepos", NULL}; + "resume", "next", "prev", "ff_rewind", + "flush_and_reload_tracks", "get_file_pos", NULL}; long elapsed, offset, newtime; int status = rb->audio_status(); int option = luaL_checkoption (L, 1, NULL, audio_option); switch(option) { - default: case AUDIO_STATUS: break; case AUDIO_PLAY: @@ -341,9 +339,9 @@ RB_WRAP(pcm) PCM_PLAYSTOP, PCM_PLAYPAUSE, PCM_PLAYLOCK, PCM_PLAYUNLOCK, PCM_CALCULATEPEAKS, PCM_SETFREQUENCY, PCM_GETBYTESWAITING, PCM_ECOUNT}; - const char *pcm_option[] = {"applysettings", "isplaying", "ispaused", - "playstop", "playpause", "playlock", "playunlock", - "calculatepeaks", "setfrequency", "getbyteswaiting", NULL}; + const char *pcm_option[] = {"apply_settings", "is_playing", "is_paused", + "play_stop", "play_pause", "play_lock", "play_unlock", + "calculate_peaks", "set_frequency", "get_bytes_waiting", NULL}; bool b_result; int left, right; size_t byteswait; @@ -353,7 +351,6 @@ RB_WRAP(pcm) int option = luaL_checkoption (L, 1, NULL, pcm_option); switch(option) { - default: case PCM_APPLYSETTINGS: rb->pcm_apply_settings(); break;