SunVox DLL Android: Stuttering on suspension?

Multi-platform modular music creation studio
Post Reply
9912
Posts: 8
Joined: Sat Oct 15, 2016 8:09 pm

SunVox DLL Android: Stuttering on suspension?

Post by 9912 » Sat Feb 08, 2020 9:07 pm

Hello, I'm very amazed with making music on android devices with SunVox, I'm using sunvox on Windows but i've found a project template inside SunVox DLL Zip file from WarmPlace website.

I've tried to modify in order to make a music player for Android using solely *.sunvox files, it went very fine, plays so smooth and great.

But when phone goes to suspension (turning off the screen and lock), sound stutters even with the simplest example (test.sunvox)

I'm using Xiaomi Redmi 7A (Snapdragon 439 8-core 2Ghz - 2GB RAM - MIUI 10/Android 9) as a test device for the player


Thanks.

User avatar
NightRadio
Site Admin
Posts: 3263
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVox DLL Android: Stuttering on suspension?

Post by NightRadio » Sun Feb 09, 2020 5:54 pm

Hi!
Please try this version (slightly modified): http://warmplace.ru/temp/sunvox_lib.zip
And show me the Logcat output

9912
Posts: 8
Joined: Sat Oct 15, 2016 8:09 pm

Re: SunVox DLL Android: Stuttering on suspension?

Post by 9912 » Wed Feb 12, 2020 7:18 am

Hi! thanks for your reply and sorry by being late...

I've performed many tests with many files, the procedure i've done as folows:

Test files:
- test.sunvox
- Beastcharmer - Dark Strings
- NightRadio - 8bit Tales
- NightRadio - Lullaby
- Harmonic Defiance - Bloom EP

Test actions performed:
- replace test.sunvox with test file
- compile sample_project to an APK
- Install on Android
- Start hearing
- Play until screen turns off
- Hear the results

File #1: test.sunvox (original file)

testing with the original project out-to-the-box gave nice results when phone enters suspension
Logcat:

Code: Select all

02-09 10:57:28.843 30953 30953 I   ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-09 10:57:29.244 30953 30953 I   Perf                                         Connecting to perf service.
02-09 10:57:29.453 30953 30953 V   CFG                                          buffer=192
02-09 10:57:29.456 30953 30953 I   native-activity                              device_sound_init() begin
02-09 10:57:29.456 30953 30953 I   native-activity                              SLES: 48000Hz 192; optimal: 0Hz 0
02-09 10:57:29.457 30953 30953 I   native-activity                              SLES: slCreateEngine
02-09 10:57:29.457 30953 30953 I   native-activity                              SLES: Create Output Mix object
02-09 10:57:29.457 30953 30953 I   native-activity                              SLES: Create the music player
02-09 10:57:29.457 30953 30953 D                                                PlayerBase::PlayerBase()
02-09 10:57:29.457 30953 30953 D                                                TrackPlayerBase::TrackPlayerBase()
02-09 10:57:29.457 30953 30953 I   libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-09 10:57:29.537 30953 30953 I   AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST successful; frameCount 0 -> 384
02-09 10:57:29.539 30953 30953 I   native-activity                              SLES: Setup to receive buffer queue event callbacks
02-09 10:57:29.539 30953 30953 I   native-activity                              SLES: Play
02-09 10:57:29.540 30953 30953 I   native-activity                              device_sound_init() end
02-09 10:57:29.540 30953 30953 I   SunVoxPlayer                                 SunVox lib version: 1 9 5
02-09 10:57:29.544 30953 30953 I   SunVoxPlayer                                 Song loaded
02-09 10:57:29.656 30953 30981 I   Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-09 10:57:29.656 30953 30981 I   Adreno                                       Build Date                       : 04/09/19
02-09 10:57:29.656 30953 30981 I   Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-09 10:57:29.656 30953 30981 I   Adreno                                       Local Branch                     :
02-09 10:57:29.656 30953 30981 I   Adreno                                       Remote Branch                    :
02-09 10:57:29.656 30953 30981 I   Adreno                                       Remote Branch                    :
02-09 10:57:29.656 30953 30981 I   Adreno                                       Reconstruct Branch               :
02-09 10:57:29.656 30953 30981 I   Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-09 10:57:29.667 30953 30981 I   Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-09 10:57:29.677 30953 30981 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-09 10:57:29.679 30953 30981 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-09 10:57:29.683 30953 30981 I   OpenGLRenderer                               Initialized EGL, version 1.4
02-09 10:57:29.683 30953 30981 D   OpenGLRenderer                               Swap behavior 2
02-09 10:57:37.236 30953 30973 I   ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
02-09 10:58:17.569 30953 30953 I   native-activity                              SOUND: sundog_sound_deinit() begin
02-09 10:58:17.576 30953 30980 D                                                PlayerBase::stop() from IPlayer
02-09 10:58:17.576 30953 30980 D   AudioTrack                                   stop() called with 2298240 frames delivered
02-09 10:58:17.648 30953 30953 D                                                PlayerBase::stop() from IPlayer
02-09 10:58:17.650 30953 30953 I   native-activity                              SOUND: sundog_sound_deinit() end
02-09 10:58:17.650 30953 30953 I   native-activity                              Max memory used: 939974
02-09 10:58:17.650 30953 30953 I   SunVoxPlayer                                 SunVox engine closed
File #2: Beastcharmer - Dark Strings (Sunvox Compo 2019.03)

