Use MixerObject's singleton-pattern to manage the channel
This commit is contained in:
parent
91cd907c4e
commit
1d123367a5
3 changed files with 9 additions and 19 deletions
|
@ -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{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue