static ALCenum opensl_open_playback(ALCdevice *Device, const ALCchar *deviceName) { osl_data *data = NULL; SLresult result; if(!deviceName) deviceName = opensl_device; else if(strcmp(deviceName, opensl_device) != 0) return ALC_INVALID_VALUE; data = calloc(1, sizeof(*data)); if(!data) return ALC_OUT_OF_MEMORY; // create engine result = slCreateEngine(&data->engineObject, 0, NULL, 0, NULL, NULL); PRINTERR(result, "slCreateEngine"); if(SL_RESULT_SUCCESS == result) { result = VCALL(data->engineObject,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "engine->Realize"); } if(SL_RESULT_SUCCESS == result) { result = VCALL(data->engineObject,GetInterface)(SL_IID_ENGINE, &data->engine); PRINTERR(result, "engine->GetInterface"); } if(SL_RESULT_SUCCESS == result) { result = VCALL(data->engine,CreateOutputMix)(&data->outputMix, 0, NULL, NULL); PRINTERR(result, "engine->CreateOutputMix"); } if(SL_RESULT_SUCCESS == result) { result = VCALL(data->outputMix,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "outputMix->Realize"); } if(SL_RESULT_SUCCESS != result) { if(data->outputMix != NULL) VCALL0(data->outputMix,Destroy)(); data->outputMix = NULL; if(data->engineObject != NULL) VCALL0(data->engineObject,Destroy)(); data->engineObject = NULL; data->engine = NULL; free(data); return ALC_INVALID_VALUE; } al_string_copy_cstr(&Device->DeviceName, deviceName); Device->ExtraData = data; return ALC_NO_ERROR; }
static ALCenum ALCopenslPlayback_open(ALCopenslPlayback *self, const ALCchar *name) { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; SLresult result; if(!name) name = opensl_device; else if(strcmp(name, opensl_device) != 0) return ALC_INVALID_VALUE; // create engine result = slCreateEngine(&self->mEngineObj, 0, NULL, 0, NULL, NULL); PRINTERR(result, "slCreateEngine"); if(SL_RESULT_SUCCESS == result) { result = VCALL(self->mEngineObj,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "engine->Realize"); } if(SL_RESULT_SUCCESS == result) { result = VCALL(self->mEngineObj,GetInterface)(SL_IID_ENGINE, &self->mEngine); PRINTERR(result, "engine->GetInterface"); } if(SL_RESULT_SUCCESS == result) { result = VCALL(self->mEngine,CreateOutputMix)(&self->mOutputMix, 0, NULL, NULL); PRINTERR(result, "engine->CreateOutputMix"); } if(SL_RESULT_SUCCESS == result) { result = VCALL(self->mOutputMix,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "outputMix->Realize"); } if(SL_RESULT_SUCCESS != result) { if(self->mOutputMix != NULL) VCALL0(self->mOutputMix,Destroy)(); self->mOutputMix = NULL; if(self->mEngineObj != NULL) VCALL0(self->mEngineObj,Destroy)(); self->mEngineObj = NULL; self->mEngine = NULL; return ALC_INVALID_VALUE; } alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; }
int VOP_ISLOCKED(struct vnode *vp) { struct vop_islocked_args a; a.a_desc = VDESC(vop_islocked); a.a_vp = vp; return (VCALL(vp, VOFFSET(vop_islocked), &a)); }
int VOP_STRATEGY(struct buf *bp) { struct vop_strategy_args a; a.a_desc = VDESC(vop_strategy); a.a_bp = bp; return (VCALL(bp->b_vp, VOFFSET(vop_strategy), &a)); }
int VOP_BWRITE(struct buf *bp) { struct vop_bwrite_args a; a.a_desc = VDESC(vop_bwrite); a.a_bp = bp; return (VCALL(bp->b_vp, VOFFSET(vop_bwrite), &a)); }
int VOP_GETPAGES(struct vnode *vp, voff_t offset, struct vm_page **m, int *count, int centeridx, vm_prot_t access_type, int advice, int flags) { int error; bool mpsafe; struct vop_getpages_args a; a.a_desc = VDESC(vop_getpages); a.a_vp = vp; a.a_offset = offset; a.a_m = m; a.a_count = count; a.a_centeridx = centeridx; a.a_access_type = access_type; a.a_advice = advice; a.a_flags = flags; mpsafe = (vp->v_vflag & VV_MPSAFE); if (!mpsafe) { KERNEL_LOCK(1, curlwp); } error = (VCALL(vp, VOFFSET(vop_getpages), &a)); if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } return error; }
int VOP_SYMLINK(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct vattr *vap, char *target) { int error; bool mpsafe; struct vop_symlink_v3_args a; a.a_desc = VDESC(vop_symlink); a.a_dvp = dvp; a.a_vpp = vpp; a.a_cnp = cnp; a.a_vap = vap; a.a_target = target; mpsafe = (dvp->v_vflag & VV_MPSAFE); if (!mpsafe) { KERNEL_LOCK(1, curlwp); } error = (VCALL(dvp, VOFFSET(vop_symlink), &a)); if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } #ifdef DIAGNOSTIC if (error == 0) KASSERT((*vpp)->v_size != VSIZENOTSET && (*vpp)->v_writesize != VSIZENOTSET); #endif /* DIAGNOSTIC */ return error; }
int VOP_PRINT(struct vnode *vp) { struct vop_print_args a; a.a_desc = VDESC(vop_print); a.a_vp = vp; return (VCALL(vp, VOFFSET(vop_print), &a)); }
int VOP_RECLAIM(struct vnode *vp, struct proc *p) { struct vop_reclaim_args a; a.a_desc = VDESC(vop_reclaim); a.a_vp = vp; a.a_p = p; return (VCALL(vp, VOFFSET(vop_reclaim), &a)); }
int VOP_ABORTOP(struct vnode *dvp, struct componentname *cnp) { struct vop_abortop_args a; a.a_desc = VDESC(vop_abortop); a.a_dvp = dvp; a.a_cnp = cnp; return (VCALL(dvp, VOFFSET(vop_abortop), &a)); }
int VOP_REVOKE(struct vnode *vp, int flags) { struct vop_revoke_args a; a.a_desc = VDESC(vop_revoke); a.a_vp = vp; a.a_flags = flags; return (VCALL(vp, VOFFSET(vop_revoke), &a)); }
int VOP_KQFILTER(struct vnode *vp, struct knote *kn) { struct vop_kqfilter_args a; a.a_desc = VDESC(vop_kqfilter); a.a_vp = vp; a.a_kn = kn; return (VCALL(vp, VOFFSET(vop_kqfilter), &a)); }
int VOP_POLL(struct vnode *vp, int events, struct proc *p) { struct vop_poll_args a; a.a_desc = VDESC(vop_poll); a.a_vp = vp; a.a_events = events; a.a_p = p; return (VCALL(vp, VOFFSET(vop_poll), &a)); }
int VOP_UNLOCK(struct vnode *vp, int flags, struct proc *p) { struct vop_unlock_args a; a.a_desc = VDESC(vop_unlock); a.a_vp = vp; a.a_flags = flags; a.a_p = p; return (VCALL(vp, VOFFSET(vop_unlock), &a)); }
int VOP_OPEN(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) { struct vop_open_args a; a.a_desc = VDESC(vop_open); a.a_vp = vp; a.a_mode = mode; a.a_cred = cred; a.a_p = p; return (VCALL(vp, VOFFSET(vop_open), &a)); }
static void opensl_stop_playback(ALCdevice *Device) { osl_data *data = Device->ExtraData; SLPlayItf player; SLresult result; result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_PLAY, &player); PRINTERR(result, "bufferQueue->GetInterface"); if(SL_RESULT_SUCCESS == result) { result = VCALL(player,SetPlayState)(SL_PLAYSTATE_STOPPED); PRINTERR(result, "player->SetPlayState"); } free(data->buffer); data->buffer = NULL; data->bufferSize = 0; }
int VOP_LOOKUP(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) { struct vop_lookup_args a; a.a_desc = VDESC(vop_lookup); a.a_dvp = dvp; a.a_vpp = vpp; a.a_cnp = cnp; return (VCALL(dvp, VOFFSET(vop_lookup), &a)); }
AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) { ALCcontext *Context; Context = GetContextRef(); if(!Context) return; if(!Context->DeferUpdates) { ALboolean UpdateSources; ALsource **src, **src_end; ALeffectslot **slot, **slot_end; FPUCtl oldMode; SetMixerFPUMode(&oldMode); LockContext(Context); Context->DeferUpdates = AL_TRUE; /* Make sure all pending updates are performed */ UpdateSources = ExchangeInt(&Context->UpdateSources, AL_FALSE); src = Context->ActiveSources; src_end = src + Context->ActiveSourceCount; while(src != src_end) { if((*src)->state != AL_PLAYING) { Context->ActiveSourceCount--; *src = *(--src_end); continue; } if(ExchangeInt(&(*src)->NeedsUpdate, AL_FALSE) || UpdateSources) ALsource_Update(*src, Context); src++; } slot = Context->ActiveEffectSlots; slot_end = slot + Context->ActiveEffectSlotCount; while(slot != slot_end) { if(ExchangeInt(&(*slot)->NeedsUpdate, AL_FALSE)) VCALL((*slot)->EffectState,update,(Context->Device, *slot)); slot++; } UnlockContext(Context); RestoreFPUMode(&oldMode); } ALCcontext_DecRef(Context); }
int VOP_GETATTR(struct vnode *vp, struct vattr *vap, struct ucred *cred, struct proc *p) { struct vop_getattr_args a; a.a_desc = VDESC(vop_getattr); a.a_vp = vp; a.a_vap = vap; a.a_cred = cred; a.a_p = p; return (VCALL(vp, VOFFSET(vop_getattr), &a)); }
int VOP_ADVLOCK(struct vnode *vp, void *id, int op, struct flock *fl, int flags) { struct vop_advlock_args a; a.a_desc = VDESC(vop_advlock); a.a_vp = vp; a.a_id = id; a.a_op = op; a.a_fl = fl; a.a_flags = flags; return (VCALL(vp, VOFFSET(vop_advlock), &a)); }
int VOP_INACTIVE(struct vnode *vp, struct proc *p) { struct vop_inactive_args a; a.a_desc = VDESC(vop_inactive); a.a_vp = vp; #ifdef VFSDEBUG if ((vp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) panic("vop_inactive: vp"); #endif a.a_p = p; return (VCALL(vp, VOFFSET(vop_inactive), &a)); }
int VOP_REALLOCBLKS(struct vnode *vp, struct cluster_save *buflist) { struct vop_reallocblks_args a; a.a_desc = VDESC(vop_reallocblks); a.a_vp = vp; #ifdef VFSDEBUG if ((vp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) panic("vop_reallocblks: vp"); #endif a.a_buflist = buflist; return (VCALL(vp, VOFFSET(vop_reallocblks), &a)); }
int VOP_IOCTL(struct vnode *vp, u_long command, void *data, int fflag, struct ucred *cred, struct proc *p) { struct vop_ioctl_args a; a.a_desc = VDESC(vop_ioctl); a.a_vp = vp; a.a_command = command; a.a_data = data; a.a_fflag = fflag; a.a_cred = cred; a.a_p = p; return (VCALL(vp, VOFFSET(vop_ioctl), &a)); }
int VOP_LINK(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) { struct vop_link_args a; a.a_desc = VDESC(vop_link); a.a_dvp = dvp; #ifdef VFSDEBUG if ((dvp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(dvp)) panic("vop_link: dvp"); #endif a.a_vp = vp; a.a_cnp = cnp; return (VCALL(dvp, VOFFSET(vop_link), &a)); }
int VOP_PATHCONF(struct vnode *vp, int name, register_t *retval) { struct vop_pathconf_args a; a.a_desc = VDESC(vop_pathconf); a.a_vp = vp; #ifdef VFSDEBUG if ((vp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) panic("vop_pathconf: vp"); #endif a.a_name = name; a.a_retval = retval; return (VCALL(vp, VOFFSET(vop_pathconf), &a)); }
int lfs_bwrite_log(struct buf *bp, const char *file, int line) { struct vop_bwrite_args a; a.a_desc = VDESC(vop_bwrite); a.a_bp = bp; if (!(bp->b_flags & B_GATHERED) && !(bp->b_oflags & BO_DELWRI)) { LFS_ENTER_LOG("write", file, line, bp->b_lblkno, bp->b_flags, curproc->p_pid); } return (VCALL(bp->b_vp, VOFFSET(vop_bwrite), &a)); }
int VOP_ACCESS(struct vnode *vp, int mode, struct ucred *cred, struct proc *p) { struct vop_access_args a; a.a_desc = VDESC(vop_access); a.a_vp = vp; #ifdef VFSDEBUG if ((vp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) panic("vop_access: vp"); #endif a.a_mode = mode; a.a_cred = cred; a.a_p = p; return (VCALL(vp, VOFFSET(vop_access), &a)); }
int VOP_READ(struct vnode *vp, struct uio *uio, int ioflag, struct ucred *cred) { struct vop_read_args a; a.a_desc = VDESC(vop_read); a.a_vp = vp; #ifdef VFSDEBUG if ((vp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) panic("vop_read: vp"); #endif a.a_uio = uio; a.a_ioflag = ioflag; a.a_cred = cred; return (VCALL(vp, VOFFSET(vop_read), &a)); }
int VOP_ISLOCKED(struct vnode *vp) { int error; bool mpsafe; struct vop_islocked_args a; a.a_desc = VDESC(vop_islocked); a.a_vp = vp; mpsafe = (vp->v_vflag & VV_MPSAFE); if (!mpsafe) { KERNEL_LOCK(1, curlwp); } error = (VCALL(vp, VOFFSET(vop_islocked), &a)); if (!mpsafe) { KERNEL_UNLOCK_ONE(curlwp); } return error; }
int VOP_CLOSE(struct vnode *vp, int fflag, struct ucred *cred, struct proc *p) { struct vop_close_args a; a.a_desc = VDESC(vop_close); a.a_vp = vp; #ifdef VFSDEBUG if ((vp->v_flag & VLOCKSWORK) && !VOP_ISLOCKED(vp)) panic("vop_close: vp"); #endif a.a_fflag = fflag; a.a_cred = cred; a.a_p = p; return (VCALL(vp, VOFFSET(vop_close), &a)); }