|
@@ -35,43 +35,43 @@ public class TtsController {
|
|
|
@Autowired
|
|
|
MusicService musicService;
|
|
|
|
|
|
- @Value("${play_path:/static/wav/hdzqdd.wav}")
|
|
|
+ @Value("${play_path:/static/wav/music.wav}")
|
|
|
String playPath;
|
|
|
|
|
|
- @GetMapping("/speak/{txt}")
|
|
|
- public String speak(@PathVariable String txt) {
|
|
|
-// redisTemplate.opsForList().rightPush("ttsList", txt);
|
|
|
- speak(txt,100);
|
|
|
- return txt;
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/speak1/{txt}/{vol}")
|
|
|
- public String speak(@PathVariable String txt,@PathVariable Integer vol) {
|
|
|
- vol = vol > 1000 ? 1000 : vol;
|
|
|
- vol = vol < 0 ? 0 : vol;
|
|
|
- Map<String,Object> m = new HashMap();
|
|
|
- m.put("txt",txt);
|
|
|
- m.put("vol",vol);
|
|
|
- redisTemplate.opsForList().rightPush("ttsList", JSON.toJSONString(m));
|
|
|
- return txt;
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/speakFile/{fileName}")
|
|
|
- public String speakFile(@PathVariable String fileName) {
|
|
|
- String path = "/home/" + fileName + ".wav";
|
|
|
- log.info("path:{}", path);
|
|
|
- WavPlayUtil.play(path);
|
|
|
- return fileName;
|
|
|
- }
|
|
|
-
|
|
|
- @GetMapping("/speakFile1/{fileName}")
|
|
|
- public String speakFile1(@PathVariable String fileName) throws IOException, InterruptedException {
|
|
|
- String path = "/home/" + fileName + ".wav";
|
|
|
- log.info("path:{}", path);
|
|
|
- Process exec = Runtime.getRuntime().exec("play " + path);
|
|
|
- exec.waitFor();
|
|
|
- return path;
|
|
|
- }
|
|
|
+// @GetMapping("/speak/{txt}")
|
|
|
+// public String speak(@PathVariable String txt) {
|
|
|
+//// redisTemplate.opsForList().rightPush("ttsList", txt);
|
|
|
+// speak(txt,100);
|
|
|
+// return txt;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/speak1/{txt}/{vol}")
|
|
|
+// public String speak(@PathVariable String txt,@PathVariable Integer vol) {
|
|
|
+// vol = vol > 1000 ? 1000 : vol;
|
|
|
+// vol = vol < 0 ? 0 : vol;
|
|
|
+// Map<String,Object> m = new HashMap();
|
|
|
+// m.put("txt",txt);
|
|
|
+// m.put("vol",vol);
|
|
|
+// redisTemplate.opsForList().rightPush("ttsList", JSON.toJSONString(m));
|
|
|
+// return txt;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/speakFile/{fileName}")
|
|
|
+// public String speakFile(@PathVariable String fileName) {
|
|
|
+// String path = "/home/" + fileName + ".wav";
|
|
|
+// log.info("path:{}", path);
|
|
|
+// WavPlayUtil.play(path);
|
|
|
+// return fileName;
|
|
|
+// }
|
|
|
+//
|
|
|
+// @GetMapping("/speakFile1/{fileName}")
|
|
|
+// public String speakFile1(@PathVariable String fileName) throws IOException, InterruptedException {
|
|
|
+// String path = "/home/" + fileName + ".wav";
|
|
|
+// log.info("path:{}", path);
|
|
|
+// Process exec = Runtime.getRuntime().exec("play " + path);
|
|
|
+// exec.waitFor();
|
|
|
+// return path;
|
|
|
+// }
|
|
|
|
|
|
@GetMapping("/startMusic/{vol}")
|
|
|
public String startMusic(@PathVariable Integer vol) {
|