1 | /* $Id: AudioAdapterImpl.h 6597 2008-01-30 12:55:54Z 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 | mAudioController = AudioControllerType_AC97;
|
---|
41 | }
|
---|
42 |
|
---|
43 | bool operator== (const Data &that) const
|
---|
44 | {
|
---|
45 | return this == &that ||
|
---|
46 | (mEnabled == that.mEnabled &&
|
---|
47 | mAudioDriver == that.mAudioDriver &&
|
---|
48 | mAudioController == that.mAudioController);
|
---|
49 | }
|
---|
50 |
|
---|
51 | BOOL mEnabled;
|
---|
52 | AudioDriverType_T mAudioDriver;
|
---|
53 | AudioControllerType_T mAudioController;
|
---|
54 | };
|
---|
55 |
|
---|
56 | VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (AudioAdapter)
|
---|
57 |
|
---|
58 | DECLARE_NOT_AGGREGATABLE(AudioAdapter)
|
---|
59 |
|
---|
60 | DECLARE_PROTECT_FINAL_CONSTRUCT()
|
---|
61 |
|
---|
62 | BEGIN_COM_MAP(AudioAdapter)
|
---|
63 | COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
---|
64 | COM_INTERFACE_ENTRY(IAudioAdapter)
|
---|
65 | END_COM_MAP()
|
---|
66 |
|
---|
67 | NS_DECL_ISUPPORTS
|
---|
68 |
|
---|
69 | DECLARE_EMPTY_CTOR_DTOR (AudioAdapter)
|
---|
70 |
|
---|
71 | HRESULT FinalConstruct();
|
---|
72 | void FinalRelease();
|
---|
73 |
|
---|
74 | // public initializer/uninitializer for internal purposes only
|
---|
75 | HRESULT init (Machine *aParent);
|
---|
76 | HRESULT init (Machine *aParent, AudioAdapter *aThat);
|
---|
77 | HRESULT initCopy (Machine *aParent, AudioAdapter *aThat);
|
---|
78 | void uninit();
|
---|
79 |
|
---|
80 | STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
|
---|
81 | STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
|
---|
82 | STDMETHOD(COMGETTER(AudioDriver)) (AudioDriverType_T *aAudioDriverType);
|
---|
83 | STDMETHOD(COMSETTER(AudioDriver)) (AudioDriverType_T aAudioDriverType);
|
---|
84 | STDMETHOD(COMGETTER(AudioController)) (AudioControllerType_T *aAudioControllerType);
|
---|
85 | STDMETHOD(COMSETTER(AudioController)) (AudioControllerType_T aAudioControllerType);
|
---|
86 |
|
---|
87 | // public methods only for internal purposes
|
---|
88 |
|
---|
89 | HRESULT loadSettings (const settings::Key &aMachineNode);
|
---|
90 | HRESULT saveSettings (settings::Key &aMachineNode);
|
---|
91 |
|
---|
92 | bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
|
---|
93 | bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
|
---|
94 | bool rollback();
|
---|
95 | void commit();
|
---|
96 | void copyFrom (AudioAdapter *aThat);
|
---|
97 |
|
---|
98 | // public methods for internal purposes only
|
---|
99 | // (ensure there is a caller and a read lock before calling them!)
|
---|
100 |
|
---|
101 | const Backupable <Data> &data() const { return mData; }
|
---|
102 |
|
---|
103 | // for VirtualBoxSupportErrorInfoImpl
|
---|
104 | static const wchar_t *getComponentName() { return L"AudioAdapter"; }
|
---|
105 |
|
---|
106 | private:
|
---|
107 |
|
---|
108 | const ComObjPtr <Machine, ComWeakRef> mParent;
|
---|
109 | const ComObjPtr <AudioAdapter> mPeer;
|
---|
110 |
|
---|
111 | Backupable <Data> mData;
|
---|
112 | };
|
---|
113 |
|
---|
114 | #endif // ____H_AUDIOADAPTER
|
---|