1
0
Fork 0

Use MixerObject's singleton-pattern to manage the channel

This commit is contained in:
krcroft 2020-02-28 18:19:38 -08:00 committed by Patryk Obara
parent 91cd907c4e
commit 1d123367a5
3 changed files with 9 additions and 19 deletions

View file

@ -106,18 +106,6 @@ MixerChannel * MIXER_FindChannel(const char * name);
/* Find the device you want to delete with findchannel "delchan gets deleted" */
void MIXER_DelChannel(MixerChannel* delchan);
// A smart pointer deleter for MixerChannel objects
// Use-case:
// std::unique_ptr<MixerChannel, MixerChannelDeleter> myChannel;
// myChannel.reset(MIXER_AddChannel(...));
//
struct MixerChannelDeleter {
void operator()(MixerChannel *channel) {
if (channel)
MIXER_DelChannel(channel);
}
};
/* Object to maintain a mixerchannel; As all objects it registers itself with create
* and removes itself when destroyed. */
class MixerObject{