VirtualBox

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

Last change on this file since 7954 was 7207, checked in by vboxsync, 17 years ago

Main: Reworked enums to avoid 1) weird duplication of enum name when referring to enum values in cross-platform code; 2) possible clashes on Win32 due to putting identifiers like Paused or Disabled to the global namespace (via C enums). In the new style, enums are used like this: a) USBDeviceState_T v = USBDeviceState_Busy from cross-platform non-Qt code; b) KUSBDeviceState v = KUSBDeviceState_Busy from Qt code; c) USBDeviceState v = USBDeviceState_Busy from plain Win32 and d) PRUInt32 USBDeviceState v = USBDeviceState::Busy from plain XPCOM.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.4 KB
Line 
1/* $Id: AudioAdapterImpl.h 7207 2008-02-28 18:43:08Z 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
25class Machine;
26
27class ATL_NO_VTABLE AudioAdapter :
28 public VirtualBoxBaseNEXT,
29 public VirtualBoxSupportErrorInfoImpl <AudioAdapter, IAudioAdapter>,
30 public VirtualBoxSupportTranslation <AudioAdapter>,
31 public IAudioAdapter
32{
33public:
34
35 struct Data
36 {
37 Data() {
38 mEnabled = false;
39 mAudioDriver = AudioDriverType_Null;
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
106private:
107
108 const ComObjPtr <Machine, ComWeakRef> mParent;
109 const ComObjPtr <AudioAdapter> mPeer;
110
111 Backupable <Data> mData;
112};
113
114#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