On Tue, 28.12.10 15:43, Colin Guthrie ([email protected]) wrote:

> >> I guess you could just use an md5 or similar hash of the filename as the
> >> cache key.
> >>
> >> Is there any fundamental problem with this?
> > 
> > Hmm, it's a bit unclean, because so far the event id is the clean cache
> > key. 
> 
> Yeah I admit it's not perfect, but an md5/sha1 hash is pretty unlikely
> to clash with an event id! :)

Hmm, sha1 is kinda slow to calculate...

I think it would make sense to simply ask developers to pass proper
names, but if they are not standard names, then prefix them with
x-appname or so. Example:

 x-quake2-shoot-bfg10k
 x-quake2-shoot-chaingun
 x-quake2-shoot-railgun

and then for each of these sounds also include the file name
property:

ca_context_play(..., 0, 
                CA_PROP_EVENT_ID, "x-quake2-shoot-bfg10k",
                CA_PROP_MEDIA_FILENAME,  "/usr/sharq/quake2/bfg10k-boom.wav",
                NULL);

That way, we have nice names to use in the cache, and we also open the
opportunity for theme designers to override the per-app sounds if they
want to, however the sound names don't need to be standardized and the
sounds don't need to be installed in the freedesktop sound theme dir but
can be private.

The prefixing with x-foobar is actually documented in the xdg sound
naming spec. But afaik nobody uses it like this so far. I guess this is
something i should have blogged about...

> > Let's turn this around: what's the use-case for doing this?
> 
> Well some people have suggested using this as a very simply way to
> generate sounds very quickly for application-specific feedback e.g.
> something that does not fit into the sound theme, like a keypress noise
> in a specific in-game menu or similar - or the handful of noises
> generated as part of a (simple) desktop game.

I think my suggestion above would be very fitting for that.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.
_______________________________________________
libcanberra-discuss mailing list
[email protected]
https://tango.0pointer.de/mailman/listinfo/libcanberra-discuss

Reply via email to