VirtualBox

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

Last change on this file since 16588 was 16588, checked in by vboxsync, 15 years ago

Main: try to set a default audio driver

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 KB
Line 
1/* $Id: AudioAdapterImpl.h 16588 2009-02-09 14:01:38Z 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
29class Machine;
30
31class ATL_NO_VTABLE AudioAdapter :
32 public VirtualBoxBaseNEXT,
33 public VirtualBoxSupportErrorInfoImpl <AudioAdapter, IAudioAdapter>,
34 public VirtualBoxSupportTranslation <AudioAdapter>,
35 public IAudioAdapter
36{
37public:
38
39 struct Data
40 {
41 Data() {
42 mEnabled = false;
43#if defined (RT_OS_WINDOWS)
44# ifdef VBOX_WITH_WINMM
45 mAudioDriver = AudioDriverType_WinMM;
46# else /* VBOX_WITH_WINMM */
47 mAudioDriver = AudioDriverType_DirectSound;
48# endif /* !VBOX_WITH_WINMM */
49#elif defined (RT_OS_SOLARIS)
50 mAudioDriver = AudioDriverType_SolAudio;
51#elif defined (RT_OS_LINUX)
52# if defined (VBOX_WITH_ALSA)
53 mAudioDriver = AudioDriverType_ALSA;
54# else /* VBOX_WITH_ALSA */
55 mAudioDriver = AudioDriverType_OSS;
56# endif /* !VBOX_WITH_ALSA */
57#elif defined (RT_OS_DARWIN)
58 mAudioDriver = AudioDriverType_CoreAudio;
59#elif defined (RT_OS_OS2)
60 mAudioDriver = AudioDriverType_MMP;;
61#else
62 mAudioDriver = AudioDriverType_Null;
63#endif
64 mAudioController = AudioControllerType_AC97;
65 }
66
67 bool operator== (const Data &that) const
68 {
69 return this == &that ||
70 (mEnabled == that.mEnabled &&
71 mAudioDriver == that.mAudioDriver &&
72 mAudioController == that.mAudioController);
73 }
74
75 BOOL mEnabled;
76 AudioDriverType_T mAudioDriver;
77 AudioControllerType_T mAudioController;
78 };
79
80 VIRTUALBOXBASE_ADD_ERRORINFO_SUPPORT (AudioAdapter)
81
82 DECLARE_NOT_AGGREGATABLE(AudioAdapter)
83
84 DECLARE_PROTECT_FINAL_CONSTRUCT()
85
86 BEGIN_COM_MAP(AudioAdapter)
87 COM_INTERFACE_ENTRY(ISupportErrorInfo)
88 COM_INTERFACE_ENTRY(IAudioAdapter)
89 END_COM_MAP()
90
91 NS_DECL_ISUPPORTS
92
93 DECLARE_EMPTY_CTOR_DTOR (AudioAdapter)
94
95 HRESULT FinalConstruct();
96 void FinalRelease();
97
98 // public initializer/uninitializer for internal purposes only
99 HRESULT init (Machine *aParent);
100 HRESULT init (Machine *aParent, AudioAdapter *aThat);
101 HRESULT initCopy (Machine *aParent, AudioAdapter *aThat);
102 void uninit();
103
104 STDMETHOD(COMGETTER(Enabled))(BOOL *aEnabled);
105 STDMETHOD(COMSETTER(Enabled))(BOOL aEnabled);
106 STDMETHOD(COMGETTER(AudioDriver)) (AudioDriverType_T *aAudioDriverType);
107 STDMETHOD(COMSETTER(AudioDriver)) (AudioDriverType_T aAudioDriverType);
108 STDMETHOD(COMGETTER(AudioController)) (AudioControllerType_T *aAudioControllerType);
109 STDMETHOD(COMSETTER(AudioController)) (AudioControllerType_T aAudioControllerType);
110
111 // public methods only for internal purposes
112
113 HRESULT loadSettings (const settings::Key &aMachineNode);
114 HRESULT saveSettings (settings::Key &aMachineNode);
115
116 bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
117 bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
118 bool rollback();
119 void commit();
120 void copyFrom (AudioAdapter *aThat);
121
122 // public methods for internal purposes only
123 // (ensure there is a caller and a read lock before calling them!)
124
125 const Backupable <Data> &data() const { return mData; }
126
127 // for VirtualBoxSupportErrorInfoImpl
128 static const wchar_t *getComponentName() { return L"AudioAdapter"; }
129
130private:
131
132 const ComObjPtr <Machine, ComWeakRef> mParent;
133 const ComObjPtr <AudioAdapter> mPeer;
134
135 Backupable <Data> mData;
136};
137
138#endif // ____H_AUDIOADAPTER
139/* vi: set tabstop=4 shiftwidth=4 expandtab: */
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use