-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (18 loc) · 746 Bytes
/
Program.cs
File metadata and controls
25 lines (18 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using SoundFlow.Backends.MiniAudio;
using SoundFlow.Components;
using SoundFlow.Providers;
using SoundFlow.Enums;
// Initialize the audio engine with the MiniAudio backend
using var audioEngine = new MiniAudioEngine(44100, Capability.Playback);
// Create a SoundPlayer and load an audio file
var player = new SoundPlayer(new StreamDataProvider(File.OpenRead("test_audio.mp3")));
// Add the player to the master mixer
Mixer.Master.AddComponent(player);
// Start playback
player.Play();
// Keep the console application running until playback finishes
Console.WriteLine("Playing audio... Press any key to stop.");
Console.ReadKey();
// Stop playback and remove the player from the mixer
player.Stop();
Mixer.Master.RemoveComponent(player);