[mythtv] [PATCH] volume control for OSS and ALSA

Ed Wildgoose lists at wildgooses.com
Wed Oct 27 22:02:02 UTC 2004


> Since everyone is busy, I decided to stick my nose in.  Hopefully this 
> will help Ed get everything together more quickly once he has time; if 
> not, please ignore this message.  ;)


Excellent!

> The attached patch (against current CVS) integrates David's code with 
> Ed's latest package.  It moves the VolumeControl functions into the 
> AudioOutput class, with most of the method implementations in 
> AudioOutputBase.  David's ALSA volume code is moved into 
> audiooutputalsa.cpp (hopefully I got this added correctly, as I don't 
> have an ALSA system for testing).  There's a new method in NVP to 
> expose the AudioOutput for the player; tv_play.cpp uses this instead 
> of a VolumeControl instance to handle the volume functions.


This sounds nearly perfect, except....

...since AudioOutputBase is only an optional feature, you can't really 
include base code there, like the generic volume control...  Consider 
for example the DirectX class which doesn't inherit from 
AudioOutputBase, or some new class which is someday written and uses 
something else.

Instead, I suggest that we create a new class, (say VolumeControl), 
which contains everything you added to AudioOutputBase, but make the 
very base class "AudioOutput" inherit from the VolumeControl class.  In 
this way, EVERY class will get the code (makes sense?).  It's not a big 
change, just a copy and paste operation.  The code which uses the class 
will not even tell that we have done this.

> I also added a previously discussed feature: when muting the left or 
> right channel, the data for the other sound channel is duplicated, so 
> you get mono sound from both speakers.


Ace!

> With these changes, the VolumeControl class is effectively out of the 
> picture for TV watching.  Mythmusic would need stubs for the extra 
> AudioOutput methods in its custom output class, but it could still use 
> the old VolumeControl for its functionality.  Later, mythmusic can be 
> updated to use the standard AudioOutput classes and their integrated 
> volume controls.


Indeed.  Leave the old MythMusic code as it is now.  I am going to work 
on wholesale moving it to the new audio code.  This basically means 
AudioOutput has to inherit from the Event class used in MythMusic, and 
the generic output code (etc) has to be modified to fire events when 
something happens (probably via your "GetBuffer" function).

This is great. 

Ed W


More information about the mythtv-dev mailing list