Open hwsmm opened 1 month ago
Should we make
SampleChannels
not resumable?
How about we add a bool ManualFree { get; set; }
to the interface? Opposite of BASS' auto-free because interfaces can't have default values (we really should be doing sample.GetChannel(new ChannelProperties { ... })
or similar, but...).
And then, every other case should auto-free when playback ends or Stop()
is called.
I believe everywhere in osu! we operate under the assumption that channels are auto-freeing by default as I believe that's effectively how they work in BASS when they're HCHANNEL
s, so this could be considered a regression from when mixers were added (and they were made into HSTREAM
s).
I think adding ManualFree
flag is unnecessary as it's only relevant when Looping
is true. Adding a comment about this may be helpful?
When
Looping
is false,SampleChannel
is automatically disposed once playback ends, but whenLooping
is true, you're responsible for disposing this channel manually, as the framework can't detect its end.
So what happens when the channel is played, manually stopped, and the ISample
is just left to live (as we never dispose samples in game)? It sounds like in this case samples would never be disposed, no?
That's right. I'll live until it gets disposed somehow.
I think there is a misunderstanding about ManualFree. Do you want channels to be unable to resume playback once it is stopped when ManualFree is false?
I first assumed that you don't want such behavior, but I guess I misread your comment.
I'm okay with that if that's what you mean.
This PR fixes SampleChannelBass reporting wrong state.
Stop
no longer makesIsAlive
false.Play
after disposal no longer makesenqueuedPlaybackStart
true, so thatPlaying
won't be true (this can be tested with TestDoesNotRestart because SampleChannel is disposed after the end of playback with #6397).Do not merge this yet. What should we do for looping samples?
Stop
no longer makesIsAlive
false, but looping sample will be a zombie because it doesn't end. Should we make SampleChannels not resumable?