FS#13961 - Add audio status, file_attr constants to lua
rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Thu, 30 Jul 2026 07:07:40 -0400
| Newsgroups | gmane.comp.systems.archos.rockbox.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 1007216fc4eb530769c708be192ee76ee8412c02 Author: William Wilgus <[email protected]> Date: Thu Jul 30 01:07:56 2026 -0400 FS#13961 - Add audio status, file_attr constants to lua use require "audio_status" to use the new AUDIO_STATUS_ defines use require "file_attrs" to use the new FILE_ATTR_ defines Change-Id: If0b3b612e92e9e5b361a9487ccca2d40f79a953e diff --git a/apps/plugins/lua/lua.make b/apps/plugins/lua/lua.make index 77216b3c1f..8563290612 100644 --- a/apps/plugins/lua/lua.make +++ b/apps/plugins/lua/lua.make @@ -27,7 +27,7 @@ all: $(subst $(LUA_INCLUDEDIR)/,$(LUA_BUILDDIR)/,$(LUA_INCLUDELIST)) $(LUA_BUILDDIR)/lua.rock: $(LUA_OBJ) $(TLSFLIB) $(LUA_BUILDDIR)/actions.lua $(LUA_BUILDDIR)/buttons.lua $(LUA_BUILDDIR)/settings.lua \ $(LUA_BUILDDIR)/rocklib_aux.o $(LUA_BUILDDIR)/rb_defines.lua $(LUA_BUILDDIR)/sound_defines.lua \ - $(LUA_INCLUDELIST) + $(LUA_BUILDDIR)/audio_status.lua $(LUA_BUILDDIR)/file_attrs.lua $(LUA_INCLUDELIST) $(LUA_BUILDDIR)/actions.lua: $(LUA_OBJ) $(LUA_SRCDIR)/action_helper.pl $(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E -P $(APPSDIR)/plugins/lib/pluginlib_actions.h | $(LUA_SRCDIR)/action_helper.pl > $(LUA_BUILDDIR)/actions.lua @@ -52,6 +52,16 @@ $(LUA_BUILDDIR)/sound_defines.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl $(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/sounddefines_helper - $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/sounddefines_helper > $(LUA_BUILDDIR)/sound_defines.lua +$(LUA_BUILDDIR)/audio_status.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl + $(SILENT)$(CC) $(INCLUDES) -dD -E -P $(TARGET) $(CFLAGS) -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rbdefines_helper.pl "audio_status" | \ + $(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/audiodefines_helper - + $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/audiodefines_helper > $(LUA_BUILDDIR)/audio_status.lua + +$(LUA_BUILDDIR)/file_attrs.lua: $(LUA_OBJ) $(LUA_SRCDIR)/rbdefines_helper.pl + $(SILENT)$(CC) $(INCLUDES) -dD -E -P $(TARGET) $(CFLAGS) -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rbdefines_helper.pl "file_attrs" | \ + $(HOSTCC) -fno-builtin $(HOST_INCLUDES) -x c -o $(LUA_BUILDDIR)/fileattrs_helper - + $(call PRINTS,GEN $(@F))$(LUA_BUILDDIR)/fileattrs_helper > $(LUA_BUILDDIR)/file_attrs.lua + $(LUA_BUILDDIR)/rocklib_aux.c: $(APPSDIR)/plugin.h $(LUA_OBJ) $(LUA_SRCDIR)/rocklib_aux.pl $(call PRINTS,GEN $(@F))$(CC) $(PLUGINFLAGS) $(INCLUDES) -E -P -include plugin.h - < /dev/null | $(LUA_SRCDIR)/rocklib_aux.pl $(LUA_SRCDIR) > $(LUA_BUILDDIR)/rocklib_aux.c diff --git a/apps/plugins/lua/rbdefines_helper.pl b/apps/plugins/lua/rbdefines_helper.pl index 8e65408d0f..639cb7d569 100755 --- a/apps/plugins/lua/rbdefines_helper.pl +++ b/apps/plugins/lua/rbdefines_helper.pl @@ -57,13 +57,24 @@ if ($def_type eq "rb_defines") { '^CORE_KEYMAP_FILE$', 'CONTEXT_(STOPSEARCHING|REMOTE|CUSTOM|CUSTOM2|PLUGIN|REMAPPED)$', '^VIEWERS_DATA_DIR$'); + + +} +elsif ($def_type eq "audio_status") { + $lua_table = "rb"; + @rockbox_defines = ( + '^AUDIO_STATUS_(PLAY|PAUSE|RECORD|PRERECORD|ERROR|WARNING)$'); } elsif ($def_type eq "sound_defines") { $lua_table = "rb.sound_settings"; @rockbox_defines = ( '^(?!.*LAST_SETTING)SOUND_'); } - +elsif ($def_type eq "file_attrs") { + $lua_table = "rb"; + @rockbox_defines = ( + '^FILE_ATTR_'); +} my @captured_defines; my @names_seen; my @all_defines; @@ -100,7 +111,7 @@ while(my $line = <STDIN>) $name = $1; next if $name =~ /^(ATTRIBUTE_|print|__).*/; #don't add reserved $value = $2; - + #print STDERR "#define ".$name." (".$value.")\n"; if(grep($name =~ $_, @rockbox_defines)) { push(@names_seen, $name); diff --git a/apps/plugins/lua_scripts/playback.lua b/apps/plugins/lua_scripts/playback.lua index 6dbba2bba7..2958a410f2 100644 --- a/apps/plugins/lua_scripts/playback.lua +++ b/apps/plugins/lua_scripts/playback.lua @@ -29,6 +29,7 @@ local _clr = require("color") require("actions") require("rbsettings") require("settings") +require("audio_status") local scrpath = rb.current_path() @@ -103,9 +104,9 @@ end local function clear_actions() track_length = (rb.audio("length") or 0) local playback = rb.audio("status") - if playback == 1 then + if playback == rb.AUDIO_STATUS_PLAY then set_active_icon(2) - elseif playback == 3 then + elseif playback == (rb.AUDIO_STATUS_PAUSE + rb.AUDIO_STATUS_PLAY) then set_active_icon(4) return end @@ -247,10 +248,10 @@ do end elseif action == act.PLA_SELECT then playback = rb.audio("status") - if playback == 1 then + if playback == rb.AUDIO_STATUS_PLAY then rb.audio("pause") collectgarbage("collect") - elseif playback == 3 then + elseif playback == (rb.AUDIO_STATUS_PAUSE + rb.AUDIO_STATUS_PLAY) then rb.audio("resume") end event = rb.audio("status") + 1 -- rockbox-cvs mailing list [email protected] https://lists.haxx.se/mailman/listinfo/rockbox-cvs