[prev in list] [next in list] [prev in thread] [next in thread] 

List:       helix-audio-dev
Subject:    [hxaudio] CR: DirectSound problem
From:       Wolfgang Schildbach <wschildbach () helixcommunity ! org>
Date:       2003-01-28 22:47:34
Message-ID: 5.1.0.14.2.20030128144323.03ccc7e8 () mail ! real ! com
[Download RAW message or body]

This implements what I believe to be the WaveOut behaviour. Note that there 
is some funkyness in how the core drives the audio device since the device 
is asked about volume before it is even opened(!). In this case I return 
100 (the max), which is what is enforced at deviceOpen time.

- Wolfgang

Index: hxaudevds.cpp
===================================================================
RCS file: /cvs/audio/device/platform/win/hxaudevds.cpp,v
retrieving revision 1.1
diff -u -w -r1.1 hxaudevds.cpp
--- hxaudevds.cpp       23 Jan 2003 23:44:29 -0000      1.1
+++ hxaudevds.cpp       28 Jan 2003 22:42:15 -0000
@@ -150,7 +150,9 @@

      if (SUCCEEDED(theErr))
      {
-       m_pDSDev->SetCooperativeLevel(m_hwnd, DSSCL_PRIORITY);
+        HX_RESULT res ;
+       res = m_pDSDev->SetCooperativeLevel(m_hwnd, DSSCL_PRIORITY);
+
         m_eState = E_DEV_OPENED;

         m_WaveFormat.wFormatTag = WAVE_FORMAT_PCM;
@@ -179,7 +181,8 @@
                            DSBCAPS_STICKYFOCUS ;

         m_ulTotalBuffer = bufferDesc.dwBufferBytes;
-       HX_RESULT res = m_pDSDev->CreateSoundBuffer(&bufferDesc, 
&m_pSecondaryBuffer, NULL);
+        if (res == DS_OK)
+           res = m_pDSDev->CreateSoundBuffer(&bufferDesc, 
&m_pSecondaryBuffer, NULL);

         switch (res)
         {
@@ -337,7 +340,14 @@

  UINT16 CHXAudioDeviceDS::_Imp_GetVolume()
  {
-    return m_uCurVolume;
+    LONG lVolume;
+
+    if (!m_pSecondaryBuffer)
+        return m_uMaxVolume ;
+
+    m_pSecondaryBuffer->GetVolume(&lVolume);
+
+    return (UINT16)(exp(lVolume / 1055.0) * (m_uMaxVolume - m_uMinVolume) 
+ m_uMinVolume) ;
  }

  HX_RESULT CHXAudioDeviceDS::_Imp_Reset()


At 02:31 PM 1/28/2003 -0800, Greg Wright wrote:
>moving to the  dev@audio mailing list....get on there is your aren't. :)
>
>
>I am new to this discussion but, if it helps, the core should be
>setting the volume of the device to the last volume it was at when
>the core shutdown. The last volume used is stored in the prefs.
>
>--greg.
>
>
>
>----- Original Message -----
>From: "Wolfgang Schildbach" <wschildbach@real.com>
>To: <mbahl@real.com>; <csloan@real.com>
>Cc: <gwright@real.com>
>Sent: Tuesday, January 28, 2003 2:29 PM
>Subject: DirectSound problem
>
>
> > (Greg, this is about a discrepancy in behaviour old waveout driver vs. new
> > DirectSound drive in audio/device)
> >
> > Chris,
> >
> > You were right -- the problem is in the volume, which is set to zero.
> > Somewhere at the beginning, the audio session asks the device what volume
> > it is set at. The DirectShow driver return 0 (silent), whereas the old 
> wave
> > driver returned 100 (full blast).
> >
> > I believe we should change the DirectSound driver to reflect the wave
> > driver, which is to return "default is full volume".
> >
> >
> > - Wolfgang Schildbach, Principal Codec Engineer, RealNetworks Codec Group
> > - fon +1-206-892 6349, email wolfgang@real.com
> >
> >

-
- Wolfgang Schildbach, Principal Codec Engineer, RealNetworks Codec Group
- fon +1-206-892 6349, email wolfgang@real.com



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic