engine/sound/src/decoders/decoder_tremolo.cpp
// The functions below mimic the usual fopen/fread etc functions, reading from a buffer
// in memory
The functions below mimic the usual fopen/fread etc functions, reading from a buffer
in memory
The functions below mimic the usual fopen / fread etc functions reading from a buffer in memory
static size_t OggRead(void *ptr, size_t size, size_t nmemb, void *datasource)
    {
        DecodeStreamInfo *info = (DecodeStreamInfo*) datasource;
        size_t tot = nmemb * size;
        if (tot > (info->m_Size - info->m_Cursor)) {
            tot = info->m_Size - info->m_Cursor;
        }
        memcpy(ptr, &info->m_Buffer[info->m_Cursor], tot);
        info->m_Cursor += tot;
        return tot;
    }
static size_t OggRead ( void * ptr , size_t size , size_t nmemb , void * datasource ) { DecodeStreamInfo * info = ( DecodeStreamInfo * ) datasource ; size_t tot = nmemb * size ; if ( tot > ( info -> m_Size - info -> m_Cursor ) ) { tot = info -> m_Size - info -> m_Cursor ; } memcpy ( ptr , & info -> m_Buffer [ info -> m_Cursor ] , tot ) ; info -> m_Cursor += tot ; return tot ; }
The functions below mimic the usual fopen/fread etc functions, reading from a buffer
in memory
The functions below mimic the usual fopen / fread etc functions reading from a buffer in memory