Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Rockbox Ports are now being developed for various digital audio players!

+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  Sequencer functions in Lua?
« previous next »
  • Print
Pages: [1]

Author Topic: Sequencer functions in Lua?  (Read 484 times)

Offline inflam52

  • Member
  • *
  • Posts: 6
Sequencer functions in Lua?
« on: May 06, 2020, 05:32:58 PM »
I'd like to build a small sequencer plugin in Lua but I'm having a hard time finding the functions needed. I've been digging through the source and documentation without any luck. I'm fairly new to developing for Rockbox so I may be overlooking something. I have a couple of questions and any help would be much appreciated:

1. Is there a way to playback 2 or more audio files at the same time? I noticed a few mixer functions but not sure if those could be used.

2. Is there any way to access the midi plugin functions in Lua (like synth - initSynth)? I noticed there is a "beep_play" function for generating a square wave but it seems pretty basic and doesn't look to support polyphony.


It would be great to do something in the spirit of the beatbox.c plugin that was abandoned several years ago. Also, if I'm missing documentation any help be great there too. I've just been using https://www.rockbox.org/wiki/PluginLua#API_list along with the source. The graphics API seem pretty well documented so I don't think I'll have issues there.

Thanks!
Logged

Offline Bilgus

  • Developer
  • Member
  • *
  • Posts: 821
Re: Sequencer functions in Lua?
« Reply #1 on: May 06, 2020, 07:28:15 PM »
Most of the Mixer functions haven't been broken out

I'm not sure if lua is fast enough to keep the buffers fed.. maybe

Playback of audio files is pretty limited as well I just recently got that working, but there is definitely no way to get two to play as of right now

Feel free to add functions as you see fit just be aware the more ram used for functions the less ram to actually run programs with
--Also be aware after you hit the *limit* playback is stopped so lua can use its buffer as ram as well

RB functions aren't able to be called directly from lua they have to go through a translation layer first
https://github.com/Rockbox/rockbox/blob/master/apps/plugins/lua/rocklib.c <--

*limit* differs between targets
« Last Edit: May 06, 2020, 07:33:03 PM by Bilgus »
Logged

Offline inflam52

  • Member
  • *
  • Posts: 6
Re: Sequencer functions in Lua?
« Reply #2 on: May 07, 2020, 06:14:54 PM »
Thanks for the reply @Bilgus!

Good info to know. Merging 2 audio files in Lua unlikely too?

Logged

Offline __builtin

  • Developer
  • Member
  • *
  • Posts: 404
  • iPod 6G, c200v1 (RIP), e200v1 (RIP)
    • FWEI.TK
Re: Sequencer functions in Lua?
« Reply #3 on: May 07, 2020, 07:07:23 PM »
Realtime mixing is only feasible from native code (i.e. C).
Logged
No support questions by PM, please.

Offline inflam52

  • Member
  • *
  • Posts: 6
Re: Sequencer functions in Lua?
« Reply #4 on: May 07, 2020, 11:53:30 PM »
That makes sense @__builtin

I guess this type of app would best be developed in C instead of Lua. Might just be worthwhile picking up where the beatbox.c plugin left off.
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9191
Re: Sequencer functions in Lua?
« Reply #5 on: May 07, 2020, 11:56:12 PM »
I suppose you could write your own mixer functions in c and then script them from Lua. 
Logged

Offline Bilgus

  • Developer
  • Member
  • *
  • Posts: 821
Re: Sequencer functions in Lua?
« Reply #6 on: May 08, 2020, 02:58:47 AM »
Personally I'd rather write the whole app in C -- lua scripts are fast to develop, test, customize but SLOW compared to C I love the idea of a lua front end and c functions together but we don't have the ability to load precompiled (.so) files (I don't have the skillz (desire?) necessary to implement dynamic loading for them in rockbox)
That leaves adding them to the binary :/
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Support and General Use
| |-+  Plugins/Viewers
| | |-+  Sequencer functions in Lua?
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.04 seconds with 23 queries.