mixer: Add bundled Mopidy-SoftwareMixer extension
This commit is contained in:
parent
4f53521fea
commit
14d0433aae
25
mopidy/softwaremixer/__init__.py
Normal file
25
mopidy/softwaremixer/__init__.py
Normal 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)
|
||||||
2
mopidy/softwaremixer/ext.conf
Normal file
2
mopidy/softwaremixer/ext.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[softwaremixer]
|
||||||
|
enabled = true
|
||||||
34
mopidy/softwaremixer/mixer.py
Normal file
34
mopidy/softwaremixer/mixer.py
Normal 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)
|
||||||
1
setup.py
1
setup.py
@ -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',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user