コード例 #1
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_bass(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_BASS, bass_slider, bass_balance, bass_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_BASS, bass_rec);
}
コード例 #2
0
ファイル: cx18-av-audio.c プロジェクト: 020gzh/linux
static int cx18_av_audio_s_ctrl(struct v4l2_ctrl *ctrl)
{
	struct v4l2_subdev *sd = to_sd(ctrl);
	struct cx18 *cx = v4l2_get_subdevdata(sd);

	switch (ctrl->id) {
	case V4L2_CID_AUDIO_VOLUME:
		set_volume(cx, ctrl->val);
		break;
	case V4L2_CID_AUDIO_BASS:
		set_bass(cx, ctrl->val);
		break;
	case V4L2_CID_AUDIO_TREBLE:
		set_treble(cx, ctrl->val);
		break;
	case V4L2_CID_AUDIO_BALANCE:
		set_balance(cx, ctrl->val);
		break;
	case V4L2_CID_AUDIO_MUTE:
		set_mute(cx, ctrl->val);
		break;
	default:
		return -EINVAL;
	}
	return 0;
}
コード例 #3
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_synth(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_SYNTH, synth_slider, synth_balance, synth_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_SYNTH, synth_rec);
}
コード例 #4
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_line(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_LINE, line_slider, line_balance, line_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_LINE, line_rec);
}
コード例 #5
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_cd(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_CD, cd_slider, cd_balance, cd_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_CD, cd_rec);
}
コード例 #6
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_pcm(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_PCM, pcm_slider, pcm_balance, pcm_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_PCM, pcm_rec);
}
コード例 #7
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_ogain(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_OGAIN, ogain_slider, ogain_balance, ogain_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_OGAIN, ogain_rec);
}
コード例 #8
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_volume(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_VOLUME, volume_slider, volume_balance, volume_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_VOLUME, volume_rec);
}
コード例 #9
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_imix(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_IMIX, imix_slider, imix_balance, imix_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_IMIX, imix_rec);
}
コード例 #10
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_speaker(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_SPEAKER, speaker_slider, speaker_balance, speaker_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_SPEAKER, speaker_rec);
}
コード例 #11
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_mic(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_MIC, mic_slider, mic_balance, mic_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_MIC, mic_rec);
}
コード例 #12
0
int cx25840_audio_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);

	switch (ctrl->id) {
	case V4L2_CID_AUDIO_VOLUME:
		set_volume(client, ctrl->value);
		break;
	case V4L2_CID_AUDIO_BASS:
		set_bass(client, ctrl->value);
		break;
	case V4L2_CID_AUDIO_TREBLE:
		set_treble(client, ctrl->value);
		break;
	case V4L2_CID_AUDIO_BALANCE:
		set_balance(client, ctrl->value);
		break;
	case V4L2_CID_AUDIO_MUTE:
		set_mute(client, ctrl->value);
		break;
	default:
		return -EINVAL;
	}
	return 0;
}
コード例 #13
0
ファイル: evolume.cpp プロジェクト: GustavoMOG/ede12
void cb_treble(Fl_Widget*, long x) 
{
    if (x == 1) set_device(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance);
    if (x == 2) set_device(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance);
    if (x == 3) set_mute(mixer_device, SOUND_MIXER_TREBLE, treble_slider, treble_balance, treble_mute);
    if (x == 4) set_rec(mixer_device, SOUND_MIXER_TREBLE, treble_rec);
}
コード例 #14
0
ファイル: v4l2_fm.c プロジェクト: EnJens/device-sony-common
int v4l2_resume(void** session_data){
  fm_v4l2_data* session;

  ALOGI("%s:\n", __FUNCTION__);
  session = get_session_data(session_data);

  return set_mute(session->fd, MUTE_OFF);
}
コード例 #15
0
ファイル: v4l2_fm.c プロジェクト: EnJens/device-sony-common
int v4l2_mute(void** session_data, int mute){
  fm_v4l2_data* session;

  ALOGI("%s:\n", __FUNCTION__);
  session = get_session_data(session_data);

  return set_mute(session->fd, mute);
}
コード例 #16
0
int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg)
{
	struct v4l2_control *ctrl = arg;

	switch (cmd) {
	case VIDIOC_INT_AUDIO_CLOCK_FREQ:
		return set_audclk_freq(client, *(u32 *)arg);

	case VIDIOC_G_CTRL:
		switch (ctrl->id) {
		case V4L2_CID_AUDIO_VOLUME:
			ctrl->value = get_volume(client);
			break;
		case V4L2_CID_AUDIO_BASS:
			ctrl->value = get_bass(client);
			break;
		case V4L2_CID_AUDIO_TREBLE:
			ctrl->value = get_treble(client);
			break;
		case V4L2_CID_AUDIO_BALANCE:
			ctrl->value = get_balance(client);
			break;
		case V4L2_CID_AUDIO_MUTE:
			ctrl->value = get_mute(client);
			break;
		default:
			return -EINVAL;
		}
		break;

	case VIDIOC_S_CTRL:
		switch (ctrl->id) {
		case V4L2_CID_AUDIO_VOLUME:
			set_volume(client, ctrl->value);
			break;
		case V4L2_CID_AUDIO_BASS:
			set_bass(client, ctrl->value);
			break;
		case V4L2_CID_AUDIO_TREBLE:
			set_treble(client, ctrl->value);
			break;
		case V4L2_CID_AUDIO_BALANCE:
			set_balance(client, ctrl->value);
			break;
		case V4L2_CID_AUDIO_MUTE:
			set_mute(client, ctrl->value);
			break;
		default:
			return -EINVAL;
		}
		break;

	default:
		return -EINVAL;
	}

	return 0;
}
コード例 #17
0
int v4l2_pause(void** session_data){
  fm_v4l2_data* session;

  ALOGI("%s:\n", __FUNCTION__);
  session = get_session_data(session_data);

  kill_rds_thread(session);
  return set_mute(session->fd, MUTE_ON);
}
コード例 #18
0
ファイル: si4713-i2c.c プロジェクト: 03199618/linux
static int si4713_set_mute(struct si4713_device *sdev, u16 mute)
{
	int rval = 0;

	mute = set_mute(mute);

	if (sdev->power_state)
		rval = si4713_write_property(sdev,
				SI4713_TX_LINE_INPUT_MUTE, mute);

	return rval;
}
コード例 #19
0
ファイル: v4l2_fm.c プロジェクト: EnJens/device-sony-common
int v4l2_reset(void** session_data)
{
  fm_v4l2_data* session;
  int ret;

  ALOGI("%s:\n", __FUNCTION__);
  session = get_session_data(session_data);

  ret = set_mute(session->fd, MUTE_ON);
  if (ret < 0)
    return -1;

  ret = close(session->fd);
  if (ret < 0)
    return -1;

  free(session);
  return 0;
}
コード例 #20
0
int cx18_av_audio_s_ctrl(struct cx18 *cx, struct v4l2_control *ctrl)
{
	switch (ctrl->id) {
	case V4L2_CID_AUDIO_VOLUME:
		set_volume(cx, ctrl->value);
		break;
	case V4L2_CID_AUDIO_BASS:
		set_bass(cx, ctrl->value);
		break;
	case V4L2_CID_AUDIO_TREBLE:
		set_treble(cx, ctrl->value);
		break;
	case V4L2_CID_AUDIO_BALANCE:
		set_balance(cx, ctrl->value);
		break;
	case V4L2_CID_AUDIO_MUTE:
		set_mute(cx, ctrl->value);
		break;
	default:
		return -EINVAL;
	}
	return 0;
}
コード例 #21
0
ファイル: v4l2_fm.c プロジェクト: EnJens/device-sony-common
static int v4l2_rx_start_func (void **data, int low_freq, int high_freq, int default_freq, int grid)
{
  char	*dev = DEFAULT_DEVICE;
  fm_v4l2_data* session;

  ALOGI("%s:\n", __FUNCTION__);
  ALOGI("low_freq %d, high_freq %d, default_freq %d, grid %d\n", low_freq, high_freq, default_freq, grid);

  session = malloc(sizeof(fm_v4l2_data));
  if (session== NULL){
      ALOGE("error on malloc");
      return -1;
  }

  memset(session, 0, sizeof(fm_v4l2_data));
  *data =  session;

  session->fd = open_dev(dev);
  if (session->fd < 0){
      ALOGE("error on open dev\n");
      return -1;
  }

  if (get_tun_radio_cap(session->fd) !=1) {
      ALOGE("error on check tunner radio capability");
      return -1;
  }

  session->vt.index=0;
  if ( get_v4l2_tuner(session->fd,  &session->vt) <0 ){
      ALOGE("error on get V4L tuner\n");
      return -1;
  }

  session->fact = get_fact(session->fd, &session->vt);
  if ( session->fact < 0) {
      ALOGE("error on get fact\n");
      return -1;
  }

  session->freq = get_proprietary_freq(default_freq, session->fact);
  session->low_freq =  get_proprietary_freq(low_freq,  session->fact);
  session->high_freq =  get_proprietary_freq(high_freq,  session->fact);
  session->grid = get_proprietary_freq(grid,  session->fact);
  session->threshold = DEFAULT_THRESHOLD;
  
  if (set_freq(session->fd, session->freq) < 0 ){
      ALOGE("error on set freq\n");
      return -1;
  }

  if (set_volume(session->fd, DEFAULT_VOLUME)<0){
      ALOGE("error on set volume\n");
      return -1;
  }

  if (set_mute(session->fd, MUTE_OFF) <0){
      ALOGE("error on mute\n");
      return -1;
  }

  return 0;
}
コード例 #22
0
ファイル: cx18-av-audio.c プロジェクト: E-LLP/n900
int cx18_av_audio(struct cx18 *cx, unsigned int cmd, void *arg)
{
	struct cx18_av_state *state = &cx->av_state;
	struct v4l2_control *ctrl = arg;
	int retval;

	switch (cmd) {
	case VIDIOC_INT_AUDIO_CLOCK_FREQ:
		if (state->aud_input > CX18_AV_AUDIO_SERIAL2) {
			cx18_av_and_or(cx, 0x803, ~0x10, 0);
			cx18_av_write(cx, 0x8d3, 0x1f);
		}
		cx18_av_and_or(cx, 0x810, ~0x1, 1);
		retval = set_audclk_freq(cx, *(u32 *)arg);
		cx18_av_and_or(cx, 0x810, ~0x1, 0);
		if (state->aud_input > CX18_AV_AUDIO_SERIAL2)
			cx18_av_and_or(cx, 0x803, ~0x10, 0x10);
		return retval;

	case VIDIOC_G_CTRL:
		switch (ctrl->id) {
		case V4L2_CID_AUDIO_VOLUME:
			ctrl->value = get_volume(cx);
			break;
		case V4L2_CID_AUDIO_BASS:
			ctrl->value = get_bass(cx);
			break;
		case V4L2_CID_AUDIO_TREBLE:
			ctrl->value = get_treble(cx);
			break;
		case V4L2_CID_AUDIO_BALANCE:
			ctrl->value = get_balance(cx);
			break;
		case V4L2_CID_AUDIO_MUTE:
			ctrl->value = get_mute(cx);
			break;
		default:
			return -EINVAL;
		}
		break;

	case VIDIOC_S_CTRL:
		switch (ctrl->id) {
		case V4L2_CID_AUDIO_VOLUME:
			set_volume(cx, ctrl->value);
			break;
		case V4L2_CID_AUDIO_BASS:
			set_bass(cx, ctrl->value);
			break;
		case V4L2_CID_AUDIO_TREBLE:
			set_treble(cx, ctrl->value);
			break;
		case V4L2_CID_AUDIO_BALANCE:
			set_balance(cx, ctrl->value);
			break;
		case V4L2_CID_AUDIO_MUTE:
			set_mute(cx, ctrl->value);
			break;
		default:
			return -EINVAL;
		}
		break;

	default:
		return -EINVAL;
	}

	return 0;
}
コード例 #23
0
/*
 * XAresult XANokiaVolumeExtItfAdapt_SetMute(void *ctx, AdaptationContextIDS ctx->ctxId, XAboolean mute)
 * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID value given as 2nd parameter
 * @param AdaptationContextIDS ctx->ctxId - Type specifier for context, this will be used to cast ctx pointer to correct type.
 * @param XAboolean mute - status of mute value
 * @return XAresult ret - Success value
 */
