AudioChannelSplitter
*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.
AudioChannelSplitter 오디오 스트림을 구성 채널로 분할하여 각각 독립적으로 처리할 수 있습니다.하나의 입력 핀, 하나의 결합된 출력 핀, 그리고 다음 보조 출력 핀 모두 연결할 수 있습니다: 왼쪽, 오른쪽, 중앙, 주변 왼쪽, 주변 오른쪽, 하위, 왼쪽 상단, 오른쪽 상단, 상단 왼쪽, 그리고 상단 오른쪽.

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