サウンドデバイスまたはコンポーネントのネイティブCOMインタフェースを取得します。
InterfacePtr := SoundGetInterface(IID, Component, Device)
型:文字列
インターフェース識別子(GUID)。"{xxxxxxx-xxxx-xxxx-xxxx-xxxx}"の形式をとる。
If blank or omitted, an interface implemented by the device itself will be retrieved. Otherwise, specify the component's display name and/or index, e.g. 1
, "Line in"
or "Line in:2"
.
詳しくは「コンポーネント(サウンド機能)」をご覧ください。
If blank or omitted, it defaults to the system's default device for playback (which is not necessarily device 1). Otherwise, specify the device's display name and/or index, e.g. 1
, "Speakers"
, "Speakers:2"
or "Speakers (Example HD Audio)"
.
詳しくはデバイス(サウンド機能)をご覧ください。
型:整数
成功した場合の戻り値はインターフェース・ポインターである。
インターフェイスがサポートされていない場合、戻り値は0である。
A TargetError is thrown if the device or component could not be found. Otherwise, an OSError is thrown on failure.
インターフェイスは以下のいずれかのソースから取得される:
"{7FB7B48F-531D-44A2-BCB3-5AD5A134B3DC}"
とすると、IAudioVolumeLevelインターフェイスを取得することができる。インターフェイスポインターを取得したら、ComCallを使ってそのメソッドを呼び出すことができる。正しいメソッド・インデックスを特定するために、Windows SDKヘッダーファイルを参照すること。
インターフェース・ポインターは、不要になったらObjReleaseに渡して解放しなければならない。これは、ComValueで"ラップ"することで可能になる。ラップされた値(オブジェクト)は、直接ComCallに渡すことができる。
Interface := ComValue(13, InterfacePtr)
Sound Functions, DeviceTopology API
Peak meter. ピーク値がゼロ(サウンドが再生されていない)の場合を除き、ツールチップに現在のピーク値が表示される。
; IAudioMeterInformation audioMeter := SoundGetInterface("{C02216F6-8C67-4B5B-9D00-D008E73E0064}") if audioMeter { try loop ; Until the script exits or an error occurs. { ; audioMeter->GetPeakValue(&peak) ComCall 3, audioMeter, "float*", &peak:=0 ToolTip peak > 0 ? peak : "" Sleep 15 } ObjRelease audioMeter } else MsgBox "Unable to get audio meter"