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
NAudioAudioBackend.cs
2
4public sealed class NAudioAudioBackend : IAudioBackend
5{
6 private NAudioAudioBackend() { }
7
11 public static NAudioAudioBackend Instance { get; } = new();
12
16 public string Name => "NAudio";
17
31 string key,
32 byte[] data,
33 string fileNameOrExtension,
34 float volume,
35 float pan,
36 float playbackSpeed)
37 {
38 var (reader, tempPath) = NAudioReaderRegistry.Open(data, fileNameOrExtension);
39 try
40 {
41 return new NAudioPlaybackHandle(key, reader, tempPath, volume, pan, playbackSpeed);
42 }
43 catch
44 {
45 reader.Dispose();
46 NAudioReaderRegistry.TryDelete(tempPath);
47 throw;
48 }
49 }
50
62 string key,
63 string uri,
64 float volume,
65 float pan,
66 float playbackSpeed)
67 => throw new NotSupportedException(
68 "Gondwana.Audio.NAudio loads files, streams, and engine assets. URI playback is provided by URI-capable backends such as Gondwana.Audio.Browser.");
69}
IAudioPlaybackHandle CreateFromBytes(string key, byte[] data, string fileNameOrExtension, float volume, float pan, float playbackSpeed)
Creates an IAudioPlaybackHandle from the provided raw audio bytes. The data is opened via the NAudioR...
static NAudioAudioBackend Instance
Gets the singleton instance of the NAudioAudioBackend.
IAudioPlaybackHandle CreateFromUri(string key, string uri, float volume, float pan, float playbackSpeed)
Creates an IAudioPlaybackHandle from a URI.
string Name
Gets the display name of this audio backend.
Creates backend-specific playback handles for the engine's common audio API.
Backend-provided playback handle used by AudioResource. Implements IDisposable to allow releasing any...