Пример #1
0
void InstrumentTrackWindow::saveSettingsBtnClicked()
{
	QFileDialog sfd( this, tr( "Save preset" ), "",
				tr( "XML preset file (*.xpf)" ) );

	QString preset_root = configManager::inst()->userPresetsDir();
	if( !QDir( preset_root ).exists() )
	{
		QDir().mkdir( preset_root );
	}
	if( !QDir( preset_root + m_track->instrumentName() ).exists() )
	{
		QDir( preset_root ).mkdir( m_track->instrumentName() );
	}

	sfd.setAcceptMode( QFileDialog::AcceptSave );
	sfd.setDirectory( preset_root + m_track->instrumentName() );
	sfd.setFileMode( QFileDialog::AnyFile );
	if( sfd.exec () == QDialog::Accepted &&
		!sfd.selectedFiles().isEmpty() && sfd.selectedFiles()[0] != ""
	)
	{
		multimediaProject mmp(
				multimediaProject::InstrumentTrackSettings );
		m_track->setSimpleSerializing();
		m_track->saveSettings( mmp, mmp.content() );
		QString f = sfd.selectedFiles()[0];
		mmp.writeFile( f );
	}
}
Пример #2
0
void LadspaEffect::changeSampleRate()
{
	multimediaProject mmp( multimediaProject::EffectSettings );
	m_controls->saveState( mmp, mmp.content() );

	LadspaControls * controls = m_controls;
	m_controls = NULL;

	m_pluginMutex.lock();
	pluginDestruction();
	pluginInstantiation();
	m_pluginMutex.unlock();

	controls->effectModelChanged( m_controls );
	delete controls;

	m_controls->restoreState( mmp.content().firstChild().toElement() );

	// the IDs of re-created controls have been saved and now need to be
	// resolved again
	AutomationPattern::resolveAllIDs();

	// make sure, connections are ok
	ControllerConnection::finalizeConnections();
}
Пример #3
0
void test()
{
	unsigned int s = 3;
	double* a = (double*)malloc(sizeof(double)*s);
	double* b = (double*)malloc(sizeof(double)*s);

	// Vector - Vector
	register unsigned int i, j;
	for (i = 0; i < s; i++)
	{
		a[i] = i;
		b[i] = i * i;
	}

	double dc = dvp(a, b, s);

	if (equal(9, dc))
		printf("Vector - Vector dot product ok\n");


	//openMp
	double oc = odvp(a, b, s);
	if (equal(oc, dc))
		printf("OpenMp: Vector - Vector dot product ok\n");

	free(a);
	free(b);

	// Matrix - Vector
	a = (double*)malloc(sizeof(double)*s);
	b = (double*)malloc(sizeof(double)*s*s);

	for (i = 0; i < s; i++){
		a[i] = 1.0;
		for (j = 0; j < s; j++){
			b[i + j*s] = 1.0;
		}
	}

	double* c = (double*)malloc(sizeof(double)*s);
	c = (double*)mvp(b, a, s, s);

	double* d = (double*)malloc(sizeof(double)*s);
	d[0] = 3.0;
	d[1] = 3.0;
	d[2] = 3.0;

	if (assert((void*)c, (void*)d, s))
		printf("Matrix - Vector product ok\n");

	//openMp
	double* cc = (double*)malloc(sizeof(double)*s);
	cc = omvp(b, a, s, s);

	if (assert(cc, d, s))
		printf("OpenMp: Matrix - Vector product ok\n");

	free(a);
	free(b);
	free(c);
	free(cc);
	free(d);

	// Matrix - Matrix
	a = (double*)malloc(sizeof(double)*s*s);
	b = (double*)malloc(sizeof(double)*s*s);
	d = (double*)malloc(sizeof(double)*s*s);
	d[0] = 30.0; d[3] = 66.0; d[6] = 102.0;
	d[1] = 36.0; d[4] = 81.0; d[7] = 126.0;
	d[2] = 42.0; d[5] = 96.0; d[8] = 150.0;

	for (i = 1; i < (s*s) + 1; i++)
	{
		a[i - 1] = i;
		b[i - 1] = i;
	}
	c = mmp(a, b, s);

	if (assert(c, d, s*s))
		printf("Matrix - Matrix product ok\n");

	//openMp
	cc = ommp(a, b, s);
	
	if (assert(cc, d, s*s))
		printf("OpenMp: Matrix - Matrix product ok\n");

	free(a);
	free(b);
	free(c);
	free(cc);
	free(d);
}