示例#1
0
/**
 * Class constructor.
 */
LearningWidget::LearningWidget(MainWindow* parent) :
    QWidget(parent),
    ui(new Ui::LearningWidget),
    model(NULL),
    mainWin(parent)
{
    //autogenerated stuff
    ui->setupUi(this);

    //creates and adds newt param widget to layout
	npw = new NetParamWidget(this);
	ui->splitterH->addWidget(npw);

    //connects signals and slots
	connect(ui->closeButton, SIGNAL(pressed()), this, SLOT(closeBtnPressed()));
	connect(ui->startBtn, SIGNAL(pressed()), this, SLOT(startLearning()));
	connect(ui->stopBtn, SIGNAL(pressed()), this, SLOT(stopLearning()));
	connect(ui->datasetBox, SIGNAL(activated(QString)), this, SLOT(datasetSelected(QString)));
	connect(ui->networkBox, SIGNAL(activated(QString)), this, SLOT(networkSelected(QString)));
	connect(ui->lrnCoefBox, SIGNAL(valueChanged(double)), this, SLOT(lrnCoefChanged(double)));
	connect(ui->maxErrBox, SIGNAL(valueChanged(double)), this, SLOT(maxErrChanged(double)));
	connect(ui->maxIterBox, SIGNAL(valueChanged(int)), this, SLOT(maxIterChanged(int)));
    connect(ui->maxTimeBox, SIGNAL(valueChanged(int)), this, SLOT(maxTimeChanged(int)));
    connect(ui->resetButton, SIGNAL(pressed()), this, SLOT(resetLearning()));
    connect(ui->graphBtn, SIGNAL(pressed()), this, SLOT(graphBtnPressed()));
    connect(ui->tableBtn, SIGNAL(pressed()), this, SLOT(tableBtnPressed()));

    ui->graphBtn->setChecked(true);
    ui->graphStack->setCurrentIndex(0);
}
示例#2
0
文件: vstchunk.cpp 项目: rsenn/eXT2
//-----------------------------------------------------------------------------
VstChunk::VstChunk(long numParameters, long numPrograms, long magic, 
					AudioEffectX *effect, unsigned long sizeofExtendedData)
:	numParameters(numParameters), numPrograms(numPrograms), effect(effect), 
	sizeofExtendedData(sizeofExtendedData)
{
	sharedChunk = 0;
	paramAssignments = 0;
	parameterIDs = 0;

	// there's nothing we can do without a pointer back to the effect
	if (effect == NULL)
		return;

	effect->programsAreChunks();	// tell host you will want to use chunks

	if (numPrograms < 1)
		numPrograms = 1;	// we do need at least 1 set of parameters
	if (numParameters < 1)
		numParameters = 1;	// come on now, what are you trying to do?

	paramAssignments = (ParameterAssignment*) malloc(numParameters * sizeof(ParameterAssignment));
	parameterIDs = (long*) malloc(numParameters * sizeof(long));

	// default to each parameter having its ID equal its index
	// (I haven't implemented anything with parameter IDs yet)
	for (long i=0; i < numParameters; i++)
		parameterIDs[i] = i;

	// calculate some data sizes that are useful to know
	sizeofProgram = sizeof(Program) + (sizeof(float) * (numParameters-2));
	sizeofParameterIDs = sizeof(long) * numParameters;
	sizeofPresetChunk = sizeofProgram 			// 1 program
						+ sizeof(ChunkInfo) 	// the special chunk header info
						+ sizeofParameterIDs;	// the table of parameter IDs
	sizeofChunk = (sizeofProgram*numPrograms)		// all of the programs
					+ sizeof(ChunkInfo)				// the special chunk header info
					+ sizeofParameterIDs			// the table of parameter IDs
					+ (sizeof(ParameterAssignment)*numParameters);	// the MIDI events assignment array

	// increase the allocation sizes if extra data must be stored
	sizeofChunk += sizeofExtendedData;
	sizeofPresetChunk += sizeofExtendedData;

	// this is the shared data that we point **data to in getChunk()
	sharedChunk = (ChunkInfo*) malloc(sizeofChunk);
	// & a few pointers to elements within that data, just for ease of use
	firstSharedParameterID = (long*) ((char*)sharedChunk + sizeof(ChunkInfo));
	firstSharedProgram = (Program*) ((char*)firstSharedParameterID + sizeofParameterIDs);
	firstSharedParamAssignment = (ParameterAssignment*) 
									((char*)firstSharedProgram + (sizeofProgram*numPrograms));

	// set all of the header infos
	chunkInfo.magic = magic;
	chunkInfo.version = effect->getVendorVersion();
	chunkInfo.lowestLoadableVersion = 0;
	chunkInfo.storedHeaderSize = sizeof(ChunkInfo);
	chunkInfo.numStoredParameters = numParameters;
	chunkInfo.numStoredPrograms = numPrograms;
	chunkInfo.storedParameterAssignmentSize = sizeof(ParameterAssignment);
	chunkInfo.storedExtendedDataSize = sizeofExtendedData;

	clearAssignments();	// initialize all of the parameters to have no MIDI event assignments
	resetLearning();	// start with MIDI learn mode off

	// default to allowing MIDI event assignment sharing instead of stealing them, 
	// unless the user has defined the environment variable DFX_PARAM_STEALMIDI
	stealAssignments = getenvBool("DFX_PARAM_STEALMIDI", false);

	// default to ignoring MIDI channel in MIDI event assignments and automation, 
	// unless the user has defined the environment variable DFX_PARAM_USECHANNEL
	useChannel = getenvBool("DFX_PARAM_USECHANNEL", false);

	// default to not allowing MIDI note or pitchbend events to be assigned to parameters
	allowNoteEvents = false;
	allowPitchbendEvents = false;

	noteRangeHalfwayDone = false;

	// default to trying to load un-matching chunks
	crisisBehaviour = kCrisisLoadWhatYouCan;

	// allow for further constructor stuff, if necessary
	init();
}