34 lines
758 B
C#
34 lines
758 B
C#
using System.Diagnostics;
|
|
|
|
namespace Mozart
|
|
{
|
|
public class SoundHandler
|
|
{
|
|
public async Task PlayAudioAsync(string path)
|
|
{
|
|
var process = Process.Start("paplay", path);
|
|
|
|
await process.WaitForExitAsync();
|
|
}
|
|
|
|
public string getPath(Instrument instrument, SoundType type, int i, int s)
|
|
{
|
|
var currentDirectory = Directory.GetCurrentDirectory();
|
|
var path = Path.Join(currentDirectory, "Data", instrument.ToString(), type.ToString() + i + "-" + s + ".wav");
|
|
|
|
return path;
|
|
}
|
|
}
|
|
|
|
public enum Instrument
|
|
{
|
|
clarinet,
|
|
flute_harp,
|
|
mbira,
|
|
piano
|
|
}
|
|
public enum SoundType {
|
|
minuet,
|
|
trio
|
|
}
|
|
} |