AudioSettings 클래스는 사운드 시스템과 관련된 다양한 글로벌 정보를 포함하는데 그 중에서도 특히 API는 스피커 모드, 샘플 레이트(플랫폼이 지원하는 경우), DSP 버퍼 크기 및 리얼/가상 음성 개수 등의 설정을 변경하기 위해 런타임 시 오디오 시스템 초기화가 가능합니다.
위의 여러 가지 설정 중에서 대부분은 프로젝트 설정의 오디오섹션에서 변경 가능합니다. 변경되면 설정이 에디터에도 적용이 되고 게임의 초기 상태를 정의할 수 있지만, AudioSettings API에 의한 사용 변경이 게임 런타임에만 적용되며 에디터에서 게임을 멈추게 되면 프로젝트 설정에서 정의된 상태로 다시 초기화됩니다.
게임이 제공하는 사운드 옵션 메뉴에서는 사용자가 사운드 설정을 변경할 수도 있고, 외부 오디오 입/출력 디바이스 또는 오디오 디바이스로 활용할 수 있는 HDMI 모니터 플러깅 등 디바이스 변경에 대응하여 외부에서 변경 사항을 가져올 수도 있습니다. AudioConfiguration AudioSettings.GetConfiguration() / bool AudioSettings.Reset(AudioConfiguration config) API는 현재 사운드 시스템 설정에 글로벌 변경을 읽고 적용할 수 있으며, 기본적으로speakerMode는 속성이 수정되었을 때 전체 오디오 시스템을 다시 초기화하는 부작용이 있었던 AudioSettings.SetDSPBufferSize (…) 함수 및 AudioSettings.outputSampleRate, AudioSettings를 대체합니다.
API는 AudioSettings.OnAudioConfigurationChanged(부울 디바이스) 를 정의하여 오디오 설정 변경을 스크립트가 알 수 있도록 콜백을 설정합니다. 실제 디바이스 변경으로든 또는 스크립트로된 설정으로든 가능합니다.
글로벌 오디오 시스템 설정의 런타임 수정이 실행될 때마다 모든 오디오 오브젝트를 리로딩해야 합니다. 이것은 디스크기반 AudioClip 에셋 및 오디오 믹서에 작동하지만 스크립트로 생성했거나 수정한 AudioClips은 손실되어 재생성해야 합니다. 마찬가지로 재생 상태 또한 손실되기 때문에 AudioSettings.OnAudioConfigurationChanged(…) 콜백 함수로 재생성되어야 합니다.
세부 정보 및 예제를 보려면 스크립팅 API 레퍼런스를 참조하십시오.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.