This is an automated email from the git hooks/post-receive script. New commit to branch feature/7063 in repository tutti. See http://git.codelutin.com/tutti.git commit fe0b3008031770263c6f6cd0b4ba96d78d77e1db Author: Kevin Morin <morin@codelutin.com> Date: Wed Jan 20 10:36:21 2016 +0100 correction de l'algo de lecture de nombres (refs #7063) --- .../fr/ifremer/tutti/ui/swing/util/SoundUtil.java | 71 +++------------------- 1 file changed, 7 insertions(+), 64 deletions(-) diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/SoundUtil.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/SoundUtil.java index e9d1bff..7148b4a 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/SoundUtil.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/SoundUtil.java @@ -97,6 +97,10 @@ public class SoundUtil { int tensAndUnits = (int) number % 100; int decimal = (int) (number * 10) % 10; + if (log.isDebugEnabled()) { + log.debug(thousands + " " + hundreds + " " + tensAndUnits + " " + decimal); + } + List<AudioInputStream> audioInputStreams = new ArrayList<>(); addSound(audioInputStreams, thousands, 1000); @@ -142,67 +146,6 @@ public class SoundUtil { } -// public static synchronized void readNumber(final double number, final String unit) { -// -// new Thread(new Runnable() { -// -// @Override -// public void run() { -// -// try { -// -// int thousands = (int) (number / 1000); -// int hundreds = (int) (number % 1000) / 100; -// int tensAndUnits = (int) number % 100; -// int decimal = (int) (number * 10) % 10; -// -// List<AudioInputStream> audioInputStreams = new ArrayList<>(); -// -// addSound(audioInputStreams, thousands, 1000); -// addSound(audioInputStreams, hundreds, 100); -// if (tensAndUnits != 0 || thousands == 0 && hundreds == 0) { -// addSound(audioInputStreams, tensAndUnits); -// } -// if (decimal > 0) { -// addSound(audioInputStreams, ","); -// addSound(audioInputStreams, decimal); -// } -// addSound(audioInputStreams, unit); -// -// if (!audioInputStreams.isEmpty()) { -// -// AudioFormat format = audioInputStreams.get(0).getFormat(); -// DataLine.Info info = new DataLine.Info(SourceDataLine.class, format); -// try (SourceDataLine audioLine = (SourceDataLine) AudioSystem.getLine(info)) { -// audioLine.open(format); -// audioLine.start(); -// -// byte[] bytesBuffer = new byte[4096]; -// -// while (!audioInputStreams.isEmpty()) { -// try (AudioInputStream audioInputStream = audioInputStreams.remove(0)) { -// int bytesRead; -// while ((bytesRead = audioInputStream.read(bytesBuffer)) != -1) { -// audioLine.write(bytesBuffer, 0, bytesRead); -// } -// } -// } -// -// audioLine.drain(); -// -// } -// } -// -// } catch (Exception e) { -// if (log.isErrorEnabled()) { -// log.error("Error while reading " + number + " " + unit, e); -// } -// } -// } -// -// }).start(); -// } - protected static long addSound(List<AudioInputStream> inputStreams, int number) throws IOException, UnsupportedAudioFileException { return addSound(inputStreams, number, 1); } @@ -212,16 +155,16 @@ public class SoundUtil { if (number > 1 || suffix == 1) { if (log.isDebugEnabled()) { - log.debug("add " + number + ".wav"); + log.debug("-> add " + number + ".wav"); } AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(SoundUtil.class.getResource(SOUNDS_DIRECTORY + "/" + number + ".wav")); inputStreams.add(audioInputStream); length += audioInputStream.getFrameLength(); } - if (number > 1 && suffix > 1) { + if (number >= 1 && suffix > 1) { if (log.isDebugEnabled()) { - log.debug("add " + suffix + ".wav"); + log.debug("-> add " + suffix + ".wav"); } AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(SoundUtil.class.getResource(SOUNDS_DIRECTORY + "/" + suffix + ".wav")); inputStreams.add(audioInputStream); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.