1
2
3
4
5
6
7 package com.octo.captcha.component.sound.wordtosound;
8
9 import com.octo.captcha.component.sound.soundconfigurator.SoundConfigurator;
10
11 import javax.sound.sampled.AudioInputStream;
12
13 /***
14 * WordToSound abstract implementation
15 *
16 * @author Benoit
17 * @version 1.0
18 */
19 public abstract class AbstractWordToSound implements WordToSound {
20 protected int maxAcceptedWordLength;
21
22 protected int minAcceptedWordLength;
23
24 protected SoundConfigurator configurator = null;
25
26 /***
27 * Constructor with a configurator
28 *
29 * @param configurator the configuration for this particular voice
30 * @param minAcceptedWordLength Length Minimal of generated words
31 * @param maxAcceptedWordLength Length Maximal of generated words
32 */
33 public AbstractWordToSound(SoundConfigurator configurator, int minAcceptedWordLength,
34 int maxAcceptedWordLength) {
35 this.configurator = configurator;
36 this.minAcceptedWordLength = minAcceptedWordLength;
37 this.maxAcceptedWordLength = maxAcceptedWordLength;
38 }
39
40 public int getMaxAcceptedWordLength() {
41 return maxAcceptedWordLength;
42 }
43
44 public int getMinAcceptedWordLength() {
45 return minAcceptedWordLength;
46 }
47
48 public int getMaxAcceptedWordLenght() {
49 return maxAcceptedWordLength;
50 }
51
52 public int getMinAcceptedWordLenght() {
53 return minAcceptedWordLength;
54 }
55
56 /***
57 * Add effect to the sound
58 *
59 * @param sound The sound to modify
60 *
61 * @return The modified sound.
62 */
63 protected abstract AudioInputStream addEffects(AudioInputStream sound);
64 }