27 memset(&m_vorbisFile, 0,
sizeof(m_vorbisFile));
32 ov_clear(&m_vorbisFile);
37 ov_callbacks callbacks = { cb_read, cb_seek, cb_close, cb_tell };
38 ov_open_callbacks(
m_file.
get(), &m_vorbisFile,
nullptr, 0, callbacks);
40 vorbis_info* vi = ov_info(&m_vorbisFile, -1);
56 char* bytesBuffer =
reinterpret_cast<char*
>(buffer);
58 size_t totalBytesRead = 0;
60 while(bufferSize > 0) {
61 size_t bytesToRead = bufferSize;
62 long bytesRead = ov_read(&m_vorbisFile, bytesBuffer, bytesToRead, 0, 2, 1, §ion);
66 bufferSize -= bytesRead;
67 bytesBuffer += bytesRead;
68 totalBytesRead += bytesRead;
71 return totalBytesRead;
76 ov_pcm_seek(&m_vorbisFile, 0);
79 size_t OggSoundFile::cb_read(
void* ptr,
size_t size,
size_t nmemb,
void* source)
82 return file->
read(ptr, size, nmemb);
85 int OggSoundFile::cb_seek(
void* source, ogg_int64_t offset,
int whence)
102 int OggSoundFile::cb_close(
void* source)
109 long OggSoundFile::cb_tell(
void* source)