menu
 
버전
2024.1.4.8780

2024.1.4.8780

2023.1.12.8706

2022.1.18.8567

2021.1.14.8108

2019.2.15.7667

2019.1.11.7296

2018.1.11.6987

2017.2.10.6745

2017.1.9.6501

2016.2.6.6153

2015.1.9.5624


menu_open
Wwise SDK 2024.1.4
Wwise를 이용해 오프라인으로 렌더링하기

오프라인 렌더링

Wwise 사운드 엔진은 실시간이 아닌 컴퓨팅 집약적 오디오 생성 및 오디오 처리와 컴퓨팅 집약적 비디오 생성을 동ㄱㅣ화할 수 있는 오프라인 렌더링을 제공합니다.

warning경고: 동기식 AK::SoundEngine::LoadBankAK::SoundEngine::UnloadBank API를 사용하는 애플리케이션에서 오프라인 렌더링을 활성화할 때는 주의를 기울여야 합니다. 자세한 내용은 오디오 렌더링 스레드 를 참조하세요.

오디오 캡처 콜백은 AK::SoundEngine::RegisterCaptureCallback 을 사용하여 등록할 수 있으며, 이는 렌더링된 오디오 버퍼에 접근하기 위한 메커니즘을 제공합니다.

다음은 오프라인 렌더링으로 구현할 수 있는 것들 중 하나를 보여주는 예입니다.

/// 게임 코드에서 접근할 수 있는 동영상 캡처 서비스
namespace VideoCaptureServices
{
/// 동영상 캡처를 위한 버퍼를 할당할 수 있습니다.
void Initialize();
/// 캡처한 영상과 오디오를 동영상 파일로 출력할 수 있습니다.
void Finalize();
/// 단일 비디오 프레임 버퍼를 파일에 캡처할 수 있습니다.
void CaptureSingleFrame();
}
/// 게임 코드에서 접근할 수 있는 오디오 캡처 서비스
namespace AudioCaptureServices
{
/// 오디오 샘플의 최종 캡처를 위해 버퍼를 할당하거나 파일을 엽니다.
void Initialize(unsigned in_uSampleRate, unsigned in_uChannels);
/// 오디오 샘플 캡처가 완료되면 버퍼나 파일 핸들을 해제합니다.
void Finalize();
/// 할당된 버퍼에 오디오 샘플을 추가합니다.
void CaptureInterleavedSamples(float* in_pfSamples, unsigned in_uSampleCount);
}
class GameInterface
{
// ...
public:
/// 게임 프레임당 한 번씩 호출되는 함수
virtual void UpdateCallback(float deltaTime //< elapsed wall clock time in real-time, inverse of the desired frame rate in offline mode
) = 0;
};
class Game : public GameInterface
{
// ...
private:
/// 오프라인 렌더링이 활성화된 경우 True.
bool m_bIsOfflineRendering{ false };
/// 캡처 콜백 등록/등록 해제를 위한 출력 장치 ID.
AkOutputDeviceID m_defaultOutputDeviceId{ AK_INVALID_OUTPUT_DEVICE_ID };
/// Wwise 오디오 캡처 콜백.
static void CaptureCallback(AkAudioBuffer& in_CaptureBuffer, AkOutputDeviceID /*in_idOutput*/, void* /*in_pCookie*/)
{
const unsigned uSampleCount = static_cast<unsigned>(in_CaptureBuffer.uValidFrames) * in_CaptureBuffer.NumChannels();
if (!uSampleCount)
return;
AudioCaptureServices::CaptureInterleavedSamples(in_CaptureBuffer.GetInterleavedData(), uSampleCount);
}
public:
/// 오프라인 렌더링을 활성화/비활성화하기 위해 호출되는 함수
void SetOfflineRendering(bool bIsOfflineRendering //< 오프라인 렌더링의 경우 true, 실시간 렌더링의 경우 false
)
{
const bool bWasOfflineRendering{ m_bIsOfflineRendering };
m_bIsOfflineRendering = bIsOfflineRendering;
// 오프라인 렌더링을 활성화/비활성화하기 위해 메시지 큐에 메시지를 전송합니다.
AK::SoundEngine::SetOfflineRendering(m_bIsOfflineRendering);
if (m_bIsOfflineRendering == bWasOfflineRendering)
return;
// 오프라인 렌더링 프레임 시간을 0으로 설정하는 메시지를 메시지 큐에 전송하여 이후 RenderAudio() 호출이 더 이상 오디오 샘플을 생성하지 않도록 합니다.
// RenderAudio()를 호출하여 메시지 큐를 지웁니다. 이 호출 후 오프라인 렌더링이 활성화/비활성화됩니다.
if (m_bIsOfflineRendering)
{
VideoCaptureServices::Initialize();
// 오프라인 렌더링을 사용하는 경우 출력 구성은 기본적으로 스테레오 출력으로 전환됩니다.
// 다른 출력 스피커 레이아웃으로 렌더링하려면 출력을 명시적으로 정의된 출력으로 바꿔야 합니다.
// 이 예제에서는 7.1.4로 전환합니다.
AkChannelConfig surroundConfig;
// 출력 장치를 교체하기 위한 메시지를 전송합니다.
AkOutputSettings newSettings;
newSettings.audioDeviceShareset = AK::AUDIO_DEVICES::SYSTEM;
newSettings.idDevice = 0;
newSettings.channelConfig = surroundConfig;
AK::SoundEngine::ReplaceOutput(newSettings, 0, &m_defaultOutputDeviceId);
// 오프라인 장치에서 캡처 콜백을 등록하기 전에 ReplaceOutput이 처리되었는지 확인하기 위해 메시지 큐를 다시 지웁니다.
const AkUInt32 uSampleRate{ AK::SoundEngine::GetSampleRate() };
// 적절한 버퍼를 할당하기 위해 샘플 속도와 채널 수를 제공합니다.
AudioCaptureServices::Initialize(uSampleRate, surroundConfig.uNumChannels);
AK::SoundEngine::RegisterCaptureCallback(&CaptureCallback, m_defaultOutputDeviceId, this);
}
else
{
AK::SoundEngine::UnregisterCaptureCallback(&CaptureCallback, m_defaultOutputDeviceId, this);
AudioCaptureServices::Finalize();
VideoCaptureServices::Finalize();
}
}
void UpdateCallback(float deltaTime) override
{
if (m_bIsOfflineRendering)
if (m_bIsOfflineRendering)
VideoCaptureServices::CaptureSingleFrame();
}
};
AKSOUNDENGINE_API AkUInt32 GetSampleRate()
AkPanningRule ePanningRule
AkUInt32 uNumChannels
Number of channels.
AkForceInline AkUInt32 NumChannels() const
Get the number of channels.
Definition: AkCommonDefs.h:348
Platform-independent initialization settings of output devices.
AKSOUNDENGINE_API AKRESULT SetOfflineRenderingFrameTime(AkReal32 in_fFrameTimeInSeconds)
AKSOUNDENGINE_API AKRESULT ReplaceOutput(const AkOutputSettings &in_Settings, AkOutputDeviceID in_outputDeviceId, AkOutputDeviceID *out_pOutputDeviceId=NULL)
AkUInt16 uValidFrames
Number of valid sample frames in the audio buffer
Definition: AkCommonDefs.h:513
#define AK_SPEAKER_SETUP_DOLBY_7_1_4
Dolby 7.1.4 setup channel mask
AKSOUNDENGINE_API AKRESULT RegisterCaptureCallback(AkCaptureCallbackFunc in_pfnCallback, AkOutputDeviceID in_idOutput=AK_INVALID_OUTPUT_DEVICE_ID, void *in_pCookie=NULL)
AKSOUNDENGINE_API AKRESULT RenderAudio(bool in_bAllowSyncRender=true)
AKSOUNDENGINE_API AKRESULT UnregisterCaptureCallback(AkCaptureCallbackFunc in_pfnCallback, AkOutputDeviceID in_idOutput=AK_INVALID_OUTPUT_DEVICE_ID, void *in_pCookie=NULL)
static const AkUInt32 AK_INVALID_OUTPUT_DEVICE_ID
Invalid Device ID
Definition: AkTypes.h:110
@ AkPanningRule_Speakers
Left and right positioned 60 degrees apart (by default - see AK::SoundEngine::GetSpeakerAngles()).
Definition: AkTypes.h:1152
AKSOUNDENGINE_API AKRESULT SetOfflineRendering(bool in_bEnableOfflineRendering)
AkForceInline void SetStandard(AkUInt32 in_uChannelMask)
Set channel config as a standard configuration specified with given channel mask.
AkUniqueID audioDeviceShareset
uint32_t AkUInt32
Unsigned 32-bit integer
AkChannelConfig channelConfig
AkUInt64 AkOutputDeviceID
Audio Output device ID
Definition: AkTypes.h:85
AkForceInline void * GetInterleavedData()
Definition: AkCommonDefs.h:370

이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요