HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2012
0403
Dangerous scripts再生位置の表示付プレイヤー0解決


Dangerous scripts

リンク

2012/4/3(Tue) 19:43:51|NO.45764

再生位置を表示させるスクリプトです。
参考にしてください。
このスクリプトは、以下URLにあるスクリプトを元に作りました。

http://www.rinku.zaq.ne.jp/ultimate/lecture/dictionary/


;--------------------------------------------------------------------------------- ; メインスクリプト ;--------------------------------------------------------------------------------- #module #deffunc mcisel int no cntno = no return #deffunc mciload str file, int no, local s cntno = no mci "close _" + cntno if int(file) { s = "cdaudio!?" poke s, 8, int(file) + 64 } else { s = file } mci "open \"" + s + "\" alias _" + cntno return #deffunc mciplay str start, str finish, int re, local s if start ! "" : s = " from " + start : else : s = "" if finish ! "" : s += " to " + finish if re : s += " repeat" mci "play _" + cntno + s return #deffunc mcistop mci "stop _" + cntno return #deffunc mciend onexit mci "stop all" mci "close all" return #deffunc mcimove int position mci "seek _" + cntno + " to " + position return #deffunc mciproduct mci "info _" + cntno + " product" return #deffunc mcitype mci "capability _" + cntno + " device type" return #defcfunc mciposiloop mci "status _" + cntno + " length" return stat #defcfunc mcicurrent mci "status _" + cntno + " position" return stat #global ;--------------------------------------------------------------------------------- ; ウインドウを真ん中に表示するためのスクリプト ;--------------------------------------------------------------------------------- #module #deffunc center width , , (ginfo_dispx - ginfo_winx) / 2, (ginfo_dispy - ginfo_winy) / 2 return #global ;--------------------------------------------------------------------------------- ;       ボタンなど ;--------------------------------------------------------------------------------- width 640,150; ウィンドウサイズ center;ウインドウを真ん中 title "プレイヤー";ウインドウ表示 ; ボタン pos 0,5:objsize 50,25:button "開く", *Open pos 50,5:objsize 50,25:button "一時停止", *sound_play pos 100,5:objsize 75,25:button "最初から再生", *suta_to_play pos 175,5:objsize 50,25:button "停止", *Music_stop pos 225,5:objsize 50,25:button "終了",*owari ;--------------------------------------------------------------------------------- ;    トラックバー ;--------------------------------------------------------------------------------- #const global TBM_SETPOS 0x0405 //スライダーの位置を設定 #const global TBM_SETRANGEMIN 0x0407 //スライダー位置の可変範囲の最小値の設定 #const global TBM_SETRANGEMAX 0x0408 //スライダー位置の可変範囲の最大値の設定 pos 0,35 :winobj "msctls_trackbar32", "", 1 , $50000000 | $18, 640, 30//トラックバー_id id = objinfo(stat,2) ;-------------------------------------------------------------------------------- ;    WAVE用 ;-------------------------------------------------------------------------------- pos 440,0 :winobj "msctls_trackbar32", "",, $50000000 | $18, 200, 30 hTrackbar = objinfo(stat, 2) sendmsg hTrackbar, $405, 1,100 sendmsg hTrackbar, $414, 10 ;--------------------------------------------------------------------------------- ; WAVEボリュームの調節 ;--------------------------------------------------------------------------------- onexit gosub *raamen ; トラックバー ;DLL呼び出し #uselib "winmm.dll" #func global waveOutSetVolume "waveOutSetVolume" int, int #module #deffunc setvolume int right, int left, local i i = limit(right, 0, 100) * 0xFFFF / 100, limit(left, 0, 100) * 0xFFFF / 100 waveOutSetVolume 0xFFFFFFFF, (i.0 << 16) + i.1 return #global volume=100 : setvolume Volume,Volume *VolumeRegulation onexit gosub *raamen *waveVolume; ループのためのラベル oncmd gosub *vscroseek, $114; トラックバー sendmsg id, TBM_SETPOS, 1, mcicurrent()//トラックバー_idに位置反映 sendmsg id, TBM_SETRANGEMAX, 1, mciposiloop()//トラックバー_idに長さ反映 redraw 0 color 255,255,255 : boxf 300,0,400,25 font msgothic,14,0 ; 文字サイズを指定 color 0,0,0:pos 300,10:mes ""+strf("%02d",mcicurrent()/1000/60)+":"+strf("%02d",mcicurrent()/1000\60)+"/"+strf("%02d",mciposiloop()/1000/60)+":"+strf("%02d",mciposiloop()/1000\60) redraw 1 await 1;0.01秒待つ goto *waveVolume; *waveVolumeとのループ *vscroseek if lparam = hTrackbar { sendmsg hTrackbar, $400 Volume=stat setvolume Volume,Volume; 音量を指定サイズに変更する } if lparam = id { sendmsg id, $400 position=stat mcimove position : mciplay "", ""; 再生位置 } return stop ;--------------------------------------------------------------------------------- ; ボタン操作用ラベル ;--------------------------------------------------------------------------------- *Open ; ファイル読み込みダイアログ dialog "wav;*.mp3", 16, "音楽ファイル" if stat { color 255,255,255 : boxf 0,70,1100,140 font msgothic,12,0 ; 文字サイズを指定 color 0,0,0:pos 5,70:mes "ファイルパス "+refstr gsel 0, 1 mciload refstr mciproduct pos 5,90: mes "プロダクト "+refstr mcitype pos 5,110:mes "タイプ "+refstr pos 5,130:mes "再生時間 "+strf("%02d",mciposiloop()/1000/60)+":"+strf("%02d",mciposiloop()/1000\60) } mciplay "", "" goto *waveVolume stop *sound_play msg = "一時停止", "再生" bflg = 1 - bflg objprm 1, msg.bflg if bflg > 0 : goto *sound_stop mciplay "", ""; 再生 goto *waveVolume stop *suta_to_play mcimove 0 mciplay "", ""; 再生 goto *waveVolume *sound_stop mcistop; 演奏ストップ goto *waveVolume *Music_stop mcimove 0 mcistop; 演奏ストップ goto *waveVolume *owari goto *raamen stop *raamen;終了じwavを100にする mci "stop myid" ; 演奏ストップ volume=100 : setvolume Volume,Volume end



この記事に返信する


ONION software Copyright 1997-2023(c) All rights reserved.