Gondwana Game Engine Development (master) - 2.6.1
Gondwana is a cross-platform 2.5D game and rendering engine written in C#/.NET 8. It provides fine-grained control over rendering, timing, and scene composition, with built-in support for parallax, z-ordering, pixel overhang, collision detection, and particle effects. Gondwana targets desktop and web platforms using SkiaSharp for graphics and pluggable audio backends for desktop and browser targets.
Loading...
Searching...
No Matches
BrowserAudioPlayer.cs
1using System.Runtime.Versioning;
2
4
8[SupportedOSPlatform("browser")]
9public sealed class BrowserAudioPlayer
10{
11 private readonly AudioResource _resource;
12
13 internal BrowserAudioPlayer(AudioResource resource)
14 {
15 _resource = resource;
16 }
17
21 public string Key => _resource.Key;
25 public bool IsPlaying => _resource.IsPlaying;
29 public bool IsPaused => _resource.IsPaused;
33 public AudioPlaybackState State => _resource.State;
37 public TimeSpan CurrentTime
38 {
39 get => _resource.CurrentTime;
40 set => _resource.CurrentTime = value;
41 }
42
46 public TimeSpan Duration => _resource.Duration;
47
51 public bool IsLooping
52 {
53 get => _resource.IsLooping;
54 set => _resource.IsLooping = value;
55 }
56
60 public float Volume
61 {
62 get => _resource.Volume;
63 set => _resource.Volume = value;
64 }
65
69 public float Pan
70 {
71 get => _resource.Pan;
72 set => _resource.Pan = value;
73 }
74
78 public float PlaybackSpeed
79 {
80 get => _resource.PlaybackSpeed;
81 set => _resource.PlaybackSpeed = value;
82 }
83
88 public void Play(bool fromStart = true) => _resource.Play(fromStart);
92 public void Pause() => _resource.Pause();
96 public void Resume() => _resource.Resume();
101 public void Seek(TimeSpan position) => _resource.Seek(position);
105 public void Stop() => _resource.Stop();
106}
Represents an audio resource that can be played, paused, resumed, sought, and disposed....
TimeSpan Duration
Gets the media duration.
bool IsPaused
Gets whether playback is paused.
bool IsPlaying
Gets whether playback is active.
TimeSpan CurrentTime
Gets or sets the current playback position.
void Resume()
Resumes paused playback.
float Volume
Gets or sets the playback volume.
float Pan
Gets or sets the stereo pan.
void Play(bool fromStart=true)
Starts playback.
void Seek(TimeSpan position)
Moves playback to the requested time.
AudioPlaybackState State
Gets the state.
bool IsLooping
Gets or sets whether playback repeats when it reaches the end.
float PlaybackSpeed
Gets or sets the playback speed multiplier.
void Pause()
Pauses playback at the current position.
AudioPlaybackState
Describes the current playback state of an audio resource without exposing backend-specific playback ...