Changeset 4931a9265236c3a8382f108840a6e72d27d0637c
- Timestamp:
- 20/10/07 18:02:03
(1 year ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1192896123 +0000
- git-parent:
[2edb3900e75e631eb1d5cf398763950cd214dad1]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1192896123 +0000
- Message:
Add sound volume, rate, and fullscreen support
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rcd6d499 |
r4931a92 |
|
| 154 | 154 | } |
|---|
| 155 | 155 | |
|---|
| | 156 | /** |
|---|
| | 157 | * Switches to the next playlist item |
|---|
| | 158 | */ |
|---|
| 156 | 159 | public void NextItem () |
|---|
| 157 | 160 | { |
|---|
| … | … | |
| 161 | 164 | MediaControlAPI.PlaylistNextItem (self, ref e); |
|---|
| 162 | 165 | e.Consume (); |
|---|
| | 166 | } |
|---|
| | 167 | |
|---|
| | 168 | /** |
|---|
| | 169 | * Normalized audio output volume in percent (must be [0..100]). |
|---|
| | 170 | */ |
|---|
| | 171 | public short SoundVolume |
|---|
| | 172 | { |
|---|
| | 173 | get |
|---|
| | 174 | { |
|---|
| | 175 | CheckDisposed (); |
|---|
| | 176 | |
|---|
| | 177 | NativeException e = NativeException.Prepare (); |
|---|
| | 178 | short vol = MediaControlAPI.SoundGetVolume (self, ref e); |
|---|
| | 179 | e.Consume (); |
|---|
| | 180 | return vol; |
|---|
| | 181 | } |
|---|
| | 182 | set |
|---|
| | 183 | { |
|---|
| | 184 | CheckDisposed (); |
|---|
| | 185 | |
|---|
| | 186 | if ((value < 0) || (value > 100)) |
|---|
| | 187 | throw new ArgumentOutOfRangeException ("Volume not within [0..100]"); |
|---|
| | 188 | |
|---|
| | 189 | NativeException e = NativeException.Prepare (); |
|---|
| | 190 | MediaControlAPI.SoundSetVolume (self, value, ref e); |
|---|
| | 191 | e.Consume (); |
|---|
| | 192 | } |
|---|
| | 193 | } |
|---|
| | 194 | |
|---|
| | 195 | /** |
|---|
| | 196 | * Performance speed rate in percent. |
|---|
| | 197 | */ |
|---|
| | 198 | public int Rate |
|---|
| | 199 | { |
|---|
| | 200 | get |
|---|
| | 201 | { |
|---|
| | 202 | CheckDisposed (); |
|---|
| | 203 | |
|---|
| | 204 | NativeException e = NativeException.Prepare (); |
|---|
| | 205 | int rate = MediaControlAPI.GetRate (self, ref e); |
|---|
| | 206 | e.Consume (); |
|---|
| | 207 | return rate; |
|---|
| | 208 | } |
|---|
| | 209 | set |
|---|
| | 210 | { |
|---|
| | 211 | CheckDisposed (); |
|---|
| | 212 | |
|---|
| | 213 | NativeException e = NativeException.Prepare (); |
|---|
| | 214 | MediaControlAPI.SetRate (self, value, ref e); |
|---|
| | 215 | e.Consume (); |
|---|
| | 216 | } |
|---|
| | 217 | } |
|---|
| | 218 | |
|---|
| | 219 | /** |
|---|
| | 220 | * Fullscreen flag. |
|---|
| | 221 | */ |
|---|
| | 222 | public bool Fullscreen |
|---|
| | 223 | { |
|---|
| | 224 | get |
|---|
| | 225 | { |
|---|
| | 226 | CheckDisposed (); |
|---|
| | 227 | |
|---|
| | 228 | NativeException e = NativeException.Prepare (); |
|---|
| | 229 | int ret = MediaControlAPI.GetFullscreen (self, ref e); |
|---|
| | 230 | e.Consume (); |
|---|
| | 231 | return ret != 0; |
|---|
| | 232 | } |
|---|
| | 233 | set |
|---|
| | 234 | { |
|---|
| | 235 | CheckDisposed (); |
|---|
| | 236 | |
|---|
| | 237 | NativeException e = NativeException.Prepare (); |
|---|
| | 238 | MediaControlAPI.SetFullscreen (self, value ? 1 : 0, ref e); |
|---|
| | 239 | e.Consume (); |
|---|
| | 240 | } |
|---|
| 163 | 241 | } |
|---|
| 164 | 242 | |
|---|
| rcd6d499 |
r4931a92 |
|
| 51 | 51 | [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_playlist_next_item")] |
|---|
| 52 | 52 | public static extern void PlaylistNextItem (MediaControlHandle self, ref NativeException e); |
|---|
| 53 | | } |
|---|
| | 53 | |
|---|
| | 54 | [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_sound_get_volume")] |
|---|
| | 55 | public static extern short SoundGetVolume (MediaControlHandle self, ref NativeException e); |
|---|
| | 56 | [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_sound_set_volume")] |
|---|
| | 57 | public static extern void SoundSetVolume (MediaControlHandle self, short volume, ref NativeException e); |
|---|
| | 58 | /* SetVisual */ |
|---|
| | 59 | |
|---|
| | 60 | [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_get_rate")] |
|---|
| | 61 | public static extern short GetRate (MediaControlHandle self, ref NativeException e); |
|---|
| | 62 | [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_set_rate")] |
|---|
| | 63 | public static extern void SetRate (MediaControlHandle self, int rate, ref NativeException e); |
|---|
| | 64 | [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_get_fullscreen")] |
|---|
| | 65 | public static extern int GetFullscreen (MediaControlHandle self, ref NativeException e); |
|---|
| | 66 | [DllImport ("libvlc-control.dll", EntryPoint="mediacontrol_set_fullscreen")] |
|---|
| | 67 | public static extern void SetFullscreen (MediaControlHandle self, int full, ref NativeException e); |
|---|
| | 68 | }; |
|---|
| 54 | 69 | |
|---|
| 55 | 70 | /** |
|---|
| rcd6d499 |
r4931a92 |
|
| 35 | 35 | mc.AddItem (s); |
|---|
| 36 | 36 | |
|---|
| | 37 | Console.WriteLine ("Volume : {0}%", mc.SoundVolume); |
|---|
| | 38 | Console.WriteLine ("Rate : {0}%", mc.Rate); |
|---|
| | 39 | Console.WriteLine ("Fullscreen: {0}", mc.Fullscreen); |
|---|
| | 40 | mc.Fullscreen = false; |
|---|
| | 41 | |
|---|
| 37 | 42 | /*mc.Play ();*/ |
|---|
| 38 | 43 | Console.ReadLine (); |
|---|
| … | … | |
| 40 | 45 | mc.Stop (); |
|---|
| 41 | 46 | mc.Clear (); |
|---|
| | 47 | mc.SoundVolume = 100; |
|---|
| | 48 | mc.Rate = 100; |
|---|
| 42 | 49 | |
|---|
| 43 | 50 | mc.Dispose (); |
|---|