Skip to content
Snippets Groups Projects
Commit 8c674b9f authored by Julian Bouzas's avatar Julian Bouzas
Browse files

base-endpoint: add wp_base_endpoint_begin_fade API

parent b1d03cd6
Branches
Tags
No related merge requests found
......@@ -511,6 +511,18 @@ wp_base_endpoint_get_global_id (WpBaseEndpoint * self)
return -1;
}
void
wp_base_endpoint_begin_fade (WpBaseEndpoint * self, guint32 stream_id,
guint duration, gfloat step, guint direction, guint type,
GCancellable * cancellable, GAsyncReadyCallback callback, gpointer data)
{
g_return_if_fail (WP_IS_BASE_ENDPOINT (self));
if (WP_BASE_ENDPOINT_GET_CLASS (self)->begin_fade)
WP_BASE_ENDPOINT_GET_CLASS (self)->begin_fade (self, stream_id,
duration, step, direction, type, cancellable, callback, data);
}
/**
* wp_base_endpoint_register_stream:
* @self: the endpoint
......
......
......@@ -45,6 +45,10 @@ struct _WpBaseEndpointClass
void (*release_link) (WpBaseEndpoint * self, WpBaseEndpointLink * link);
const gchar * (*get_endpoint_link_factory) (WpBaseEndpoint * self);
void (*begin_fade) (WpBaseEndpoint * self, guint32 stream_id, guint duration,
gfloat step, guint direction, guint type, GCancellable * cancellable,
GAsyncReadyCallback callback, gpointer data);
};
WP_API
......@@ -84,6 +88,11 @@ const char * wp_base_endpoint_get_role (WpBaseEndpoint * self);
WP_API
guint32 wp_base_endpoint_get_global_id (WpBaseEndpoint * self);
WP_API
void wp_base_endpoint_begin_fade (WpBaseEndpoint * self, guint32 stream_id,
guint duration, gfloat step, guint direction, guint type,
GCancellable * cancellable, GAsyncReadyCallback callback, gpointer data);
WP_API
void wp_base_endpoint_register_stream (WpBaseEndpoint * self, GVariant * stream);
......
......
......@@ -141,6 +141,33 @@ endpoint_prepare_link (WpBaseEndpoint * ep, guint32 stream_id,
return wp_audio_stream_prepare_link (stream, properties, error);
}
static void
endpoint_begin_fade (WpBaseEndpoint * ep, guint32 stream_id, guint duration,
gfloat step, guint direction, guint type, GCancellable * cancellable,
GAsyncReadyCallback callback, gpointer data)
{
WpPwAudioSoftdspEndpoint *self = WP_PW_AUDIO_SOFTDSP_ENDPOINT (ep);
WpAudioStream *stream = NULL;
/* Fade the adapter if stream id is none */
if (stream_id == WP_STREAM_ID_NONE) {
wp_audio_stream_begin_fade (self->adapter, duration, step, direction,
type, cancellable, callback, data);
return;
}
/* Make sure the stream Id is valid */
g_return_if_fail(stream_id < self->converters->len);
/* Make sure the stream is valid */
stream = g_ptr_array_index (self->converters, stream_id);
g_return_if_fail(stream);
/* Begin fade */
wp_audio_stream_begin_fade (stream, duration, step, direction, type,
cancellable, callback, data);
}
static void
on_exported_control_changed (WpEndpoint * ep, guint32 control_id,
WpPwAudioSoftdspEndpoint *self)
......@@ -480,6 +507,7 @@ endpoint_class_init (WpPwAudioSoftdspEndpointClass * klass)
endpoint_class->get_role = endpoint_get_role;
endpoint_class->get_global_id = endpoint_get_global_id;
endpoint_class->prepare_link = endpoint_prepare_link;
endpoint_class->begin_fade = endpoint_begin_fade;
/* Instal the properties */
g_object_class_install_property (object_class, PROP_PROXY_NODE,
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment