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();
|
closeMusicFile();
|
||||||
}
|
}
|
||||||
android_fd = fd;
|
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) {
|
if(musicFile) {
|
||||||
timeRatio.store(((double) playbackRate.load()) / ((double) musicFile->rate));
|
timeRatio.store(((double) playbackRate.load()) / ((double) musicFile->rate));
|
||||||
haveTimeRatio.store(true);
|
haveTimeRatio.store(true);
|
||||||
|
|||||||
@@ -105,6 +105,8 @@ public class LstForegroundService extends Service implements SensorEventListener
|
|||||||
try {
|
try {
|
||||||
if(contentUri != null) {
|
if(contentUri != null) {
|
||||||
PlaybackEngine.playMusic(uriToFd(contentUri), this, R.raw.track_beat);
|
PlaybackEngine.playMusic(uriToFd(contentUri), this, R.raw.track_beat);
|
||||||
|
} else {
|
||||||
|
PlaybackEngine.playMusic(0, this, R.raw.track_beat);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// TODO proper error handling
|
// TODO proper error handling
|
||||||
|
|||||||
Reference in New Issue
Block a user