AudioChannelSplitter

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

AudioChannelSplitter オーディオストリームをコンポーネントチャンネルに分割し、それぞれが独立して処理できるようにします。それは1つの 入力 ピン、1つの結合された 出力 ピン、および次のセカンダリ出力ピンを提供します。すべてが Wires に接続/から接続できます: 中央左回り右回りサブバック左バック右トップ左トップ右トップバック左 、および トップバック右

Diagram showing position of all potential channels.

コードサンプル

Splitting & Mixing Channels

local Workspace = game:GetService("Workspace")
local function wireUp(source : Instance, target : Instance, sourceName : string?, targetName : string?)
local wire = Instance.new("Wire", source)
wire.SourceInstance = source
wire.TargetInstance = target
if sourceName then wire.SourceName = sourceName end
if targetName then wire.TargetName = targetName end
return wire
end
local listener = Instance.new("AudioListener")
listener.Parent = Workspace.CurrentCamera
local output = Instance.new("AudioDeviceOutput")
output.Parent = Workspace
local splitter = Instance.new("AudioChannelSplitter")
splitter.Parent = Workspace
local mixer = Instance.new("AudioChannelMixer")
mixer.Parent = Workspace
-- Send what the listener hears to a splitter and send a mix to the final output
wireUp(listener, splitter)
wireUp(mixer, output)
-- Set up both the splitter and mixer to use a quadrophonic layout
splitter.Layout = Enum.AudioChannelLayout.Quad
mixer.Layout = Enum.AudioChannelLayout.Quad
-- Give each of the four channels its own pitch shifter
local frontLeft = Instance.new("AudioPitchShifter")
frontLeft.Name = "Front Left"
frontLeft.Pitch = 1.25
frontLeft.Parent = Workspace
local backLeft = Instance.new("AudioPitchShifter")
backLeft.Name = "Back Left"
backLeft.Pitch = 0.5
backLeft.Parent = Workspace
local frontRight = Instance.new("AudioPitchShifter")
frontRight.Name = "Front Right"
frontRight.Pitch = 1.5
frontRight.Parent = Workspace
local backRight = Instance.new("AudioPitchShifter")
backRight.Name = "Back Right"
backRight.Pitch = 0.75
backRight.Parent = Workspace
wireUp(splitter, frontLeft, "Left")
wireUp(splitter, backLeft, "BackLeft")
wireUp(splitter, frontRight, "Right")
wireUp(splitter, backRight, "BackRight")
wireUp(frontLeft, mixer, nil, "Left")
wireUp(backLeft, mixer, nil, "BackLeft")
wireUp(frontRight, mixer, nil, "Right")
wireUp(backRight, mixer, nil, "BackRight")
-- Configure a part to emit audio
local part = Instance.new("Part")
part.Shape = Enum.PartType.Ball
part.Size = Vector3.new(4, 4, 4)
part.Material = Enum.Material.SmoothPlastic
part.CastShadow = false
part.Position = Vector3.new(0, 4, -12)
part.Anchored = true
part.Parent = Workspace
local analyzer = Instance.new("AudioAnalyzer")
analyzer.Parent = part
local emitter = Instance.new("AudioEmitter")
emitter.Parent = part
local assetPlayer = Instance.new("AudioPlayer")
assetPlayer.Looping = true
assetPlayer.Asset = "rbxassetid://97799489309320"
assetPlayer.Parent = emitter
wireUp(assetPlayer, emitter)
wireUp(assetPlayer, analyzer)
-- Start playing the audio
assetPlayer:Play()
-- Adjust the part's color as the audio plays
while true do
local peak = math.sqrt(analyzer.PeakLevel)
part.Color = Color3.new(peak, peak, peak)
task.wait()
end

概要

プロパティ

方法

イベント

プロパティ

並列読み取り

分離する入力チャネルレイアウトを制御します。このチャンネル分割機の入力前のすべてのオーディオストリームがアップミックスされる必要がある場合(入力が必要なほどのチャンネルが増える)、このチャンネル分割機の入力前のすべてのオーディオストリームがアップミックスされる必要があります。

出力 ピンは、 入力 に接続されたストリームのコピーを生成しますが、AudioChannelSplitter.Layout の値によっては:

  • For Mono , the センター ピンはオーディオストリームを生成します。
  • For Stereo , the および ピンはオーディオストリームを生成します。
  • For Quad , the , , バック左 , そして バック右 ピンはオーディオストリームを生成します。
  • Surround_5Quad と同じで、 センター がオーディオストリームを生成します。
  • Surround_5_1Surround_5 と同じで、 サブ がオーディオストリームを生成します。
  • Surround_7_1Surround_5_1 と同じで、 SurroundLeftSurroundRight がオーディオストリームを生成します。
  • For Surround_7_1_4 、すべてのセカンダリ出力ピンはオーディオストリームを生成します。

方法

GetConnectedWires

Instances

指定されたピンに接続された Wires のアレイを返します。

パラメータ

pin: string
既定値: ""

戻り値

Instances

GetInputPins

1つのストリングを含むテーブルを返し、"Input"Wire.TargetName で利用可能な入力ピンを示します。


戻り値

GetOutputPins

返すのは、どの出力ピンが利用可能かを示すストリングのテーブル Wire.SourceName :

  • "Output"
  • "Left"
  • "Right"
  • "Center"
  • "SurroundLeft"
  • "SurroundRight"
  • "BackLeft"
  • "BackRight"
  • "Sub"
  • "TopLeft"
  • "TopRight"
  • "TopBackLeft"
  • "TopBackRight"

戻り値

イベント

WiringChanged

Wire が接続または切断された後に発生するイベント、および Wire が現在または以前に AudioChannelSplitter および他のワイヤー可能なインスタンスのピンに接続されているか、接続されていました。

パラメータ

connected: boolean

インスタンスが接続されたか、切断されたか。

pin: string

ターゲットの AudioChannelSplitter にピンを打った Wire

wire: Wire

Wire と他のインスタンスの間の AudioChannelSplitter

instance: Instance

Wire を介して接続された他のインスタンス。