Gondwana.Audio.NAudio
2.6.1
dotnet add package Gondwana.Audio.NAudio --version 2.6.1
NuGet\Install-Package Gondwana.Audio.NAudio -Version 2.6.1
<PackageReference Include="Gondwana.Audio.NAudio" Version="2.6.1" />
<PackageVersion Include="Gondwana.Audio.NAudio" Version="2.6.1" />
<PackageReference Include="Gondwana.Audio.NAudio" />
paket add Gondwana.Audio.NAudio --version 2.6.1
#r "nuget: Gondwana.Audio.NAudio, 2.6.1"
#:package Gondwana.Audio.NAudio@2.6.1
#addin nuget:?package=Gondwana.Audio.NAudio&version=2.6.1
#tool nuget:?package=Gondwana.Audio.NAudio&version=2.6.1
Gondwana.Audio.NAudio
Stop() resets the reported position to zero. NAudio finishes stopping its worker
asynchronously; the stream and speed-provider buffers are rewound after that worker
exits, before any queued Play(false) begins. This avoids blocking a UI thread that
may need to deliver the stop callback. An already-stopped source rewinds immediately.
Gondwana.Audio.NAudio provides the Windows desktop audio backend for the Gondwana Game Engine using NAudio.
The core Gondwana package defines the backend-neutral Gondwana.Audio contracts and resource APIs. This package supplies the NAudio implementation used by Windows desktop games.
Features
- WAV and MP3 playback
- OGG / OGA / MOGG playback through NAudio.Vorbis
- WMA and M4A playback through Media Foundation
- play, pause, resume, stop, seek, looping, volume, and stereo pan
- variable playback speed from 0.25x through 4.0x
- loading from files, streams, and Gondwana asset files
- integration with
Engine.Managers.AudioResources
Playback speed changes rate and pitch together. Pitch-preserving time stretching is not part of the core audio contract.
Setup
Install Gondwana.Audio.NAudio in a Windows-targeted project (net8.0-windows).
A cross-platform net8.0 desktop project needs a compatible backend selected
explicitly; adding this Windows package is not a cross-platform audio solution.
using Gondwana;
Engine.Instance.UseNAudio();
When using Gondwana.WinForms.Hosting, platform configuration initializes the NAudio backend automatically. Direct WinForms users may continue to call:
Engine.Instance.InitializeWinFormsAudioFormats();
which now configures this backend.
Playback
var sound = Engine.Managers.AudioResources.LoadFromFile("theme", "assets/theme.ogg");
sound.Volume = 0.8f;
sound.Pan = 0.0f;
sound.PlaybackSpeed = 1.25f;
sound.IsLooping = true;
sound.Play();
Related packages
Gondwana— core engine and backend-neutral audio contractsGondwana.Audio.Browser— browser/WASM audio backendGondwana.Audio.Midi— MIDI/SoundFont support built on the NAudio pipeline
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0-windows7.0 is compatible. net9.0-windows was computed. net10.0-windows was computed. |
-
net8.0-windows7.0
- Gondwana (>= 2.6.1)
- NAudio (>= 2.3.0)
- NAudio.Vorbis (>= 1.5.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Gondwana.Audio.NAudio:
| Package | Downloads |
|---|---|
|
Gondwana.WinForms
WinForms-based platform support for the Gondwana Game Engine, providing rendering, input, and Windows desktop integration. |
|
|
Gondwana.Audio.Midi
MIDI audio playback support for the Gondwana Game Engine, including integration for loading and playing MIDI files through the NAudio audio backend. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Full changelog: https://github.com/Isthimius/Gondwana/blob/master/CHANGELOG.md