Skip to content

Commit

Permalink
Re-enable sound pools if MC is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
avanwinkle committed May 29, 2024
1 parent 275ce3b commit 4c00e63
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 5 additions & 1 deletion mpf/config_spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1700,8 +1700,12 @@ sound_player:
events_when_looping: list|event_posted|None
events_when_about_to_finish: list|event_posted|None
key: single|str|None
sound_pools:
__valid_in__: machine, mode # todo add to validator
__type__: config_dict
__allow_others__:
sound_ducking:
bus: single|str|None
bus: single|str|
attack: single|secs|
attenuation: single|float|
delay: single|secs|0.0
Expand Down
10 changes: 7 additions & 3 deletions mpf/core/config_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,23 @@ def _check_sections(self, config_spec, config, config_type, filename, ignore_unk
if not isinstance(config, dict):
raise ConfigFileError("Config should be a dict: {}".format(config), 1, self.log.name, filename)

deprecated_080 = ["playlists", "playlist_player", "slides", "sounds", "sound_pools", "sound_loop_player",
deprecated_080 = ["sound_pools"]
invalid_080 = ["playlists", "playlist_player", "slides", "sounds", "sound_loop_player",
"sound_loop_sets", "sound_system", "track_player", "widgets"]
for k in config.keys():
if k in config_spec:
if k in deprecated_080:
self.log.warning("Config section '%s' is deprecated in MPF 0.80 and will be unsupported in future versions. "
"Please migrate this config to GMC.", k)
if config_type not in config_spec[k]['__valid_in__']:
raise ConfigFileError('Found a "{}:" section in config file {}, '
'but that section is not valid in {} config '
'files (only in {}).'.format(k, filename, config_type,
config_spec[k]['__valid_in__']),
2, self.log.name, filename)
elif k in deprecated_080:
elif k in invalid_080:
# MPF 0.80 DEPRECATION
self.log.warning("Config section '%s' is deprecated in MPF 0.80 and will be ignored.", k)
self.log.error("Config section '%s' is removed in MPF 0.80 and will be ignored.", k)
elif not ignore_unknown_sections:
suggestion = self._find_similar_key(k, config_spec, config_type)

Expand Down
5 changes: 4 additions & 1 deletion mpf/core/config_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ def check_for_invalid_sections(self, spec, config, validation_failure_info):
validation_failure_info.parent.item, config), 3, self.log.name)

def _validate_type_subconfig(self, item, param, validation_failure_info):
if item is None:
# The inclusion of sound_pools causes a nested ducking subconfig that
# fails due to missing required properties. Check for an empty dict
# as subconfig and ignore it.
if item is None or not len(item):
return {}
try:
attribute, base_spec_str = param.split(",", 1)
Expand Down

0 comments on commit 4c00e63

Please sign in to comment.