The main reason of testing with many files, is to test when the app plays with this files on a playlist, so i had to test with many use cases.
With this file i'm testing with complex effects, however, it began to distort on suspension
Logcat:

Code: Select all

02-09 11:05:32.733 1461 1461 I     ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-09 11:05:33.179 1461 1461 I     Perf                                         Connecting to perf service.
02-09 11:05:33.408 1461 1461 V     CFG                                          buffer=192
02-09 11:05:33.468 1461 1461 I     native-activity                              device_sound_init() begin
02-09 11:05:33.468 1461 1461 I     native-activity                              SLES: 48000Hz 192; optimal: 0Hz 0
02-09 11:05:33.468 1461 1461 I     native-activity                              SLES: slCreateEngine
02-09 11:05:33.470 1461 1461 I     native-activity                              SLES: Create Output Mix object
02-09 11:05:33.470 1461 1461 I     native-activity                              SLES: Create the music player
02-09 11:05:33.470 1461 1461 D                                                  PlayerBase::PlayerBase()
02-09 11:05:33.471 1461 1461 D                                                  TrackPlayerBase::TrackPlayerBase()
02-09 11:05:33.471 1461 1461 I     libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-09 11:05:33.546 1461 1461 I     AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST successful; frameCount 0 -> 384
02-09 11:05:33.547 1461 1461 I     native-activity                              SLES: Setup to receive buffer queue event callbacks
02-09 11:05:33.547 1461 1461 I     native-activity                              SLES: Play
02-09 11:05:33.549 1461 1461 I     native-activity                              device_sound_init() end
02-09 11:05:33.550 1461 1461 I     SunVoxPlayer                                 SunVox lib version: 1 9 5
02-09 11:05:33.726 1461 1461 I     SunVoxPlayer                                 Song loaded
02-09 11:05:33.867 1461 1504 I     Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-09 11:05:33.867 1461 1504 I     Adreno                                       Build Date                       : 04/09/19
02-09 11:05:33.867 1461 1504 I     Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-09 11:05:33.867 1461 1504 I     Adreno                                       Local Branch                     :
02-09 11:05:33.867 1461 1504 I     Adreno                                       Remote Branch                    :
02-09 11:05:33.867 1461 1504 I     Adreno                                       Remote Branch                    :
02-09 11:05:33.867 1461 1504 I     Adreno                                       Reconstruct Branch               :
02-09 11:05:33.867 1461 1504 I     Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-09 11:05:33.874 1461 1504 I     Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-09 11:05:33.883 1461 1504 I     ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-09 11:05:33.884 1461 1504 I     ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-09 11:05:33.885 1461 1504 I     OpenGLRenderer                               Initialized EGL, version 1.4
02-09 11:05:33.885 1461 1504 D     OpenGLRenderer                               Swap behavior 2
02-09 11:05:41.168 1461 1490 I     ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
File #3: NightRadio - 8bit Tales (Album: Back to the Sources)

I've tested this file for the reason of no using demanding effects, theoretically it would sound perfect, so when the test is executed, it sounded perfect.
Logcat:

Code: Select all