XAresult XANokiaVolumeExtItfAdapt_SetMute(XAAdaptationMMFCtx *ctx,
        XAboolean mute)
    {
    XAuint32 volume;
    XAresult res = XA_RESULT_SUCCESS;

    DEBUG_API("->XANokiaVolumeExtItfAdapt_SetMute");
    if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation
            && ctx->baseObj.ctxId != XAMediaRecorderAdaptation
            && ctx->baseObj.ctxId != XARadioAdaptation))
        {
        DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");
        DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetMute");
        /* invalid parameter */
        res = XA_RESULT_PARAMETER_INVALID;
        return res;
        }

    if (ctx->baseObj.ctxId == XAMediaPlayerAdaptation)
        {
        if (mute)
            {

            res = mmf_volumeitf_get_volume(
                    ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext,
                    &volume);
            if(res == XA_RESULT_SUCCESS)
                {
                ((XAMediaPlayerAdaptationMMFCtx*) ctx)->premutevol = volume;
                res = mmf_volumeitf_set_volume(
                        ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext, 0);
                }
            }
        else
            {
            res = mmf_volumeitf_set_volume(
                    ((XAMediaPlayerAdaptationMMFCtx*) ctx)->mmfContext,
                    ((XAMediaPlayerAdaptationMMFCtx*) ctx)->premutevol);
            }
        }
    else if (ctx->baseObj.ctxId == XAMediaRecorderAdaptation)
        {
        if (mute)
            {

            res = mmf_volumeitf_get_volume(
                    ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext,
                    &volume);
            if(res == XA_RESULT_SUCCESS)
                {
                ((XAMediaRecorderAdaptationMMFCtx*) ctx)->premutevol = volume;
                res = mmf_volumeitf_set_volume(
                        ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext, 0);
                }
            }
        else
            {
            res = mmf_volumeitf_set_volume(
                    ((XAMediaRecorderAdaptationMMFCtx*) ctx)->mmfContext,
                    ((XAMediaRecorderAdaptationMMFCtx*) ctx)->premutevol);
            }
        }
    else if (ctx->baseObj.ctxId == XARadioAdaptation)
        {
        res = set_mute(cmmfradiobackendengine_init(), ctx, mute);
        }

    DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetMute");
    return res;
    }
