Beispiel #1
0
void CAudioFormatDlg::OnSelchangeInputdevice()
{
	int devID = m_ctrlCBInputDevice.GetCurSel();
	if (devID < m_iNumDevice) {
		//UpdateDeviceData(m_devicemap[devID], m_cFmt.m_dwWaveinSelected, NULL);
		UpdateDeviceData(m_devicemap[devID], m_cFmt.m_dwWaveinSelected, m_cFmt.AudioFormat());
	}
}
void AudioFormat::OnSelchangeInputdevice()
{
	// TODO: Add your control notification handler code here

	int devID;
	devID = ((CComboBox *) (GetDlgItem(IDC_INPUTDEVICE)))->GetCurSel();
	if (devID < numdevice) {

		UpdateDeviceData(devicemap[devID],waveinselected,NULL);

	}

}
Beispiel #3
0
BOOL CAudioFormatDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	//Interleave
	m_ctrlButtonInterleave.SetCheck(m_cFmt.m_bInterleaveFrames);
	m_iInterleavePeriod = m_cFmt.m_iInterleaveFactor;

	m_ctrlEditFactor.EnableWindow(m_cFmt.m_bInterleaveFrames);
	m_ctrlButtonInterleaveFrames.EnableWindow(m_cFmt.m_bInterleaveFrames);
	m_ctrlButtonInterleaveSeconds.EnableWindow(m_cFmt.m_bInterleaveFrames);

	m_ctrlButtonInterleaveFrames.SetCheck(m_cFmt.m_iInterleavePeriod == FRAMES);
	m_ctrlButtonInterleaveSeconds.SetCheck(m_cFmt.m_iInterleavePeriod == MILLISECONDS);

	m_iAudioBitsPerSample = m_cFmt.m_iBitsPerSample;
	m_iAudioNumChannels = m_cFmt.m_iNumChannels;
	m_iAudioSamplesPerSeconds = m_cFmt.m_iSamplesPerSeconds;

	m_bAudioCompression = m_cFmt.m_bCompression;

	//Ver 1.2

	//Generate device list
	LoadDeviceList();

	////Select the device combo box
	//int deviceIsSelected = 0;
	//int selectedDevice = WAVE_MAPPER;
	//for (int i = 0; i < m_iNumDevice; ++i) {
	//	if (m_cFmt.m_uDeviceID == m_devicemap[i]) {
	//		m_ctrlCBInputDevice.SetCurSel(i);
	//		selectedDevice = m_devicemap[i];
	//		deviceIsSelected = 1;
	//	}
	//}
	//if (!deviceIsSelected) {
	//	if (m_iNumDevice) {
	//		m_ctrlCBInputDevice.SetCurSel(0);
	//	}
	//}

	LoadFormatList();

	//Ver 1.2
	WAVEINCAPS pwic;
	MMRESULT mmr = ::waveInGetDevCaps(m_cFmt.m_uDeviceID , &pwic, sizeof(pwic));
	if (MMSYSERR_NOERROR != mmr) {
		// TODO: handle error
	}

	// This code works on the assumption (when filling in values for the user - interfaces)
	// that the m_Format and pwfx formats (external variables) are already chosen correctly
	// and compatibile with each other
	int devID = m_ctrlCBInputDevice.GetCurSel();
	if (CB_ERR != devID) {
		UpdateDeviceData(m_ctrlCBInputDevice.GetItemData(devID), m_cFmt.m_dwWaveinSelected, m_cFmt.AudioFormat());
	}

	//ver 1.8
	m_ctrlButtonSystemRecord.SetCheck(m_cFmt.m_bUseMCI);
	//UpdateCompressFormatInterface();
	UpdateData(FALSE);

	return TRUE; // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}
