AudioAdapterImpl.cpp revision 26d2a42f095ded346df2e41cc4837cb426b4753a
c5b9358e561295f178bc3e0d299bf9c02d357d0evboxsync * VirtualBox COM class implementation
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * available from http://www.virtualbox.org. This file is free software;
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * you can redistribute it and/or modify it under the terms of the GNU
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * General Public License (GPL) as published by the Free Software
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
a16eb14ad7a4b5ef91ddc22d3e8e92d930f736fcvboxsync * additional information or have any questions.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync// constructor / destructor
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync/////////////////////////////////////////////////////////////////////////////
3bad884471a4755d52abffc98cc326f153750ca1vboxsync// public initializer/uninitializer for internal purposes only
9c11b89c71ca727d975c39f2719063501ddcd03dvboxsync/////////////////////////////////////////////////////////////////////////////
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Initializes the audio adapter object.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * @param aParent Handle of the parent object.
3bad884471a4755d52abffc98cc326f153750ca1vboxsync /* Enclose the state transition NotReady->InInit->Ready */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync /* mPeer is left null */
5eb8c49f193655f19bb89b653df8643091fa987bvboxsync /* Confirm a successful initialization */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync * Initializes the audio adapter object given another audio adapter object
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * (a kind of copy constructor). This object shares data with
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * the object passed as an argument.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * @note This object must be destroyed before the original object
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * it shares data with is destroyed.
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * @note Locks @a aThat object for reading.
c1a925cf66044662d1265e27eab1337d409f124dvboxsyncHRESULT AudioAdapter::init (Machine *aParent, AudioAdapter *aThat)
dc95659cf2f6c5830e66313b6046e4317881035bvboxsync LogFlowThisFunc (("aParent=%p, aThat=%p\n", aParent, aThat));
b34f0f200ed0778053a2a1d93381c2c6b60cb2d5vboxsync /* Enclose the state transition NotReady->InInit->Ready */
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync /* Confirm a successful initialization */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsync * Initializes the guest object given another guest object
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync * (a kind of copy constructor). This object makes a private copy of data
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync * of the original object passed as an argument.
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync * @note Locks @a aThat object for reading.
dc95659cf2f6c5830e66313b6046e4317881035bvboxsyncHRESULT AudioAdapter::initCopy (Machine *aParent, AudioAdapter *aThat)
3bad884471a4755d52abffc98cc326f153750ca1vboxsync LogFlowThisFunc (("aParent=%p, aThat=%p\n", aParent, aThat));
a734bb626f889ee3334bfc381be194b4ec56aae6vboxsync /* Enclose the state transition NotReady->InInit->Ready */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync /* mPeer is left null */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync /* Confirm a successful initialization */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync * Uninitializes the instance and sets the ready flag to FALSE.
3bad884471a4755d52abffc98cc326f153750ca1vboxsync * Called either from FinalRelease() or by the parent when it gets destroyed.
3bad884471a4755d52abffc98cc326f153750ca1vboxsync /* Enclose the state transition Ready->InUninit->NotReady */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync// IAudioAdapter properties
3bad884471a4755d52abffc98cc326f153750ca1vboxsync/////////////////////////////////////////////////////////////////////////////
3bad884471a4755d52abffc98cc326f153750ca1vboxsyncSTDMETHODIMP AudioAdapter::COMGETTER(Enabled)(BOOL *aEnabled)
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsyncSTDMETHODIMP AudioAdapter::COMSETTER(Enabled)(BOOL aEnabled)
3bad884471a4755d52abffc98cc326f153750ca1vboxsync /* the machine needs to be mutable */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync Machine::AutoMutableStateDependency adep (mParent);
3bad884471a4755d52abffc98cc326f153750ca1vboxsyncSTDMETHODIMP AudioAdapter::COMGETTER(AudioDriver)(AudioDriverType_T *aAudioDriver)
8c99dcd207cf5b7bee01f95fbe19728a94076f94vboxsyncSTDMETHODIMP AudioAdapter::COMSETTER(AudioDriver)(AudioDriverType_T aAudioDriver)
69dc0354ae98899256f5e73898f1dc973345ee65vboxsync /* the machine needs to be mutable */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync Machine::AutoMutableStateDependency adep (mParent);
3bad884471a4755d52abffc98cc326f153750ca1vboxsync * which audio driver type are we supposed to use?
858960add9f9dc845ad839300639ca2d932a1715vboxsync#endif /* RT_OS_WINDOWS */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync#endif /* RT_OS_LINUX */
29bdc01040c07a3dd482a94a2cb8f0a90f8587a7vboxsyncSTDMETHODIMP AudioAdapter::COMGETTER(AudioController)(AudioControllerType_T *aAudioController)
3bad884471a4755d52abffc98cc326f153750ca1vboxsyncSTDMETHODIMP AudioAdapter::COMSETTER(AudioController)(AudioControllerType_T aAudioController)
3bad884471a4755d52abffc98cc326f153750ca1vboxsync /* the machine needs to be mutable */
3bad884471a4755d52abffc98cc326f153750ca1vboxsync Machine::AutoMutableStateDependency adep (mParent);
3bad884471a4755d52abffc98cc326f153750ca1vboxsync * which audio hardware type are we supposed to use?
d66f73c3fe5c4de905e6b8623d2d3fe170628358vboxsync AssertMsgFailed (("Wrong audio controller type %d\n",
3bad884471a4755d52abffc98cc326f153750ca1vboxsync// IAudioAdapter methods
3bad884471a4755d52abffc98cc326f153750ca1vboxsync/////////////////////////////////////////////////////////////////////////////
3bad884471a4755d52abffc98cc326f153750ca1vboxsync// public methods only for internal purposes
3bad884471a4755d52abffc98cc326f153750ca1vboxsync/////////////////////////////////////////////////////////////////////////////
727cf0d6c794dffee1023d2bbb6e94eda7f35ca9vboxsync * Loads settings from the given machine node.
3bad884471a4755d52abffc98cc326f153750ca1vboxsync * May be called once right after this object creation.
727cf0d6c794dffee1023d2bbb6e94eda7f35ca9vboxsync * @param aMachineNode <Machine> node.
3bad884471a4755d52abffc98cc326f153750ca1vboxsync * @note Locks this object for writing.
c1a925cf66044662d1265e27eab1337d409f124dvboxsyncHRESULT AudioAdapter::loadSettings (const settings::Key &aMachineNode)
e0e7da0420be1398d23ffa9953686d3a43619abdvboxsync using namespace settings;
#ifdef RT_OS_WINDOWS
#ifdef VBOX_WITH_WINMM
#ifdef RT_OS_SOLARIS
#ifdef RT_OS_LINUX
# ifdef VBOX_WITH_ALSA
# ifdef VBOX_WITH_PULSE
#ifdef RT_OS_DARWIN
#ifdef RT_OS_OS2
return S_OK;
using namespace settings;
case AudioControllerType_SB16:
case AudioDriverType_Null:
#ifdef RT_OS_WINDOWS
case AudioDriverType_WinMM:
# ifdef VBOX_WITH_WINMM
#ifdef RT_OS_SOLARIS
case AudioDriverType_SolAudio:
#ifdef RT_OS_LINUX
case AudioDriverType_ALSA:
# ifdef VBOX_WITH_ALSA
case AudioDriverType_Pulse:
# ifdef VBOX_WITH_PULSE
case AudioDriverType_OSS:
#ifdef RT_OS_DARWIN
#ifdef RT_OS_OS2
case AudioDriverType_MMPM:
E_FAIL);
return S_OK;
bool changed = false;
return changed;
if (mPeer)