SoundStream *WavLoader::open(std::string name, DataSource *source) { WavStream *stream = new WavStream(); if (!stream->load(name, source)) { delete stream; return 0; } return stream; }
/* * in - wav file stream to play. Claims ownership and will delete it. * vol - volume/panning * * return: 1 on success, 0 on failure */ int OpenALAudio::play_long_wav(InputStream *in, const DsVolume &vol) { const int BUFFER_COUNT = 4; StreamContext *sc = NULL; WavStream *ws = NULL; int id; assert(this->wav_init_flag); ws = new WavStream; if (!ws->open(in)) { delete in; goto err; } sc = new StreamContext; if (!sc->init(ws)) goto err; set_source_panning(sc->source, vol.ds_pan); set_source_volume(sc->source, vol.ds_vol + this->wav_volume); if (!check_al()) goto err; sc->stream_data(BUFFER_COUNT); id = unused_key(&this->streams); this->streams[id] = sc; return id; err: delete sc; delete ws; return 0; }
void WavStream_set3dDistanceDelay(void * aClassPtr, int aDistanceDelay) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dDistanceDelay(!!aDistanceDelay); }
void WavStream_set3dListenerRelative(void * aClassPtr, int aListenerRelative) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dListenerRelative(!!aListenerRelative); }
void WavStream_set3dProcessing(void * aClassPtr, int aDo3dProcessing) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dProcessing(!!aDo3dProcessing); }
void WavStream_set3dDopplerFactor(void * aClassPtr, float aDopplerFactor) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dDopplerFactor(aDopplerFactor); }
void WavStream_setFilter(void * aClassPtr, unsigned int aFilterId, Filter * aFilter) { WavStream * cl = (WavStream *)aClassPtr; cl->setFilter(aFilterId, aFilter); }
void WavStream_set3dAttenuator(void * aClassPtr, AudioAttenuator * aAttenuator) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dAttenuator(aAttenuator); }
void WavStream_setVolume(void * aClassPtr, float aVolume) { WavStream * cl = (WavStream *)aClassPtr; cl->setVolume(aVolume); }
double WavStream_getLength(void * aClassPtr) { WavStream * cl = (WavStream *)aClassPtr; return cl->getLength(); }
int WavStream_loadFileToMem(void * aClassPtr, File * aFile) { WavStream * cl = (WavStream *)aClassPtr; return cl->loadFileToMem(aFile); }
int WavStream_loadToMem(void * aClassPtr, const char * aFilename) { WavStream * cl = (WavStream *)aClassPtr; return cl->loadToMem(aFilename); }
int WavStream_loadMemEx(void * aClassPtr, unsigned char * aData, unsigned int aDataLen, int aCopy, int aTakeOwnership) { WavStream * cl = (WavStream *)aClassPtr; return cl->loadMem(aData, aDataLen, !!aCopy, !!aTakeOwnership); }
int WavStream_loadMem(void * aClassPtr, unsigned char * aData, unsigned int aDataLen) { WavStream * cl = (WavStream *)aClassPtr; return cl->loadMem(aData, aDataLen); }
void WavStream_set3dCollider(void * aClassPtr, AudioCollider * aCollider) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dCollider(aCollider); }
void WavStream_set3dColliderEx(void * aClassPtr, AudioCollider * aCollider, int aUserData) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dCollider(aCollider, aUserData); }
void WavStream_setLooping(void * aClassPtr, int aLoop) { WavStream * cl = (WavStream *)aClassPtr; cl->setLooping(!!aLoop); }
void WavStream_setInaudibleBehavior(void * aClassPtr, int aMustTick, int aKill) { WavStream * cl = (WavStream *)aClassPtr; cl->setInaudibleBehavior(!!aMustTick, !!aKill); }
void WavStream_set3dMinMaxDistance(void * aClassPtr, float aMinDistance, float aMaxDistance) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dMinMaxDistance(aMinDistance, aMaxDistance); }
void WavStream_stop(void * aClassPtr) { WavStream * cl = (WavStream *)aClassPtr; cl->stop(); }
void WavStream_set3dAttenuation(void * aClassPtr, unsigned int aAttenuationModel, float aAttenuationRolloffFactor) { WavStream * cl = (WavStream *)aClassPtr; cl->set3dAttenuation(aAttenuationModel, aAttenuationRolloffFactor); }