1 | /* $Id: AudioAdapterImpl.h 6076 2007-12-14 19:23:03Z vboxsync $ */
|
---|
2 |
|
---|
3 | /** @file
|
---|
4 | *
|
---|
5 | * VirtualBox COM class implementation
|
---|
6 | */
|
---|
7 |
|
---|
8 | /*
|
---|
9 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
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 |
|
---|
20 | #ifndef ____H_AUDIOADAPTER
|
---|
21 | #define ____H_AUDIOADAPTER
|
---|
22 |
|
---|
23 | #include "VirtualBoxBase.h"
|
---|
24 |
|
---|
25 | class Machine;
|
---|
26 |
|
---|
27 | class ATL_NO_VTABLE AudioAdapter :
|
---|
28 | public VirtualBoxBaseNEXT,
|
---|
29 | public VirtualBoxSupportErrorInfoImpl <AudioAdapter, IAudioAdapter>,
|
---|
30 | public VirtualBoxSupportTranslation <AudioAdapter>,
|
---|
31 | public IAudioAdapter
|
---|
32 | {
|
---|
33 | public:
|
---|
34 |
|
---|
35 | struct Data
|
---|
36 | {
|
---|
37 | Data() {
|
---|
38 | mEnabled = false;
|
---|
39 | mAudioDriver = AudioDriverType_NullAudioDriver;
|
---|
40 | }
|
---|
41 |
|
---|
42 | bool operator== (const Data &that) const
|
---|
43 | {
|
---|
44 | return this == &that ||
|
---|
45 | (mEnabled == that.mEnabled &&
|
---|
46 | mAudioDriver == that.mAudioDriver);
|
---|
47 | }
|
---|
48 |
|
---|
49 | BOOL mEnabled;
|
---|
50 | AudioDriverType_T mAudioDriver;
|
---|
51 | };
|
---|
52 |
|
---|
53 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (AudioAdapter)
|
---|
54 |
|
---|
55 | DECLARE_NOT_AGGREGATABLE(AudioAdapter)
|
---|
56 |
|
---|
57 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
58 |
|
---|
59 | BEGIN_COM_MAP(AudioAdapter)
|
---|
60 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
61 | COM_INTERFACE_ENTRY(IAudioAdapter)
|
---|
62 | END_COM_MAP()
|
---|
63 |
|
---|
64 | NS_DECL_ISUPPORTS
|
---|
65 |
|
---|
66 | DECLARE_EMPTY_CTOR_DTOR (AudioAdapter)
|
---|
67 |
|
---|
68 | HRESULT FinalConstruct();
|
---|
69 | void FinalRelease();
|
---|
70 |
|
---|
71 | // public initializer/uninitializer for internal purposes only
|
---|
72 | HRESULT init (Machine *aParent);
|
---|
73 | HRESULT init (Machine *aParent, AudioAdapter *aThat);
|
---|
74 | HRESULT initCopy (Machine *aParent, AudioAdapter *aThat);
|
---|
75 | void uninit();
|
---|
76 |
|
---|
77 | STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
|
---|
78 | STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
|
---|
79 | STDMETHOD(COMGETTER(AudioDriver)) (AudioDriverType_T *aAudioDriverType);
|
---|
80 | STDMETHOD(COMSETTER(AudioDriver)) (AudioDriverType_T aAudioDriverType);
|
---|
81 |
|
---|
82 | // public methods only for internal purposes
|
---|
83 |
|
---|
84 | HRESULT loadSettings (const settings::Key &aMachineNode);
|
---|
85 | HRESULT saveSettings (settings::Key &aMachineNode);
|
---|
86 |
|
---|
87 | bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
|
---|
88 | bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
|
---|
89 | bool rollback();
|
---|
90 | void commit();
|
---|
91 | void copyFrom (AudioAdapter *aThat);
|
---|
92 |
|
---|
93 | // public methods for internal purposes only
|
---|
94 | // (ensure there is a caller and a read lock before calling them!)
|
---|
95 |
|
---|
96 | const Backupable <Data> &data() const { return mData; }
|
---|
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
|
---|