using Cryville.Audio;
using System;
using System.Collections.Generic;
using System.IO;
using UnityEngine;

namespace Cryville.EEW.Unity {
	class SoundPlayer : Core.SoundPlayer {
		public SoundPlayer() : base(GetEngineList(), AudioUsage.NotificationEvent) { }
		static List<Type> GetEngineList() => new() {
			typeof(Audio.Wasapi.MMDeviceEnumeratorWrapper),
			typeof(Audio.WaveformAudio.WaveDeviceManager)
		};

		protected override Stream Open(string path) {
			path = Path.Combine(Application.streamingAssetsPath, "Sounds", path + ".ogg");
			if (!File.Exists(path)) return null;
			return new FileStream(path, FileMode.Open, FileAccess.Read);
		}
	}
}
