Bonjour,

Je souhaiterais lancer un fichier MP3 à mon Donkey USB. Dans l'exemple si dessous le son reproduit est créé par Java (si j'ai bien compris ).

Code : 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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*******************************************************************************
 * Copyright (c) 2009 www.roboidstudio.org. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors: Kyoung Jin Kim
 ******************************************************************************/
 
package examples.roboid.donkey;
 
import org.roboid.robot.Roboid;
 
import roboid.core.Controller;
import roboid.donkey.Donkey;
 
/**
 * generating sound and driving speaker for 2 seconds.
 * 
 * @author Kyoung Jin Kim
 */
public class Example_04 implements Controller
{
    private Donkey donkey = new Donkey();
    private int i;
    private int[] wave = new int[960];
 
    public static void main(String[] srgs)
    {
        new Example_04();
    }
 
    public Example_04()
    {
        wait(3000);
        donkey.setController(this);
 
        while(i < 20)
        {
            i++;
            generate(i + 30);
            wait(100);
        }
 
        // don't forget to dispose.
        donkey.dispose();
    }
 
    @Override
    public void execute(Roboid roboid)
    {
        donkey.speaker.write(wave);
    }
 
    private void generate(int duration)
    {
        for(int j = 0; j < 960; j++)
            wave[j] = (j % duration) * 5000;
    }
 
    private static void wait(int time)
    {
        try
        {
            Thread.sleep(time);
        } catch (InterruptedException e)
        {}
    }
}
Je pense que c'est possible puisqu'il est possible qu'il lise les mails, j'en suis pas là !

Merci de vos réponses,