1 | <?php |
||
29 | class SoundComponent extends ComponentAbstract implements SoundCMPTIF |
||
30 | { |
||
31 | |||
32 | /** |
||
33 | * Initialize Component |
||
34 | * |
||
35 | * {@inheritdoc} |
||
36 | * |
||
37 | * @return bool |
||
38 | */ |
||
39 | 6 | public function initializeComponent(): bool |
|
44 | |||
45 | /** |
||
46 | * Autoplay sound |
||
47 | * |
||
48 | * Whether to automatically play sound once set. |
||
49 | * |
||
50 | * @param bool $autoplay |
||
51 | * @return SoundCMPTIF |
||
52 | */ |
||
53 | 5 | public function autoplay(bool $autoplay = false): SoundCMPTIF |
|
58 | |||
59 | /** |
||
60 | * Play event |
||
61 | * |
||
62 | * An event for the entity to listen to before playing sound. |
||
63 | * |
||
64 | * @param string $event |
||
65 | * @return SoundCMPTIF |
||
66 | */ |
||
67 | 1 | public function on(string $event = 'click'): SoundCMPTIF |
|
72 | |||
73 | /** |
||
74 | * Loop sound |
||
75 | * |
||
76 | * Whether to loop the sound once the sound finishes playing. |
||
77 | * |
||
78 | * @param bool $loop |
||
79 | * @return SoundCMPTIF |
||
80 | */ |
||
81 | 1 | public function loop(bool $loop = false): SoundCMPTIF |
|
86 | |||
87 | /** |
||
88 | * Audio source |
||
89 | * |
||
90 | * Path to sound file. |
||
91 | * |
||
92 | * @param null|string $src |
||
93 | * @return SoundCMPTIF |
||
94 | */ |
||
95 | 4 | public function src(string $src = null): SoundCMPTIF |
|
100 | |||
101 | /** |
||
102 | * Volume |
||
103 | * |
||
104 | * How loud to play the sound. |
||
105 | * |
||
106 | * @param int|float $vol |
||
107 | * @return SoundCMPTIF |
||
108 | */ |
||
109 | 1 | public function volume(float $vol = 1): SoundCMPTIF |
|
114 | } |