|
@@ -25,17 +25,17 @@ public class MusicServiceImpl implements MusicService {
|
|
Process p;
|
|
Process p;
|
|
String cmd;
|
|
String cmd;
|
|
//1:开始命令到达,0:无开始命令
|
|
//1:开始命令到达,0:无开始命令
|
|
- Boolean startCmd=false;
|
|
|
|
|
|
+ Boolean startCmd = false;
|
|
//1:结束命令到达,0:无结束命令
|
|
//1:结束命令到达,0:无结束命令
|
|
- Boolean endCmd=false;
|
|
|
|
|
|
+ Boolean endCmd = false;
|
|
//1:重复播放,0:不重复
|
|
//1:重复播放,0:不重复
|
|
- Boolean repeat=false;
|
|
|
|
|
|
+ Boolean repeat = false;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Integer start(String path, Integer vol) {
|
|
public Integer start(String path, Integer vol) {
|
|
synchronized (this) {
|
|
synchronized (this) {
|
|
- log.info("start music cmd:{}", cmd);
|
|
|
|
cmd = "play -v " + Float.valueOf(new Integer(vol).toString()) / 100 + " " + path;
|
|
cmd = "play -v " + Float.valueOf(new Integer(vol).toString()) / 100 + " " + path;
|
|
|
|
+ log.info("start music cmd:{}", cmd);
|
|
startCmd = true;
|
|
startCmd = true;
|
|
repeat = true;
|
|
repeat = true;
|
|
return 0;
|
|
return 0;
|
|
@@ -54,6 +54,8 @@ public class MusicServiceImpl implements MusicService {
|
|
@Scheduled(fixedRate = 500)
|
|
@Scheduled(fixedRate = 500)
|
|
public void play() {
|
|
public void play() {
|
|
synchronized (this) {
|
|
synchronized (this) {
|
|
|
|
+ log.info("startCmd:{}, endCmd:{}, repeat:{}", startCmd, endCmd, repeat);
|
|
|
|
+ log.info("p:{}, p.isAlive:{}", p, p.isAlive());
|
|
if (startCmd) {
|
|
if (startCmd) {
|
|
startCmd = false;
|
|
startCmd = false;
|
|
if (p != null) {
|
|
if (p != null) {
|