Skip to content
This repository has been archived by the owner on Sep 18, 2022. It is now read-only.

Commit

Permalink
Added SoundDevice
Browse files Browse the repository at this point in the history
  • Loading branch information
craftersmine committed Mar 4, 2019
1 parent 332a223 commit 8193df4
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions craftersmine.EtherEngine.Core/SoundDevice.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using craftersmine.EtherEngine.Utilities;
using NVorbis.OpenTKSupport;
using OpenTK.Audio;

namespace craftersmine.EtherEngine.Core
{
public sealed class SoundDevice
{
public AudioContext Context { get; private set; }
internal OggStreamer OggStreamer { get; set; }

public SoundDevice(string audioDevice)
{
Debugging.Log(LogEntryType.Info, "Using \"" + audioDevice + "\" audio device");
Context = new AudioContext(audioDevice);
Debugging.Log(LogEntryType.Info, "Current audio context is " + Context.ToString());
Debugging.Log(LogEntryType.Info, "Constructing audio streaming instance...");
OggStreamer = new OggStreamer();
Initialize();
}

public SoundDevice()
{
Debugging.Log(LogEntryType.Info, "Using \"" + AudioContext.DefaultDevice + "\" audio device");
Context = new AudioContext(AudioContext.DefaultDevice);
Debugging.Log(LogEntryType.Info, "Current audio context is " + Context.ToString());
Debugging.Log(LogEntryType.Info, "Constructing audio streaming instance...");
OggStreamer = new OggStreamer();
Initialize();
}

public void Initialize()
{
Context.MakeCurrent();
}
}
}

0 comments on commit 8193df4

Please sign in to comment.