Migrate some members of the Player class to smart pointers
1. Moves the mutex and mixer channel members to unique pointers 2. Moves the trackFile to a weak pointer 3. Move member initialization to the class definition This class still retains a raw *cd member, however fixing this ripples up to the array of [26] CD images, and across more code that generically deals with mount points; so this work remains to do.
This commit is contained in:
parent
2d76132a8b
commit
91cd907c4e
4 changed files with 70 additions and 76 deletions
|
@ -106,6 +106,18 @@ 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