feat: play beats when no music is selected
This commit is contained in:
@@ -486,7 +486,8 @@ void PlaybackEngine::playMusic(int fd, long long offset, long long length) {
|
||||
closeMusicFile();
|
||||
}
|
||||
android_fd = fd;
|
||||
musicFile.reset(mp3file_open_fd(android_fd, offset, length, 0));
|
||||
if(fd != 0)
|
||||
musicFile.reset(mp3file_open_fd(android_fd, offset, length, 0));
|
||||
if(musicFile) {
|
||||
timeRatio.store(((double) playbackRate.load()) / ((double) musicFile->rate));
|
||||
haveTimeRatio.store(true);
|
||||
|
||||
@@ -105,6 +105,8 @@ public class LstForegroundService extends Service implements SensorEventListener
|
||||
try {
|
||||
if(contentUri != null) {
|
||||
PlaybackEngine.playMusic(uriToFd(contentUri), this, R.raw.track_beat);
|
||||
} else {
|
||||
PlaybackEngine.playMusic(0, this, R.raw.track_beat);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// TODO proper error handling
|
||||
|
||||
Reference in New Issue
Block a user