AudioAdapterImpl.cpp revision 474365bb5a844c1cf7183e37b637dfbfaf6eb7d1
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include "AudioAdapterImpl.h"
#include "MachineImpl.h"
#include <VBox/settings.h>
#include "AutoStateDep.h"
#include "AutoCaller.h"
#include "Logging.h"
struct AudioAdapterData
{
AudioAdapterData() :
mEnabled(false),
{}
};
struct AudioAdapter::Data
{
};
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
}
{
}
{
return BaseFinalConstruct();
}
void AudioAdapter::FinalRelease()
{
uninit();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes the audio adapter object.
*
* @param aParent Handle of the parent object.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan(this);
/* Get the default audio driver out of the system properties */
/* mPeer is left null */
/* Confirm a successful initialization */
return S_OK;
}
/**
* Initializes the audio adapter object given another audio adapter object
* (a kind of copy constructor). This object shares data with
* the object passed as an argument.
*
* @note This object must be destroyed before the original object
* it shares data with is destroyed.
*
* @note Locks @a aThat object for reading.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan(this);
/* Confirm a successful initialization */
return S_OK;
}
/**
* Initializes the guest object given another guest object
* (a kind of copy constructor). This object makes a private copy of data
* of the original object passed as an argument.
*
* @note Locks @a aThat object for reading.
*/
{
/* Enclose the state transition NotReady->InInit->Ready */
AutoInitSpan autoInitSpan(this);
/* mPeer is left null */
/* Confirm a successful initialization */
return S_OK;
}
/**
* Uninitializes the instance and sets the ready flag to FALSE.
* Called either from FinalRelease() or by the parent when it gets destroyed.
*/
void AudioAdapter::uninit()
{
LogFlowThisFunc(("\n"));
/* Enclose the state transition Ready->InUninit->NotReady */
AutoUninitSpan autoUninitSpan(this);
if (autoUninitSpan.uninitDone())
return;
delete mData;
}
// IAudioAdapter properties
/////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
{
/* the machine needs to be mutable */
{
}
return S_OK;
}
{
return S_OK;
}
{
/* the machine needs to be mutable */
{
{
}
else
{
}
}
return rc;
}
{
return S_OK;
}
{
/* the machine needs to be mutable */
{
/*
* which audio hardware type are we supposed to use?
*/
switch (aAudioController)
{
case AudioControllerType_AC97:
case AudioControllerType_SB16:
case AudioControllerType_HDA:
{
break;
}
default:
AssertMsgFailed (("Wrong audio controller type %d\n",
}
}
return rc;
}
// IAudioAdapter methods
/////////////////////////////////////////////////////////////////////////////
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
/**
* Loads settings from the given machine node.
* May be called once right after this object creation.
*
* @param aMachineNode <Machine> node.
*
* @note Locks this object for writing.
*/
{
AutoCaller autoCaller(this);
/* Note: we assume that the default values for attributes of optional
* nodes are assigned in the Data::Data() constructor and don't do it
* here. It implies that this method may only be called after constructing
* a new AudioAdapter object while all its data fields are in the default
* values. Exceptions are fields whose creation time defaults don't match
* values that should be applied when these fields are not explicitly set
* in the settings file (for backwards compatibility reasons). This takes
* place when a setting of a newly created object must default to A while
* the same setting of an object loaded from the old settings file must
* default to B. */
return S_OK;
}
/**
* Saves settings to the given machine node.
*
* @param aMachineNode <Machine> node.
*
* @note Locks this object for reading.
*/
{
AutoCaller autoCaller(this);
return S_OK;
}
/**
* @note Locks this object for writing.
*/
void AudioAdapter::i_rollback()
{
/* sanity */
AutoCaller autoCaller(this);
}
/**
* @note Locks this object for writing, together with the peer object (also
* for writing) if there is one.
*/
void AudioAdapter::i_commit()
{
/* sanity */
AutoCaller autoCaller(this);
/* sanity too */
/* lock both for writing since we modify both (mPeer is "master" so locked
* first) */
if (mData->m.isBackedUp())
{
if (mPeer)
{
/* attach new data to the peer and reshare it */
}
}
}
/**
* @note Locks this object for writing, together with the peer object
* represented by @a aThat (locked for reading).
*/
{
/* sanity */
AutoCaller autoCaller(this);
/* sanity too */
/* peer is not modified, lock it for reading (aThat is "master" so locked
* first) */
/* this will back up current data */
}
/* vi: set tabstop=4 shiftwidth=4 expandtab: */