Bundle fallback ringback and busy tone audio files

Most desktop Linux sound themes lack telephony events like
phone-outgoing-calling and phone-outgoing-busy, causing gsound
playback to fail silently. Bundle OGG Vorbis fallback files and
pass GSOUND_ATTR_MEDIA_FILENAME alongside GSOUND_ATTR_EVENT_ID
so libcanberra falls back to the bundled audio when the theme
event is not found.
This commit is contained in:
Kevin Bataille
2026-02-08 14:45:29 +01:00
parent 1f9effa868
commit 4d46cdb029
5 changed files with 31 additions and 0 deletions

View File

@@ -110,3 +110,10 @@ if compile_schemas.found()
args: ['--strict', '--dry-run', meson.current_source_dir()], args: ['--strict', '--dry-run', meson.current_source_dir()],
) )
endif endif
# Sounds (fallback for systems without telephony events in sound theme)
install_data(
'sounds/phone-outgoing-calling.oga',
'sounds/phone-outgoing-busy.oga',
install_dir: join_paths(datadir, calls_name, 'sounds'),
)

Binary file not shown.

Binary file not shown.

View File

@@ -78,6 +78,8 @@ config_data.set_quoted('APP_DATA_NAME', calls_name)
config_data.set_quoted('GETTEXT_PACKAGE', calls_name) config_data.set_quoted('GETTEXT_PACKAGE', calls_name)
config_data.set_quoted('LOCALEDIR', full_localedir) config_data.set_quoted('LOCALEDIR', full_localedir)
config_data.set_quoted('PLUGIN_LIBDIR', full_calls_plugin_libdir) config_data.set_quoted('PLUGIN_LIBDIR', full_calls_plugin_libdir)
config_data.set_quoted('CALLS_SOUNDS_DIR',
join_paths(prefix, get_option('datadir'), calls_name, 'sounds'))
config_data.set_quoted('PACKAGE_URL', calls_homepage) config_data.set_quoted('PACKAGE_URL', calls_homepage)
config_data.set_quoted('PACKAGE_VERSION', calls_version) config_data.set_quoted('PACKAGE_VERSION', calls_version)
config_data.set('PACKAGE_URL_RAW', calls_homepage) config_data.set('PACKAGE_URL_RAW', calls_homepage)

View File

@@ -26,6 +26,8 @@
#include "calls-media-playback.h" #include "calls-media-playback.h"
#include "calls-config.h"
#include <gsound.h> #include <gsound.h>
@@ -96,6 +98,23 @@ playback_event_to_string (PlaybackEvent event)
} }
} }
static const char *
playback_event_to_filename (PlaybackEvent event)
{
switch (event) {
case PLAYBACK_CALLING:
return CALLS_SOUNDS_DIR "/phone-outgoing-calling.oga";
case PLAYBACK_BUSY:
return CALLS_SOUNDS_DIR "/phone-outgoing-busy.oga";
case PLAYBACK_LAST:
default:
return NULL;
}
}
static void static void
calls_media_playback_dispose (GObject *object) calls_media_playback_dispose (GObject *object)
{ {
@@ -182,11 +201,13 @@ static void
playback_data (MediaPlaybackData *data) playback_data (MediaPlaybackData *data)
{ {
const char *event_id; const char *event_id;
const char *filename;
g_assert (CALLS_IS_MEDIA_PLAYBACK (data->self)); g_assert (CALLS_IS_MEDIA_PLAYBACK (data->self));
g_assert (data->self->context); g_assert (data->self->context);
event_id = playback_event_to_string (data->event); event_id = playback_event_to_string (data->event);
filename = playback_event_to_filename (data->event);
if (!event_id) { if (!event_id) {
g_warning ("No event id found for %d", data->event); g_warning ("No event id found for %d", data->event);
@@ -201,6 +222,7 @@ playback_data (MediaPlaybackData *data)
data, data,
GSOUND_ATTR_CANBERRA_CACHE_CONTROL, "volatile", GSOUND_ATTR_CANBERRA_CACHE_CONTROL, "volatile",
GSOUND_ATTR_EVENT_ID, event_id, GSOUND_ATTR_EVENT_ID, event_id,
GSOUND_ATTR_MEDIA_FILENAME, filename,
NULL); NULL);
} }