AudioAdapterImpl.cpp revision c97989161fbe75bc14cea477a5443bbf474dd3ad
/** @file
*
* VirtualBox COM class implementation
*/
/*
* Copyright (C) 2006-2007 innotek GmbH
*
* 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 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.
*
* If you received this file as part of a commercial VirtualBox
* distribution, then only the terms of your commercial VirtualBox
* license agreement apply instead of the previous paragraph.
*/
#include "AudioAdapterImpl.h"
#include "MachineImpl.h"
#include "Logging.h"
// constructor / destructor
/////////////////////////////////////////////////////////////////////////////
{
return S_OK;
}
void AudioAdapter::FinalRelease()
{
if (isReady())
uninit ();
}
// public initializer/uninitializer for internal purposes only
/////////////////////////////////////////////////////////////////////////////
/**
* Initializes the audio adapter object.
*
* @returns COM result indicator
*/
{
// mPeer is left null
setReady (true);
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.
*/
{
setReady (true);
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.
*/
{
// mPeer is left null
setReady (true);
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()
{
LogFlowMember (("AudioAdapter::uninit()\n"));
AssertReturn (isReady(), (void) 0);
setReady(false);
}
// IAudioAdapter properties
/////////////////////////////////////////////////////////////////////////////
/**
* Returns the enabled status
*
* @returns COM status code
* @param enabled address of result variable
*/
{
if (!enabled)
return E_POINTER;
CHECK_READY();
return S_OK;
}
/**
* Sets the enabled state
*
* @returns COM status code
* @param enabled address of result variable
*/
{
CHECK_READY();
{
}
return S_OK;
}
/**
* Returns the current audio driver type
*
* @returns COM status code
* @param audioDriver address of result variable
*/
{
if (!audioDriver)
return E_POINTER;
CHECK_READY();
return S_OK;
}
/**
* Sets the audio driver type
*
* @returns COM status code
* @param audioDriver audio driver type to use
*/
{
CHECK_READY();
{
/*
* which audio driver type are we supposed to use?
*/
switch (audioDriver)
{
#ifdef __WIN__
#ifdef VBOX_WITH_WINMM
#endif
#endif /* __WIN__ */
#ifdef __LINUX__
#ifdef VBOX_WITH_ALSA
#endif
#endif /* __LINUX__ */
#ifdef __DARWIN__
#endif
{
break;
}
default:
{
Log(("wrong audio driver type specified!\n"));
}
}
}
return rc;
}
// IAudioAdapter methods
/////////////////////////////////////////////////////////////////////////////
// public methods only for internal purposes
/////////////////////////////////////////////////////////////////////////////
void AudioAdapter::commit()
{
if (mData.isBackedUp())
{
if (mPeer)
{
// attach new data to the peer and reshare it
}
}
}
{
// this will back up current data
}