|
|
|
@ -1,26 +1,26 @@
|
|
|
|
|
using Plugin.Maui.Audio;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Plugin.Maui.Audio;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.Maui.Controls;
|
|
|
|
|
using Microsoft.Maui.Controls;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace MusiLib.Model
|
|
|
|
|
{
|
|
|
|
|
public class Metronome
|
|
|
|
|
{
|
|
|
|
|
public AudioPlayer player;
|
|
|
|
|
public bool isMusicPlaying;
|
|
|
|
|
public bool isMusicBeginning;
|
|
|
|
|
|
|
|
|
|
public Metronome()
|
|
|
|
|
{
|
|
|
|
|
player = DependencyService.Get<AudioPlayer>();
|
|
|
|
|
isMusicPlaying = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace MusiLib.Model
|
|
|
|
|
{
|
|
|
|
|
public class Metronome
|
|
|
|
|
{
|
|
|
|
|
public AudioPlayer player;
|
|
|
|
|
public bool isMusicPlaying;
|
|
|
|
|
public bool isMusicBeginning;
|
|
|
|
|
|
|
|
|
|
public Metronome()
|
|
|
|
|
{
|
|
|
|
|
player = DependencyService.Get<AudioPlayer>();
|
|
|
|
|
isMusicPlaying = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task Lancer(string cheminFichier)
|
|
|
|
|
{
|
|
|
|
|
var fichierAudio = (AudioPlayer)AudioManager.Current.CreatePlayer(await FileSystem.OpenAppPackageFileAsync(cheminFichier));
|
|
|
|
@ -28,31 +28,31 @@ namespace MusiLib.Model
|
|
|
|
|
player.Play();
|
|
|
|
|
isMusicPlaying=true;
|
|
|
|
|
isMusicBeginning =true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void PlayMusic()
|
|
|
|
|
{
|
|
|
|
|
player.Play();
|
|
|
|
|
isMusicPlaying = true;
|
|
|
|
|
}
|
|
|
|
|
public void PauseMusic()
|
|
|
|
|
{
|
|
|
|
|
player.Pause();
|
|
|
|
|
isMusicPlaying = false;
|
|
|
|
|
}
|
|
|
|
|
public void StopMusic()
|
|
|
|
|
{
|
|
|
|
|
if (isMusicBeginning)
|
|
|
|
|
{
|
|
|
|
|
player.Stop();
|
|
|
|
|
isMusicPlaying = false;
|
|
|
|
|
isMusicBeginning = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void PauseMusic()
|
|
|
|
|
{
|
|
|
|
|
player.Pause();
|
|
|
|
|
isMusicPlaying = false;
|
|
|
|
|
}
|
|
|
|
|
public void StopMusic()
|
|
|
|
|
{
|
|
|
|
|
if (isMusicBeginning)
|
|
|
|
|
{
|
|
|
|
|
player.Stop();
|
|
|
|
|
isMusicPlaying = false;
|
|
|
|
|
isMusicBeginning = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void ReglerTempo(float tempo)
|
|
|
|
|
{
|
|
|
|
|
player.Speed = tempo;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|