|
|
@ -1,32 +1,47 @@
|
|
|
|
using System;
|
|
|
|
using Plugin.Maui.Audio;
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace App.Models
|
|
|
|
namespace MusiLib.Model
|
|
|
|
{
|
|
|
|
{
|
|
|
|
class Metronome
|
|
|
|
public class Metronome
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public void lancer()
|
|
|
|
static AudioPlayer player;
|
|
|
|
|
|
|
|
static bool isMusicPlaying = false;
|
|
|
|
|
|
|
|
static bool isMusicBeginning = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static async void beginMusic()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//lancer la partition
|
|
|
|
player = (AudioPlayer)AudioManager.Current.CreatePlayer(await FileSystem.OpenAppPackageFileAsync("au_clair_de_la_lune.wav"));
|
|
|
|
|
|
|
|
player.Play();
|
|
|
|
|
|
|
|
isMusicPlaying = true;
|
|
|
|
|
|
|
|
isMusicBeginning = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void arreter()
|
|
|
|
public static void playMusic()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//mettre en pause la partition
|
|
|
|
player.Play();
|
|
|
|
|
|
|
|
isMusicPlaying = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void reinitialiser()
|
|
|
|
public static void pauseMusic()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//remettre la partition à 0
|
|
|
|
player.Pause();
|
|
|
|
|
|
|
|
isMusicPlaying = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void stopMusic()
|
|
|
|
public void regler()
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//régler la partition (volume, tempo ...)
|
|
|
|
if (isMusicBeginning)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
player.Stop();
|
|
|
|
|
|
|
|
isMusicPlaying = false;
|
|
|
|
|
|
|
|
isMusicBeginning = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|