Share via


IAudioSessionControl 介面 (audiopolicy.h)

IAudioSessionControl 介面可讓用戶端設定音訊會話的控制參數,以及監視會話中的事件。 IAudioClient::Initialize 方法會初始化數據流物件,並將數據流指派給音訊會話。 用戶端會呼叫 IAudioClient::GetService 方法,並將參數 riid 設定為 REFIID IID_IAudioSessionControl,以取得數據流物件上 IAudioSessionControl 介面的參考。

或者,用戶端可以取得現有會話的 IAudioSessionControl 介面,而不需要先建立數據流物件,並將數據流新增至會話。 相反地,用戶端會呼叫 IAudioSessionManager::GetAudioSessionControl 方法,並將參數 AudioSessionGuid 設定為會話 GUID。

當用戶端透過 IAudioSessionControl 介面中的方法變更會話參數時,用戶端可以註冊以接收來自會話管理員的通知。

釋放 IAudioSessionControl 介面實例時,客戶端必須從與呼叫建立物件的 IAudioClient::GetService 相同的線程呼叫介面的 Release 方法。

IAudioSessionControl 介面會控制音訊會話。 音訊會話是共用模式數據流的集合。 此介面不適用於獨佔模式數據流。

如需使用 IAudioSessionControl 介面的程式代碼範例,請參閱 舊版音訊應用程式的音訊事件

繼承

IAudioSessionControl 介面繼承自 IUnknown 介面。 IAudioSessionControl 也有下列類型的成員:

方法

IAudioSessionControl 介面具有這些方法。

 
IAudioSessionControl::GetDisplayName

GetDisplayName 方法會擷取音訊會話的顯示名稱。
IAudioSessionControl::GetGroupingParam

GetGroupingParam 方法會擷取音訊會話的群組參數。
IAudioSessionControl::GetIconPath

GetIconPath 方法會擷取音訊會話顯示圖示的路徑。
IAudioSessionControl::GetState

GetState 方法會擷取音訊會話的目前狀態。
IAudioSessionControl::RegisterAudioSessionNotification

RegisterAudioSessionNotification 方法會註冊用戶端以接收會話事件的通知,包括數據流狀態的變更。
IAudioSessionControl::SetDisplayName

SetDisplayName 方法會將顯示名稱指派給目前的會話。
IAudioSessionControl::SetGroupingParam

SetGroupingParam 方法會將會話指派給會話群組。
IAudioSessionControl::SetIconPath

SetIconPath 方法會將顯示圖示指派給目前的會話。
IAudioSessionControl::UnregisterAudioSessionNotification

UnregisterAudioSessionNotification 方法會刪除用戶端先前的註冊,以接收通知。

規格需求

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

另請參閱

核心音訊介面

IAudioClient::GetService

IAudioClient::Initialize

IAudioSessionManager::GetAudioSessionControl

WASAPI