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
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Porting audio-related code to c++ with a different
« previous next »
  • Print
Pages: [1]

Author Topic: Porting audio-related code to c++ with a different  (Read 1323 times)

Offline slecta

  • Member
  • *
  • Posts: 10
Porting audio-related code to c++ with a different
« on: May 04, 2020, 09:32:54 PM »
hi all,

was wondering if anyone could give me an idea what API library is closest to rockbox architecture when it comes to the audio callback type API stuff?  i made a plugin and was hoping to copy it over to another platform, like to run on a raspberry pi independently without rockbox..

not sure if i'm using the right language to explain what i am asking, hope it makes sense.. just want to get my stuff running outside of rockbox and i found the streaming audio callback part of the coding (specifically pcm_callback and rb->pcm_play_data) to be the most difficult when i got it running with rockbox, so was wondering if there is a library that is similar (or even identical) to how rockbox (plugin api) treats audio streams?

tried one or two libraries and they seemed somewhat different, and was wondering if there's an obvious answer like "rb was using this library which is also available outside the rockbox context"

thanks in advance
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9214
Re: Porting audio-related code to c++ with a different
« Reply #1 on: May 04, 2020, 11:35:15 PM »
Quote from: slecta on May 04, 2020, 09:32:54 PM
tried one or two libraries and they seemed somewhat different, and was wondering if there's an obvious answer like "rb was using this library which is also available outside the rockbox context"

There is no external library here, you are directly calling the underlying OS functions.  I think it would be easiest to just write a wrapper around them for whatever you're using.
Logged

Offline __builtin

  • Developer
  • Member
  • *
  • Posts: 405
  • iPod 6G, c200v1 (RIP), e200v1 (RIP)
    • FWEI.TK
Re: Porting audio-related code to c++ with a different
« Reply #2 on: May 05, 2020, 12:49:39 AM »
There's a couple strategies you could take here. I'm most familiar with the SDL library, so I'll speak to that here.

SDL's audio module has a pretty similar callback architecture for getting PCM samples, see: https://www.libsdl.org/release/SDL-1.2.15/docs/html/guideaudioexamples.html. The exact semantics (callback function parameters, caller/callee allocation etc.) are different but pretty trivial. Also the SDL video module (for SDL 1.2 and sticking to software rendering, at least) is superficially similar enough that you should be able to port most things easily enough.

You could also take a different route entirely and just compile rockbox itself into SDL application, which will give you whatever plugin you wrote for free (minus some adaptation of the input code IIRC). That's probably much easier, but comes at the cost of bringing all of rockbox with it.
Logged
No support questions by PM, please.

Offline boomselecta

  • Member
  • *
  • Posts: 5
Re: Porting audio-related code to c++ with a different
« Reply #3 on: August 09, 2021, 02:09:07 PM »
Hi there,

Thanks for both your replies!

What kind of thing should I be looking for (googling) if I were to follow the compile-the-plugin-with-rockboz-into-a-standalone-pc-program (as you called it, as a standalone SDL?

Thanks again!
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9214
Re: Porting audio-related code to c++ with a different
« Reply #4 on: August 09, 2021, 08:30:36 PM »
When you configure a rockbox build (see development guide on the left side of the screen), select SDL as your target.  You'll need SDL libraries installed, but that will let you run Rockbox as a PC application.
Logged

Offline boomselecta

  • Member
  • *
  • Posts: 5
Re: Porting audio-related code to c++ with a different
« Reply #5 on: August 11, 2021, 01:37:02 PM »
Wow that's awesome!  Thanks for your help.

Have a great day
Logged

  • Print
Pages: [1]
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Porting audio-related code to c++ with a different
 

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

Page created in 0.064 seconds with 23 queries.