02-09 11:15:00.150 3895 3895 I     ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-09 11:15:00.540 3895 3895 I     Perf                                         Connecting to perf service.
02-09 11:15:00.827 3895 3895 V     CFG                                          buffer=192
02-09 11:15:00.846 3895 3895 I     native-activity                              device_sound_init() begin
02-09 11:15:00.846 3895 3895 I     native-activity                              SLES: 48000Hz 192; optimal: 0Hz 0
02-09 11:15:00.846 3895 3895 I     native-activity                              SLES: slCreateEngine
02-09 11:15:00.851 3895 3895 I     native-activity                              SLES: Create Output Mix object
02-09 11:15:00.851 3895 3895 I     native-activity                              SLES: Create the music player
02-09 11:15:00.852 3895 3895 D                                                  PlayerBase::PlayerBase()
02-09 11:15:00.853 3895 3895 D                                                  TrackPlayerBase::TrackPlayerBase()
02-09 11:15:00.853 3895 3895 I     libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-09 11:15:00.888 3895 3895 I     AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST successful; frameCount 0 -> 384
02-09 11:15:00.890 3895 3895 I     native-activity                              SLES: Setup to receive buffer queue event callbacks
02-09 11:15:00.890 3895 3895 I     native-activity                              SLES: Play
02-09 11:15:00.892 3895 3895 I     native-activity                              device_sound_init() end
02-09 11:15:00.896 3895 3895 I     SunVoxPlayer                                 SunVox lib version: 1 9 5
02-09 11:15:00.928 3895 3895 I     SunVoxPlayer                                 Song loaded
02-09 11:15:01.030 3895 3918 I     Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-09 11:15:01.030 3895 3918 I     Adreno                                       Build Date                       : 04/09/19
02-09 11:15:01.030 3895 3918 I     Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-09 11:15:01.030 3895 3918 I     Adreno                                       Local Branch                     :
02-09 11:15:01.030 3895 3918 I     Adreno                                       Remote Branch                    :
02-09 11:15:01.030 3895 3918 I     Adreno                                       Remote Branch                    :
02-09 11:15:01.030 3895 3918 I     Adreno                                       Reconstruct Branch               :
02-09 11:15:01.031 3895 3918 I     Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-09 11:15:01.037 3895 3918 I     Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-09 11:15:01.046 3895 3918 I     ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-09 11:15:01.047 3895 3918 I     ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-09 11:15:01.048 3895 3918 I     OpenGLRenderer                               Initialized EGL, version 1.4
02-09 11:15:01.048 3895 3918 D     OpenGLRenderer                               Swap behavior 2
02-09 11:15:08.540 3895 3910 I     ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
File #4: NightRadio - Lullaby (Album: Soul Resonance)

I've picked this song by being large sized compared to a normal-sized project (15.4 MB), despite the large-sized samples, it sounded perfect on suspension.
Logcat:

Code: Select all

02-09 11:27:23.754 6219 6219 I     ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-09 11:27:24.148 6219 6219 I     Perf                                         Connecting to perf service.
02-09 11:27:24.404 6219 6219 V     CFG                                          buffer=192
02-09 11:27:24.413 6219 6219 I     native-activity                              device_sound_init() begin
02-09 11:27:24.413 6219 6219 I     native-activity                              SLES: 48000Hz 192; optimal: 0Hz 0
02-09 11:27:24.413 6219 6219 I     native-activity                              SLES: slCreateEngine
02-09 11:27:24.413 6219 6219 I     native-activity                              SLES: Create Output Mix object
02-09 11:27:24.416 6219 6219 I     native-activity                              SLES: Create the music player
02-09 11:27:24.416 6219 6219 D                                                  PlayerBase::PlayerBase()
02-09 11:27:24.416 6219 6219 D                                                  TrackPlayerBase::TrackPlayerBase()
02-09 11:27:24.416 6219 6219 I     libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-09 11:27:24.440 6219 6219 I     AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST successful; frameCount 0 -> 384
02-09 11:27:24.443 6219 6219 I     native-activity                              SLES: Setup to receive buffer queue event callbacks
02-09 11:27:24.443 6219 6219 I     native-activity                              SLES: Play
02-09 11:27:24.445 6219 6219 I     native-activity                              device_sound_init() end
02-09 11:27:24.445 6219 6219 I     SunVoxPlayer                                 SunVox lib version: 1 9 5
02-09 11:27:25.017 6219 6219 I     SunVoxPlayer                                 Song loaded
02-09 11:27:25.019 6219 6219 W     Activity                                     Slow Operation: Activity com.yourcompany.sunvoxplayer/.MainActivity onCreate took 798ms
02-09 11:27:25.139 6219 6243 I     Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-09 11:27:25.139 6219 6243 I     Adreno                                       Build Date                       : 04/09/19
02-09 11:27:25.139 6219 6243 I     Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-09 11:27:25.139 6219 6243 I     Adreno                                       Local Branch                     :
02-09 11:27:25.139 6219 6243 I     Adreno                                       Remote Branch                    :
02-09 11:27:25.139 6219 6243 I     Adreno                                       Remote Branch                    :
02-09 11:27:25.139 6219 6243 I     Adreno                                       Reconstruct Branch               :
02-09 11:27:25.139 6219 6243 I     Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-09 11:27:25.164 6219 6243 I     Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-09 11:27:25.170 6219 6243 I     ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-09 11:27:25.171 6219 6243 I     ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-09 11:27:25.172 6219 6243 I     OpenGLRenderer                               Initialized EGL, version 1.4
02-09 11:27:25.172 6219 6243 D     OpenGLRenderer                               Swap behavior 2
02-09 11:27:32.130 6219 6236 I     ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
02-09 11:29:21.497 6219 6219 I     native-activity                              SOUND: sundog_sound_deinit() begin
02-09 11:29:21.506 6219 6242 D                                                  PlayerBase::stop() from IPlayer
02-09 11:29:21.506 6219 6242 D     AudioTrack                                   stop() called with 5614464 frames delivered
02-09 11:29:21.581 6219 6219 D                                                  PlayerBase::stop() from IPlayer
02-09 11:29:21.600 6219 6219 I     native-activity                              SOUND: sundog_sound_deinit() end
02-09 11:29:21.600 6219 6219 I     native-activity                              Max memory used: 19595908
02-09 11:29:21.600 6219 6219 I     SunVoxPlayer                                 SunVox engine closed
02-09 11:29:21.601 6219 6219 W     Activity                                     Slow Operation: Activity com.yourcompany.sunvoxplayer/.MainActivity onDestroy took 105ms
File #5: Harmonic Defiance - Bloom EP

