There is only 1 trivial sizeof to strlen change that makes this patch functionality equivalent to the code in 150Cay and, now, in 347Atlas too.

So, I'll just call it the same as the previous 2 commits.

This is now on 310Atlas and HEAD.

Thanks for the review.

--
Daniel Yek.



Gregory Wright wrote:
Are there new diffs or are you just merging the exact change as shown
in:

http://lists.helixcommunity.org/pipermail/audio-dev/2009-January/000960.html <http://lists.helixcommunity.org/pipermail/audio-dev/2009-January/000960.html>

If so, looks good.
--greg.


On Jul 14, 2009, at 5:44 PM, Daniel Yek wrote:


Modified by: [email protected]
Date: 7/14/2009
Project: RealPlayer for Netbook

Synopsis: Merging Software Volume Control, Multichannel, PulseAudio fixes from 347Atlas to 310Atlas

Overview:
This is a merge (from 150Cay to 347Atlas, which was completed and now) from 347Atlas to 310Atlas of the following change:
http://lists.helixcommunity.org/pipermail/audio-dev/2009-January/000960.html

Previously, a bug (now I know was sizeof syntax bugs) was found at the last minute (not affecting the player project) when verifying a configuration not used by the player, but would be used by other Helix client. That prevented a merge to 310Atlas.

I have resolved the problem now (actually 2 of them).

I am now proceeding to merge this change into 310Atlas so that I can check in the PulseAudio work later.

Files Modified:
audio/device/platform/unix/audlinux_alsa.cpp
- Implement Software Volume Control; Support surround sound playback.
audio/device/pub/platform/unix/audlinux_alsa.h
audio/gaintool/gain.c
audio/gaintool/pub/gain.h
client/audiosvc/pub/mixengine.h

audio/device/platform/unix/audlinux_oss.cpp - _OpenAudio() prototype changed.
audio/device/platform/unix/audUnix.cpp - _OpenAudio() prototype changed.
audio/device/pub/platform/unix/audlinux_oss.h - _OpenAudio() prototype changed. audio/device/pub/platform/unix/audUnix.h - _OpenAudio() prototype changed.


audio/device/auddevlib_linux2.pcf - Added HELIX_CONFIG_SOFTWARE_VOLUME_CONTROL

audio/device/pub/platform/unix/audhpux.h
audio/device/pub/platform/unix/audirix.h
audio/device/pub/platform/unix/audlinux_esound.h
audio/device/pub/platform/unix/audSolaris.h
audio/device/pub/platform/unix/audusound.h
audio/device/platform/unix/audhpux.cpp
audio/device/platform/unix/audirix.cpp
audio/device/platform/unix/audlinux_esound.cpp
audio/device/platform/unix/audSolaris.cpp
audio/device/platform/unix/audusound.cpp


Branch: 310Atlas, HEAD.

Copyright assignment: I am a RealNetworks employee.



--
Daniel Yek.



Daniel Yek wrote:

Modified by: [email protected]
Date: 1/26/2009
Project: RealPlayer for Netbook

Synopsis: Merge Software Volume Control, Multichannel, PulseAudio fixes.

Overview:
This is mostly just a merge of ALSA device code from 150Cay to 347Atlas.

REMAINING WORK:
---------------
I still have some work to do before I can submit these changes
for code review for 310Atlas and HEAD:
(1) I'm currently still getting this error:
  ALSA lib control.c:909:(snd_ctl_open_noupdate) Invalid CTL defa
when the HELIX_FEATURE_SOFTWARE_VOLUME_CONTROL macro isn't defined.
I need to fix this later.

(2) I am yet to test this change with other players that we have.
Some of them might work differently and can potentially break.


ABOUT THE MERGE:
----------------
This is mostly a merge of the following CRs:

(A) Support multi-channel playback on Linux using ALSA:
http://lists.helixcommunity.org/pipermail/audio-dev/2006-October/000770.html http://lists.helixcommunity.org/pipermail/audio-dev/2006-October/000772.html http://lists.helixcommunity.org/pipermail/player-dev/2006-October/002537.html

(B) Changing Volume Control to not touch system volume:
http://lists.helixcommunity.org/pipermail/player-dev/2006-September/002491.html

Changing Volume Control to not touch system volume;
Software Volume Control (#2)
http://lists.helixcommunity.org/pipermail/audio-dev/2006-October/000770.html http://lists.helixcommunity.org/pipermail/player-dev/2006-October/002538.html

(C) Fixing %lld (actualSize < estimatedSize) logging assert:
http://lists.helixcommunity.org/pipermail/common-dev/2008-January/004290.html

(D) Fix playback problem when PulseAudio is enabled:
http://lists.helixcommunity.org/pipermail/audio-dev/2008-May/000887.html


NEW CHANGES:
------------
(1)
The code that implements Software Volume Control is now wrapped in the
  HELIX_CONFIG_SOFTWARE_VOLUME_CONTROL
preprocessor block.
This macro should be defined only for Linux builds when
not targeting PulseAudio, but targetting (straight) ALSA.

(2)
Renamed DisableMultiChannelPlayback (old)
to PlaybackMultiChannelAsStereo (new).

gwright suggested to use "DisableMultiChannelPlayback" Preference here:
http://lists.helixcommunity.org/pipermail/audio-dev/2006-October/000773.html
dyek:
  // Add "DisableSurroundSoundPlayback" into the Preference.
gwright:
  I think that "DisableMultiChannelPlayback" might be a clearer name.

I found both "DisableSurroundSoundPlayback" and
"DisableMultiChannelPlayback" were not obvious in its meaning.
So, I decided to take the opportunity to rename the Preference to
"PlaybackMultiChannelAsStereo", which, hopefully, is more understandable.

Setting the Preferences would cause surround sound channels to be
played from the front stereo speakers.
It is especially useful if the user's system speakers are not configured
properly to play surround sound content successfully.


(3)
Removed this function call:
  snd_pcm_sw_params_set_xfer_align(m_pAlsaPCMHandle, swparams, 1);
because snd_pcm_sw_params_set_xfer_align() has been deprecated in
Fedora 9 (alsa-lib-1.0.16) and
it needs no replacement function call.

(4)
Not merging this function:
  snd_pcm_sw_params_set_sleep_min(m_pAlsaPCMHandle, swparams, 100);
to 310Atlas because it wasn't used there and has been deprecated in
Fedora 9 (alsa-lib-1.0.16).

Reference:
[alsa-devel] Blacklist (Re: ALSA API as standards):
http://mailman.alsa-project.org/pipermail/alsa-devel/2007-November/004425.html
  /* xfer_align is also superfluous */
  snd_pcm_sw_params_set_xfer_align

  /* sleep_min is never used by apps (except for aplay as an option) */
  snd_pcm_sw_params_set_sleep_min


ADAPTED DESCRIPTION FROM OLD CRs:
---------------------------------
(A) Support multi-channel playback on Linux using ALSA

We hear 2 channels only when playing 5.1 channel content.
This change enables multi-channel playback on ALSA.

(1)
Many member functions implementation in Helix Client Core's ALSA audio
device code, audlinux_alsa.cpp, share the same member variable,
m_wLastError.

When an error occurred in a member function, the ending _CloseAudio()
call can wipe out the existing error condition.

The code looked like this:

m_wLastError = RA_AOE_BADFORMAT;
_CloseAudio(); // This function always set: "m_wLastError = RA_AOE_NOERR;"
return m_wLastError;

So, we always returned RA_AOE_NOERR in _CheckFormat(), even when the system
can't play the format.

(2)
The implementation was catered for 2-channel playback only.
Playing back 5.1 channels content caused ALSA's "default" PCM device to
invoke its ("plug" and) "route" plugin and shrink the channels to 2 channels,
discarding surround sound content.

The right ALSA PCM device to use to play 5.1 content is the
"plug:surround51" PCM, which only takes 6-channel input.

If the system isn't set up to play 5.1 content, snd_pcm_open(),
this PCM would fail and Helix client would then fallback to 2-channel
and use the "default" PCM.

Note that on some misconfigured system, "surround51" was defined
even though the system isn't 5.1 capable.
This is system configuration problem.
On such system, ALSA would invoke the "plug" plugin, which uses "route"
plugin to discard surround sound content and playback in 2-channel mode.
On these systems, we really want to have Helix client "preserve" all
channels by downmixing it to 2 channels.

This is now handled by the "PlaybackMultiChannelAsStereo" preference.

If a system's surround sound playback isn't working, use:
~/.config/real/realplayerrc or ~/.helix/HelixSDK_10_0:
  PlaybackMultiChannelAsStereo=1

That would force all channels to be merged into 2 channels (stereo).

There is a checkbox provided in the players' Preference Dialog box too.


(3)
ALSA now always configures the sound card to 48000Hz.
So, Helix's ALSA audio device _CheckFormat() code now forces Helix client
to use 48000Hz.

However, a user could change the "AlsaVaryingSampleRate" preference entry
in the following file like this:
~/.config/real/realplayerrc or ~/.helix/HelixSDK_10_0:
  AlsaVaryingSampleRate=1

With this, the previous player behavior is preserved to use whatever
sample rate ALSA plug layer is accepting. ALSA's plug layer would
then resample to 48000Hz before sending it to the device.

(4)
Implemented Surround Sound playback channels mapping from Helix/Windows
internal channels mapping to ALSA's mapping.



(B) Changing Volume Control to not touch system volume;
Software Volume Control (#2)

The player was changing the System/PCM/Device Volume.
Users expressed desire for application volume control to
not influence system volume.

The previous CR is this:
http://lists.helixcommunity.org/pipermail/player-dev/2006-September/002491.html

We have changed the approach used to address this problem.
In this patch, we are sticking to volume control interface returned by:
  3. Audio device volume control = IHXAudioPlayer::GetDeviceVolume()

GetDeviceVolume() was used in the released players.
Until now, this volume control has been the:
system audio device volume control
which is ALSA's PCM device.

This patch turns this device Volume Control into:
Helix audio device volume control
This one being software volume control if
HELIX_CONFIG_SOFTWARE_VOLUME_CONTROL macro is defined.

This patch utilizes Helix Gaintool to attenuate the volume.
(Despite the name.)
Gaintool changes the audio volume smoothly, without introducing abrupt
changes.

Also, by implementing the software volume control in Helix's ALSA device code, the response delay is capped to about 0.3 second with smooth changes
extends slightly beyond 0.6 second.

When the player volume is set to 100, and when Gaintool has came to the
steady state, audio data is then sent directly to the
system audio device by passing Gaintool processing.
That means that the user always get the best audio quality when
the volume is set to 100,
(which means 100% of the current system volume,) and
then the system-provided volume control is used to
set the desired volume control,
because no change of audio data occurs -- Gaintool does not process it.

Volume saving and restoring is implemented using the "volume" preference.

This fix only implement software volume control in
Helix's ALSA device code, not in OSS.
When the volume control preference is set to OSS,
the volume control still changes system volume.


Changes in player/hxclientkit/src/CHXClientPlayer.cpp:

Wrapped Software Volume Control code in
HELIX_CONFIG_SOFTWARE_VOLUME_CONTROL preprocessor block.

Now, only if HELIX_FEATURE_SOFTWARE_VOLUME_CONTROL is defined,
hxclientkit will read the "volume" Preference and
set the Helix client volume when it initializes.
This is for the case where PulseAudio ALSA device is not used.

Without HELIX_FEATURE_SOFTWARE_VOLUME_CONTROL defined,
hxclientkit and the player will not touch the Helix client volume
(which, in this case, is tied to the system volume.)
This is the original case before Software Volume Control was added
and also the case when PulseAudio support is working well.



Files Modified:
audio/device/platform/unix/audlinux_alsa.cpp
  - Implement Software Volume Control; Support surround sound playback.
audio/device/pub/platform/unix/audlinux_alsa.h
audio/gaintool/gain.c
audio/gaintool/pub/gain.h
client/audiosvc/pub/mixengine.h

audio/device/platform/unix/audlinux_oss.cpp - _OpenAudio() prototype changed. audio/device/platform/unix/audUnix.cpp - _OpenAudio() prototype changed. audio/device/pub/platform/unix/audlinux_oss.h - _OpenAudio() prototype changed. audio/device/pub/platform/unix/audUnix.h - _OpenAudio() prototype changed.


audio/device/auddevlib_linux2.pcf - Added HELIX_CONFIG_SOFTWARE_VOLUME_CONTROL

audio/device/pub/platform/unix/audhpux.h
audio/device/pub/platform/unix/audirix.h
audio/device/pub/platform/unix/audlinux_esound.h
audio/device/pub/platform/unix/audSolaris.h
audio/device/pub/platform/unix/audusound.h
audio/device/platform/unix/audhpux.cpp
audio/device/platform/unix/audirix.cpp
audio/device/platform/unix/audlinux_esound.cpp
audio/device/platform/unix/audSolaris.cpp
audio/device/platform/unix/audusound.cpp




Image Size and Heap Use impact (Client -Only):
None.

Platforms and Profiles Affected:
Linux

Distribution Libraries Affected:
None.

Distribution library impact and planned action:
None.

Platforms and Profiles Build Verified:
Profile: helix_client_all_define
Platform: Fedora

Platforms and Profiles Functionality verified:
Profile: helix_client_all_define
Platform: Fedora

Branch: 347Atlas

Copyright assignment: I am a RealNetworks employee.

_______________________________________________
Audio-dev mailing list
[email protected]
http://lists.helixcommunity.org/mailman/listinfo/audio-dev

Reply via email to