예제 #1
0
파일: mixer.c 프로젝트: acieroid/osscmix
void
update_ctrl (s_ctrl ctrl)
{
	oss_mixext ext;
	oss_mixer_value val;
	int left, right;

	left = ctrl.left_val;
	right = ctrl.right_val;

	ext.dev = 0;
	ext.ctrl = ctrl.real_id;

	OSS_CALL(SNDCTL_MIX_EXTINFO, &ext)

	/* if we can't change the values, we just do nothing */
	if (!(ext.flags & MIXF_WRITEABLE))
		return;

	val.dev = ext.dev;
	val.ctrl = ext.ctrl;
	val.timestamp = ext.timestamp;
	switch (ext.type) {
		case MIXT_STEREOSLIDER16:
		case MIXT_MONOSLIDER16:
			if (left > 0xffff) left = 0xffff;
			if (right > 0xffff) right = 0xffff;
			val.value = (left & 0xffff) | ((right & 0xffff) << 16);
			break;
		case MIXT_MONOSLIDER:
		case MIXT_SLIDER:
			val.value = left;
			break;
		default:
			if (left > 255) left = 255;
			if (right > 255) right = 255;
			val.value = (left & 255) | ((right & 255) << 8);
			break;
	}
	OSS_CALL(SNDCTL_MIX_WRITE, &val);
}
예제 #2
0
파일: mixer.c 프로젝트: acieroid/osscmix
void
get_values (s_ctrl *ctrl)
{
	oss_mixer_value val;
	int mask = 0xff, shift = 8;

	val.dev = ctrl->dev;
	val.ctrl = ctrl->real_id;
	val.timestamp = ctrl->timestamp;
	OSS_CALL(SNDCTL_MIX_READ, &val);

	/* FIXME: you *can't* mute a ctrl which is not a MIXT_MUTE */
	ctrl->muted = false;

	switch (ctrl->type) {
		case MIXT_STEREOSLIDER16:
			shift = 16; mask = 0xffff;
		case MIXT_STEREOSLIDER:
			ctrl->stereo = TRUE;
			ctrl->left_val = val.value & mask;
			ctrl->right_val = (val.value >> shift) & mask;
			break;
		case MIXT_SLIDER:
			mask = ~0;
		case MIXT_MONOSLIDER16:
			mask = 0xffff;
		case MIXT_MONOSLIDER:
		case MIXT_MONODB:
			ctrl->stereo = FALSE;
			ctrl->left_val = val.value & mask;
		default:
			ctrl->stereo = FALSE;
			ctrl->max_value = 1;
			ctrl->left_val = 0;
	}
}
예제 #3
0
파일: LuaOSS.c 프로젝트: SunsetTech/LuaOSS
	OSS_CALL(SNDCTL_SYSINFO,oss_sysinfo,,AS_STRUCT)
		STRUCT_STR(product)
		STRUCT_STR(version)
		STRUCT_STR(license)
		STRUCT_INT(versionnum)
		STRUCT_INT(numaudios)
		STRUCT_INT(numaudioengines)
		STRUCT_INT(nummidis)
		STRUCT_INT(numtimers)
		STRUCT_INT(numcards)
		STRUCT_INT(nummixers)
	FINISH
}

DEF(SNDCTL_MIXERINFO) {
	OSS_CALL(SNDCTL_MIXERINFO,oss_mixerinfo,STRUCT_SET(dev,GET_INT(2)),AS_STRUCT)
		STRUCT_INT(dev)
		STRUCT_STR(id)
		STRUCT_STR(name)
		STRUCT_INT(modify_counter)
		STRUCT_INT(enabled)
		STRUCT_INT(nrext)
		STRUCT_INT(priority)
		STRUCT_STR(devnode)
	FINISH
}

DEF(SNDCTL_MIX_EXTINFO) {
	OSS_CALL(SNDCTL_MIX_EXTINFO,oss_mixext,STRUCT_SET(dev,GET_INT(2)) STRUCT_SET(ctrl,GET_INT(3)),AS_STRUCT)
		STRUCT_INT(dev)
		STRUCT_INT(ctrl)