diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..2cd48b4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+bin
+obj
+.vs
diff --git a/FineAudio.Core.csproj b/FineAudio.Core.csproj
new file mode 100644
index 0000000..914176b
--- /dev/null
+++ b/FineAudio.Core.csproj
@@ -0,0 +1,12 @@
+
+
+
+ netstandard2.0
+ true
+
+
+
+
+
+
+
diff --git a/FineAudio.csproj b/FineAudio.csproj
new file mode 100644
index 0000000..ee24162
--- /dev/null
+++ b/FineAudio.csproj
@@ -0,0 +1,12 @@
+
+
+
+ net472
+ true
+
+
+
+
+
+
+
diff --git a/AudioDevice.cs b/src/AudioDevice.cs
similarity index 97%
rename from AudioDevice.cs
rename to src/AudioDevice.cs
index 9dbb52b..12328b0 100644
--- a/AudioDevice.cs
+++ b/src/AudioDevice.cs
@@ -1,8 +1,9 @@
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
+using Microsoft.Xna.Framework;
-namespace MoonWorks.Audio
+namespace FineAudio
{
public class AudioDevice : IDisposable
{
@@ -34,7 +35,7 @@ namespace MoonWorks.Audio
if (devices == 0)
{
- Logger.LogError("No audio devices found!");
+ FNALoggerEXT.LogError("No audio devices found!");
Handle = IntPtr.Zero;
FAudio.FAudio_Release(Handle);
return;
@@ -81,7 +82,7 @@ namespace MoonWorks.Audio
IntPtr.Zero
) != 0)
{
- Logger.LogError("No mastering voice found!");
+ FNALoggerEXT.LogError("No mastering voice found!");
Handle = IntPtr.Zero;
FAudio.FAudio_Release(Handle);
return;
diff --git a/AudioEmitter.cs b/src/AudioEmitter.cs
similarity index 98%
rename from AudioEmitter.cs
rename to src/AudioEmitter.cs
index c23becd..327e6d2 100644
--- a/AudioEmitter.cs
+++ b/src/AudioEmitter.cs
@@ -1,8 +1,8 @@
using System;
using System.Runtime.InteropServices;
-using MoonWorks.Math;
+using Microsoft.Xna.Framework;
-namespace MoonWorks.Audio
+namespace FineAudio
{
public class AudioEmitter : AudioResource
{
diff --git a/AudioListener.cs b/src/AudioListener.cs
similarity index 97%
rename from AudioListener.cs
rename to src/AudioListener.cs
index 0f9e515..35fd131 100644
--- a/AudioListener.cs
+++ b/src/AudioListener.cs
@@ -1,7 +1,7 @@
using System;
-using MoonWorks.Math;
+using Microsoft.Xna.Framework;
-namespace MoonWorks.Audio
+namespace FineAudio
{
public class AudioListener : AudioResource
{
diff --git a/AudioResource.cs b/src/AudioResource.cs
similarity index 97%
rename from AudioResource.cs
rename to src/AudioResource.cs
index edf8b49..3cf9066 100644
--- a/AudioResource.cs
+++ b/src/AudioResource.cs
@@ -1,6 +1,6 @@
using System;
-namespace MoonWorks.Audio
+namespace FineAudio
{
public abstract class AudioResource : IDisposable
{
diff --git a/SoundInstance.cs b/src/SoundInstance.cs
similarity index 98%
rename from SoundInstance.cs
rename to src/SoundInstance.cs
index 731237e..ee1550f 100644
--- a/SoundInstance.cs
+++ b/src/SoundInstance.cs
@@ -1,8 +1,8 @@
using System;
using System.Runtime.InteropServices;
-using MoonWorks.Math;
+using Microsoft.Xna.Framework;
-namespace MoonWorks.Audio
+namespace FineAudio
{
public abstract class SoundInstance : AudioResource
{
@@ -195,7 +195,7 @@ namespace MoonWorks.Audio
if (Handle == IntPtr.Zero)
{
- Logger.LogError("SoundInstance failed to initialize!");
+ FNALoggerEXT.LogError("SoundInstance failed to initialize!");
return;
}
diff --git a/SoundState.cs b/src/SoundState.cs
similarity index 69%
rename from SoundState.cs
rename to src/SoundState.cs
index 4fb9cb2..e3c7e3e 100644
--- a/SoundState.cs
+++ b/src/SoundState.cs
@@ -1,4 +1,4 @@
-namespace MoonWorks.Audio
+namespace FineAudio
{
public enum SoundState
{
diff --git a/StaticSound.cs b/src/StaticSound.cs
similarity index 89%
rename from StaticSound.cs
rename to src/StaticSound.cs
index 4976244..d618225 100644
--- a/StaticSound.cs
+++ b/src/StaticSound.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
-namespace MoonWorks.Audio
+namespace FineAudio
{
public class StaticSound : AudioResource
{
@@ -19,37 +19,6 @@ namespace MoonWorks.Audio
private Stack Instances = new Stack();
- public static StaticSound LoadOgg(AudioDevice device, string filePath)
- {
- var filePointer = FAudio.stb_vorbis_open_filename(filePath, out var error, IntPtr.Zero);
-
- if (error != 0)
- {
- throw new AudioLoadException("Error loading file!");
- }
- var info = FAudio.stb_vorbis_get_info(filePointer);
- var bufferSize = FAudio.stb_vorbis_stream_length_in_samples(filePointer) * info.channels;
- var buffer = new float[bufferSize];
-
- FAudio.stb_vorbis_get_samples_float_interleaved(
- filePointer,
- info.channels,
- buffer,
- (int) bufferSize
- );
-
- FAudio.stb_vorbis_close(filePointer);
-
- return new StaticSound(
- device,
- (ushort) info.channels,
- info.sample_rate,
- buffer,
- 0,
- (uint) buffer.Length
- );
- }
-
// mostly borrowed from https://github.com/FNA-XNA/FNA/blob/b71b4a35ae59970ff0070dea6f8620856d8d4fec/src/Audio/SoundEffect.cs#L385
public static StaticSound LoadWav(AudioDevice device, string filePath)
{
diff --git a/StaticSoundInstance.cs b/src/StaticSoundInstance.cs
similarity index 98%
rename from StaticSoundInstance.cs
rename to src/StaticSoundInstance.cs
index cb7966a..47fcc48 100644
--- a/StaticSoundInstance.cs
+++ b/src/StaticSoundInstance.cs
@@ -1,6 +1,6 @@
using System;
-namespace MoonWorks.Audio
+namespace FineAudio
{
public class StaticSoundInstance : SoundInstance
{
diff --git a/StreamingSound.cs b/src/StreamingSound.cs
similarity index 99%
rename from StreamingSound.cs
rename to src/StreamingSound.cs
index 18a5a33..48a8c85 100644
--- a/StreamingSound.cs
+++ b/src/StreamingSound.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Runtime.InteropServices;
-namespace MoonWorks.Audio
+namespace FineAudio
{
///
/// For streaming long playback.
diff --git a/StreamingSoundOgg.cs b/src/StreamingSoundOgg.cs
similarity index 90%
rename from StreamingSoundOgg.cs
rename to src/StreamingSoundOgg.cs
index a83e95a..b11be92 100644
--- a/StreamingSoundOgg.cs
+++ b/src/StreamingSoundOgg.cs
@@ -1,8 +1,9 @@
using System;
using System.IO;
using System.Runtime.InteropServices;
+using Microsoft.Xna.Framework;
-namespace MoonWorks.Audio
+namespace FineAudio
{
public class StreamingSoundOgg : StreamingSound
{
@@ -26,9 +27,9 @@ namespace MoonWorks.Audio
if (error != 0)
{
((GCHandle) fileDataPtr).Free();
- Logger.LogError("Error opening OGG file!");
- Logger.LogError("Error: " + error);
- throw new AudioLoadException("Error opening OGG file!");
+ FNALoggerEXT.LogError("Error opening OGG file!");
+ FNALoggerEXT.LogError("Error: " + error);
+ throw new System.ArgumentException("OGG file not valid!");
}
var info = FAudio.stb_vorbis_get_info(vorbisHandle);