AudioDeviceOutput 接受音頻流量以被渲染成物理硬件裝置,例如喇叭或耳機。它提供一個單一的 輸入 端子,可以由 Wires 目標。任何音頻流量都可以被連接到 0> Class.AudioDeviceOutput0> 。
範例程式碼
Outputting Audio to Device
local audioPlayer : AudioPlayer = Instance.new("AudioPlayer")
audioPlayer.Parent = workspace
audioPlayer.AssetId = "rbxassetid://9112854440"
local deviceOutput = Instance.new("AudioDeviceOutput")
deviceOutput.Parent = workspace
local wire = Instance.new("Wire")
wire.Parent = workspace
wire.SourceInstance = audioPlayer
wire.TargetInstance = deviceOutput
audioPlayer:Play()