;============================================================ ; sample_vcam.hsp -- DirectShow 仮想ウェブカメラ サンプル ; ; HSP のスクリーン描画内容を仮想カメラとして配信するデモ。 ; Zoom / Teams / OBS 等のアプリで「IronHSP Virtual Camera」を ; カメラデバイスとして選択すると映像を確認できます。 ; ; 事前準備: ; 1. 管理者権限のコマンドプロンプトで以下を実行: ; regsvr32 hspvcam.dll ; 2. このサンプルを実行 ; 3. Zoom 等のアプリでカメラに「IronHSP Virtual Camera」を選択 ;============================================================ #include "iron_vcam.hsp" ; 仮想カメラの解像度とフレームレート cam_w = 640 cam_h = 480 cam_fps = 30 ; HSP ウィンドウをカメラと同じサイズに設定 screen 0, cam_w, cam_h title "IronHSP Virtual Webcam Demo" ; 仮想カメラ初期化 vcam_init cam_w, cam_h, cam_fps if stat != 0 { dialog "仮想カメラの初期化に失敗しました\n\nregsvr32 hspvcam.dll を\n管理者権限で実行してください", 1, "エラー" end } mes "仮想カメラを初期化しました" mes "解像度: " + cam_w + "x" + cam_h + " @ " + cam_fps + "fps" mes "" mes "このウィンドウの内容が仮想カメラに送信されます。" mes "Zoom 等で「IronHSP Virtual Camera」を選択してください。" mes "ESC キーで終了します。" mes "" ; アニメーションパラメータ angle = 0 frame_count = 0 ; メインループ repeat ; ESC キーで終了 getkey k, 27 if k : goto *quit redraw 0 ; 背景をグラデーションで描画 repeat cam_h r = cnt * 64 / cam_h g = 32 + cnt * 128 / cam_h b = 128 + cnt * 127 / cam_h color r, g, b line 0, cnt, cam_w, cnt loop ; 回転する円 cx = cam_w / 2 cy = cam_h / 2 sz = 80 color 255, 200, 0 circle cx - sz, cy - sz, cx + sz, cy + sz, 1 ; テキスト表示 color 255, 255, 255 font "MS Gothic", 20 pos 10, 10 mes "IronHSP Virtual Webcam" pos 10, 35 mes "Frame: " + frame_count ; 接続状態の表示 pos 10, 60 if vcam_is_active() { color 0, 255, 0 mes "Status: LIVE" } else { color 255, 100, 100 mes "Status: Waiting..." } ; 時刻表示 color 255, 255, 255 pos 10, cam_h - 30 mes "Time: " + gettime(4) + ":" + strf("%02d", gettime(5)) + ":" + strf("%02d", gettime(6)) redraw 1 ; カレントスクリーンを仮想カメラに送信 vcam_send angle += 3 if angle >= 360 : angle -= 360 frame_count++ await 1000 / cam_fps loop *quit ; 後始末 vcam_term end