SoundService

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
서비스

경험에서 플레이하는 방법의 다양한 측면을 결정하는 서비스입니다. Sounds``Class.SoundService 는 그룹이 작동하는 데 필수적이지 않기 때문에 종종 SoundGroups 을 저장하는 데 사용됩니다.

SoundService 속성(AmbientReverb, DistanceFactor, DopplerScaleRolloffScale)은 경험에서 모든 Sounds 플레이 방식을 변경하는 데 사용할 수 있으며, SetListener() 함수를 사용하면 소리가 들리는 위치를 설정할 수 있습니다.

코드 샘플

The code in this sample, when ran from a LocalScript, will change the SoundService.AmbientReverb property of SoundService when the player is inside a BasePart tagged using CollectionService.

To add or remove tags and reverb types, change the entries in the 'reverbTags' table.

Dynamic Reverb System

local Players = game:GetService("Players")
local CollectionService = game:GetService("CollectionService")
local SoundService = game:GetService("SoundService")
local localPlayer = Players.LocalPlayer
local reverbTags = {
["reverb_Cave"] = Enum.ReverbType.Cave,
}
-- collect parts and group them by tag
local parts = {}
for reverbTag, reverbType in pairs(reverbTags) do
for _, part in pairs(CollectionService:GetTagged(reverbTag)) do
parts[part] = reverbType
end
end
-- function to check if a position is within a part's extents
local function positionInPart(part, position)
local extents = part.Size / 2
local offset = part.CFrame:PointToObjectSpace(position)
return offset.x < extents.x and offset.y < extents.y and offset.z < extents.z
end
local reverbType = SoundService.AmbientReverb
while true do
task.wait()
if not localPlayer then
return
end
local character = localPlayer.Character
-- default to no reverb
local newReverbType = Enum.ReverbType.NoReverb
if character and character.PrimaryPart then
local position = character.PrimaryPart.Position
-- go through all the indexed parts
for part, type in pairs(parts) do
-- see if the character is within them
if positionInPart(part, position) then
-- if so, pick that reverb type
newReverbType = type
break
end
end
end
-- set the reverb type if it has changed
if newReverbType ~= reverbType then
SoundService.AmbientReverb = newReverbType
reverbType = newReverbType
end
end

요약

속성

메서드

속성

AmbientReverb

병렬 읽기

이 속성에 대한 각 Enum.ReverbType 옵션은 FMOD 사운드 엔진에서 사용할 수 있는 기본값에 해당합니다.예를 들어, AmbientReverbEnum.ReverbType.Hangar 로 설정되면 소리가 큰 폐쇄 공간에 있는 것처럼 다르게 반향되어 시뮬레이션됩니다.

변경하는 AmbientReverb Roblox사용하는 다음 속성에 영향을 줍니다.

  • 잔향 소멸 시간.
  • 초기 반사 지연 시간.
  • 초기 반사와 관련된 늦은 잔향 지연 시간.
  • 고 주파수 참조.
  • 높은 주파수에서 중간 주파수 쇠퇴 시간 비율.
  • 늦은 잔향 붕괴에서 에코 밀도를 제어하는 값.
  • 늦은 잔향 붕괴에서 모달 밀도를 제어하는 값.
  • 저주파 참조.
  • 낮은 주파수에서의 상대 방 효과 레벨.
  • 높은 주파수에서의 상대 방 효과 레벨.
  • 방 효과에 대한 초기 반사 레벨.
  • 중간 주파수에서의 방 효과 레벨.

CharacterSoundsUseNewApi

플러그인 보안
병렬 읽기

DefaultListenerLocation

플러그인 보안
병렬 읽기

기본적으로 AudioListener를 배치할 위치를 결정합니다. 각 옵션의 자세한 설명은 Enum.ListenerLocation에 참조하십시오.

DistanceFactor

병렬 읽기

용량 감소를 계산할 때 부모에게 전달된 또는 에 대한 스터드 수가 미터로 간주되는 횟수.

기본적으로 이 속성은 3.33, 즉 미터가 용량 감소를 위해 3.33스터드로 간주됩니다.더 큰 DistanceFactor , 더 많은 음향이 점진적으로 감소합니다.

경험이 다른 규모를 사용하는 경우에만 이 속성을 변경하는 것이 좋습니다.예를 들어, 더 큰 사용자 지정 문자를 사용할 때 DistanceFactor를 줄이고 싶을 수 있습니다.

DopplerScale

병렬 읽기

이 속성은 음향의 피치가 Doppler 효과로 인해 변화하는 정도를 결정하며, 음향의 피치가 소스와 관찰자가 소리의 이동으로 점점 더 멀어지거나 가까워지면서 변화하는 현상입니다.부모로 지정된 Sounds 또는 BasePart 또는 Attachment 에만 영향을 줍니다.

