diff options
author | Casimir666 <casimir666@users.sourceforge.net> | 2010-08-03 23:41:05 +0400 |
---|---|---|
committer | Casimir666 <casimir666@users.sourceforge.net> | 2010-08-03 23:41:05 +0400 |
commit | 541ee5f9e7e10b0dbee320b9923f3bd27eee6e75 (patch) | |
tree | b947dfd2e3676adcd78ef689bf9daed731823fd3 /src/filters/renderer | |
parent | 6bd99577c004d3b8d909d7795c25e802cd938adb (diff) |
Added : IBasicAudio settings for DirectSound
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2185 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/renderer')
-rw-r--r-- | src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp | 64 | ||||
-rw-r--r-- | src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h | 17 |
2 files changed, 79 insertions, 2 deletions
diff --git a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp index e0dff543f..2572d1dab 100644 --- a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp +++ b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.cpp @@ -125,6 +125,7 @@ CMpcAudioRenderer::CMpcAudioRenderer(LPUNKNOWN punk, HRESULT *phr) , isAudioClientStarted (false)
, lastBufferTime (0)
, hnsActualDuration (0)
+, m_lVolume(DSBVOLUME_MIN)
{
HMODULE hLib;
@@ -292,6 +293,14 @@ STDMETHODIMP CMpcAudioRenderer::NonDelegatingQueryInterface(REFIID riid, void ** {
return GetReferenceClockInterface(riid, ppv);
}
+ else if (riid == IID_IDispatch)
+ {
+ return GetInterface(static_cast<IDispatch*>(this), ppv);
+ }
+ else if (riid == IID_IBasicAudio)
+ {
+ return GetInterface(static_cast<IBasicAudio*>(this), ppv);
+ }
return CBaseRenderer::NonDelegatingQueryInterface (riid, ppv);
}
@@ -428,6 +437,61 @@ STDMETHODIMP CMpcAudioRenderer::Pause() return CBaseRenderer::Pause();
};
+// === IDispatch
+STDMETHODIMP CMpcAudioRenderer::GetTypeInfoCount(UINT * pctinfo)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CMpcAudioRenderer::GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CMpcAudioRenderer::GetIDsOfNames(REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid)
+{
+ return E_NOTIMPL;
+}
+
+STDMETHODIMP CMpcAudioRenderer::Invoke(DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr)
+{
+ return E_NOTIMPL;
+}
+
+// === IBasicAudio
+STDMETHODIMP CMpcAudioRenderer::put_Volume(long lVolume)
+{
+ m_lVolume = lVolume;
+ if (!useWASAPI && m_pDSBuffer)
+ return m_pDSBuffer->SetVolume(lVolume);
+
+ return S_OK;
+}
+
+STDMETHODIMP CMpcAudioRenderer::get_Volume(long *plVolume)
+{
+ if (!useWASAPI && m_pDSBuffer)
+ return m_pDSBuffer->GetVolume(plVolume);
+
+ return S_OK;
+}
+
+STDMETHODIMP CMpcAudioRenderer::put_Balance(long lBalance)
+{
+ if (!useWASAPI && m_pDSBuffer)
+ return m_pDSBuffer->SetPan(lBalance);
+
+ return S_OK;
+}
+
+STDMETHODIMP CMpcAudioRenderer::get_Balance(long *plBalance)
+{
+ if (!useWASAPI && m_pDSBuffer)
+ return m_pDSBuffer->GetPan(plBalance);
+
+ return S_OK;
+}
+
HRESULT CMpcAudioRenderer::GetReferenceClockInterface(REFIID riid, void **ppv)
{
diff --git a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h index bd0ef8559..6157c0092 100644 --- a/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h +++ b/src/filters/renderer/MpcAudioRenderer/MpcAudioRenderer.h @@ -44,7 +44,7 @@ #define AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED AUDCLNT_ERR(0x019)
class __declspec(uuid("601D2A2B-9CDE-40bd-8650-0485E3522727"))
-CMpcAudioRenderer : public CBaseRenderer
+CMpcAudioRenderer : public CBaseRenderer, public IBasicAudio
{
public:
CMpcAudioRenderer(LPUNKNOWN punk, HRESULT *phr);
@@ -72,6 +72,18 @@ public: STDMETHOD(Stop) ();
STDMETHOD(Pause) ();
+ // === IDispatch (pour IBasicAudio)
+ STDMETHOD(GetTypeInfoCount) (UINT * pctinfo);
+ STDMETHOD(GetTypeInfo) (UINT itinfo, LCID lcid, ITypeInfo ** pptinfo);
+ STDMETHOD(GetIDsOfNames) (REFIID riid, OLECHAR** rgszNames, UINT cNames, LCID lcid, DISPID* rgdispid);
+ STDMETHOD(Invoke) (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pdispparams, VARIANT* pvarResult, EXCEPINFO* pexcepinfo, UINT* puArgErr);
+
+ // === IBasicAudio
+ STDMETHOD(put_Volume) (long lVolume);
+ STDMETHOD(get_Volume) (long *plVolume);
+ STDMETHOD(put_Balance) (long lBalance);
+ STDMETHOD(get_Balance) (long *plBalance);
+
// CMpcAudioRenderer
private:
@@ -83,13 +95,14 @@ private: HRESULT GetReferenceClockInterface(REFIID riid, void **ppv);
HRESULT WriteSampleToDSBuffer(IMediaSample *pMediaSample, bool *looped);
- LPDIRECTSOUND8 m_pDS;
+ LPDIRECTSOUND8 m_pDS;
LPDIRECTSOUNDBUFFER m_pDSBuffer;
DWORD m_dwDSWriteOff;
WAVEFORMATEX *m_pWaveFileFormat;
int m_nDSBufSize;
CBaseReferenceClock* m_pReferenceClock;
double m_dRate;
+ long m_lVolume;
soundtouch::SoundTouch* m_pSoundTouch;
// CMpcAudioRenderer WASAPI methods
|