bonjour,
j'ai deux fonctions qui ont chacune un SoundPlayer:
et
Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 public void rotation(double v) { DoubleAnimation anim1 = new DoubleAnimation(); SoundPlayer son = new SoundPlayer("C:\\Users\\Bibi\\Documents\\Visual Studio 2010\\Projects\\jeu memo\\jeu memo\\Son\\testdeplacement.wav"); anim1.To = v; anim1.BeginTime = TimeSpan.FromSeconds(0.85); anim1.Duration = new Duration(TimeSpan.FromSeconds(2)); anim1.AutoReverse = false; RotateTransform rotation = (RotateTransform)testes.RenderTransform; son.Play(); rotation.BeginAnimation(RotateTransform.AngleProperty, anim1); }
Code c# : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 internal void perdu(Color c) { SoundPlayer soud = new SoundPlayer("C:\\Users\\Bibi\\Downloads\\49946__simon-rue__misslyckad-bana-v3.wav"); Storyboard story = new Storyboard(); ColorAnimation animc = new ColorAnimation(); animc.From = Colors.Black; animc.To = c; animc.Duration = new Duration(TimeSpan.FromSeconds(0.5)); animc.AutoReverse = true; story.Children.Add(animc); Storyboard.SetTarget(animc, bordfond); Storyboard.SetTargetProperty(animc, new PropertyPath("Stroke.Color")); soud.Play(); story.Begin(); }
je passe plusieurs fois dans la premiere methode, le SoundPlayer marche bien,
mais dès que je passe dans la deuxieme, le soud marche,pas de probleme jusque là.
Quand je repasse dans la premiere méthode, le son ne marche plus, j'ai un "clic" qui ce fait mais je n'ai pas le son. quand je le fais en mode debug, ca marche bien.
Bug lier a mon code ? ou pas ?
Merci.
Partager