[Helix-client-dev] Resetting PCM volume for each url change
Greg Wright gwright at real.comPaul Cifarelli wrote:
> (adding amarok-devel so that they can follow along with our discussion)
>
> Ok, now the behavior is different, but it's not exactly what I'm looking for.
> Now, whatever the PCM volume happens to be when I initialize the client core
> is what we are reset to on every url change. Is there a way of just
> preventing the core from messing with the PCM volume at all? What I do
> notice though, upon checking more carefully, is that this *is* the same as
> the behavior of RealPlayer, so I think I must setting the pref right.
>
> The thing is, if I get the device volume, GetVolume doesnt re-read the hw if
> some external source has changed it. Is there a way to force GetVolume (or
> any other call) to read from the hw? I can do this myself of course, as a
> workaround at least, so that I can read it, save it, restore it, but I'd
> rather use device independent calls to do this (particularly once an alsa is
> enabled).
I think you are now looking at code changes. If you are in a position to
do that, then you will start by looking at the GetVolue/SetVolume calls
in client/audiosvc. A good place to start with is in hxaudses.cpp where
that pref, that you added, is read and used. That is for mostly education
on how the sound system is used. After that, take a look at
CHXAudioSession::Close in the same file. In there you will find:
#if defined(HELIX_FEATURE_PREFERENCES)
if (m_pPreferences)
{
/* Store the last volume setting */
IHXBuffer* pBuffer = new CHXBuffer;
pBuffer->AddRef();
pBuffer->SetSize(16);
SafeSprintf((char*) pBuffer->GetBuffer(),16,"%d",(int) m_uVolume); /* Flawfinder: ignore */
m_pPreferences->WritePref("Volume", pBuffer);
pBuffer->Release();
....
My guess is that you just want to add a GetVolume() call just before
the pref is written.
--greg.
>
> Thanks for the help,
> Paul
>
> On Monday 29 August 2005 02:27 pm, paulc2 at optonline.net wrote:
>
>>>If that doesn't help you, then are you willing to make code changes?
>>
>>Sure, in fact, I want to do this programatically in the top level client.
>>I just didnt know what the pref might be, but I suspected there might be
>>one since realplayer does not exhibit the same behavior.
>>
>>Will try it tonight...
>>
>>Thanks,
>>Paul
>>
>>Quoting Greg Wright <gwright at real.com>:
>>
>>>Paul Cifarelli wrote:
>>>
>>>>Hi Guys,
>>>>
>>>>I'm having a problem (linux) where on every change of URL, the PCM
>>>>volume in the device mixer (so, the PCM slider in kmix, for example)
>>>>gets reset to 50%. Some of our users have been complaining, so I
>>>>was hoping there was a way to disable this behavior. A pref maybe?
>>>>
>>>>The reset doesnt actually occur until the first time I call
>>>>EventOccurred, but after that first call, the PCM volume can be
>>>>adjusted without trouble. But, the first EventOccured after another
>>>>OpenURL, back to 50%.
>>>
>>>Try setting the following pref in your prefs file:
>>>
>>> OpenAudioDeviceOnPlayback=0
>>>
>>>This should allow the core to open the audio device on engine startup.
>>>When it does this it should be able to read the current device's audio
>>>volume and use that instead of the default 50 for the first volume set.
>>>If you don't set that then we don't create the audio device until the
>>>first clip is played; which
>>>is the default.
>>>
>>>If that doesn't help you, then are you willing to make code changes?
>>>--greg.
>>>
>>>
>>>>For reference, the code looks like this (just like splay...):
>>>>
>>>>void HelixSimplePlayer::dispatch()
>>>>{
>>>> struct _HXxEvent *pNothing = 0x0;
>>>> struct timeval tv;
>>>> tv.tv_sec = 0;
>>>> tv.tv_usec = SLEEP_TIME*1000;
>>>>
>>>> // on first call to dispatch, PCM volume still ok
>>>> pEngine->EventOccurred(pNothing);
>>>> // here back to 50%. Subsequent calls to dispatch do not affect PCM
>>>>vol }
>>>>
>>>>I searched the forums and found that Warren Melnik posted the same
>>>>question but I didnt find a response. Was hoping he figured it out
>>>>on his own...
>>>>
>>>>Paul
>>>>
>>>>_______________________________________________
>>>>Helix-client-dev mailing list
>>>>Helix-client-dev at helixcommunity.org
>>>>http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
>>
>>----------------------------------------------------------------
>>This message was sent using IMP, the Internet Messaging Program.
>>
>>
>>
>>_______________________________________________
>>Helix-client-dev mailing list
>>Helix-client-dev at helixcommunity.org
>>http://lists.helixcommunity.org/mailman/listinfo/helix-client-dev
>
>