Oolite
Loading...
Searching...
No Matches
OOALSoundDecoder.m File Reference
import "OOALSoundDecoder.h"
import "NSDataOOExtensions.h"
import "OOLogging.h"
import "unzip.h"
import <vorbis/vorbisfile.h>
Include dependency graph for OOALSoundDecoder.m:

Go to the source code of this file.

Classes

class  OOALSoundVorbisCodec

Enumerations

enum  { kMaxDecodeSize = 1 << 20 }

Functions

static size_t OOReadOXZVorbis (void *ptr, size_t size, size_t nmemb, void *datasource)
static int OOCloseOXZVorbis (void *datasource)

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kMaxDecodeSize 

Definition at line 35 of file OOALSoundDecoder.m.

35 {
36 kMaxDecodeSize = 1 << 20 // 2^20 frames = 4 MB
37};
@ kMaxDecodeSize

Function Documentation

◆ OOCloseOXZVorbis()

int OOCloseOXZVorbis ( void * datasource)
static

Definition at line 455 of file OOALSoundDecoder.m.

456{
457 // doing this prevents replaying
458 // OOALSoundVorbisCodec *src = (OOALSoundVorbisCodec *)datasource;
459 // unzClose(src->uf);
460 return 0;
461}

Referenced by OOALSoundVorbisCodec::initWithPath:, and OOALSoundVorbisCodec::reset.

Here is the caller graph for this function:

◆ OOReadOXZVorbis()

size_t OOReadOXZVorbis ( void * ptr,
size_t size,
size_t nmemb,
void * datasource )
static

Definition at line 438 of file OOALSoundDecoder.m.

439{
440 OOALSoundVorbisCodec* src = (OOALSoundVorbisCodec*)datasource;
441 size_t toRead = size * nmemb;
442 void* buf = (void*)malloc(toRead);
443 int err = UNZ_OK;
444 err = unzReadCurrentFile(src->uf, buf, toRead);
445 // OOLog(@"sound.replay",@"Read %d blocks, got %d",toRead,err);
446 if (err > 0) {
447 memcpy(ptr, buf, err);
448 }
449 if (err < 0) {
450 return OV_EREAD;
451 }
452 return err;
453}
voidpf void uLong size
Definition ioapi.h:126
voidpf void * buf
Definition ioapi.h:126
int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len)
Definition unzip.c:1600
#define UNZ_OK
Definition unzip.h:75

References OOALSoundVorbisCodec::uf, UNZ_OK, and unzReadCurrentFile().

Referenced by OOALSoundVorbisCodec::initWithPath:, and OOALSoundVorbisCodec::reset.

Here is the call graph for this function:
Here is the caller graph for this function: