Motor Sınıfı
AudioChannelMixer
*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.
Özet
Özellikler
Yöntemler
GetConnectedWires(pin: string):{Wire} |
Olaylar
WiringChanged(connected: boolean,pin: string,wire: Wire,instance: Instance):RBXScriptSignal |
Kod Örnekleri
Kanal Bölme ve Karıştırma
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
-- Dinleyicinin duyduğu sesi bir bölücüye gönder ve karışımı son çıktıya gönder
wireUp(listener, splitter)
wireUp(mixer, output)
-- Hem bölücüyü hem de karıştırıcıyı dörtlü bir düzen kullanacak şekilde ayarla
splitter.Layout = Enum.AudioChannelLayout.Quad
mixer.Layout = Enum.AudioChannelLayout.Quad
-- Dört kanaldan her birine kendi yükseklik kaydırıcısını ver
local frontLeft = Instance.new("AudioPitchShifter")
frontLeft.Name = "Ön Sol"
frontLeft.Pitch = 1.25
frontLeft.Parent = Workspace
local backLeft = Instance.new("AudioPitchShifter")
backLeft.Name = "Arka Sol"
backLeft.Pitch = 0.5
backLeft.Parent = Workspace
local frontRight = Instance.new("AudioPitchShifter")
frontRight.Name = "Ön Sağ"
frontRight.Pitch = 1.5
frontRight.Parent = Workspace
local backRight = Instance.new("AudioPitchShifter")
backRight.Name = "Arka Sağ"
backRight.Pitch = 0.75
backRight.Parent = Workspace
wireUp(splitter, frontLeft, "Sol")
wireUp(splitter, backLeft, "ArkaSol")
wireUp(splitter, frontRight, "Sağ")
wireUp(splitter, backRight, "ArkaSağ")
wireUp(frontLeft, mixer, nil, "Sol")
wireUp(backLeft, mixer, nil, "ArkaSol")
wireUp(frontRight, mixer, nil, "Sağ")
wireUp(backRight, mixer, nil, "ArkaSağ")
-- Ses yaymak için bir parça yapılandır
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)
-- Sesi çalmaya başla
assetPlayer:Play()
-- Ses çaldıkça parçanın rengini ayarla
while true do
local peak = math.sqrt(analyzer.PeakLevel)
part.Color = Color3.new(peak, peak, peak)
task.wait()
endAPI Referansı
Özellikler
Yöntemler
GetConnectedWires
Olaylar