1 | /* $Id: AudioAdapterImpl.h 26167 2010-02-02 19:59:09Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
10 | *
|
---|
11 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
12 | * available from http://www.virtualbox.org. This file is free software;
|
---|
13 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
14 | * General Public License (GPL) as published by the Free Software
|
---|
15 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
16 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
17 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
18 | *
|
---|
19 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
20 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
21 | * additional information or have any questions.
|
---|
22 | */
|
---|
23 |
|
---|
24 | #ifndef ____H_AUDIOADAPTER
|
---|
25 | #define ____H_AUDIOADAPTER
|
---|
26 |
|
---|
27 | #include "VirtualBoxBase.h"
|
---|
28 |
|
---|
29 | namespace settings
|
---|
30 | {
|
---|
31 | struct AudioAdapter;
|
---|
32 | }
|
---|
33 |
|
---|
34 | class ATL_NO_VTABLE AudioAdapter :
|
---|
35 | public VirtualBoxBase,
|
---|
36 | public VirtualBoxSupportErrorInfoImpl<AudioAdapter, IAudioAdapter>,
|
---|
37 | public VirtualBoxSupportTranslation<AudioAdapter>,
|
---|
38 | VBOX_SCRIPTABLE_IMPL(IAudioAdapter)
|
---|
39 | {
|
---|
40 | public:
|
---|
41 |
|
---|
42 | struct Data
|
---|
43 | {
|
---|
44 | Data();
|
---|
45 |
|
---|
46 | bool operator== (const Data &that) const
|
---|
47 | {
|
---|
48 | return this == &that ||
|
---|
49 | (mEnabled == that.mEnabled &&
|
---|
50 | mAudioDriver == that.mAudioDriver &&
|
---|
51 | mAudioController == that.mAudioController);
|
---|
52 | }
|
---|
53 |
|
---|
54 | BOOL mEnabled;
|
---|
55 | AudioDriverType_T mAudioDriver;
|
---|
56 | AudioControllerType_T mAudioController;
|
---|
57 | };
|
---|
58 |
|
---|
59 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (AudioAdapter)
|
---|
60 |
|
---|
61 | DECLARE_NOT_AGGREGATABLE(AudioAdapter)
|
---|
62 |
|
---|
63 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
64 |
|
---|
65 | BEGIN_COM_MAP(AudioAdapter)
|
---|
66 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
67 | COM_INTERFACE_ENTRY(IAudioAdapter)
|
---|
68 | COM_INTERFACE_ENTRY(IDispatch)
|
---|
69 | END_COM_MAP()
|
---|
70 |
|
---|
71 | DECLARE_EMPTY_CTOR_DTOR (AudioAdapter)
|
---|
72 |
|
---|
73 | HRESULT FinalConstruct();
|
---|
74 | void FinalRelease();
|
---|
75 |
|
---|
76 | // public initializer/uninitializer for internal purposes only
|
---|
77 | HRESULT init(Machine *aParent);
|
---|
78 | HRESULT init(Machine *aParent, AudioAdapter *aThat);
|
---|
79 | HRESULT initCopy(Machine *aParent, AudioAdapter *aThat);
|
---|
80 | void uninit();
|
---|
81 |
|
---|
82 | STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
|
---|
83 | STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
|
---|
84 | STDMETHOD(COMGETTER(AudioDriver))(AudioDriverType_T *aAudioDriverType);
|
---|
85 | STDMETHOD(COMSETTER(AudioDriver))(AudioDriverType_T aAudioDriverType);
|
---|
86 | STDMETHOD(COMGETTER(AudioController))(AudioControllerType_T *aAudioControllerType);
|
---|
87 | STDMETHOD(COMSETTER(AudioController))(AudioControllerType_T aAudioControllerType);
|
---|
88 |
|
---|
89 | // public methods only for internal purposes
|
---|
90 |
|
---|
91 | HRESULT loadSettings(const settings::AudioAdapter &data);
|
---|
92 | HRESULT saveSettings(settings::AudioAdapter &data);
|
---|
93 |
|
---|
94 | bool rollback();
|
---|
95 | void commit();
|
---|
96 | void copyFrom(AudioAdapter *aThat);
|
---|
97 |
|
---|
98 | // for VirtualBoxSupportErrorInfoImpl
|
---|
99 | static const wchar_t *getComponentName() { return L"AudioAdapter"; }
|
---|
100 |
|
---|
101 | private:
|
---|
102 |
|
---|
103 | const ComObjPtr<Machine, ComWeakRef> mParent;
|
---|
104 | const ComObjPtr<AudioAdapter> mPeer;
|
---|
105 |
|
---|
106 | Backupable<Data> mData;
|
---|
107 | };
|
---|
108 |
|
---|
109 | #endif // ____H_AUDIOADAPTER
|
---|
110 | /* vi: set tabstop=4 shiftwidth=4 expandtab: */
|
---|