SoundGroup

แสดงที่เลิกใช้งานแล้ว

*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่

A SoundGroup ใช้เพื่อจัดการปริมาณและผลกระทบในหลาย Sounds พร้อมกันเสียงทุกเสียงในกลุ่มเสียงจะมีระดับเสียงที่ปรับโดยคุณสมบัติ Volume ของกลุ่มซึ่งทำหน้าที่เป็นตัวคูณ ซึ่งหมายถึงเสียง Sound ที่มีระดับเสียง 0.5 ถูกกำหนดให้กับเสียง SoundGroup ที่มีระดับเสียง 0.5 จะมีระดับเสียงที่มีประสิทธิภาพของ 0.25

หาก SoundGroup มีเด็ก SoundEffects ใดๆ ผลกระทบเหล่านั้นจะถูกนำไปใช้กับทั้งหมดของ Sounds ในกลุ่ม

โปรดทราบว่าต้องเพิ่ม Sound ใน SoundGroup โดยการตั้งค่าคุณสมบัติ SoundGroup ไม่ใช่เพียงแค่การปลูกฝัง Sound ให้กับ SoundGroup เท่านั้นA สามารถเป็นส่วนหนึ่งของกลุ่มเดียวได้ตลอดเวลา แม้ว่าคุณจะสามารถซ้อนกลุ่มได้ตามที่ระบุไว้ ที่นี่

ดู กลุ่มเสียง สำหรับรายละเอียดเพิ่มเติมเกี่ยวกับการทำงานกับคลาส SoundGroup

คุณสมบัติ

Volume

อ่านพร้อมๆ กัน

ตัวคูณระดับเสียงที่ใช้กับ Sounds ซึ่งเป็นของ SoundGroup มูลค่าสามารถอยู่ระหว่าง 0 ถึง 10

ตัวอย่างโค้ด

This sample demonstrates how a SoundGroup can be used to change the volume of its associated Sounds and apply SoundEffects.

In this example a Sound is instanced in the Workspace and assigned to a new SoundGroup. The Sound is played and during playback the volume is changed via the SoundGroup and a SoundEffect is added.

SoundGroups

local SoundService = game:GetService("SoundService")
-- create a sound group
local soundGroup = Instance.new("SoundGroup")
soundGroup.Parent = SoundService
-- create a sound
local sound = Instance.new("Sound")
sound.SoundId = "rbxassetid://9120386436"
sound.Looped = true
sound.PlaybackSpeed = 2
sound.SoundGroup = soundGroup
sound.Parent = workspace
-- play the sound
sound:Play()
task.wait(10)
-- change the volume
soundGroup.Volume = 0.1
task.wait(3)
-- return the volume
soundGroup.Volume = 0.5
task.wait(4)
-- add a sound effect
local reverb = Instance.new("ReverbSoundEffect")
reverb.Parent = soundGroup

วิธีการ

อีเวนต์