1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::AudioSource;
use crate::Extractable;
use crate::MetaContainer;
use crate::Source;
use crate::TimelineElement;
use crate::TrackElement;
use glib::object::IsA;
use glib::translate::*;

glib::wrapper! {
    /// Outputs a test audio stream using audiotestsrc. The default property values
    /// output silence. Useful for testing pipelines, or to fill gaps in an audio
    /// track.
    ///
    /// # Implements
    ///
    /// [`AudioTestSourceExt`][trait@crate::prelude::AudioTestSourceExt], [`AudioSourceExt`][trait@crate::prelude::AudioSourceExt], [`SourceExt`][trait@crate::prelude::SourceExt], [`TrackElementExt`][trait@crate::prelude::TrackElementExt], [`TimelineElementExt`][trait@crate::prelude::TimelineElementExt], [`trait@glib::ObjectExt`], [`ExtractableExt`][trait@crate::prelude::ExtractableExt], [`MetaContainerExt`][trait@crate::prelude::MetaContainerExt], [`TimelineElementExtManual`][trait@crate::prelude::TimelineElementExtManual]
    #[doc(alias = "GESAudioTestSource")]
    pub struct AudioTestSource(Object<ffi::GESAudioTestSource, ffi::GESAudioTestSourceClass>) @extends AudioSource, Source, TrackElement, TimelineElement, @implements Extractable, MetaContainer;

    match fn {
        type_ => || ffi::ges_audio_test_source_get_type(),
    }
}

impl AudioTestSource {
    pub const NONE: Option<&'static AudioTestSource> = None;
}

/// Trait containing all [`struct@AudioTestSource`] methods.
///
/// # Implementors
///
/// [`AudioTestSource`][struct@crate::AudioTestSource]
pub trait AudioTestSourceExt: 'static {
    /// Get the current frequency of `self`.
    ///
    /// # Returns
    ///
    /// The current frequency of `self`.
    #[doc(alias = "ges_audio_test_source_get_freq")]
    #[doc(alias = "get_freq")]
    fn freq(&self) -> f64;

    /// Get the current volume of `self`.
    ///
    /// # Returns
    ///
    /// The current volume of `self`
    #[doc(alias = "ges_audio_test_source_get_volume")]
    #[doc(alias = "get_volume")]
    fn volume(&self) -> f64;

    /// Lets you set the frequency applied on the track element
    /// ## `freq`
    /// The frequency you want to apply on `self`
    #[doc(alias = "ges_audio_test_source_set_freq")]
    fn set_freq(&self, freq: f64);

    /// Sets the volume of the test audio signal.
    /// ## `volume`
    /// The volume you want to apply on `self`
    #[doc(alias = "ges_audio_test_source_set_volume")]
    fn set_volume(&self, volume: f64);
}

impl<O: IsA<AudioTestSource>> AudioTestSourceExt for O {
    fn freq(&self) -> f64 {
        unsafe { ffi::ges_audio_test_source_get_freq(self.as_ref().to_glib_none().0) }
    }

    fn volume(&self) -> f64 {
        unsafe { ffi::ges_audio_test_source_get_volume(self.as_ref().to_glib_none().0) }
    }

    fn set_freq(&self, freq: f64) {
        unsafe {
            ffi::ges_audio_test_source_set_freq(self.as_ref().to_glib_none().0, freq);
        }
    }

    fn set_volume(&self, volume: f64) {
        unsafe {
            ffi::ges_audio_test_source_set_volume(self.as_ref().to_glib_none().0, volume);
        }
    }
}