VirtualBox

source: vbox/trunk/src/VBox/Main/include/AudioAdapterImpl.h@ 4044

Last change on this file since 4044 was 3348, checked in by vboxsync, 17 years ago

Main: Converted AudioAdapter and NetworkAdapter to the new locking scheme.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1/** @file
2 *
3 * VirtualBox COM class implementation
4 */
5
6/*
7 * Copyright (C) 2006-2007 innotek GmbH
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License as published by the Free Software Foundation,
13 * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
14 * distribution. VirtualBox OSE is distributed in the hope that it will
15 * be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * If you received this file as part of a commercial VirtualBox
18 * distribution, then only the terms of your commercial VirtualBox
19 * license agreement apply instead of the previous paragraph.
20 */
21
22#ifndef ____H_AUDIOADAPTER
23#define ____H_AUDIOADAPTER
24
25#include "VirtualBoxBase.h"
26
27class Machine;
28
29class ATL_NO_VTABLE AudioAdapter :
30 public VirtualBoxBaseNEXT,
31 public VirtualBoxSupportErrorInfoImpl <AudioAdapter, IAudioAdapter>,
32 public VirtualBoxSupportTranslation <AudioAdapter>,
33 public IAudioAdapter
34{
35public:
36
37 struct Data
38 {
39 Data() {
40 mEnabled = false;
41 mAudioDriver = AudioDriverType_NullAudioDriver;
42 }
43
44 bool operator== (const Data &that) const
45 {
46 return this == &that ||
47 (mEnabled == that.mEnabled &&
48 mAudioDriver == that.mAudioDriver);
49 }
50
51 BOOL mEnabled;
52 AudioDriverType_T mAudioDriver;
53 };
54
55 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (AudioAdapter)
56
57 DECLARE_NOT_AGGREGATABLE(AudioAdapter)
58
59 DECLARE_PROTECT_FINAL_CONSTRUCT()
60
61 BEGIN_COM_MAP(AudioAdapter)
62 COM_INTERFACE_ENTRY(ISupportErrorInfo)
63 COM_INTERFACE_ENTRY(IAudioAdapter)
64 END_COM_MAP()
65
66 NS_DECL_ISUPPORTS
67
68 DECLARE_EMPTY_CTOR_DTOR (AudioAdapter)
69
70 HRESULT FinalConstruct();
71 void FinalRelease();
72
73 // public initializer/uninitializer for internal purposes only
74 HRESULT init (Machine *aParent);
75 HRESULT init (Machine *aParent, AudioAdapter *aThat);
76 HRESULT initCopy (Machine *aParent, AudioAdapter *aThat);
77 void uninit();
78
79 STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
80 STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
81 STDMETHOD(COMGETTER(AudioDriver)) (AudioDriverType_T *aAudioDriverType);
82 STDMETHOD(COMSETTER(AudioDriver)) (AudioDriverType_T aAudioDriverType);
83
84 // public methods only for internal purposes
85
86 bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
87 bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
88 bool rollback();
89 void commit();
90 void copyFrom (AudioAdapter *aThat);
91
92 // public methods for internal purposes only
93 // (ensure there is a caller and a read lock before calling them!)
94
95 const Backupable <Data> &data() const { return mData; }
96
97 // for VirtualBoxSupportErrorInfoImpl
98 static const wchar_t *getComponentName() { return L"AudioAdapter"; }
99
100private:
101
102 const ComObjPtr <Machine, ComWeakRef> mParent;
103 const ComObjPtr <AudioAdapter> mPeer;
104
105 Backupable <Data> mData;
106};
107
108#endif // ____H_AUDIOADAPTER
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette