Opened 12 years ago

Closed 11 years ago

#6279 closed enhancement (duplicate)

Software volume control

Reported by: foobum@… Owned by: JYA
Priority: trivial Milestone: unknown
Component: MythTV - General Version: unknown
Severity: low Keywords: software volume control
Cc: Ticket locked: no

Description

This patch allows the internal volume controls to work when audio is output via a digital device (including 'passthru' and upmixed AC-3). Depends on #5900.

Turning on internal volume controls whilst leaving the mixer device as a hardware device will give you software control over the volume of 'passthru' AC-3. Also setting the mixer device to "software" gives you software volume control of all audio.

Includes a crude attempt at normalising the volume of PCM from video, PCM from mythmusic and 'passthru' AC-3. There's a small delay between user input and change in volume due to buffering.

Attachments (11)

softvol-fixes.patch (10.8 KB) - added by foobum@… 12 years ago.
softvol-trunk.patch (10.5 KB) - added by foobum@… 12 years ago.
softvol-fixes-2.patch (11.1 KB) - added by foobum@… 12 years ago.
softvol-trunk-2.patch (10.8 KB) - added by foobum@… 12 years ago.
softvol-fixes-3.patch (11.4 KB) - added by foobum@… 12 years ago.
softvol-trunk-3.patch (11.1 KB) - added by foobum@… 12 years ago.
softvol-fixes-4.patch (12.8 KB) - added by foobum@… 12 years ago.
softvol-trunk-4.patch (11.9 KB) - added by foobum@… 12 years ago.
softvol-fixes-5.patch (11.4 KB) - added by foobum@… 11 years ago.
against r20844
softvol-trunk-5.patch (11.1 KB) - added by foobum@… 11 years ago.
against r20844
sofvol-trunk-6.patch (10.9 KB) - added by JYA 11 years ago.
Against trunk r21594

Download all attachments as: .zip

Change History (32)

Changed 12 years ago by foobum@…

Attachment: softvol-fixes.patch added

Changed 12 years ago by foobum@…

Attachment: softvol-trunk.patch added

comment:1 Changed 12 years ago by anonymous

I had to add #include <limits> to have it compiled using fixes-19961

comment:2 Changed 12 years ago by anonymous

I had to add #include <limits> to have it compiled using fixes-19961 in mythtv/libs/libmyth/audiooutputbase.cpp

comment:3 Changed 12 years ago by anonymous

Confirmed: Works perfect with fixes-19961 with audio via HDMI interface using Mixer "software".

comment:4 Changed 12 years ago by Markus Schulz <msc@…>

wow, many thanks. works fine after my first tests. really really nice, now i can control everything with only one remote...

comment:5 Changed 12 years ago by Andreas <miscdreas@…>

Works with -fixes svn 20023. I am particularly happy about the working dts passthru. It would be nice to see the patches being committed.

comment:6 Changed 12 years ago by stuartm

Please can we keep discussion and 'me too' posts out of the ticket system.

comment:7 Changed 12 years ago by Markus Schulz <msc@…>

small Problem, after seeking thru commercials with different audio track (5.1 -> 2.0) the volume would be reset to the default value. And in general the changed volume would'nt be saved after exit from the player.

comment:8 Changed 12 years ago by Markus Schulz <msc@…>

another problem, DTS audio don't work anymore (don't know if #5900 or #6279 was the real problem). i would expect (cause of softmixing) a DTS decode with AC3 encode, but no audio was the result. Disable upmixer won't help too.

Changed 12 years ago by foobum@…

Attachment: softvol-fixes-2.patch added

Changed 12 years ago by foobum@…

Attachment: softvol-trunk-2.patch added

comment:9 Changed 12 years ago by foobum@…

Both problems should be fixed..

Changed 12 years ago by foobum@…

Attachment: softvol-fixes-3.patch added

Changed 12 years ago by foobum@…

Attachment: softvol-trunk-3.patch added

comment:10 Changed 12 years ago by foobum@…

New patches fix volume set to zero when skipping over stream change.

comment:11 Changed 12 years ago by Markus Schulz <msc@…>

Disable upmixer should disable Software Mixer too...

comment:12 Changed 12 years ago by foobum@…

Don't think it should - I want software control of stereo (which, for me, is sent out a digital device) too.

Changed 12 years ago by foobum@…

Attachment: softvol-fixes-4.patch added

Changed 12 years ago by foobum@…

Attachment: softvol-trunk-4.patch added

comment:13 Changed 12 years ago by foobum@…

New patches fix DTS channel order.

comment:14 Changed 12 years ago by Markus Schulz <msc@…>

But if i remember right, if the channel/recording/video only provides AC3/DTS audio and i disable the upmixer the result was buggy. I will check this again and produce some logs.

comment:15 Changed 12 years ago by Matthew Wire <devel@…>

I get the following compile error with latest trunk:

audiooutputbase.cpp: In member function ‘void AudioOutputBase::_AdjustVolume(AudioDataType?*, int, bool)’:
audiooutputbase.cpp:654: error: ‘numeric_limits’ was not declared in this scope
audiooutputbase.cpp:654: error: expected primary-expression before ‘>’ token
audiooutputbase.cpp:654: error: no matching function for call to ‘max()’
audiooutputbase.cpp:656: error: expected primary-expression before ‘>’ token
audiooutputbase.cpp:656: error: no matching function for call to ‘max()’
audiooutputbase.cpp:658: error: expected primary-expression before ‘>’ token
audiooutputbase.cpp:658: error: no matching function for call to ‘min()’
audiooutputbase.cpp:661: error: expected primary-expression before ‘>’ token
audiooutputbase.cpp:661: error: no matching function for call to ‘max()’

comment:16 Changed 11 years ago by jyavenard@…

Need to add: #include <limits>

to mythtv/libs/libmyth/audiooutputbase.cpp

Changed 11 years ago by foobum@…

Attachment: softvol-fixes-5.patch added

against r20844

Changed 11 years ago by foobum@…

Attachment: softvol-trunk-5.patch added

against r20844

comment:17 Changed 11 years ago by foobum@…

New patches against r20844 and audioencoding-*-7.patch on #5900.

comment:18 Changed 11 years ago by mythtv@…

When mixer control is set to master, volume is reset every time audio output is initialized.

This patch needs to be applied on top of softvol-trunk-5.patch

diff --git a/mythtv/libs/libmyth/audiooutputbase.cpp b/mythtv/libs/libmyth/audiooutputbase.cpp
index cf2fc42..c3e0fbf 100644
--- a/mythtv/libs/libmyth/audiooutputbase.cpp
+++ b/mythtv/libs/libmyth/audiooutputbase.cpp
@@ -341,7 +341,11 @@ void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
 
     // Only used for software volume
     if (set_initial_vol && internal_vol)
-        volume = gContext->GetNumSetting("PCMMixerVolume", 80);
+    {
+        QString controlLabel = gContext->GetSetting("MixerControl", "PCM");
+        controlLabel += "MixerVolume";
+        volume = gContext->GetNumSetting(controlLabel, 80);
+    }
 
     SyncVolume();
 

Works great otherwise (as of r21298 in trunk). Great job and thanks a lot for contributing.

comment:19 Changed 11 years ago by JYA

sofvol-trunk-6.patch

Patches against trunk r21594 and audioencoding-trunk-7.4.patch.

Changed 11 years ago by JYA

Attachment: sofvol-trunk-6.patch added

Against trunk r21594

comment:20 Changed 11 years ago by JYA

Owner: changed from Isaac Richards to JYA
Status: newassigned

comment:21 Changed 11 years ago by JYA

Resolution: duplicate
Status: assignedclosed

See #6975

Note: See TracTickets for help on using tickets.