summaryrefslogtreecommitdiff
path: root/apps/plugins/lua/rocklib.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua/rocklib.c')
-rw-r--r--apps/plugins/lua/rocklib.c62
1 files changed, 61 insertions, 1 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 9518fe955b..b37f5245dc 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -378,6 +378,65 @@ RB_WRAP(audio)
378 return 1; 378 return 1;
379} 379}
380 380
381RB_WRAP(sound)
382{
383 enum e_snd {SOUND_SET = 0, SOUND_CURRENT, SOUND_DEFAULT,
384 SOUND_MIN, SOUND_MAX, SOUND_UNIT, SOUND_SET_PITCH,
385 SOUND_VAL2PHYS, SOUND_ECOUNT};
386
387 const char *snd_option[] = {"set", "current", "default",
388 "min", "max", "unit", "pitch",
389 "val2phys", NULL};
390
391 lua_pushnil(L); /*push nil so options w/o return have something to return */
392
393 int option = luaL_checkoption (L, 1, NULL, snd_option);
394 int setting = luaL_checkint(L, 2);
395 int value, result;
396 switch(option)
397 {
398 case SOUND_SET:
399 value = luaL_checkint(L, 3);
400 rb->sound_set(setting, value);
401 return 1; /*nil*/
402 break;
403 case SOUND_CURRENT:
404 result = rb->sound_current(setting);
405 break;
406 case SOUND_DEFAULT:
407 result = rb->sound_default(setting);
408 break;
409 case SOUND_MIN:
410 result = rb->sound_min(setting);
411 break;
412 case SOUND_MAX:
413 result = rb->sound_max(setting);
414 break;
415 case SOUND_UNIT:
416 lua_pushstring (L, rb->sound_unit(setting));
417 return 1;
418 break;
419#if ((CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) || \
420 (CONFIG_CODEC == SWCODEC)) && defined (HAVE_PITCHCONTROL)
421 case SOUND_SET_PITCH:
422 rb->sound_set_pitch(setting);
423 return 1;/*nil*/
424 break;
425#endif
426 case SOUND_VAL2PHYS:
427 value = luaL_checkint(L, 3);
428 result = rb->sound_val2phys(setting, value);
429 break;
430
431 default:
432 return 1;
433 break;
434 }
435
436 lua_pushinteger(L, result);
437 return 1;
438}
439
381#if CONFIG_CODEC == SWCODEC 440#if CONFIG_CODEC == SWCODEC
382RB_WRAP(pcm) 441RB_WRAP(pcm)
383{ 442{
@@ -723,9 +782,10 @@ static const luaL_Reg rocklib[] =
723 RB_FUNC(gui_syncyesno_run), 782 RB_FUNC(gui_syncyesno_run),
724 RB_FUNC(do_menu), 783 RB_FUNC(do_menu),
725 784
726 /* DEVICE AUDIO / PLAYLIST CONTROL */ 785 /* DEVICE AUDIO / SOUND / PLAYLIST CONTROL */
727 RB_FUNC(audio), 786 RB_FUNC(audio),
728 RB_FUNC(playlist), 787 RB_FUNC(playlist),
788 RB_FUNC(sound),
729#if CONFIG_CODEC == SWCODEC 789#if CONFIG_CODEC == SWCODEC
730 RB_FUNC(pcm), 790 RB_FUNC(pcm),
731 RB_FUNC(mixer_frequency), 791 RB_FUNC(mixer_frequency),