That was a case, this file combines cases #2 and #4, being huge (~30 MB) and complex (Metamodules), adding the fact of its 20 minutes of duration, in the first try, everything sounded fine even on screen off, but when the player reached the complex part, the phone stuttered and freezes :shock: , so i had to reboot losing the logcat. On the second try i've tapped the screen to hold the screen turned on, but it freezes again on the same part (around 1:25), however i've managed to stop the app and obtained the logcat.
Logcat:

Code: Select all

02-09 12:05:51.463 7606 7606 I     ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-09 12:05:51.837 7606 7606 I     Perf                                         Connecting to perf service.
02-09 12:05:52.087 7606 7606 V     CFG                                          buffer=192
02-09 12:05:52.111 7606 7606 I     native-activity                              device_sound_init() begin
02-09 12:05:52.111 7606 7606 I     native-activity                              SLES: 48000Hz 192; optimal: 0Hz 0
02-09 12:05:52.111 7606 7606 I     native-activity                              SLES: slCreateEngine
02-09 12:05:52.112 7606 7606 I     native-activity                              SLES: Create Output Mix object
02-09 12:05:52.112 7606 7606 I     native-activity                              SLES: Create the music player
02-09 12:05:52.112 7606 7606 D                                                  PlayerBase::PlayerBase()
02-09 12:05:52.113 7606 7606 D                                                  TrackPlayerBase::TrackPlayerBase()
02-09 12:05:52.113 7606 7606 I     libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-09 12:05:52.135 7606 7606 I     AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST successful; frameCount 0 -> 384
02-09 12:05:52.136 7606 7606 I     native-activity                              SLES: Setup to receive buffer queue event callbacks
02-09 12:05:52.136 7606 7606 I     native-activity                              SLES: Play
02-09 12:05:52.138 7606 7606 I     native-activity                              device_sound_init() end
02-09 12:05:52.139 7606 7606 I     SunVoxPlayer                                 SunVox lib version: 1 9 5
02-09 12:05:52.720 7606 7606 I     SunVoxPlayer                                 Song loaded
02-09 12:05:52.722 7606 7606 W     Activity                                     Slow Operation: Activity com.yourcompany.sunvoxplayer/.MainActivity onCreate took 823ms
02-09 12:05:52.835 7606 7635 I     Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-09 12:05:52.835 7606 7635 I     Adreno                                       Build Date                       : 04/09/19
02-09 12:05:52.835 7606 7635 I     Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-09 12:05:52.835 7606 7635 I     Adreno                                       Local Branch                     :
02-09 12:05:52.835 7606 7635 I     Adreno                                       Remote Branch                    :
02-09 12:05:52.835 7606 7635 I     Adreno                                       Remote Branch                    :
02-09 12:05:52.835 7606 7635 I     Adreno                                       Reconstruct Branch               :
02-09 12:05:52.835 7606 7635 I     Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-09 12:05:52.849 7606 7635 I     Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-09 12:05:52.858 7606 7635 I     ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-09 12:05:52.860 7606 7635 I     ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-09 12:05:52.860 7606 7635 I     OpenGLRenderer                               Initialized EGL, version 1.4
02-09 12:05:52.860 7606 7635 D     OpenGLRenderer                               Swap behavior 2
02-09 12:05:59.830 7606 7621 I     ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
02-09 12:08:13.597 7606 7606 I     native-activity                              SOUND: sundog_sound_deinit() begin
02-09 12:08:13.603 7606 7628 D                                                  PlayerBase::stop() from IPlayer
02-09 12:08:13.603 7606 7628 D     AudioTrack                                   stop() called with 5643264 frames delivered
02-09 12:08:13.688 7606 7606 D                                                  PlayerBase::stop() from IPlayer
02-09 12:08:13.695 7606 7606 I     native-activity                              SOUND: sundog_sound_deinit() end
02-09 12:08:13.695 7606 7606 I     native-activity                              Max memory used: 40977467
02-09 12:08:13.696 7606 7606 I     SunVoxPlayer                                 SunVox engine closed
02-09 12:08:13.696 7606 7606 W     Activity                                     Slow Operation: Activity com.yourcompany.sunvoxplayer/.MainActivity onDestroy took 104ms

