サンプル音声はZ-MUSIC v3から無断で借りています。
不都合があればご連絡ください。
// Sound player
// for X-BASIC for iOS v1.7 later
width(64)
//
vpriority(TPAGE,GPAGE0,GPAGE1,GPAGE2,GPAGE3)
vpage(B_TPAGE or B_GPAGE0 or B_GPAGE1 or B_GPAGE2 or B_GPAGE3,YES)
apage(GPAGE0)
//
// 全ファイルリストを得る
dim str fileList(256):// ()内は扱える最大ファイル数
int allcnt
int i,ret
str ext
//
// 拡張子(大文字小文字を区別するので注意)
// 正規表現
ext="PCM|pcm|wav|WAV|aiff|AIFF|M44|P16|M30":
allcnt=files(fileList,"",ext,YES,FILES_FILE,YES)
if allcnt<=0 then {
locate(0,0)
print localizedString("音声ファイルがありません":"Sound file not found.")
} else {
int no
for i=0 to allcnt-1
locate(0,0):print fileList(i)
str pext=pathExtension(fileList(i))
strupr(pext)
if pext="PCM" then {
print "(ADPCM)"
no=a_setPlayData(fileList(i),0)
} else {
no=a_setPlayData(fileList(i))
}
a_play(no)
hitKey()
a_end(no)
next
}
end
//---------
func hitKey()
setFunctionKey(0,localizedString("ここを押してください","Hit This Button"),'!')
displayFunctionKey(YES,0,0)
while inkey()=0
endwhile
cls()
displayFunctionKey(NO,0,0)
endfunc
//---------
func str localizedString(js;str,es;str)
if isLocalizeJapan() then return(js)
return (es)
endfunc
//---------
音声サンプルを含む圧縮ファイルはこちら XBsoundloader.zip
0 件のコメント:
コメントを投稿