#module
#deffunc mcisel int
mref no, 0
cntno = no
return
#deffunc mciload str, int
mref file, 32 : mref no, 1
cntno = no
mci "close _" + cntno
strmid i, file, , 2 : int i
if i {
file = "cdaudio!?"
poke file, 8, i + 64
}
mci "open \"" + file + "\" alias _" + cntno
return
#deffunc mciplay str, str, int
mref start, 32 : mref finish, 33 : mref re, 2
if start ! "" : s = " from " + start : else : s = ""
if finish ! "" : s += " to " + finish
if re : s += " repeat"
mci "play _" + cntno + s
return
#deffunc mciend onexit
mci "stop all"
mci "close all"
return
#deffunc mcisetsound int, int
mref direction, 0 : mref flg, 1
if flg ! 0 : s = "on" : else : s = "off"
if direction = 1 : s = "left " + s : else : if direction = 2 : s = "right " + s : else : s = "all " + s
mci "set _" + cntno + " audio " + s
return
#global
sdim file, 256, 2
sdim d, 4, 2
objsize 100, 20
d = "左", "右"
repeat 2
pos 10, 30 * cnt + 10 : button d.cnt + "読込", *load
pos 120, 30 * cnt + 10 : input file.cnt, 300, 20
loop
pos 10, 100 : button "再生", *play
stop
*load
i = (stat ! 0)
dialog "wav;*.mp3;*.asf;*.wma;*.cda", 16, d.cnt + "スピーカーから流す音楽"
if stat {
file.i = refstr
objprm i * 2 + 1, file.i
mciload file.i, i
mcisetsound 2 - i // 反対側の出力をOFFにする
}
stop
*play
repeat 2
mcisel cnt
mciplay "", "", 1
loop
stop
|