IAudioEndpointVolume::GetVolumeRange 方法 (endpointvolume.h)

GetVolumeRange方法會取得進入或離開音訊端點裝置之音訊資料流程的音量範圍,以分貝為單位。

語法

HRESULT GetVolumeRange(
  [out] float *pflVolumeMindB,
  [out] float *pflVolumeMaxdB,
  [out] float *pflVolumeIncrementdB
);

參數

[out] pflVolumeMindB

最小磁片區層級的指標。 此參數會指向 浮點 數變數,方法會將最小磁片區層級寫入至其中以分貝為單位。 在 IAudioEndpointVolume 介面實例的存留期內,這個值會維持不變。

[out] pflVolumeMaxdB

最大磁片區層級的指標。 這個參數指向 浮點 數變數,方法會將最大磁片區層級寫入至其中,以分貝為單位。 在 IAudioEndpointVolume 介面實例的存留期內,這個值會維持不變。

[out] pflVolumeIncrementdB

磁片區增量的指標。 此參數會指向 浮點 數變數,方法會將磁片區遞增寫入以分貝為單位。 此增量會在 IAudioEndpointVolume 介面實例的存留期維持不變。

傳回值

如果方法成功,它會傳回 S_OK。 如果失敗,可能的傳回碼包括但不限於下表所示的值。

傳回碼 描述
E_POINTER
參數 pfLevelMinDBpfLevelMaxDBpfVolumeIncrementDBNull

備註

從 vmin = *pfLevelMinDB 到 vmax = *pfLevelMaxDB 的磁片區範圍分成 n 個大小 vinc = *pfVolumeIncrementDB的統一間隔,其中

n = (vmax – vmin) / vinc。

vmin、vmax 和 vinc 的值會以分貝為單位來測量。 用戶端可以將磁片區層級設定為 vmin 到 vmax 範圍中 n + 1 個離散值的其中一個。

IAudioEndpointVolume::SetChannelVolumeLevelIAudioEndpointVolume::SetMasterVolumeLevel方法只接受從 vmin 到 vmax 範圍內的磁片區層級。 如果呼叫端指定超出此範圍的磁片區層級,此方法會失敗並傳回E_INVALIDARG。 如果呼叫端指定位於磁片區範圍中兩個步驟之間的磁片區層級,此方法會將端點磁片區層級設定為最接近要求磁片區層級的步驟,並傳回S_OK。 不過,後續呼叫 IAudioEndpointVolume::GetChannelVolumeLevelIAudioEndpointVolume::GetMasterVolumeLevel 會擷取先前呼叫 SetChannelVolumeLevelSetMasterVolumeLevel所要求的磁片區層級,而不是步驟值。

如果磁片區控制項是在硬體中實作, GetVolumeRange 會描述硬體磁片區設定的範圍和細微性。 相反地, IEndpointVolume::GetVolumeStepInfo 方法所報告的步驟會對應至 IEndpointVolume::VolumeStepDownIEndpointVolume::VolumeStepUp 方法以軟體計算的音訊磁帶曲線上的點。 任一種方法都會先計算對應至曲線下一個點的理想化磁片區層級。 接下來,方法會選取最接近理想層級的硬體磁片區設定。 如需音訊磁帶曲線的詳細資訊,請參閱 音訊磁帶磁片區控制項

需求

   
最低支援的用戶端 Windows Vista [傳統型應用程式 |UWP 應用程式]
最低支援的伺服器 Windows Server 2008 [傳統型應用程式 |UWP 應用程式]
目標平台 Windows
標頭 endpointvolume.h

另請參閱

IAudioEndpointVolume 介面

IAudioEndpointVolume::GetChannelVolumeLevel

IAudioEndpointVolume::GetMasterVolumeLevel

IAudioEndpointVolume::SetChannelVolumeLevel

IAudioEndpointVolume::SetMasterVolumeLevel

IEndpointVolume::GetVolumeStepInfo

IEndpointVolume::VolumeStepDown

IEndpointVolume::VolumeStepUp