Author Topic: [Release] libShellAudio - easy BGM/Music player via SceShell  (Read 8069 times)

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
libShellAudio

ShellAudio is PS Vita library that is a result of reverse engineering Sony's static library that is used in system applications and Music application to play audio files using SceShell resources.

https://github.com/GrapheneCt/libShellAudio

suprx module version: https://github.com/GrapheneCt/libShellAudio/releases

Features:
1. Very easy to use.
2. Doesn't use any of the resources allocated to the application.
3. All decoding is performed on Codec Engine.
4. Supports EQ, different repeat modes, shuffle mode.
5. When in music mode, volume can be controlled with "Music" slider from quick menu.

Supported codecs:
1. MP3 (.mp3)
2. AAC (.m4a, .aac)
3. ATRAC9 (.at9)
4. WAV (.wav)

Examples of usage:

1. Application BGM (NOTE: in param.sfo, ATTRIBUTE flag ENABLE BGM PROXY must be set to 1)

shellAudioInitializeForBGM(0);
SceShellSvcAudioCustomOpt optParams;
sceClibMemset(&optParams, 0, 0x10);
optParams.flag = -1;
shellAudioSetAudioForBGM("pd0:data/systembgm/near.at9", &optParams);
shellAudioSetVolumeForBGM(0x4E20);
shellAudioSetParam2ForBGM(1);
shellAudioSendCommandForBGM(SCE_SHELLAUDIO_DEFAULT, 0);

2. Music player with jazz EQ:

shellAudioInitializeForMusicPlayer(0);
shellAudioSendCommandForMusicPlayer(SCE_SHELLAUDIO_STOP, 0);
shellAudioSetAudioForMusicPlayer("pd0:data/systembgm/near.at9", NULL);
shellAudioSendCommandForMusicPlayer(SCE_SHELLAUDIO_PLAY, 0);
shellAudioSetEQModeForMusicPlayer(SCE_SHELLAUDIO_EQ_JAZZ);

« Last Edit: June 23, 2020, 12:22:50 AM by Graphene »

teakhanirons

  • Guest
Re: [Release] libShellAudio - easy BGM/Music player via SceShell
« Reply #1 on: May 15, 2020, 12:34:23 PM »
I'm having trouble with linking.
Code: [Select]
<artificial>:(.text+0x1c): undefined reference to `SceShellSvc_B31E7F1C'I don't see the NID in DolceSDK db.yml nor is it imported in the library by NID. dots says that's the problem.
I'll ask cuevavirus to generate a stub for it.
Meanwhile, may I ask how you're using it without the NID so I can use it too?
« Last Edit: May 15, 2020, 02:07:47 PM by teakhanirons »

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Re: [Release] libShellAudio - easy BGM/Music player via SceShell
« Reply #2 on: May 15, 2020, 02:47:13 PM »
Since this library uses currently undocumented SceShellSvc_B31E7F1C function, stub for it must be generated manually, for example with dolce_gen_libs.

teakhanirons

  • Guest
Re: [Release] libShellAudio - easy BGM/Music player via SceShell
« Reply #3 on: May 15, 2020, 04:57:59 PM »
Some things to note that Graphene told me while troubleshooting my project:

If used in an user plugin, init_type when using shellAudioInitializeForBGM should be 1 instead of 0.

Some things to note when using this on shell itself (title ID: main):
Audio related stuff are loaded late in shell's initialization so you have to use SceShellSvc_stub_weak when linking it.
For the same reason as above, the plugin should be threaded with a delay of 8 to 10 seconds at the thread start (when vsh bridge: shell ready is present in stdout, shell is completely loaded). see here: https://forum.devchroma.nl/index.php/topic,163.0.html
« Last Edit: May 18, 2020, 10:42:02 AM by teakhanirons »

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Re: [Release] libShellAudio - easy BGM/Music player via SceShell
« Reply #4 on: May 18, 2020, 01:39:03 AM »
libShellAudio has been updated:

Changed:

shellAudioSetParam1ForBGM() -> shellAudioSetVolumeForBGM()
shellAudioGetSomethingForMusicPlayer1() -> shellAudioGetSqliteBufferForMusicPlayer()
shellAudioGetSomethingForMusicPlayer2() -> shellAudioGetMetadataForMusicPlayer()
shellAudioGetSomethingForMusicPlayer3() -> shellAudioGetPlaybackStatusForMusicPlayer()

Added:

shellAudioInitializeForShell()
shellAudioFinishForBGM()
shellAudioGetStatusForMusicPlayer()
shellAudioLockForMusicPlayer()
shellAudioSendSqliteBufferForMusicPlayer()

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Re: [Release] libShellAudio - easy BGM/Music player via SceShell
« Reply #5 on: May 22, 2020, 12:37:19 AM »
libShellAudio has been updated:

Added:

shellAudioFinishForMusicPlayer()
shellAudioAutoSeekForMusicPlayer()
shellAudioSetALCModeForMusicPlayer()
shellAudioSetVolumeForMusicPlayer()

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Re: [Release] libShellAudio - easy BGM/Music player via SceShell
« Reply #6 on: June 23, 2020, 12:22:22 AM »
suprx module version of the library is now available here: https://github.com/GrapheneCt/libShellAudio/releases

Offline Graphene

  • Useful Idiot
  • ***
  • Posts: 108
    • View Profile
Re: [Release] libShellAudio - easy BGM/Music player via SceShell
« Reply #7 on: July 13, 2020, 03:33:36 AM »
Static version of libShelAudio has been updated to accomodate changes in DolceSDK.