Skip to content

Commit

Permalink
Temporarily switch of timing syncronization.
Browse files Browse the repository at this point in the history
  • Loading branch information
thetwom committed Jan 9, 2023
1 parent 7e2491f commit 02d4f76
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/src/main/java/de/moekadu/metronome/audio/AudioMixer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -711,19 +711,19 @@ class AudioMixer (val context: Context, private val scope: CoroutineScope) {
val framesToMillis = FrameNumberToMillis(player.sampleRate).apply { sync(0) }
player.positionNotificationPeriod = player.bufferSizeInFrames

player.setPlaybackPositionUpdateListener(object : AudioTrack.OnPlaybackPositionUpdateListener {
override fun onMarkerReached(track: AudioTrack?) {}
override fun onPeriodicNotification(track: AudioTrack?) {
try {
track?.playbackHeadPosition?.let { framesToMillis.sync(it) }
} catch (_: java.lang.Exception) {

}
// if (player.playState != AudioTrack.PLAYSTATE_PLAYING) {
// framesToMillis.sync(player.playbackHeadPosition)
// player.setPlaybackPositionUpdateListener(object : AudioTrack.OnPlaybackPositionUpdateListener {
// override fun onMarkerReached(track: AudioTrack?) {}
// override fun onPeriodicNotification(track: AudioTrack?) {
// try {
// track?.playbackHeadPosition?.let { framesToMillis.sync(it) }
// } catch (_: java.lang.Exception) {
//
// }
}
})
//// if (player.playState != AudioTrack.PLAYSTATE_PLAYING) {
//// framesToMillis.sync(player.playbackHeadPosition)
//// }
// }
// })

player.play()

Expand Down

0 comments on commit 02d4f76

Please sign in to comment.