User avatar
NightRadio
Site Admin
Posts: 3263
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVox DLL Android: Stuttering on suspension?

Post by NightRadio » Wed Feb 12, 2020 9:50 am

Thank you very much for the detailed log!
File #5: Harmonic Defiance - Bloom EP
... when the player reached the complex part, the phone stuttered and freezes
This is the problem :(
The system does not provide enough resources for heavy audio threads in background.
And actual amount of resources depends on the device.
Please try the trick: comment out this piece of code:

Code: Select all

if( optimal_sample_rate > 0 && optimal_buffer_size > 0 )
{
  sample_rate = optimal_sample_rate;
  cfg += "buffer=" + optimal_buffer_size;
}
Default sample rate (44100) and buffer size (1024) will be used instead of 48000/192

9912
Posts: 8
Joined: Sat Oct 15, 2016 8:09 pm

Re: SunVox DLL Android: Stuttering on suspension?

Post by 9912 » Sat Feb 15, 2020 12:55 am

Thanks, i've performed the tests again but all test songs began to stutter after entering suspension, the same as the beginning, and that's strange, the last file ran normally before suspension instead of freezing on the complex part. :unknown:

I think is because of the buffer size, is there a way to manually (programatically) change the buffer size?, searching the default value gave me no results.

Logcats as follows per file:

File #1: test.sunvox

Code: Select all

02-14 13:46:33.262 18029 18029 I   ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-14 13:46:33.706 18029 18029 I   Perf                                         Connecting to perf service.
02-14 13:46:34.003 18029 18029 V   CFG                                          
02-14 13:46:34.011 18029 18029 I   native-activity                              device_sound_init() begin
02-14 13:46:34.011 18029 18029 I   native-activity                              SLES: 44100Hz 1024; optimal: 0Hz 0
02-14 13:46:34.011 18029 18029 I   native-activity                              SLES: slCreateEngine
02-14 13:46:34.012 18029 18029 I   native-activity                              SLES: Create Output Mix object
02-14 13:46:34.012 18029 18029 I   native-activity                              SLES: Create the music player
02-14 13:46:34.012 18029 18029 D                                                PlayerBase::PlayerBase()
02-14 13:46:34.013 18029 18029 D                                                TrackPlayerBase::TrackPlayerBase()
02-14 13:46:34.013 18029 18029 I   libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-14 13:46:34.015 18029 18029 W   AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 1772
02-14 13:46:34.021 18029 18029 I   native-activity                              SLES: Setup to receive buffer queue event callbacks
02-14 13:46:34.021 18029 18029 I   native-activity                              SLES: Play
02-14 13:46:34.023 18029 18029 I   native-activity                              device_sound_init() end
02-14 13:46:34.023 18029 18029 I   SunVoxPlayer                                 SunVox lib version: 1 9 5
02-14 13:46:34.027 18029 18029 I   SunVoxPlayer                                 Song loaded
02-14 13:46:34.114 18029 18052 I   Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-14 13:46:34.114 18029 18052 I   Adreno                                       Build Date                       : 04/09/19
02-14 13:46:34.114 18029 18052 I   Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-14 13:46:34.114 18029 18052 I   Adreno                                       Local Branch                     :
02-14 13:46:34.114 18029 18052 I   Adreno                                       Remote Branch                    :
02-14 13:46:34.114 18029 18052 I   Adreno                                       Remote Branch                    :
02-14 13:46:34.114 18029 18052 I   Adreno                                       Reconstruct Branch               :
02-14 13:46:34.114 18029 18052 I   Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-14 13:46:34.127 18029 18052 I   Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-14 13:46:34.134 18029 18052 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-14 13:46:34.136 18029 18052 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-14 13:46:34.137 18029 18052 I   OpenGLRenderer                               Initialized EGL, version 1.4
02-14 13:46:34.137 18029 18052 D   OpenGLRenderer                               Swap behavior 2
02-14 13:46:41.671 18029 18044 I   ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
02-14 13:46:51.738 18029 18029 I   native-activity                              SOUND: sundog_sound_deinit() begin
02-14 13:46:51.767 18029 18051 D                                                PlayerBase::stop() from IPlayer
02-14 13:46:51.768 18029 18051 D   AudioTrack                                   stop() called with 720896 frames delivered
02-14 13:46:51.796 18029 18029 D                                                PlayerBase::stop() from IPlayer
02-14 13:46:51.799 18029 18029 I   native-activity                              SOUND: sundog_sound_deinit() end
02-14 13:46:51.799 18029 18029 I   native-activity                              Max memory used: 906035
02-14 13:46:51.799 18029 18029 I   SunVoxPlayer                                 SunVox engine closed
File #2: Beastcharmer - Dark Strings

Code: Select all

02-14 13:48:51.750 18579 18579 I   ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-14 13:48:52.199 18579 18579 I   Perf                                         Connecting to perf service.
02-14 13:48:52.559 18579 18579 V   CFG                                          
02-14 13:48:52.562 18579 18579 I   native-activity                              device_sound_init() begin
02-14 13:48:52.562 18579 18579 I   native-activity                              SLES: 44100Hz 1024; optimal: 0Hz 0
02-14 13:48:52.562 18579 18579 I   native-activity                              SLES: slCreateEngine
02-14 13:48:52.563 18579 18579 I   native-activity                              SLES: Create Output Mix object
02-14 13:48:52.563 18579 18579 I   native-activity                              SLES: Create the music player
02-14 13:48:52.563 18579 18579 D                                                PlayerBase::PlayerBase()
02-14 13:48:52.563 18579 18579 D                                                TrackPlayerBase::TrackPlayerBase()
02-14 13:48:52.563 18579 18579 I   libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-14 13:48:52.567 18579 18579 W   AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 1772
02-14 13:48:52.568 18579 18579 I   native-activity                              SLES: Setup to receive buffer queue event callbacks
02-14 13:48:52.568 18579 18579 I   native-activity                              SLES: Play
02-14 13:48:52.569 18579 18579 I   native-activity                              device_sound_init() end
02-14 13:48:52.570 18579 18579 I   SunVoxPlayer                                 SunVox lib version: 1 9 5
02-14 13:48:52.752 18579 18579 I   SunVoxPlayer                                 Song loaded
02-14 13:48:52.907 18579 18602 I   Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-14 13:48:52.907 18579 18602 I   Adreno                                       Build Date                       : 04/09/19
02-14 13:48:52.907 18579 18602 I   Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-14 13:48:52.907 18579 18602 I   Adreno                                       Local Branch                     :
02-14 13:48:52.907 18579 18602 I   Adreno                                       Remote Branch                    :
02-14 13:48:52.907 18579 18602 I   Adreno                                       Remote Branch                    :
02-14 13:48:52.907 18579 18602 I   Adreno                                       Reconstruct Branch               :
02-14 13:48:52.907 18579 18602 I   Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-14 13:48:52.944 18579 18602 I   Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-14 13:48:52.952 18579 18602 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-14 13:48:52.953 18579 18602 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-14 13:48:52.954 18579 18602 I   OpenGLRenderer                               Initialized EGL, version 1.4
02-14 13:48:52.954 18579 18602 D   OpenGLRenderer                               Swap behavior 2
02-14 13:49:00.190 18579 18594 I   ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
02-14 13:49:44.585 18579 18579 I   native-activity                              SOUND: sundog_sound_deinit() begin
02-14 13:49:44.617 18579 18600 D                                                PlayerBase::stop() from IPlayer
02-14 13:49:44.617 18579 18600 D   AudioTrack                                   stop() called with 2185216 frames delivered
02-14 13:49:44.641 18579 18579 D                                                PlayerBase::stop() from IPlayer
02-14 13:49:44.650 18579 18579 I   native-activity                              SOUND: sundog_sound_deinit() end
02-14 13:49:44.650 18579 18579 I   native-activity                              Max memory used: 35812970
02-14 13:49:44.651 18579 18579 I   SunVoxPlayer                                 SunVox engine closed
File #3: NightRadio - 8bit Tales

Code: Select all

02-14 13:52:17.902 19085 19085 I   ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-14 13:52:18.387 19085 19085 I   Perf                                         Connecting to perf service.
02-14 13:52:18.677 19085 19085 V   CFG                                          
02-14 13:52:18.688 19085 19085 I   native-activity                              device_sound_init() begin
02-14 13:52:18.688 19085 19085 I   native-activity                              SLES: 44100Hz 1024; optimal: 0Hz 0
02-14 13:52:18.688 19085 19085 I   native-activity                              SLES: slCreateEngine
02-14 13:52:18.690 19085 19085 I   native-activity                              SLES: Create Output Mix object
02-14 13:52:18.690 19085 19085 I   native-activity                              SLES: Create the music player
02-14 13:52:18.691 19085 19085 D                                                PlayerBase::PlayerBase()
02-14 13:52:18.692 19085 19085 D                                                TrackPlayerBase::TrackPlayerBase()
02-14 13:52:18.692 19085 19085 I   libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-14 13:52:18.696 19085 19085 W   AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 1772
02-14 13:52:18.697 19085 19085 I   native-activity                              SLES: Setup to receive buffer queue event callbacks
02-14 13:52:18.697 19085 19085 I   native-activity                              SLES: Play
02-14 13:52:18.698 19085 19085 I   native-activity                              device_sound_init() end
02-14 13:52:18.699 19085 19085 I   SunVoxPlayer                                 SunVox lib version: 1 9 5
02-14 13:52:18.725 19085 19085 I   SunVoxPlayer                                 Song loaded
02-14 13:52:18.854 19085 19121 I   Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-14 13:52:18.854 19085 19121 I   Adreno                                       Build Date                       : 04/09/19
02-14 13:52:18.854 19085 19121 I   Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-14 13:52:18.854 19085 19121 I   Adreno                                       Local Branch                     :
02-14 13:52:18.854 19085 19121 I   Adreno                                       Remote Branch                    :
02-14 13:52:18.854 19085 19121 I   Adreno                                       Remote Branch                    :
02-14 13:52:18.854 19085 19121 I   Adreno                                       Reconstruct Branch               :
02-14 13:52:18.854 19085 19121 I   Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-14 13:52:18.861 19085 19121 I   Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-14 13:52:18.922 19085 19121 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-14 13:52:18.924 19085 19121 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-14 13:52:18.925 19085 19121 I   OpenGLRenderer                               Initialized EGL, version 1.4
02-14 13:52:18.925 19085 19121 D   OpenGLRenderer                               Swap behavior 2
02-14 13:52:26.378 19085 19114 I   ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
02-14 13:52:53.459 19085 19121 I   Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-14 13:52:53.459 19085 19121 I   Adreno                                       Build Date                       : 04/09/19
02-14 13:52:53.459 19085 19121 I   Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-14 13:52:53.459 19085 19121 I   Adreno                                       Local Branch                     :
02-14 13:52:53.459 19085 19121 I   Adreno                                       Remote Branch                    :
02-14 13:52:53.459 19085 19121 I   Adreno                                       Remote Branch                    :
02-14 13:52:53.459 19085 19121 I   Adreno                                       Reconstruct Branch               :
02-14 13:52:53.459 19085 19121 I   Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-14 13:52:53.477 19085 19121 I   Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-14 13:52:53.480 19085 19121 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-14 13:52:53.480 19085 19121 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-14 13:52:53.481 19085 19121 I   OpenGLRenderer                               Initialized EGL, version 1.4
02-14 13:52:53.481 19085 19121 D   OpenGLRenderer                               Swap behavior 2
02-14 13:52:54.737 19085 19085 I   native-activity                              SOUND: sundog_sound_deinit() begin
02-14 13:52:54.747 19085 19120 D                                                PlayerBase::stop() from IPlayer
02-14 13:52:54.748 19085 19120 D   AudioTrack                                   stop() called with 1510400 frames delivered
02-14 13:52:54.791 19085 19085 D                                                PlayerBase::stop() from IPlayer
02-14 13:52:54.793 19085 19085 I   native-activity                              SOUND: sundog_sound_deinit() end
02-14 13:52:54.793 19085 19085 I   native-activity                              Max memory used: 2165939
02-14 13:52:54.793 19085 19085 I   SunVoxPlayer                                 SunVox engine closed
File #4: NightRadio - Lullaby

Code: Select all

02-14 13:55:36.106 19984 19984 I   ny.sunvoxplaye                               Late-enabling -Xcheck:jni
02-14 13:55:36.501 19984 19984 I   Perf                                         Connecting to perf service.
02-14 13:55:36.779 19984 19984 V   CFG                                          
02-14 13:55:36.799 19984 19984 I   native-activity                              device_sound_init() begin
02-14 13:55:36.799 19984 19984 I   native-activity                              SLES: 44100Hz 1024; optimal: 0Hz 0
02-14 13:55:36.799 19984 19984 I   native-activity                              SLES: slCreateEngine
02-14 13:55:36.803 19984 19984 I   native-activity                              SLES: Create Output Mix object
02-14 13:55:36.803 19984 19984 I   native-activity                              SLES: Create the music player
02-14 13:55:36.803 19984 19984 D                                                PlayerBase::PlayerBase()
02-14 13:55:36.804 19984 19984 D                                                TrackPlayerBase::TrackPlayerBase()
02-14 13:55:36.804 19984 19984 I   libOpenSLES                                  Emulating old channel mask behavior (ignoring positional mask 0x3, using default mask 0x3 based on channel count of 2)
02-14 13:55:36.820 19984 19984 W   AudioTrack                                   AUDIO_OUTPUT_FLAG_FAST denied by server; frameCount 0 -> 1772
02-14 13:55:36.824 19984 19984 I   native-activity                              SLES: Setup to receive buffer queue event callbacks
02-14 13:55:36.824 19984 19984 I   native-activity                              SLES: Play
02-14 13:55:36.825 19984 19984 I   native-activity                              device_sound_init() end
02-14 13:55:36.826 19984 19984 I   SunVoxPlayer                                 SunVox lib version: 1 9 5
02-14 13:55:37.448 19984 19984 I   SunVoxPlayer                                 Song loaded
02-14 13:55:37.452 19984 19984 W   Activity                                     Slow Operation: Activity com.yourcompany.sunvoxplayer/.MainActivity onCreate took 858ms
02-14 13:55:37.610 19984 20009 I   Adreno                                       QUALCOMM build                   : 50f1b2d, I1b05bd271c
02-14 13:55:37.610 19984 20009 I   Adreno                                       Build Date                       : 04/09/19
02-14 13:55:37.610 19984 20009 I   Adreno                                       OpenGL ES Shader Compiler Version: EV031.25.03.03
02-14 13:55:37.610 19984 20009 I   Adreno                                       Local Branch                     :
02-14 13:55:37.610 19984 20009 I   Adreno                                       Remote Branch                    :
02-14 13:55:37.610 19984 20009 I   Adreno                                       Remote Branch                    :
02-14 13:55:37.610 19984 20009 I   Adreno                                       Reconstruct Branch               :
02-14 13:55:37.610 19984 20009 I   Adreno                                       Build Config                     : S L 6.0.7 AArch32
02-14 13:55:37.641 19984 20009 I   Adreno                                       PFP: 0x005ff112, ME: 0x005ff066
02-14 13:55:37.679 19984 20009 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
02-14 13:55:37.680 19984 20009 I   ConfigStore                                  android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
02-14 13:55:37.681 19984 20009 I   OpenGLRenderer                               Initialized EGL, version 1.4
02-14 13:55:37.681 19984 20009 D   OpenGLRenderer                               Swap behavior 2
02-14 13:55:44.494 19984 20000 I   ny.sunvoxplaye                               ProcessProfilingInfo new_methods=14 is saved saved_to_disk=1 resolve_classes_delay=8000
02-14 13:56:10.083 19984 19984 I   native-activity                              SOUND: sundog_sound_deinit() begin
02-14 13:56:10.131 19984 20007 D                                                PlayerBase::stop() from IPlayer
02-14 13:56:10.131 19984 20007 D   AudioTrack

User avatar
NightRadio
Site Admin
Posts: 3263
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVox DLL Android: Stuttering on suspension?

Post by NightRadio » Sat Feb 15, 2020 12:58 pm

Thanks, i've performed the tests again but all test songs began to stutter after entering suspension, the same as the beginning, and that's strange, the last file ran normally before suspension instead of freezing on the complex part.
In my opinion, this is a combination of two problems.
1) Bad OpenSL (base audio system that SunVox uses) implementation. It works fine for 48000+192, but it starts to stutter on 44100+1024.
2) The system does not provide enough CPU resources for the app that has faded into the background.
So for the best results, we should use this code:

Code: Select all

if( optimal_sample_rate > 0 && optimal_buffer_size > 0 )
{
  sample_rate = optimal_sample_rate;
  cfg += "buffer=" + optimal_buffer_size;
}
You also can try to change the last line to this:

Code: Select all

cfg += "buffer=" + optimal_buffer_size * 2;
But i'm not sure it will help.

The other strange thing is that my Android9 phone return the value in this function: GetExclusiveCores() - CPU cores exclusively reserved for the app.
But it does not work on your device.

9912
Posts: 8
Joined: Sat Oct 15, 2016 8:09 pm

Re: SunVox DLL Android: Stuttering on suspension?

Post by 9912 » Thu Feb 20, 2020 12:11 am

Thanks for your reply, the device was the problem, the system reduce cpu usage on suspension to save battery and is the reason of the long lasting battery of my phone and the app behavior.

Anyway, I'm releasing the source code of the player on GitHub: https://github.com/9912/sunplay

Post Reply