이 값을 증가시키면 도플러 효과의 영향이 과장되지만, 줄이면 최소화됩니다.기본적으로 이 속성의 값은 1입니다.

RespectFilteringEnabled

병렬 읽기

이 속성은 클라이언트에서 서버로, 그리고 서버에서 플레이백이 복제되는지 여부를 결정합니다. Sound즉, 가 호출하고 이 속성이 인 경우, 소리는 각각의 클라이언트에서만 재생됩니다.이 속성이 false 인 경우 다른 클라이언트도 소리를 듣습니다.

기본값은 true 이며, 필터링이 활성화되어 있습니다.

RolloffScale

병렬 읽기

Sound 볼륨이 얼마나 빨리 감소하는지 설정합니다.더 높은 RolloffScale , 수신기와 소리 사이의 거리가 증가함에 따라 소리의 볼륨이 더 빠르게 감소합니다.

이 속성은 기본값으로 설정된 Sounds 또는 RollOffMode 속성이 설정된 Inverse 또는 InverseTapered에만 적용됩니다.LinearLinearSquare 모드는 이 속성에 영향을 받지 않는 다른 공격 완화 모델을 사용합니다.이 속성은 또한 Sounds에 부모로 지정되지 않은 BasePart 또는 Attachment에 영향을 미치지 않습니다.

VolumetricAudio

스크립팅할 수 없음
병렬 읽기

메서드

GetListener

이 메서드는 현재 리스너 유형 SoundService 및 플레이어가 경험의 오디오를 "듣는" 지점을 의미하는 리스너로 설정된 것을 반환합니다.기본적으로 리스너는 Workspace.CurrentCamera로 설정됩니다.수신기는 SetListener()을 사용하여 변경할 수 있습니다.

첫 번째 결과는 수신자의 Enum.ListenerType이고 두 번째 결과는 그 입력의존합니다:


<th>설명</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Enum.ListenerType.카메라</code></td>
<td><code>Class.Workspace.CurrentCamera|CurrentCamera</code>가 항상 사용되므로 리스너 개체를 반환하지 않습니다.</td>
</tr>
<tr>
<td><code>Enum.ListenerType.CFrame</code></td>
<td>Class.SoundService:SetListener()|SetListener()에서 사용된 Datatype.CFrame을 반환합니다.</td>
</tr>
<tr>
<td><code>Enum.ListenerType.ObjectPosition</code></td>
<td>Class.SoundService:SetListener()|SetListener() 에서 사용된 Class.BasePart 를 반환합니다.</td>
</tr>
<tr>
<td><code>Enum.ListenerType.ObjectCFrame</code></td>
<td>Class.SoundService:SetListener()|SetListener() 에서 사용된 Class.BasePart 를 반환합니다.</td>
</tr>
</tbody>
수신기 유형

반환

현재 Enum.ListenerType 및 수신기가 설정된 것. 수신기는 BasePart , CFrame 또는 nil 일 수 있습니다.

OpenAttenuationCurveEditor

()
플러그인 보안

매개 변수

selectedCurveObjects: Instances
기본값: ""

반환

()

OpenDirectionalCurveEditor

()
플러그인 보안

매개 변수

selectedCurveObjects: Instances
기본값: ""

반환

()

PlayLocalSound

()

로컬에서 Sound 재생하여 소리가 이 메서드를 호출하는 클라이언트에만 들릴 수 있으며, 부모로 지정된 위치와 상관없이 합니다.이 메서드는 스튜디오 클라이언트에서 로컬로 Sound 재생하기에 가장 유용합니다, 예를 들어 스튜디오 클라이언트에서 Script 에 대한 Plugin.

매개 변수

sound: Instance

재생할 Sound 이어야 합니다.

기본값: ""

반환

()

SetListener

()

클라이언트에서 사용하는 수신기를 설정하여 플레이어가 경험의 오디오를 "듣는" 지점을 의미합니다.부모로 지정된 Sounds 또는 BasePart 또는 Attachment에 대해 리스너는 재생 소리의 볼륨과 왼쪽/오른쪽 균형에 영향을 줍니다.

기본적으로 수신기는 Workspace.CurrentCamera 로 설정되지만, 다양한 유형의 수신기를 사용할 수 있습니다.

수신기는 GetListener()를 사용하여 검색할 수 있습니다.

매개 변수

listenerType: Enum.ListenerType

리스너의 Enum.ListenerType .

기본값: ""
listener: Tuple

의존 Enum.ListenerType에 따라.Use a BasePart 에 대해 Enum.ListenerType.ObjectPosition 또는 Enum.ListenerType.ObjectCFrame , a CFrame 에 대해 Enum.ListenerType.CFrame 또는 nil 에 대해 Enum.ListenerType.Camera 을 사용합니다.

기본값: ""

반환

()

이벤트