-
-
Notifications
You must be signed in to change notification settings - Fork 311
Expand file tree
/
Copy pathPlaybackViewModel.kt
More file actions
712 lines (620 loc) · 22.3 KB
/
Copy pathPlaybackViewModel.kt
File metadata and controls
712 lines (620 loc) · 22.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
/*
* Copyright (c) 2021 Auxio Project
* PlaybackViewModel.kt is part of Auxio.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package org.oxycblt.auxio.playback
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.launch
import org.oxycblt.auxio.list.ListSettings
import org.oxycblt.auxio.list.adapter.UpdateInstructions
import org.oxycblt.auxio.playback.state.DeferredPlayback
import org.oxycblt.auxio.playback.state.PlaybackCommand
import org.oxycblt.auxio.playback.state.PlaybackStateManager
import org.oxycblt.auxio.playback.state.Progression
import org.oxycblt.auxio.playback.state.QueueChange
import org.oxycblt.auxio.playback.state.RepeatMode
import org.oxycblt.auxio.playback.state.ScanDirection
import org.oxycblt.auxio.playback.state.ShuffleMode
import org.oxycblt.auxio.util.Event
import org.oxycblt.auxio.util.MutableEvent
import org.oxycblt.musikr.Album
import org.oxycblt.musikr.Artist
import org.oxycblt.musikr.Genre
import org.oxycblt.musikr.MusicParent
import org.oxycblt.musikr.Playlist
import org.oxycblt.musikr.Song
import timber.log.Timber as L
/**
* An [ViewModel] that provides a safe UI frontend for the current playback state.
*
* @author Alexander Capehart (OxygenCobalt)
*
* TODO: Debug subtle backwards movement of position on pause
*/
@HiltViewModel
class PlaybackViewModel
@Inject
constructor(
private val playbackManager: PlaybackStateManager,
private val playbackSettings: PlaybackSettings,
private val commandFactory: PlaybackCommand.Factory,
private val listSettings: ListSettings,
) : ViewModel(), PlaybackStateManager.Listener, PlaybackSettings.Listener {
private var lastPositionJob: Job? = null
private val _song = MutableStateFlow<Song?>(null)
/** The currently playing song. */
val song: StateFlow<Song?>
get() = _song
private val _parent = MutableStateFlow<MusicParent?>(null)
/** The [MusicParent] currently being played. Null if playback is occurring from all songs. */
val parent: StateFlow<MusicParent?> = _parent
private val _isPlaying = MutableStateFlow(false)
/** Whether playback is ongoing or paused. */
val isPlaying: StateFlow<Boolean>
get() = _isPlaying
private val _positionDs = MutableStateFlow(0L)
/** The current position, in deci-seconds (1/10th of a second). */
val positionDs: StateFlow<Long>
get() = _positionDs
private val _repeatMode = MutableStateFlow(RepeatMode.NONE)
/** The current [RepeatMode]. */
val repeatMode: StateFlow<RepeatMode>
get() = _repeatMode
private val _isShuffled = MutableStateFlow(false)
/** Whether the queue is shuffled or not. */
val isShuffled: StateFlow<Boolean>
get() = _isShuffled
private val _currentBarAction = MutableStateFlow(playbackSettings.barAction)
/** The current secondary action to show alongside the play button in the playback bar. */
val currentBarAction: StateFlow<ActionMode>
get() = _currentBarAction
private val _openPanel = MutableEvent<OpenPanel>()
/**
* A [OpenPanel] command that is awaiting a view capable of responding to it. Null if none
* currently.
*/
val openPanel: Event<OpenPanel>
get() = _openPanel
private val _pagerQueue = MutableStateFlow(PagerQueue(listOf(), 0))
/** The current queue in a special bundled format suitable for the cover ViewPager2. */
val pagerQueue: StateFlow<PagerQueue> = _pagerQueue
private val _pagerCommand = MutableEvent<PagerCommand>()
/** Specialized ViewPager2-friendly queue commands */
val pagerCommand: Event<PagerCommand>
get() = _pagerCommand
private val _playbackDecision = MutableEvent<PlaybackDecision>()
/**
* A [PlaybackDecision] command that is awaiting a view capable of responding to it. Null if
* none currently.
*/
val playbackDecision: Event<PlaybackDecision>
get() = _playbackDecision
/**
* The current audio session ID of the internal player. Null if no audio player is available.
*/
val currentAudioSessionId: Int?
get() = playbackManager.currentAudioSessionId
init {
playbackManager.addListener(this)
playbackSettings.registerListener(this)
}
override fun onCleared() {
playbackManager.removeListener(this)
playbackSettings.unregisterListener(this)
}
override fun onIndexMoved(index: Int) {
L.d("Index moved, updating current song")
_positionDs.value = playbackManager.progression.calculateElapsedPositionMs().msToDs()
_song.value = playbackManager.currentSong
_pagerCommand.put(PagerCommand(update = null, scroll = index))
_pagerQueue.value = _pagerQueue.value.copy(index = index)
}
override fun onQueueChanged(queue: List<Song>, index: Int, change: QueueChange) {
// Other types of queue changes preserve the current song.
if (change.type == QueueChange.Type.SONG) {
L.d("Queue changed, updating current song")
_song.value = playbackManager.currentSong
}
_pagerCommand.put(
PagerCommand(
update = change.instructions,
scroll = index.takeIf { change.type != QueueChange.Type.MAPPING },
)
)
_pagerQueue.value = PagerQueue(queue = queue, index = index)
}
override fun onQueueReordered(queue: List<Song>, index: Int, isShuffled: Boolean) {
L.d("Queue completely changed, updating current song")
_isShuffled.value = isShuffled
_pagerCommand.put(PagerCommand(update = UpdateInstructions.Replace(0), scroll = index))
_pagerQueue.value = PagerQueue(queue = queue, index = index)
}
override fun onNewPlayback(
parent: MusicParent?,
queue: List<Song>,
index: Int,
isShuffled: Boolean,
) {
L.d("New playback started, updating playback information")
_song.value = playbackManager.currentSong
_parent.value = parent
_isShuffled.value = isShuffled
_pagerCommand.put(PagerCommand(update = UpdateInstructions.Replace(0), scroll = index))
_pagerQueue.value = PagerQueue(queue = queue, index = index)
}
override fun onProgressionChanged(progression: Progression) {
L.d("Player state changed, starting new position polling")
_isPlaying.value = progression.isPlaying
// Still need to update the position now due to co-routine launch delays
_positionDs.value = progression.calculateElapsedPositionMs().msToDs()
// Replace the previous position co-routine with a new one that uses the new
// state information.
lastPositionJob?.cancel()
lastPositionJob =
viewModelScope.launch {
while (true) {
_positionDs.value = progression.calculateElapsedPositionMs().msToDs()
// Wait a deci-second for the next position tick.
delay(100)
}
}
}
override fun onRepeatModeChanged(repeatMode: RepeatMode) {
_repeatMode.value = repeatMode
}
override fun onBarActionChanged() {
_currentBarAction.value = playbackSettings.barAction
}
// --- PLAYING FUNCTIONS ---
fun play(song: Song, with: PlaySong) {
L.d("Playing $song with $with")
playWithImpl(song, with, ShuffleMode.IMPLICIT)
}
fun playExplicit(song: Song, with: PlaySong) {
playWithImpl(song, with, ShuffleMode.OFF)
}
fun shuffleExplicit(song: Song, with: PlaySong) {
playWithImpl(song, with, ShuffleMode.ON)
}
/** Shuffle all songs in the music library. */
fun shuffleAll() {
L.d("Shuffling all songs")
playFromAllImpl(null, ShuffleMode.ON)
}
/**
* Play a [Song] from one of it's [Artist]s.
*
* @param song The [Song] to play.
* @param artist The [Artist] to play from. Must be linked to the [Song]. If null, the user will
* be prompted on what artist to play. Defaults to null.
*/
fun playFromArtist(song: Song, artist: Artist? = null) {
playFromArtistImpl(song, artist, ShuffleMode.IMPLICIT)
}
/**
* Play a [Song] from one of it's [Genre]s.
*
* @param song The [Song] to play.
* @param genre The [Genre] to play from. Must be linked to the [Song]. If null, the user will
* be prompted on what artist to play. Defaults to null.
*/
fun playFromGenre(song: Song, genre: Genre? = null) {
playFromGenreImpl(song, genre, ShuffleMode.IMPLICIT)
}
private fun playWithImpl(song: Song, with: PlaySong, shuffle: ShuffleMode) {
when (with) {
is PlaySong.FromAll -> playFromAllImpl(song, shuffle)
is PlaySong.FromAlbum -> playFromAlbumImpl(song, shuffle)
is PlaySong.FromArtist -> playFromArtistImpl(song, with.which, shuffle)
is PlaySong.FromGenre -> playFromGenreImpl(song, with.which, shuffle)
is PlaySong.FromPlaylist -> playFromPlaylistImpl(song, with.which, shuffle)
is PlaySong.ByItself -> playItselfImpl(song, shuffle)
}
}
private fun playItselfImpl(song: Song, shuffle: ShuffleMode) {
playbackManager.play(
requireNotNull(commandFactory.song(song, shuffle)) {
"Invalid playback parameters [$song $shuffle]"
}
)
}
private fun playFromAllImpl(song: Song?, shuffle: ShuffleMode) {
val params =
if (song != null) {
commandFactory.songFromAll(song, shuffle)
} else {
commandFactory.all(shuffle)
}
playImpl(params)
}
private fun playFromAlbumImpl(song: Song, shuffle: ShuffleMode) {
L.d("Playing $song from album")
playImpl(commandFactory.songFromAlbum(song, shuffle))
}
private fun playFromArtistImpl(song: Song, artist: Artist?, shuffle: ShuffleMode) {
val params = commandFactory.songFromArtist(song, artist, shuffle)
if (params != null) {
playbackManager.play(params)
return
}
L.d(
"Cannot use given artist parameter for $song [$artist from ${song.artists}], showing choice dialog"
)
startPlaybackDecision(PlaybackDecision.PlayFromArtist(song))
}
private fun playFromGenreImpl(song: Song, genre: Genre?, shuffle: ShuffleMode) {
val params = commandFactory.songFromGenre(song, genre, shuffle)
if (params != null) {
playbackManager.play(params)
return
}
L.d(
"Cannot use given genre parameter for $song [$genre from ${song.genres}], showing choice dialog"
)
startPlaybackDecision(PlaybackDecision.PlayFromArtist(song))
}
private fun playFromPlaylistImpl(song: Song, playlist: Playlist, shuffle: ShuffleMode) {
L.d("Playing $song from $playlist")
playImpl(commandFactory.songFromPlaylist(song, playlist, shuffle))
}
private fun startPlaybackDecision(decision: PlaybackDecision) {
val existing = _playbackDecision.flow.value
if (existing != null) {
L.d("Already handling decision $existing, ignoring $decision")
return
}
_playbackDecision.put(decision)
}
/**
* Play an [Album].
*
* @param album The [Album] to play.
*/
fun play(album: Album) {
L.d("Playing $album")
playImpl(commandFactory.album(album, ShuffleMode.OFF))
}
/**
* Shuffle an [Album].
*
* @param album The [Album] to shuffle.
*/
fun shuffle(album: Album) {
L.d("Shuffling $album")
playImpl(commandFactory.album(album, ShuffleMode.ON))
}
/**
* Play an [Artist].
*
* @param artist The [Artist] to play.
*/
fun play(artist: Artist) {
L.d("Playing $artist")
playImpl(commandFactory.artist(artist, ShuffleMode.OFF))
}
/**
* Shuffle an [Artist].
*
* @param artist The [Artist] to shuffle.
*/
fun shuffle(artist: Artist) {
L.d("Shuffling $artist")
playImpl(commandFactory.artist(artist, ShuffleMode.ON))
}
/**
* Play a [Genre].
*
* @param genre The [Genre] to play.
*/
fun play(genre: Genre) {
L.d("Playing $genre")
playImpl(commandFactory.genre(genre, ShuffleMode.OFF))
}
/**
* Shuffle a [Genre].
*
* @param genre The [Genre] to shuffle.
*/
fun shuffle(genre: Genre) {
L.d("Shuffling $genre")
playImpl(commandFactory.genre(genre, ShuffleMode.ON))
}
/**
* Play a [Playlist].
*
* @param playlist The [Playlist] to play.
*/
fun play(playlist: Playlist) {
L.d("Playing $playlist")
playImpl(commandFactory.playlist(playlist, ShuffleMode.OFF))
}
/**
* Shuffle a [Playlist].
*
* @param playlist The [Playlist] to shuffle.
*/
fun shuffle(playlist: Playlist) {
L.d("Shuffling $playlist")
playImpl(commandFactory.playlist(playlist, ShuffleMode.ON))
}
/**
* Play a list of [Song]s.
*
* @param songs The [Song]s to play.
*/
fun play(songs: List<Song>) {
L.d("Playing ${songs.size} songs")
playImpl(commandFactory.songs(songs, ShuffleMode.OFF))
}
/**
* Shuffle a list of [Song]s.
*
* @param songs The [Song]s to shuffle.
*/
fun shuffle(songs: List<Song>) {
L.d("Shuffling ${songs.size} songs")
playImpl(commandFactory.songs(songs, ShuffleMode.ON))
}
private fun playImpl(command: PlaybackCommand?) {
playbackManager.play(requireNotNull(command) { "Invalid playback parameters" })
}
/**
* Start the given [DeferredPlayback] to be completed eventually. This can be used to enqueue a
* playback action at startup to then occur when the music library is fully loaded.
*
* @param action The [DeferredPlayback] to perform eventually.
*/
fun playDeferred(action: DeferredPlayback) {
L.d("Starting action $action")
playbackManager.playDeferred(action)
}
// --- PLAYER FUNCTIONS ---
/**
* Seek to the given position in the currently playing [Song].
*
* @param positionDs The position to seek to, in deci-seconds (1/10th of a second).
*/
fun seekTo(positionDs: Long) {
L.d("Seeking to ${positionDs}ds")
playbackManager.seekTo(positionDs.dsToMs())
}
/** Step back by 10 seconds in the current song. */
fun stepBackwards() {
L.d("Stepping back 10 seconds")
val currentPositionMs = playbackManager.progression.calculateElapsedPositionMs()
val newPositionMs = (currentPositionMs - 10000).coerceAtLeast(0)
playbackManager.seekTo(newPositionMs)
}
/** Step forward by 10 seconds in the current song. */
fun stepForward() {
L.d("Stepping forward 10 seconds")
val currentPositionMs = playbackManager.progression.calculateElapsedPositionMs()
val currentSong = playbackManager.currentSong
if (currentSong != null) {
val newPositionMs =
(currentPositionMs + STEP_INCREMENT).coerceAtMost(currentSong.durationMs)
playbackManager.seekTo(newPositionMs)
}
}
/** Begin scanning through the current track while a transport button is held. */
fun startScan(direction: ScanDirection) {
L.d("Starting scan in direction $direction")
playbackManager.startScan(direction)
}
/** Stop scanning and return to normal playback. */
fun stopScan() {
L.d("Stopping scan")
playbackManager.stopScan()
}
// --- QUEUE FUNCTIONS ---
/** Skip to the next [Song]. */
fun next() {
L.d("Skipping to next song")
playbackManager.next()
}
/** Skip to the previous [Song]. */
fun prev() {
L.d("Skipping to previous song")
playbackManager.prev()
}
/**
* Add a [Song] to the top of the queue.
*
* @param song The [Song] to add.
*/
fun playNext(song: Song) {
L.d("Playing $song next")
playbackManager.playNext(song)
}
/**
* Add a [Album] to the top of the queue.
*
* @param album The [Album] to add.
*/
fun playNext(album: Album) {
L.d("Playing $album next")
playbackManager.playNext(listSettings.albumSongSort.songs(album.songs))
}
/**
* Add a [Artist] to the top of the queue.
*
* @param artist The [Artist] to add.
*/
fun playNext(artist: Artist) {
L.d("Playing $artist next")
playbackManager.playNext(listSettings.artistSongSort.songs(artist.songs))
}
/**
* Add a [Genre] to the top of the queue.
*
* @param genre The [Genre] to add.
*/
fun playNext(genre: Genre) {
L.d("Playing $genre next")
playbackManager.playNext(listSettings.genreSongSort.songs(genre.songs))
}
/**
* Add a [Playlist] to the top of the queue.
*
* @param playlist The [Playlist] to add.
*/
fun playNext(playlist: Playlist) {
L.d("Playing $playlist next")
playbackManager.playNext(playlist.songs)
}
/**
* Add [Song]s to the top of the queue.
*
* @param songs The [Song]s to add.
*/
fun playNext(songs: List<Song>) {
L.d("Playing ${songs.size} songs next")
playbackManager.playNext(songs)
}
/**
* Add a [Song] to the end of the queue.
*
* @param song The [Song] to add.
*/
fun addToQueue(song: Song) {
L.d("Adding $song to queue")
playbackManager.addToQueue(song)
}
/**
* Add a [Album] to the end of the queue.
*
* @param album The [Album] to add.
*/
fun addToQueue(album: Album) {
L.d("Adding $album to queue")
playbackManager.addToQueue(listSettings.albumSongSort.songs(album.songs))
}
/**
* Add a [Artist] to the end of the queue.
*
* @param artist The [Artist] to add.
*/
fun addToQueue(artist: Artist) {
L.d("Adding $artist to queue")
playbackManager.addToQueue(listSettings.artistSongSort.songs(artist.songs))
}
/**
* Add a [Genre] to the end of the queue.
*
* @param genre The [Genre] to add.
*/
fun addToQueue(genre: Genre) {
L.d("Adding $genre to queue")
playbackManager.addToQueue(listSettings.genreSongSort.songs(genre.songs))
}
/**
* Add a [Playlist] to the end of the queue.
*
* @param playlist The [Playlist] to add.
*/
fun addToQueue(playlist: Playlist) {
L.d("Adding $playlist to queue")
playbackManager.addToQueue(playlist.songs)
}
/**
* Add [Song]s to the end of the queue.
*
* @param songs The [Song]s to add.
*/
fun addToQueue(songs: List<Song>) {
L.d("Adding ${songs.size} songs to queue")
playbackManager.addToQueue(songs)
}
// --- STATUS FUNCTIONS ---
/** Toggle [isPlaying] (i.e from playing to paused) */
fun togglePlaying() {
L.d("Toggling playing state")
playbackManager.playing(!playbackManager.progression.isPlaying)
}
/** Toggle [isShuffled] (ex. from on to off) */
fun toggleShuffled() {
L.d("Toggling shuffled state")
playbackManager.shuffled(!playbackManager.isShuffled)
}
/**
* Toggle [repeatMode] (ex. from [RepeatMode.NONE] to [RepeatMode.TRACK])
*
* @see RepeatMode.increment
*/
fun toggleRepeatMode() {
L.d("Toggling repeat mode")
playbackManager.repeatMode(playbackManager.repeatMode.increment())
}
// --- UI CONTROL ---
/** Open the main panel, closing all other panels. */
fun openMain() = openImpl(OpenPanel.MAIN)
/** Open the playback panel, closing the queue panel if needed. */
fun openPlayback() = openImpl(OpenPanel.PLAYBACK)
/**
* Open the queue panel, assuming that it exists in the current layout, is collapsed, and with
* the playback panel already being expanded.
*/
fun openQueue() = openImpl(OpenPanel.QUEUE)
private fun openImpl(panel: OpenPanel) {
val existing = openPanel.flow.value
if (existing != null) {
L.d("Already opening $existing, ignoring opening $panel")
return
}
_openPanel.put(panel)
}
private companion object {
private const val STEP_INCREMENT = 10000 // ms
}
}
data class PagerQueue(val queue: List<Song>, val index: Int)
data class PagerCommand(val update: UpdateInstructions?, val scroll: Int?)
/**
* Command for controlling the main playback panel UI.
*
* @author Alexander Capehart (OxygenCobalt)
*/
enum class OpenPanel {
/** Open the main view, collapsing all other panels. */
MAIN,
/** Open the playback panel, collapsing the queue panel if applicable. */
PLAYBACK,
/**
* Open the queue panel, assuming that it exists in the current layout, is collapsed, and with
* the playback panel already being expanded. Do nothing if these conditions are not met.
*/
QUEUE,
}
/**
* Command for opening decision dialogs when playback from a [Song] is ambiguous.
*
* @author Alexander Capehart (OxygenCobalt)
*/
sealed interface PlaybackDecision {
/** The [Song] currently attempting to be played from. */
val song: Song
/** Navigate to a dialog to determine which [Artist] a [Song] should be played from. */
class PlayFromArtist(override val song: Song) : PlaybackDecision
/** Navigate to a dialog to determine which [Genre] a [Song] should be played from. */
class PlayFromGenre(override val song: Song) : PlaybackDecision
}