mixer: Add bundled Mopidy-SoftwareMixer extension

This commit is contained in:
Stein Magnus Jodal 2014-07-08 00:47:39 +02:00
parent 4f53521fea
commit 14d0433aae
4 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,25 @@
from __future__ import unicode_literals
import os
import mopidy
from mopidy import config, ext
class Extension(ext.Extension):
dist_name = 'Mopidy-SoftwareMixer'
ext_name = 'softwaremixer'
version = mopidy.__version__
def get_default_config(self):
conf_file = os.path.join(os.path.dirname(__file__), 'ext.conf')
return config.read(conf_file)
def get_config_schema(self):
schema = super(Extension, self).get_config_schema()
return schema
def setup(self, registry):
from .mixer import SoftwareMixer
registry.add('mixer', SoftwareMixer)

View File

@ -0,0 +1,2 @@
[softwaremixer]
enabled = true

View File

@ -0,0 +1,34 @@
from __future__ import unicode_literals
import logging
import pykka
from mopidy import mixer
logger = logging.getLogger(__name__)
class SoftwareMixer(pykka.ThreadingActor, mixer.Mixer):
name = 'software'
def __init__(self, config, audio):
super(SoftwareMixer, self).__init__()
self.config = config
self.audio = audio
logger.info('Mixing using GStreamer software mixing')
def get_volume(self):
return self.audio.get_volume().get()
def set_volume(self, volume):
self.audio.set_volume(volume)
def get_mute(self):
return self.audio.get_mute().get()
def set_mute(self, muted):
self.audio.set_mute(muted)

View File

@ -42,6 +42,7 @@ setup(
'http = mopidy.http:Extension', 'http = mopidy.http:Extension',
'local = mopidy.local:Extension', 'local = mopidy.local:Extension',
'mpd = mopidy.mpd:Extension', 'mpd = mopidy.mpd:Extension',
'softwaremixer = mopidy.softwaremixer:Extension',
'stream = mopidy.stream:Extension', 'stream = mopidy.stream:Extension',
], ],
}, },