menu
 

在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

+1 投票

Hello all.

I'm trying to understand the kind of data that can be passed into a audio buffer channel.

According to https://www.audiokinetic.com/library/2015.1_5418/?source=SDK&id=soundengine__plugins.html#fx_audiobuffer_struct

    Audio buffers’ channels are not interleaved, and all samples are normalized 32-bit floating point in the (-1.f,1.f) range running at a 48 kHz sampling rate.

So, as an example, is it possible to simply read a RAW file, Mono track, 48 kHz, little endian 32 bit float data straight from disk and feed into into a channel, like so ? 

// Note: length of file and eventual starvation is not my concern for the moment.

AKRESULT CAkFXSrcRawFile::Init(    
    AK::IAkPluginMemAlloc *            /*in_pAllocator*/,     /// Memory allocator interface.
    AK::IAkSourcePluginContext *in_pSourceFXContext,/// Sound engine plug-in execution context.
    AK::IAkPluginParam *in_pParams,            /// Associated effect parameters node.
    AkAudioFormat &    io_rFormat            /// Output audio format.
)
{
    io_rFormat.SetAll(48000, AK_SPEAKER_SETUP_MONO, 32, 1, AK_FLOAT, AK_NONINTERLEAVED);

        m_pFile = fopen("mysound.raw", "rb")
}

    void CAkFXSrcRawFile::Execute(AkAudioBuffer* io_pBufferOut)
    {
     if (io_pBufferOut->NumChannels())
    {
        AkSampleType* ch0Buffer = io_pBufferOut->GetChannel(0);

        io_pBufferOut->uValidFrames = fread(ch0Buffer, sizeof(AkSampleType), io_pBufferOut->MaxFrames(), m_pFile);
    
        if (!feof(m_pFile) && io_pBufferOut->uValidFrames > 0)
        {
            io_pBufferOut->eState = AK_DataReady;
            return;
        }
    }
    
    io_pBufferOut->eState = AK_NoDataReady;
   }

 

 

分类:General Discussion | 用户: Marc S. (120 分)

Please sign-in or register to answer this question.

...