Closed GoogleCodeExporter closed 9 years ago
用参数的话,不合理啊,每个歌的offset都不一样,难道换歌��
�重新算个offset重新执行脚本?
按键是可以考虑,不过挺麻烦的。
Original comment by bones7...@gmail.com
on 24 Aug 2009 at 9:59
用参数当然可以啊,当发现某一首歌不同步时,可以终止程��
�,重新加参数运行来调整 offset.
我觉得这样算是不错了,做起来也简单。
用按键控制的话会比交麻烦,我见过有人用
脚本写了个俄罗斯方块游戏,还有贪吃蛇游戏,你可
以找这些来参考一下。
Original comment by ptpt52
on 24 Aug 2009 at 12:53
可不可以参考一下 Mplayer
的声画同步调节?那个是运行中接受按键调节的,不过不知��
�用
Shell 好不好写……
Original comment by ive...@gmail.com
on 23 Oct 2009 at 1:28
你们的代码不好改,烦,我写了个模型,可以通过键盘输入��
�改 offset 的值, 代码如下:
#########################
#!/bin/bash
offset=0
ot=/tmp/offset.tmp
[ -f "$ot" ] || touch "$ot"
echo 0 > "$ot"
thread_getkey(){ #读取键盘输入
while :; do
Keypress=$(head -c1)
if [ "x$Keypress" = "xw" ]; then #输入 w 时候 offset + 10
((offset+=10))
elif [ "x$Keypress" = "xs" ]; then #输入 s 时候 offset -10
((offset-=10))
elif [ "x$Keypress" = "xq" ]; then #输入 q 时候 退出程序
echo stop > "$ot"
break
fi
echo "$offset" > "$ot"
done
}
main_pth(){
while :; do
offset=`cat "$ot"`
[ "x$offset" = "xstop" ] && break
echo "offset=$offset" 显示歌词
sleep 1
done
return 0
}
old_tty_settings=$(stty -g) #Save old settings
stty -icanon
stty -echo
main_pth& #处理并显示歌词的进程后台运行
thread_getkey #读取键盘输入
stty "$old_tty_settings" #Restore old settings
Original comment by ptpt52
on 24 Dec 2009 at 8:37
已经将ptpt52的程序commit到svn:)
Original comment by cxcxcxcx@gmail.com
on 21 Jan 2010 at 8:05
Original issue reported on code.google.com by
ptpt52
on 15 Aug 2009 at 9:38