Exemple #1
0
void ofApp::audioOut(float* output, int bufferSize, int nChannels) {
	float sum = 0;
	for (int i = 0; i < bufferSize; i++){
		output[i * nChannels] = floatBuffer[bufferPosition * nChannels];
		output[i * nChannels + 1] = floatBuffer[bufferPosition * nChannels + 1];
		
		curBuffer[i * nChannels] = output[i * nChannels] * (1<<15);
		curBuffer[i * nChannels + 1] = output[i * nChannels + 1] * (1<<15);
	
		if(i % 2 == 0) { // drop 96khz to 48khz
			bufferPosition++;
			if(bufferPosition == bufferFrames) {
				bufferPosition = 0;
				relativePosition = 0;
				exportXml();
			}
		}
	}
	
	timecoder_submit(&timecoder, &curBuffer[0], bufferSize);
	relativeTtm[ttmPosition] = getRelative();
	absoluteTtm[ttmPosition] = getAbsolute();
	if(exporting) {
		wholeBuffer.push_back(absoluteTtm[ttmPosition] );
	}
	pitchTtm[ttmPosition] = getPitch();
	ttmPosition++;
	if(ttmPosition == relativeTtm.size()) {
		ttmPosition = 0;
	}
}
Exemple #2
0
StreamsBrowsePage::StreamsBrowsePage(QWidget *p)
    : SinglePageWidget(p)
    , settings(0)
{
    importAction = new Action(Icon("document-import"), i18n("Import Streams Into Favorites"), this);
    exportAction = new Action(Icon("document-export"), i18n("Export Favorite Streams"), this);
    addAction = ActionCollection::get()->createAction("addstream", i18n("Add New Stream To Favorites"), Icons::self()->addRadioStreamIcon);
    editAction = new Action(Icons::self()->editIcon, i18n("Edit"), this);
    searchAction = new Action(Icons::self()->searchIcon, i18n("Seatch For Streams"), this);
    connect(searchAction, SIGNAL(triggered()), this, SIGNAL(searchForStreams()));
//     connect(view, SIGNAL(itemsSelected(bool)), addToPlaylist, SLOT(setEnabled(bool)));
    connect(view, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(itemDoubleClicked(const QModelIndex &)));
    connect(view, SIGNAL(itemsSelected(bool)), SLOT(controlActions()));
    connect(addAction, SIGNAL(triggered()), this, SLOT(addStream()));
    connect(StreamsModel::self()->addBookmarkAct(), SIGNAL(triggered()), this, SLOT(addBookmark()));
    connect(StreamsModel::self()->configureDiAct(), SIGNAL(triggered()), this, SLOT(configureDi()));
    connect(StreamsModel::self()->reloadAct(), SIGNAL(triggered()), this, SLOT(reload()));
    connect(editAction, SIGNAL(triggered()), this, SLOT(edit()));
    connect(importAction, SIGNAL(triggered()), this, SLOT(importXml()));
    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportXml()));
    connect(StreamsModel::self(), SIGNAL(error(const QString &)), this, SIGNAL(error(const QString &)));
    connect(StreamsModel::self(), SIGNAL(loading()), view, SLOT(showSpinner()));
    connect(StreamsModel::self(), SIGNAL(loaded()), view, SLOT(hideSpinner()));
    connect(StreamsModel::self(), SIGNAL(categoriesChanged()), view, SLOT(closeSearch()));
    connect(StreamsModel::self(), SIGNAL(favouritesLoaded()), SLOT(expandFavourites()));
    connect(StreamsModel::self(), SIGNAL(addedToFavourites(QString)), SLOT(addedToFavourites(QString)));
    connect(DigitallyImported::self(), SIGNAL(loginStatus(bool,QString)), SLOT(updateDiStatus()));
    connect(DigitallyImported::self(), SIGNAL(updated()), SLOT(updateDiStatus()));
    connect(view, SIGNAL(headerClicked(int)), SLOT(headerClicked(int)));
    StreamsModel::self()->configureDiAct()->setEnabled(false);

    proxy.setSourceModel(StreamsModel::self());
    view->setModel(&proxy);
    view->setDeleteAction(StdActions::self()->removeAction);
    view->setSearchResetLevel(1);
    view->alwaysShowHeader();

    Configuration config(metaObject()->className());
    view->setMode(ItemView::Mode_DetailedTree);
    view->load(config);

    MenuButton *menuButton=new MenuButton(this);
    Action *configureAction=new Action(Icons::self()->configureIcon, i18n("Configure"), this);
    connect(configureAction, SIGNAL(triggered()), SLOT(configure()));
    menuButton->addAction(createViewMenu(QList<ItemView::Mode>()  << ItemView::Mode_BasicTree << ItemView::Mode_SimpleTree
                                                                  << ItemView::Mode_DetailedTree << ItemView::Mode_List));
    menuButton->addAction(configureAction);
    menuButton->addAction(StreamsModel::self()->configureDiAct());
    menuButton->addSeparator();
    menuButton->addAction(addAction);
    menuButton->addAction(StdActions::self()->removeAction);
    menuButton->addAction(editAction);
    menuButton->addAction(StreamsModel::self()->reloadAct());
    menuButton->addSeparator();
    menuButton->addAction(importAction);
    menuButton->addAction(exportAction);

    diStatusLabel=new ServiceStatusLabel(this);
    diStatusLabel->setText("DI", i18nc("Service name", "Digitally Imported"));
    connect(diStatusLabel, SIGNAL(clicked()), SLOT(diSettings()));
    updateDiStatus();  
    ToolButton *searchButton=new ToolButton(this);
    searchButton->setDefaultAction(searchAction);
    init(ReplacePlayQueue, QList<QWidget *>() << menuButton << diStatusLabel, QList<QWidget *>() << searchButton);

    view->addAction(editAction);
    view->addAction(StdActions::self()->removeAction);
    view->addAction(StreamsModel::self()->addToFavouritesAct());
    view->addAction(StreamsModel::self()->addBookmarkAct());
    view->addAction(StreamsModel::self()->reloadAct());
}
void ExportWizard::accept()
{

    QString finishText = buttonText(QWizard::FinishButton);
    if (finishText == tr("Finish"))
    {
        QDialog::accept();
        return;
    }

    QString key = exportInfo->getSource();
    QSqlDatabase source = QSqlDatabase::database(strMap.value(key));

    if (field("txtRadio").toBool())
    {
        QString directory = field("txtName").toString();
        exportTxt(source, directory);
    }
    else if (field("accessRadio").toBool())
    {
        QString accessName = field("accessName").toString();
        QSqlDatabase target = QSqlDatabase::addDatabase("QODBC", "QODBCTempConnect");
        target.setDatabaseName("DRIVER={Microsoft Access driver (*.mdb, *.accdb)};FIL={MS Access};DBQ=" + accessName);

        if (!target.open())
            return;

        exportData(source, target);
    }
    else if (field("sqlserverRadio").toBool())
    {
        QString databaseName = field("sqlserverDatabaseName").toString();
        QString hostName = field("sqlserverHostName").toString();
        QString dsn = "Driver={sql server};server=" + hostName + ";database=" + databaseName;
        QSqlDatabase target = QSqlDatabase::addDatabase("QODBC", "QODBCTempConnect");
        target.setDatabaseName(dsn);
        QString userName = field("sqlserverUserName").toString();
        if (!userName.isEmpty())
            target.setUserName(userName);

        QString password = field("sqlserverPassword").toString();
        if (!password.isEmpty())
            target.setPassword(password);

        QString port = field("sqlserverPort").toString();
        if (!port.isEmpty())
        {
            bool ok;
            int i = port.toInt(&ok);
            if (ok)
                target.setPort(i);
        }

        if (target.open())
        {
            exportData(source, target);
        }

    }
    else if (field("excelRadio").toBool())
    {
        QString excelName = field("excelName").toString();
        exportExcel(source, excelName);
    }
    else
    {
        QString directory = field("xmlName").toString();
        exportXml(source, directory);
    }

}