SoundSetVolume

サウンドデバイスの音量設定を変更します。

SoundSetVolume NewSetting , Component, Device

パラメータ

NewSetting

型:文字列整数浮動小数点

A string containing a percentage number between -100 and 100 inclusive. 数値がプラス記号またはマイナス記号で始まる場合、現在の設定は指示された量だけ上下に調整される。そうでない場合は、NewSettingで示されたレベルに明示的に設定される。

If the percentage number begins with a minus sign or is unsigned, it does not need to be enclosed in quotation marks.

コンポーネント

型:文字列または整数

If blank or omitted, it defaults to the master volume setting. Otherwise, specify the component's display name and/or index, e.g. 1, "Line in" or "Line in:2".

詳しくは「コンポーネント(サウンド機能)」をご覧ください。

Device

型:文字列または整数

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)".

詳しくはデバイス(サウンド機能)をご覧ください。

エラー処理

A TargetError is thrown if the device or component could not be found or if the component does not support this control type. Otherwise, an OSError is thrown on failure.

備考

ボリュームを調整する別の方法として、スクリプトにボリュームコントロールのキーストロークを送信させ、以下の例のようにシステム全体のマスターボリュームを変更する方法があります:

Send "{Volume_Up}"  ; Raise the master volume by 1 interval (typically 5%).
Send "{Volume_Down 3}"  ; Lower the master volume by 3 intervals.

システムにインストールされているサウンドデバイスの機能(名前や使用可能なコンポーネントなど)を調べるには、サウンドカード解析スクリプトを実行します。

SoundSetVolumeは、音量レベルを変更する際、既存のバランスを維持しようとする。

現在の音量設定を取得するには、SoundGetVolumeを使用する。

サウンド機能

Sets the master volume to 50 percent. Quotation marks can be omitted.

SoundSetVolume "50"
SoundSetVolume 50

Increases the master volume by 10 percent. Quotation marks cannot be omitted.

SoundSetVolume "+10"

Decreases the master volume by 10 percent. Quotation marks can be omitted.

SoundSetVolume "-10"
SoundSetVolume -10

Increases microphone recording volume by 20 percent.

SoundSetVolume "+20", , "Microphone"