* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#define COBJMACROS
+#include "config.h"
+
+#include <stdarg.h>
+
+#include "windef.h"
+#include "winbase.h"
+#include "winnls.h"
+#include "winreg.h"
+#include "wine/debug.h"
+#include "wine/unicode.h"
+
+#include "ole2.h"
+#include "mmdeviceapi.h"
+#include "mmsystem.h"
+#include "dsound.h"
+#include "audioclient.h"
+#include "endpointvolume.h"
+#include "audiopolicy.h"
+
#include "mmdevapi.h"
-static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl;
+WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
typedef struct AEVImpl {
IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface;
LONG ref;
+ float master_vol;
+ BOOL mute;
} AEVImpl;
static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *iface)
return CONTAINING_RECORD(iface, AEVImpl, IAudioEndpointVolumeEx_iface);
}
-HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
-{
- AEVImpl *This;
- This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
- *ppv = (IAudioEndpointVolume*)This;
- if (!This)
- return E_OUTOFMEMORY;
- This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
- This->ref = 1;
- return S_OK;
-}
-
static void AudioEndpointVolume_Destroy(AEVImpl *This)
{
HeapFree(GetProcessHeap(), 0, This);
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
IsEqualIID(riid, &IID_IAudioEndpointVolumeEx)) {
- *ppv = This;
+ *ppv = &This->IAudioEndpointVolumeEx_iface;
}
else
return E_NOINTERFACE;
static HRESULT WINAPI AEV_SetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float leveldb, const GUID *ctx)
{
+ AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
+
TRACE("(%p)->(%f,%s)\n", iface, leveldb, debugstr_guid(ctx));
- FIXME("stub\n");
- return E_NOTIMPL;
+
+ if(leveldb < -100.f || leveldb > 0.f)
+ return E_INVALIDARG;
+
+ This->master_vol = leveldb;
+
+ return S_OK;
}
static HRESULT WINAPI AEV_SetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float level, const GUID *ctx)
static HRESULT WINAPI AEV_GetMasterVolumeLevel(IAudioEndpointVolumeEx *iface, float *leveldb)
{
+ AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
+
TRACE("(%p)->(%p)\n", iface, leveldb);
+
if (!leveldb)
return E_POINTER;
- FIXME("stub\n");
- return E_NOTIMPL;
+
+ *leveldb = This->master_vol;
+
+ return S_OK;
}
static HRESULT WINAPI AEV_GetMasterVolumeLevelScalar(IAudioEndpointVolumeEx *iface, float *level)
static HRESULT WINAPI AEV_SetMute(IAudioEndpointVolumeEx *iface, BOOL mute, const GUID *ctx)
{
+ AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
+ HRESULT ret;
+
TRACE("(%p)->(%u,%s)\n", iface, mute, debugstr_guid(ctx));
- FIXME("stub\n");
- return E_NOTIMPL;
+
+ ret = This->mute == mute ? S_FALSE : S_OK;
+
+ This->mute = mute;
+
+ return ret;
}
static HRESULT WINAPI AEV_GetMute(IAudioEndpointVolumeEx *iface, BOOL *mute)
{
+ AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface);
+
TRACE("(%p)->(%p)\n", iface, mute);
+
if (!mute)
return E_POINTER;
- FIXME("stub\n");
- return E_NOTIMPL;
+
+ *mute = This->mute;
+
+ return S_OK;
}
static HRESULT WINAPI AEV_GetVolumeStepInfo(IAudioEndpointVolumeEx *iface, UINT *stepsize, UINT *stepcount)
static HRESULT WINAPI AEV_GetVolumeRange(IAudioEndpointVolumeEx *iface, float *mindb, float *maxdb, float *inc)
{
TRACE("(%p)->(%p,%p,%p)\n", iface, mindb, maxdb, inc);
+
if (!mindb || !maxdb || !inc)
return E_POINTER;
- FIXME("stub\n");
- return E_NOTIMPL;
+
+ *mindb = -100.f;
+ *maxdb = 0.f;
+ *inc = 1.f;
+
+ return S_OK;
}
static HRESULT WINAPI AEV_GetVolumeRangeChannel(IAudioEndpointVolumeEx *iface, UINT chan, float *mindb, float *maxdb, float *inc)
AEV_GetVolumeRange,
AEV_GetVolumeRangeChannel
};
+
+HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolumeEx **ppv)
+{
+ AEVImpl *This;
+
+ *ppv = NULL;
+ This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
+ if (!This)
+ return E_OUTOFMEMORY;
+ This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
+ This->ref = 1;
+
+ *ppv = &This->IAudioEndpointVolumeEx_iface;
+ return S_OK;
+}