HSPで簡単な音楽プレーヤーを作ったのですが、音楽ファイル(MP3)を再生しようとしても、再生できる曲とできない曲があります。
なぜでしょうか?
色々見ても問題が見当たりません。
よろしくお願いします。
;以下スクリプト
gsel 0,2
*home
onexit *owari
title "KPb 1.0.1"
bgscr 0,275,50:cls 1
cls 2
onclick gosub *move
objsize 50,50
pos 0,0:button "開く",*psh_open
pos 50,0:button "再生",*psh_play
pos 100,0:button "一時停止",*psh_stop
pos 150,0:button "停止",*teishi
pos 200,0:button "終了",*owari
mci "set HSP time format milliseconds"
stop
*psh_open
dialog "wav;*.mp3;*.mid;*.wma", 16, "音楽ファイル"
if stat=0:stop
file=refstr
mci "open \""+refstr+"\" type mpegvideo alias HSP" ; ファイルオープン
exist file
sdim id3_data,0x80
bload file, id3_data,,strsize-0x80 ; ID3タグを確認
if wpeek(id3_data,0)!0x4154 : stop
dialog "読み込みが完了しました。",p1,"メッセージ"
stop
*psh_play
mci "play HSP" ; 再生
repeat
mci "status HSP position" ; 再生時間取得
title "KP ["+strf("%02d",stat/1000/60)+":"+strf("%02d",stat/1000\60)+"]"
await 100
loop
*psh_stop
mci "stop HSP" ; 再生停止
stop
*teishi
mci "close HSP" ; 再生停止
goto *home
stop
*owari
end
*move
if wparam=1 : sendmsg hwnd,$00A1,2,0
return