Windows Audio Session API、通称 WASAPI(ワサピ)はアプリ-オーディオデバイス間のストリームを管理する低レベルWin32 APIである[1]Core Audio APIsの1つ。

概要

編集

オーディオを扱うアプリケーションはマイク・スピーカー等の"オーディオエンドポイントデバイス"と連携して機能する。デバイスはOSによって管理されており、これらデバイスとアプリケーションを繋ぐオーディオストリームの管理がWASAPIの役割である。

例えばスピーカー出力を行うためにはWASAPIを用いて"エンドポイントバッファ"へ音声データを書きこめばよい[2]。APIコールを受けたOSはAudioEngineによるミキシング、デバイスドライバを介したスピーカー制御をおこない、実際にスピーカーから音声が出力される。

WASAPIは基本的にどのようなサウンドデバイスでも利用することができるが、使用するアプリケーションがWASAPIに対応している必要がある。

動作モード

編集

排他モード(exclusive)

編集

OS標準のミキサーや各種エフェクト(APO)処理を一切介さずにエンドポイントバッファ上のオーディオサンプルをアプリケーションが直接読み書きできる構造となっている。

共有モード

編集

他のアプリケーションの出力と共にOS標準のミキサーや各種エフェクト(APO)を介して再生されるため、複数の音声再生・録音アプリケーションを同時に使用する場合に適している。

利用

編集

WASAPIWin32 APIOSWindows OSAudioclient.hAudiopolicy.h WASAPIOS[3]WASAPII/O

WASAPI

 - IAudioClient::Initialize

read/write/etc - IAudioClient::GetService

 - IAudioClient::Start

I/Oread/write

read/write - IAudioClient::GetCurrentPadding[4][5]

/ - IAudioCaptureClient::GetBuffer/IAudioRenderClient::GetBuffer

read/write - read/write

/ - IAudioCaptureClient::ReleaseBuffer/IAudioRenderClient::ReleaseBuffer

WASAPIAPIread/write調/Windows OS調

対応ソフトウェア

編集

以下はWASAPI対応ソフトウェアの一例である。

DTMソフトウェア

編集

波形編集ソフトウェア

編集

メディアプレーヤー

編集

歴史

編集

Core Audio APIの一部としてMicrosoft Windows Vistaにて導入された。それ以降も機能が追加されている(例: IAudioClient3)。

脚注

編集
  1. ^ "The Windows Audio Session API (WASAPI) enables client applications to manage the flow of audio data between the application and an audio endpoint device." Windows Developer. About WASAPI.
  2. ^ "To play an audio stream through a rendering endpoint device, an application periodically writes audio data to a rendering endpoint buffer. The audio engine mixes the streams from the various applications." Windows Developer. About WASAPI.
  3. ^ "Header files Audioclient.h and Audiopolicy.h define the WASAPI interfaces." About WASAPI. Windows App Development.
  4. ^ "the client can call the IAudioClient::GetCurrentPadding method to get the total amount of captured data that is available in the buffer." Capturing a Stream. Windows App Development.
  5. ^ "For a rendering buffer, the padding value that is reported by the IAudioClient::GetCurrentPadding method represents the amount of rendering data that is queued up to play in the buffer." Rendering a Stream. Windows App Development.
  6. ^ foobar2000: Change Log”. 2022年7月15日閲覧。

関連項目

編集

外部リンク

編集