int SdrPlugin::Start()
{
    if(isStarted)
        return -4;

    if(pSDRhw == NULL)
        return -1;

    // todo: why plugin options? it's audio options!
    PLUGIN_OPTIONS OptPlug;
    OptPlug.cbPaDriverIndex = pUi->cbPaDriver->currentIndex();
    OptPlug.cbPaOutIndex = pUi->cbPaOut->currentIndex();
    OptPlug.cbPaInIndex = pUi->cbPaIn->currentIndex();
    OptPlug.cbPaChannelsIndex = pUi->cbPaChannels->currentIndex();
    OptPlug.cbPaSampleRate = pUi->cbPaSampleRate->currentText().toInt();
    OptPlug.cbPaBufferSizeIndex = pUi->cbPaBufferSize->currentIndex();
    OptPlug.sbPaLattency = pUi->sbPaLattency->value();
    OptPlug.sbDdsMul = pUi->cbDdsOsc->currentIndex()+1;
    OptPlug.cbPaMicIndex = pUi->cbPaMic->currentIndex();
    OptPlug.cbPaSpeakerIndex = pUi->cbPaSpeaker->currentIndex();
    OptPlug.isTwoSoundCard = pUi->cbPaChannels->currentIndex() == 2; // 2x2
    OptPlug.userData = userData;

    portAudio.setParam(OptPlug);

    if(portAudio.start(AudioCallBack)!=0)
        return -1;

    pSDRhw->open(0, OptPlug.sbDdsMul);
    if(pSDRhw->isOpen()==0)
        emit sunsdrConnectInfo("SDR device is not connected.");
    else
        emit sunsdrConnectInfo("SDR device is connected.");
    return 0;

    pUi->tbSDR->setEnabled(false);
    isStarted = true;
    return 0;
}
Beispiel #2
0
int SdrPlugin::Start()
{
	if(isStarted)
		return -4;

    if(pSDRhw == NULL)
        return -1;

	OptPlug.cbPaDriverIndex = pUi->cbPaDriver->currentIndex();
	OptPlug.cbPaOutIndex = pUi->cbPaOut->currentIndex();
	OptPlug.cbPaInIndex = pUi->cbPaIn->currentIndex();
	OptPlug.cbPaChannelsIndex = pUi->cbPaChannels->currentIndex();
	OptPlug.cbPaSampleRate = pUi->cbPaSampleRate->currentText().toInt();
	OptPlug.cbPaBufferSizeIndex = pUi->cbPaBufferSize->currentIndex();
	OptPlug.sbPaLattency = pUi->sbPaLattency->value();
	OptPlug.sbDdsMul = pUi->cbDdsOsc->currentIndex()+1;
	pAudio->setParam(&OptPlug);
	if(OptPlug.cbPaChannelsIndex == 0)
	{
		if(pAudio->start(AudioCallBack)!=0)
			return -1;
	}
	else
	{
		if(pAudio->start(AudioCallBack4)!=0)
			return -1;
	}
    pSDRhw->open(0, OptPlug.sbDdsMul);
    if(pSDRhw->isOpen()==0)
		emit sunsdrConnectInfo("SDR device is not connected.");
	else
		emit sunsdrConnectInfo("SDR device is connected.");
	return 0;

	pUi->tbSDR->setEnabled(false);
	isStarted = true;
	return 0;
}