From 1a4ba37cb8a99ce6ed8f4408246232c1b27dc4cc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 25 Jul 2008 15:33:58 +0200 Subject: add support for .disabled files, reshuffle lookup order to allow easier overwriting of sounds from themes that inherit from others --- spec/sound-theme-spec.xml | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/spec/sound-theme-spec.xml b/spec/sound-theme-spec.xml index e5a14ba..2277cf3 100644 --- a/spec/sound-theme-spec.xml +++ b/spec/sound-theme-spec.xml @@ -157,7 +157,7 @@ The sounds files must be one of the types: WAV/PCM 8-48kHz, 8/16 bits or OGG/Vorbis. The extension must be ".wav", or ".ogg" - respectively (lower case).In addition to the sound files there may + respectively (lower case). In addition to the sound files there may be an additional file with extra sound data for each file. It should have the same basename as the sound file, with the extension ".sound". e.g. if the sound file is called @@ -165,6 +165,14 @@ "system-shutdown.sound". + An additional pseudo file format ".disabled" is supported for + disabling sounds in a theme that inherits from another theme. If + the sound lookup algorithms detects a file with the suffix + ".disabled" it shall immediately terminate the lookup logic and + consider the sound not available. All files with ".disabled" + suffix should be of length zero. + + To save disk space Vorbis encoded sound files are recommended. @@ -445,6 +453,9 @@ profile. + The lookup algorithm should check for ".disabled" files first, followed by ".ogg" and finally for ".wav". + + The exact algorithm (in pseudocode) for looking up a sound in a theme is: @@ -472,21 +483,21 @@ LookupSound (requestedname, requestedlocale, requestedoutputprofile, requestedth for theme in (requestedtheme, "freedesktop", "") { - for each locale in (requestedlocale, - truncatesuffix(requestedlocale, "@"), - truncatesuffix(requestedlocale, "_"), - "C", - "") { - for each name in (requestedname, - truncatesuffix(requestedname, "-"), - truncatesuffix(truncatesuffix(requestedname, "-"), "-"), - truncatesuffix(truncatesuffix(truncatesuffix(requestedname, "-"), "-"), "-"), - ...) { - for profile in (requestedoutputprofile, "stereo", "") { - for each subdir in $(theme subdir list) { - if DirectoryMatchesOutputProfile(subdir, profile) { - for each directory in $(basename list) { - for extension in ("wav", "ogg") { + for profile in (requestedoutputprofile, "stereo", "") { + for each subdir in $(theme subdir list) { + if DirectoryMatchesOutputProfile(subdir, profile) { + for each directory in $(basename list) { + for each name in (requestedname, + truncatesuffix(requestedname, "-"), + truncatesuffix(truncatesuffix(requestedname, "-"), "-"), + truncatesuffix(truncatesuffix(truncatesuffix(requestedname, "-"), "-"), "-"), + ...) { + for each locale in (requestedlocale, + truncatesuffix(requestedlocale, "@"), + truncatesuffix(requestedlocale, "_"), + "C", + "") { + for extension in ("disabled", "wav", "ogg") { filename = directory/theme/subdir/locale/name.extension if exist filename return filename -- cgit