@@ -40,6 +40,12 @@ public override bool Playing
40
40
/// </summary>
41
41
private volatile bool userRequestedPlay ;
42
42
43
+ /// <summary>
44
+ /// <c>true</c> if the user last called <see cref="Stop"/>.
45
+ /// <c>false</c> if the user last called <see cref="Play"/> or this channel finished playback.
46
+ /// </summary>
47
+ private volatile bool userRequestedStop ;
48
+
43
49
/// <summary>
44
50
/// Whether the playback start has been enqueued.
45
51
/// </summary>
@@ -55,6 +61,8 @@ public override bool Looping
55
61
}
56
62
}
57
63
64
+ public override bool IsAlive => base . IsAlive && ( Playing || userRequestedStop ) ;
65
+
58
66
private bool hasChannel => channel != 0 ;
59
67
60
68
public override ChannelAmplitudes CurrentAmplitudes => ( bassAmplitudeProcessor ??= new BassAmplitudeProcessor ( this ) ) . CurrentAmplitudes ;
@@ -99,8 +107,13 @@ protected override void UpdateState()
99
107
playing = true ;
100
108
break ;
101
109
110
+ case PlaybackState . Paused when userRequestedStop :
111
+ playing = false ;
112
+ break ;
113
+
102
114
default :
103
115
playing = false ;
116
+ userRequestedStop = false ;
104
117
break ;
105
118
}
106
119
}
@@ -119,6 +132,8 @@ public override void Play()
119
132
{
120
133
userRequestedPlay = true ;
121
134
135
+ userRequestedStop = false ;
136
+
122
137
// Pin Playing and IsAlive to true so that the channel isn't killed by the next update. This is only reset after playback is started.
123
138
enqueuedPlaybackStart = true ;
124
139
@@ -138,6 +153,8 @@ public override void Stop()
138
153
{
139
154
userRequestedPlay = false ;
140
155
156
+ userRequestedStop = true ;
157
+
141
158
base . Stop ( ) ;
142
159
143
160
EnqueueAction ( ( ) =>
0 commit comments