AudioChannelMixer 여러 오디오 스트림을 단일 멀티채널 스트림으로 믹스합니다.그것은 하나의 결합된 입력 핀, 하나의 출력 핀, 그리고 다음 보조 입력 핀 모두를 연결할 수 있습니다 : 왼쪽, 오른쪽, 중앙, 주변 왼쪽, 주변 오른쪽, 하위, 뒤쪽 왼쪽, 뒤쪽 오른쪽, 상단 왼쪽, 상단 오른쪽, 그리고 상단 오른쪽.

코드 샘플
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
요약
메서드
지정된 핀에 연결된 배열 Wires를 반환합니다.
반환 할 수 있는 입력 핀을 선택할 수 있습니다 Wire.TargetName .
이벤트
다른 인스턴스가 를 통해 연결되거나 연결 해제되면 발생합니다. 연결되거나 연결 해제되면 발생합니다.
속성
Layout
혼합할 출력 채널 레이아웃을 제어합니다.입력 핀의 출력은 항상 "그대로" 출력에 전달되지만, 값에 따라 다음과 같이 전달됩니다:
- For Mono , the 센터 핀은 오디오 스트림을 소비합니다.
- For Surround_7_1_4 , 모든 보조 입력 핀이 오디오 스트림을 소비합니다.
메서드
GetInputPins
다음 입력 핀이 사용 가능한지를 나타내는 문자열 테이블을 반환합니다 Wire.TargetName :
- "Input"
- "Left"
- "Right"
- "Center"
- "SurroundLeft"
- "SurroundRight"
- "BackLeft"
- "BackRight"
- "Sub"
- "TopLeft"
- "TopRight"
- "TopBackLeft"
- "TopBackRight"
반환
이벤트
WiringChanged
연결되거나 연결 해제된 Wire 후 발생하는 이벤트로, Wire 는 현재 또는 이전에 AudioChannelMixer 및 다른 연결 가능한 인스턴스에 고정되었거나 고정되었습니다.
매개 변수
인스턴스가 연결되었거나 연결 해제되었는지 여부.
타겟 AudioChannelMixer 에 있는 핀은 다음과 같습니다.The pin on the that the Wire targets.
Wire 와 다른 인스턴스 사이의 AudioChannelMixer.