AUDIO_CURVE_TYPE列舉 (ksmedia.h)

AUDIO_CURVE_TYPE列舉會定義常數,指定要套用的曲線演算法來設定磁碟區層級。

Syntax

typedef enum {
  AUDIO_CURVE_TYPE_NONE,
  AUDIO_CURVE_TYPE_WINDOWS_FADE
} AUDIO_CURVE_TYPE;

常數

 
AUDIO_CURVE_TYPE_NONE
指定不會套用曲線演算法。 指定此曲線時,指定的曲線持續時間必須等於 0。
AUDIO_CURVE_TYPE_WINDOWS_FADE
Specifies that the algorithm that is applied to the volume setting must follow the curve shown in the diagram in the Remarks section.

備註

下列虛擬代碼段顯示套用至磁碟區設定以達到目標磁碟區層級之演算法的邏輯。

// POWER IN AMPLITUDE: 1.75

// Fade In:
// Curve begins at 0 when nFrame = 0
// When nFrame gets to (nFrames - 1), curve = 1
//
// curve = pow(nFrame / (nFrames - 1), exponent)

float fFrameCount = nFrames - 1.0f;
for (UINT32 nFrame = 0; nFrame < nFrames; nFrame++) {
    float curve = powf(nFrame / fFrameCount, 1.75f);
    for (UINT32 nChannel = 0; nChannel < pWfx->nChannels; nChannel++) {
            pFloat[nFrame * pWfx->nChannels + nChannel] *= curve;
    }
}

// Fade Out:
// curve begins at 1 when nFrame = 0
// When nFrame gets to (nFrames - 1), curve = 0
//
// curve = pow(1 - (nFrame / (nFrames - 1)), exponent)

float fFrameCount = nFrames - 1.0f;
for (UINT32 nFrame = 0; nFrame < nFrames; nFrame++) {
    float curve = powf(1.0f - (nFrame / fFrameCount), 1.75f);
    for (UINT32 nChannel = 0; nChannel < pWfx->nChannels; nChannel++) {
            pFloat[nFrame * pWfx->nChannels + nChannel] *= curve;
    }
}

下圖顯示先前虛擬程式代碼的圖形表示法,用於設定磁碟區層級。

磁碟區層級曲線的圖形表示。

規格需求

需求
最低支援的用戶端 Windows 8
標頭 ksmedia.h

另請參閱

KSAUDIOENGINE_VOLUMELEVEL

KSPROPERTY_AUDIOENGINE_VOLUMELEVEL