summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/lua/rocklib.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 6c96f37a94..9ad6411b2f 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -314,10 +314,14 @@ RB_WRAP(audio)
314{ 314{
315 enum e_audio {AUDIO_STATUS = 0, AUDIO_PLAY, AUDIO_STOP, AUDIO_PAUSE, 315 enum e_audio {AUDIO_STATUS = 0, AUDIO_PLAY, AUDIO_STOP, AUDIO_PAUSE,
316 AUDIO_RESUME, AUDIO_NEXT, AUDIO_PREV, AUDIO_FFREWIND, 316 AUDIO_RESUME, AUDIO_NEXT, AUDIO_PREV, AUDIO_FFREWIND,
317 AUDIO_FLUSHANDRELOADTRACKS, AUDIO_GETPOS, AUDIO_ECOUNT}; 317 AUDIO_FLUSHANDRELOADTRACKS, AUDIO_GETPOS, AUDIO_LENGTH,
318 const char *audio_option[] = {"status", "play", "stop", "pause", 318 AUDIO_ELAPSED, AUDIO_ECOUNT};
319 "resume", "next", "prev", "ff_rewind", 319 const char *audio_option[] = {"status", "play", "stop",
320 "flush_and_reload_tracks", "get_file_pos", NULL}; 320 "pause", "resume", "next",
321 "prev", "ff_rewind",
322 "flush_and_reload_tracks",
323 "get_file_pos", "length",
324 "elapsed", NULL};
321 long elapsed, offset, newtime; 325 long elapsed, offset, newtime;
322 int status = rb->audio_status(); 326 int status = rb->audio_status();
323 327
@@ -365,6 +369,18 @@ RB_WRAP(audio)
365 case AUDIO_GETPOS: 369 case AUDIO_GETPOS:
366 lua_pushinteger(L, rb->audio_get_file_pos()); 370 lua_pushinteger(L, rb->audio_get_file_pos());
367 return 1; 371 return 1;
372 case AUDIO_LENGTH:
373 if ((status & AUDIO_STATUS_PLAY) == AUDIO_STATUS_PLAY)
374 lua_pushinteger(L, rb->audio_current_track()->length);
375 else
376 lua_pushnil(L);
377 return 1;
378 case AUDIO_ELAPSED:
379 if ((status & AUDIO_STATUS_PLAY) == AUDIO_STATUS_PLAY)
380 lua_pushinteger(L, rb->audio_current_track()->elapsed);
381 else
382 lua_pushnil(L);
383 return 1;
368 } 384 }
369 385
370 rb->yield(); 386 rb->yield();