コード例 #24
0
ファイル: cx25840-audio.c プロジェクト: PennPanda/linux-repo
int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg)
{
	struct cx25840_state *state = i2c_get_clientdata(client);
	struct v4l2_control *ctrl = arg;
	int retval;

	switch (cmd) {
	case VIDIOC_INT_AUDIO_CLOCK_FREQ:
		if (!state->is_cx25836)
			cx25840_and_or(client, 0x810, ~0x1, 1);
		if (state->aud_input != CX25840_AUDIO_SERIAL) {
			cx25840_and_or(client, 0x803, ~0x10, 0);
			cx25840_write(client, 0x8d3, 0x1f);
		}
		retval = set_audclk_freq(client, *(u32 *)arg);
		if (state->aud_input != CX25840_AUDIO_SERIAL) {
			cx25840_and_or(client, 0x803, ~0x10, 0x10);
		}
		if (!state->is_cx25836)
			cx25840_and_or(client, 0x810, ~0x1, 0);
		return retval;

	case VIDIOC_G_CTRL:
		switch (ctrl->id) {
		case V4L2_CID_AUDIO_VOLUME:
			ctrl->value = get_volume(client);
			break;
		case V4L2_CID_AUDIO_BASS:
			ctrl->value = get_bass(client);
			break;
		case V4L2_CID_AUDIO_TREBLE:
			ctrl->value = get_treble(client);
			break;
		case V4L2_CID_AUDIO_BALANCE:
			ctrl->value = get_balance(client);
			break;
		case V4L2_CID_AUDIO_MUTE:
			ctrl->value = get_mute(client);
			break;
		default:
			return -EINVAL;
		}
		break;

	case VIDIOC_S_CTRL:
		switch (ctrl->id) {
		case V4L2_CID_AUDIO_VOLUME:
			set_volume(client, ctrl->value);
			break;
		case V4L2_CID_AUDIO_BASS:
			set_bass(client, ctrl->value);
			break;
		case V4L2_CID_AUDIO_TREBLE:
			set_treble(client, ctrl->value);
			break;
		case V4L2_CID_AUDIO_BALANCE:
			set_balance(client, ctrl->value);
			break;
		case V4L2_CID_AUDIO_MUTE:
			set_mute(client, ctrl->value);
			break;
		default:
			return -EINVAL;
		}
		break;

	default:
		return -EINVAL;
	}

	return 0;
}
コード例 #25
0
ファイル: main.c プロジェクト: MoSheriff/Comm-Audio
int main(int argc , char ** argv)
{
	MMRESULT						err;
	WAVEFORMATEX					waveFormat;
	MIXERLINE						mixerLine;
	HANDLE							waveInThread;
	unsigned long					n, numSrc;

	waveInThread = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)waveInProc, 0, 0, &err);
	if (!waveInThread)
	{
		printf("Can't create WAVE recording thread! -- %08X\n", GetLastError());
		return(-1);
	}
	CloseHandle(waveInThread);

	ZeroMemory(&WaveHeader[0], sizeof(WAVEHDR) * 2);

	waveFormat.wFormatTag = WAVE_FORMAT_PCM;
	waveFormat.nChannels = 2;
	waveFormat.nSamplesPerSec = 44100;
	waveFormat.wBitsPerSample = 16;
	waveFormat.nBlockAlign = waveFormat.nChannels * (waveFormat.wBitsPerSample/8);
	waveFormat.nAvgBytesPerSec = waveFormat.nSamplesPerSec * waveFormat.nBlockAlign;
	waveFormat.cbSize = 0;

	err = waveInOpen(&WaveInHandle, WAVE_MAPPER, &waveFormat, (DWORD)err, 0, CALLBACK_THREAD);
	if (err)
	{
		PrintWaveErrorMsg(err, "Can't open WAVE In Device!");
		return(-2);
	}
	else
	{
		err = mixerOpen(&MixerHandle, (DWORD)WaveInHandle, 0, 0, MIXER_OBJECTF_HWAVEIN);
		if (err)
		{
			printf("Device does not have mixer support! -- %08X\n", err);
		}

		else
		{
			mixerLine.cbStruct = sizeof(MIXERLINE);
			mixerLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN;
			err = mixerGetLineInfo((HMIXEROBJ)MixerHandle, &mixerLine, MIXER_GETLINEINFOF_COMPONENTTYPE);
			if (err)
			{
				printf("Device does not have a WAVE recording control! -- %08X\n", err);
				goto record;
			}

			numSrc = mixerLine.cConnections;

			mixerLine.dwSource = mixerLine.dwDestination;
			set_mute(&mixerLine, 1, ERRMSG_NONE);

			/* Make sure that there is at least one WAVEIN source line available. If not, then just go with the
			 * WAVEIN master volume and mute above
			 */
			if (!numSrc)
			{
				printf("ERROR: There are no WAVE inputs to adjust!\n");
				goto record;
			}

remute:
			printf("The device has the following WAVE inputs. Choose which one to mute,\nor press ENTER to start recording.\n\n");

			/* Print the names of the source lines for the MIXERLINE_COMPONENTTYPE_DST_WAVEIN destination. But,
			 * omit any MIDI In
			 */
			for (n = 0; n < numSrc; n++)
			{
				mixerLine.cbStruct = sizeof(MIXERLINE);
				mixerLine.dwSource = n;

				if (!(err = mixerGetLineInfo((HMIXEROBJ)MixerHandle, &mixerLine, MIXER_GETLINEINFOF_SOURCE)))
				{
					if (mixerLine.dwComponentType != MIXERLINE_COMPONENTTYPE_SRC_SYNTHESIZER)
						printf("\t#%lu: %s\n", n, mixerLine.szName);
				}
			}

			/* Get his choice of source line to mute, or ENTER to continue with recording */
			{
			TCHAR	buffer[3];

			fgets(&buffer[0], 3, stdin);

			if (buffer[0] >= '1' && buffer[0] <= '9')
			{
				buffer[0] -= '1';
				if ((unsigned long)buffer[0] < numSrc)
				{
					mixerLine.cbStruct = sizeof(MIXERLINE);
					mixerLine.dwSource = buffer[0];
					mixerGetLineInfo((HMIXEROBJ)MixerHandle, &mixerLine, MIXER_GETLINEINFOF_SOURCE);

					set_mute(&mixerLine, 0, ERRMSG_PRINT);
				}

				/* Go back to check for more muted sources */
				goto remute;
			}
			}

record:		mixerClose(MixerHandle);
		}

		WaveFileHandle = CreateFile("test.snd", GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
		if (WaveFileHandle == INVALID_HANDLE_VALUE)
		{
			printf("Can't create test.snd disk file!\n");
		}
		else
		{
			WaveHeader[1].dwBufferLength = WaveHeader[0].dwBufferLength = waveFormat.nAvgBytesPerSec << 1;
			if (!(WaveHeader[0].lpData = (char *)VirtualAlloc(0, WaveHeader[0].dwBufferLength * 2, MEM_COMMIT, PAGE_READWRITE)))
			{
				printf("ERROR: Can't allocate memory for WAVE buffer!\n");
			}
			else
			{
				WaveHeader[1].lpData = WaveHeader[0].lpData + WaveHeader[0].dwBufferLength;

				if ((err = waveInPrepareHeader(WaveInHandle, &WaveHeader[0], sizeof(WAVEHDR))))
				{
					printf("Error preparing WAVEHDR 1! -- %08X\n", err);
				}
				else
				{
					if ((err = waveInPrepareHeader(WaveInHandle, &WaveHeader[1], sizeof(WAVEHDR))))
					{
						printf("Error preparing WAVEHDR 2! -- %08X\n", err);
					}
					else
					{
						/* Queue first WAVEHDR (recording hasn't started yet) */
						if ((err = waveInAddBuffer(WaveInHandle, &WaveHeader[0], sizeof(WAVEHDR))))
						{
							printf("Error queueing WAVEHDR 1! -- %08X\n", err);
						}
						else
						{
							if ((err = waveInAddBuffer(WaveInHandle, &WaveHeader[1], sizeof(WAVEHDR))))
							{
								printf("Error queueing WAVEHDR 2! -- %08X\n", err);
								DoneAll = 1;
								goto abort;
							}
							else
							{
								//record
								InRecord = TRUE;
								if ((err = waveInStart(WaveInHandle)))
								{
									printf("Error starting record! -- %08X\n", err);
								}
								else
								{
									printf("Recording has started. Press ENTER key to stop recording...\n");
									getchar();
								}

								/* Tell our recording thread not to queue any WAVEHDRs it gets back via MM_WIM_DONE */
abort:							InRecord = FALSE;
								
								waveInReset(WaveInHandle);

								while (DoneAll < 2) Sleep(100);
							}
						}

						if ((err = waveInPrepareHeader(WaveInHandle, &WaveHeader[1], sizeof(WAVEHDR))))
						{
							printf("Error unpreparing WAVEHDR 2! -- %08X\n", err);
						}
					}

					if ((err = waveInPrepareHeader(WaveInHandle, &WaveHeader[0], sizeof(WAVEHDR))))
					{
						printf("Error unpreparing WAVEHDR 1! -- %08X\n", err);
					}
				}
			}
		}
	}

	/* Close the WAVE In device */
	do
	{
		err = waveInClose(WaveInHandle);
		if (err) PrintWaveErrorMsg(err, "Can't close WAVE In Device!");
	} while (err);

	/* Close the disk file if it opened */
	if (WaveFileHandle != INVALID_HANDLE_VALUE) CloseHandle(WaveFileHandle);

	/* Free any memory allocated for our buffers */
	if (WaveHeader[0].lpData) VirtualFree(WaveHeader[0].lpData, 0, MEM_RELEASE);

	return(0);
}