Beispiel #4
0
BOOL ExitPropertyPageAdvanced(_In_ HWND hwndDlg, _Inout_ PCOISANE_Data privateData)
{
	SP_DEVINSTALL_PARAMS devInstallParams;
	PWINSANE_Session oSession;
	PWINSANE_Device oDevice;
	LPTSTR lpName;
	LPTSTR lpUsername;
	LPTSTR lpPassword;
	BOOL res;

	lpName = (LPTSTR) HeapAlloc(privateData->hHeap, HEAP_ZERO_MEMORY, sizeof(TCHAR) * MAX_PATH);
	if (lpName) {
		res = GetDlgItemText(hwndDlg, IDC_PROPERTIES_COMBO_SCANNER, lpName, MAX_PATH);
		if (res) {
			if (privateData->lpName) {
				HeapFree(privateData->hHeap, 0, privateData->lpName);
			}
			privateData->lpName = lpName;
		} else {
			HeapFree(privateData->hHeap, 0, lpName);
		}
	} else {
		res = FALSE;
	}

	if (res) {
		lpUsername = (LPTSTR) HeapAlloc(privateData->hHeap, HEAP_ZERO_MEMORY, sizeof(TCHAR) * MAX_PATH);
		if (lpUsername) {
			if (GetDlgItemText(hwndDlg, IDC_PROPERTIES_EDIT_USERNAME, lpUsername, MAX_PATH)) {
				if (privateData->lpUsername) {
					HeapFree(privateData->hHeap, 0, privateData->lpUsername);
				}
				privateData->lpUsername = lpUsername;
			} else {
				HeapFree(privateData->hHeap, 0, lpUsername);
			}
		}

		lpPassword = (LPTSTR) HeapAlloc(privateData->hHeap, HEAP_ZERO_MEMORY, sizeof(TCHAR) * MAX_PATH);
		if (lpPassword) {
			if (GetDlgItemText(hwndDlg, IDC_PROPERTIES_EDIT_PASSWORD, lpPassword, MAX_PATH)) {
				if (privateData->lpPassword) {
					HeapFree(privateData->hHeap, 0, privateData->lpPassword);
				}
				privateData->lpPassword = lpPassword;
			} else {
				HeapFree(privateData->hHeap, 0, lpPassword);
			}
		}

		oSession = WINSANE_Session::Remote(privateData->lpHost, privateData->usPort);
		if (oSession) {
			if (oSession->Init(NULL, NULL) == SANE_STATUS_GOOD) {
				if (oSession->GetDevices() > 0) {
					oDevice = oSession->GetDevice(privateData->lpName);
					if (oDevice) {
						UpdateDeviceInfo(privateData, oDevice);
						UpdateDeviceData(privateData, oDevice);

						ZeroMemory(&devInstallParams, sizeof(SP_DEVINSTALL_PARAMS));
						devInstallParams.cbSize = sizeof(SP_DEVINSTALL_PARAMS);
						res = SetupDiGetDeviceInstallParams(privateData->hDeviceInfoSet, privateData->pDeviceInfoData, &devInstallParams);
						if (res) {
							devInstallParams.FlagsEx |= DI_FLAGSEX_PROPCHANGE_PENDING;
							res = SetupDiSetDeviceInstallParams(privateData->hDeviceInfoSet, privateData->pDeviceInfoData, &devInstallParams);
						}
					} else {
						res = FALSE;
					}
				} else {
					res = FALSE;
				}
				if (oSession->Exit() != SANE_STATUS_GOOD) {
					res = FALSE;
				}
			} else {
				res = FALSE;
			}
			delete oSession;
		} else {
			res = FALSE;
		}
	}

	return res;
}
BOOL AudioFormat::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO: Add extra initialization here

	//Interleave
	((CButton *) (GetDlgItem(IDC_INTERLEAVE)))->SetCheck(interleaveFrames);
	CString interleaveFactorStr;
	interleaveFactorStr.Format("%d",interleaveFactor);
	((CEdit *) (GetDlgItem(IDC_IFACTOR)))->SetWindowText(interleaveFactorStr);

		if (interleaveFrames) {
		((CButton *) (GetDlgItem(IDC_IFACTOR)))->EnableWindow(TRUE);
		((CButton *) (GetDlgItem(IDC_INTERLEAVEFRAMES)))->EnableWindow(TRUE);
		((CButton *) (GetDlgItem(IDC_INTERLEAVESECONDS)))->EnableWindow(TRUE);

	}
	else {
		((CButton *) (GetDlgItem(IDC_IFACTOR)))->EnableWindow(FALSE);
		((CButton *) (GetDlgItem(IDC_INTERLEAVEFRAMES)))->EnableWindow(FALSE);
		((CButton *) (GetDlgItem(IDC_INTERLEAVESECONDS)))->EnableWindow(FALSE);

	}

	if (interleaveUnit == FRAMES) {
		((CButton *) (GetDlgItem(IDC_INTERLEAVEFRAMES)))->SetCheck(TRUE);
		((CButton *) (GetDlgItem(IDC_INTERLEAVESECONDS)))->SetCheck(FALSE);
	}
	else {
		((CButton *) (GetDlgItem(IDC_INTERLEAVEFRAMES)))->SetCheck(FALSE);
		((CButton *) (GetDlgItem(IDC_INTERLEAVESECONDS)))->SetCheck(TRUE);
	}

	audio_bits_per_sampleLocal = audio_bits_per_sample;
	audio_num_channelsLocal = audio_num_channels;
	audio_samples_per_secondsLocal = audio_samples_per_seconds;

	bAudioCompressionLocal = bAudioCompression;

	//Ver 1.2

	//Generate device list
	numdevice = 0;
	devicemap[numdevice] = WAVE_MAPPER;
	numdevice ++ ;

	((CComboBox *) (GetDlgItem(IDC_INPUTDEVICE)))->ResetContent( );
	((CComboBox *) (GetDlgItem(IDC_INPUTDEVICE)))->AddString("Default input device");

	int numdevs=waveInGetNumDevs();
	for (int i=0; i<numdevs; i++)
	{
		WAVEINCAPS wicaps;
		MMRESULT mmr=waveInGetDevCaps(i,&wicaps,sizeof(WAVEINCAPS));
		if (mmr==MMSYSERR_NOERROR)
		{

				((CComboBox *) (GetDlgItem(IDC_INPUTDEVICE)))->AddString(wicaps.szPname);
				devicemap[numdevice] = i;
				numdevice ++ ;

		}

	}

	//Select the device combo box
	int deviceIsSelected= 0;
	int selectedDevice = WAVE_MAPPER;
	for (i=0; i<numdevice; i++) {

		if (AudioDeviceID == devicemap[i]) {
			((CComboBox *) (GetDlgItem(IDC_INPUTDEVICE)))->SetCurSel(i);
			selectedDevice = devicemap[i];
			deviceIsSelected = 1;
		}

	}
	if (!deviceIsSelected) {
		if (numdevice)
			((CComboBox *) (GetDlgItem(IDC_INPUTDEVICE)))->SetCurSel(0);

	}

	//Ver 1.2
	WAVEINCAPS pwic;
	MMRESULT mmr = waveInGetDevCaps( AudioDeviceID ,  &pwic, sizeof(pwic) );

	int selected_cindex=-1; //selected index of combo box
	numformat=0; //counter, number of format

	//This code works on the assumption (when filling in values for the user - interfaces)
	//that the  m_Format and pwfx formats (external variables) are already chosen correctly and compatibile with each other
	int devID;
	devID = ((CComboBox *) (GetDlgItem(IDC_INPUTDEVICE)))->GetCurSel();
	if (devID < numdevice) {

		UpdateDeviceData(selectedDevice,waveinselected,pwfx);

	}

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}