Skip to content

How to prevent offload gapless playback based on metadata? #2855

@nift4

Description

@nift4

I'm working on a ReplayGain implementation for my music player. To ensure battery usage is low, I want to make offload work with it as well.
ReplayGain handles files with low volume by increasing the volume above 100%. Clipping is considered, so this is only done if a file has a low peak volume and silence in upper part of headroom. Increasing volume above 100% without compression (not needed since after increasing the volume, files still won't clip) can only be achieved using DynamicsProcessing in Android, not using AudioTrack.setVolume() which is capped at 100%. So I need to update DynamicsProcessing parameter synchronized with song change.
However when using gapless offload, it's hard to time the change correctly as it already processes start of next file before current one is done playing. Hence I need to prevent offload gapless if gain changes. However offload gapless should still work if gain is the same (to allow gapless albums to still be played gapless). The gain is stored in Format.Metadata tags.
I am implementing this in a decorating AudioSink to ensure I can update effect settings before frames are written to AudioTrack. Is there any way to prevent offload gapless this way if gain is different?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions