버전
menu

Wwise SDK 2019.2.15
오디오 플러그인에 미디어 추가하기

플러그인 미디어 시스템을 이용하면 플러그인(효과, 음원, 싱크, 믹서)에서 Wwise 아키텍처를 활용해 프로젝트 내 이진 데이터 파일을 저장할 수 있습니다.

플러그인에서 커스텀 데이터를 사용하는 대신 플러그인 미디어를 사용하면 다음과 같은 다양한 장점이 있습니다.

  • 데이터 빌트인 지속
  • Source Control 통합 (작업 그룹 기능 사용)
  • 플랫폼별로 허용된 데이터 변환
  • 허용된 데이터를 담을 SoundBank를 최종 사용자가 선택

Wwise 저작 플러그인

플러그인 미디어 관리하기

Override the function AK::Wwise::IAudioPlugin::SetPluginObjectMedia and store the pointer for later use. This function will be called at the initialization of the Wwise plug-in (authoring side). By implementing this function, you will receive an interface to an IPluginObjectMedia*, which allows to you to manage media files.

class MyPlugin : public AK::Wwise::IAudioPlugin
{
...
virtual void SetPluginObjectMedia( IPluginObjectMedia * in_pObjectMedia )
{
m_pObjMedia = in_pObjectMedia;
}
}

You can import media files by calling AK::Wwise::IPluginObjectMedia::SetMediaSource. When importing media, they will be copied to the plug-in's Original directory and will be managed completely by Wwise. 인덱스 0에서 플러그인 미디어 파일을 추가하려면:

m_pObjMedia->SetMediaSource( tszFilename, 0, bReplace );

Later, you can call AK::Wwise::IPluginObjectMedia::InvalidateMediaSource to request a conversion of the media files. Override the function to be notified when the plug-in data changes.

virtual void NotifyPluginMediaChanged()
{
// React to changes
// ...
// Wwise에게 데이터가 내변환되어야 한다고 알림.
m_pPSet->NotifyInternalDataChanged( AK::IAkPluginParam::ALL_PLUGIN_DATA_ID );
}

더 자세한 정보는 AK::Wwise::IPluginObjectMedia 의 함수에 대한 문서를 참고하세요.

런타임을 위한 미디어 변환

You may want to convert your media for runtime. To implement conversion functions, you need to inherit from AK::Wwise::IPluginMediaConverter and implement the required functions (including ConvertFile and GetCurrentConversionSettingsHash) that will allow you to convert your imported original WAV to an appropriate format for the real-time component.

Once you implement all functions in AK::Wwise::IPluginMediaConverter, you can override the function GetPluginMediaConverterInterface() to tell Wwise you want to convert your media.

virtual AK::Wwise::IPluginMediaConverter* GetPluginMediaConverterInterface()
{
return this;
}

다음은 AK::Wwise::IPluginMediaConverter 함수의 구현 예제입니다.

AK::Wwise::ConversionResult YourPlugin::ConvertFile(
const GUID & in_guidPlatform,
const BasePlatformID & in_basePlatform,
LPCWSTR in_szSourceFile,
LPCWSTR in_szDestFile,
AkUInt32 in_uSampleRate,
AkUInt32 in_uBlockLength,
AK::Wwise::IProgress* in_pProgress,
{
// 변환된 파일로 원본 소스 변환
// At minimum, copy the original file to converted
::CopyFile(in_szSourceFile,in_szDestFile, FALSE);
}
ULONG YourPlugin::GetCurrentConversionSettingsHash( const GUID & in_guidPlatform, AkUInt32 in_uSampleRate , AkUInt32 in_uBlockLength )
{
AK::FNVHash32 hashFunc;
// 변환에 영향을 미치는 매개 변수로부터 Hash 생성.
// 원본 파일 이름 가져오기.
CString szInputFileName;
m_pObjMedia->GetMediaSourceFileName( szInputFileName.GetBuffer( _MAX_PATH ), _MAX_PATH );
szInputFileName.ReleaseBuffer();
szInputFileName.MakeLower();
return hashFunc.Compute( (unsigned char *)(LPCTSTR)szInputFileName, szInputFileName.GetLength()*sizeof(TCHAR) );
}

플러그인 정의

플러그인 정의 파일에서 CanReferenceDataFile 이 반드시 true로 돼있는지 확인하세요.

<PluginModule>
<EffectMixerSourceOrSinkPlugin Name="YOUR_PLUGIN" CompanyID="???" PluginID="???">
<PluginInfo MenuPath="???">
<PlatformSupport>
<Platform Name="Windows">
...
<CanReferenceDataFile>true</CanReferenceDataFile>
</Platform>
<Platform Name="XboxOne">
...
<CanReferenceDataFile>true</CanReferenceDataFile>
</Platform>

런타임 플러그인

런타임에 플러그인 미디어 사용하기

In the real-time component of your plug-in, when implementing AK::IAkEffectPlugin, you will receive an AK::IAkEffectPluginContext pointer in the Init(...) function. From the AK::IAkEffectPluginContext, you can call AK::IAkPluginContextBase::GetPluginMedia to obtain the converted media that was packaged in Wwise SoundBanks.

AK::IAkPluginMemAlloc* in_pAllocator, // 메모리 할당 인터페이스
AK::IAkEffectPluginContext* in_pFXCtx, // FX 컨텍스트
const AkAudioFormat& in_rFormat // 오디오 입력 형식 )
{
AkUInt8 * pPluginData = NULL;
AkUInt32 uPluginDataSize;
in_pFXCtx->GetPluginMedia( 0, pPluginData, uPluginDataSize );
if ( pPluginData == NULL )
return AK_Fail; // 임펄스 응답 없이 플러그인을 인스턴스화 하면 포인터가 없음.
...
}
참고:
이 예제에서는 런타임 때 effect 플러그인 미디어를 사용하는 방법을 설명합니다. However, it could just as easily be illustrating how to use another plug-in type, such as a source plug-in. In that case, you'd be implementing AK::IAkSourcePlugin and receiving an AK::IAkSourcePluginContext pointer.

Wwise 내에서의 사용

버스 내 Effect에서 플러그인 미디어 사용하기

Wwise에서, 모든 Effect는 Init.bnk에 저장됩니다. To avoid having the Init.bnk be too large, the plug-in media is not automatically added to Init.bnk. You will need to manually add the Effect ShareSet or the bus to a separate SoundBank.

@ AK_Fail
The operation failed.
Definition: AkTypes.h:125
AKRESULT
Standard function call result.
Definition: AkTypes.h:122
virtual void GetPluginMedia(AkUInt32 in_dataIndex, AkUInt8 *&out_rpData, AkUInt32 &out_rDataSize)=0
AKSOUNDENGINE_API AKRESULT Init(const AkCommSettings &in_settings)
ConversionResult
Conversion error code.
Definition: Utilities.h:192
#define NULL
Definition: AkTypes.h:49
uint8_t AkUInt8
Unsigned 8-bit integer
Definition: AkTypes.h:83
@ ConversionSuccess
Definition: Utilities.h:193
HashParams::HashType Compute(const void *in_pData, typename HashParams::SizeType in_dataSize)
Definition: AkFNVHash.h:102
static const AkPluginParamID ALL_PLUGIN_DATA_ID
Definition: IAkPlugin.h:616
uint32_t AkUInt32
Unsigned 32-bit integer
Definition: AkTypes.h:85
Defines the parameters of an audio buffer format.
Definition: AkCommonDefs.h:60
virtual void SetPluginObjectMedia(IPluginObjectMedia *in_pObjectMedia)=0

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

지원이 필요하신가요?

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

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

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

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

Wwise를 시작해 보세요