From fd7f9ac12f44f53c3eb37166a9e5ae7304c969f0 Mon Sep 17 00:00:00 2001 From: Brandon Lewis Date: Fri, 2 Jul 2010 14:46:09 +0200 Subject: [PATCH] add routines to AudioTestSource to set freq and volume --- docs/libs/ges-sections.txt | 2 ++ ges/ges-track-audio-test-source.c | 31 +++++++++++++++++++++++++++++-- ges/ges-track-audio-test-source.h | 10 +++++++++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/docs/libs/ges-sections.txt b/docs/libs/ges-sections.txt index 505b22a35d..46577f8782 100644 --- a/docs/libs/ges-sections.txt +++ b/docs/libs/ges-sections.txt @@ -449,6 +449,8 @@ GESTrackAudioTestSource GESTrackAudioTestSourceClass ges_track_audio_test_source_new ges_track_audio_test_source_get_type +ges_track_audio_test_source_set_freq +ges_track_audio_test_source_set_volume GES_TRACK_AUDIO_TEST_SOURCE GES_TRACK_AUDIO_TEST_SOURCE_CLASS diff --git a/ges/ges-track-audio-test-source.c b/ges/ges-track-audio-test-source.c index 0988cd45e0..5dbd2e6562 100644 --- a/ges/ges-track-audio-test-source.c +++ b/ges/ges-track-audio-test-source.c @@ -72,6 +72,8 @@ ges_track_audio_test_source_class_init (GESTrackAudioTestSourceClass * klass) static void ges_track_audio_test_source_init (GESTrackAudioTestSource * self) { + self->freq = 440; + self->volume = 0; } static void @@ -107,14 +109,39 @@ ges_track_audio_test_source_set_property (GObject * object, } static GstElement * -ges_track_audio_test_source_create_element (GESTrackSource * self) +ges_track_audio_test_source_create_element (GESTrackSource * trksrc) { + GESTrackAudioTestSource *self; GstElement *ret; + self = (GESTrackAudioTestSource *) trksrc; ret = gst_element_factory_make ("audiotestsrc", NULL); - g_object_set (ret, "volume", (gdouble) 0, NULL); + g_object_set (ret, "volume", (gdouble) self->volume, "freq", (gdouble) + self->freq, NULL); return ret; } +void +ges_track_audio_test_source_set_freq (GESTrackAudioTestSource * self, + gdouble freq) +{ + GstElement *element; + self->freq = freq; + element = ((GESTrackSource *) self)->element; + if (element) + g_object_set (element, "freq", (gdouble) freq, NULL); +} + +void +ges_track_audio_test_source_set_volume (GESTrackAudioTestSource * self, + gdouble volume) +{ + GstElement *element; + self->volume = volume; + element = ((GESTrackSource *) self)->element; + if (element) + g_object_set (element, "freq", (gdouble) volume, NULL); +} + GESTrackAudioTestSource * ges_track_audio_test_source_new (void) { diff --git a/ges/ges-track-audio-test-source.h b/ges/ges-track-audio-test-source.h index c6941d9d9a..51c8c7464c 100644 --- a/ges/ges-track-audio-test-source.h +++ b/ges/ges-track-audio-test-source.h @@ -53,7 +53,9 @@ G_BEGIN_DECLS struct _GESTrackAudioTestSource { GESTrackSource parent; - /*< public >*/ + /*< private >*/ + gdouble freq; + gdouble volume; }; /** @@ -72,6 +74,12 @@ GType ges_track_audio_test_source_get_type (void); GESTrackAudioTestSource* ges_track_audio_test_source_new (void); +void ges_track_audio_test_source_set_freq(GESTrackAudioTestSource *self, + gdouble freq); + +void ges_track_audio_test_source_set_volume(GESTrackAudioTestSource *self, + gdouble volume); + G_END_DECLS #endif /* _GES_TRACK_AUDIO_TEST_SOURCE */