Пример #1
0
void init()
{
    OSCCON = 0b01100010;

    UART_Init();

    initBargraph();

    initSonar();

    initBuzzer();

    song();

    CLRWDT();

    //INIT OLED
    I2C_Close();              // Close the  I2C Bus
    I2C_Init(1);             // I2C 400kHz, 20MHz-CRYSTAL
    Oled_Init();
    Oled_SetFont(Terminal12x16, 12, 16, 32,127);
    Oled_FillScreen(0x00, 0, 0);
    Oled_ConstText("SONAR", 35, 0);
    Oled_Text("!", 110, 0);
    Oled_ConstText("L=", 2, 5);
    Oled_ConstText("cm", 105, 5);
}
Пример #2
0
/*
 * Seeks in the stream
 */
bool
Control::seek(int offset)
{
	EXIT_IDLE;

	pms->log(MSG_DEBUG, 0, "Seeking by %d seconds\n", offset);

	/* FIXME: perhaps this check should be performed at an earlier stage? */
	if (!song()) {
		return false;
	}

	offset = st->time_elapsed + offset;

	return mpd_run_seek_id(conn->h(), song()->id, offset);
}
Пример #3
0
int main (void) {

	int usrInt; //This holds the user's integer
	int intLimit = 11; //This sets up the limt of the HELLO LOOP
	void song(); //Declares song is a thing.
	float mathTheFunTimes(float); //Declares that the math function is a thing
	float usrDeci; //This will hold the user input for the math function

	printf("\nWelcome to Griffin Scott's ANNOYING PROGRAM OF ANNOYING WONDER!");
	printf("\nPlease enter an EXCITING NUMBER between 0 and 10 for an ANNOYING PRIZE!");
	//fgets(); //And this fills usrInt with the inputed number.

	scanf("%d", &usrInt);//Sets usrInt to what the user types in.

	if (usrInt < intLimit) {
		for(int i; i < usrInt; i++) { //Loops for every
			printf("\nHello Delicious Friends.");
		}//Closes for
	}//Closes if
	else{ //And here is the error catching if you try to insert a character or a float into usrInit.
		printf("\nERROR ERROR ERROR ERROR NOPE NOPE NOPE LIBRATE TUTAME EX INFERIS\n LIBRATE TUTAME EX INFERIS\n LIBRATE TUTAME EX INFERIS\n\n\n");
	}//Closes else

	song(); //And begin playing D.D Y Ponle Play's Dia.

	printf("\nAnd now for something entirely different. Please insert a number with a decimal point like 7.5. Be warned, there are crazy people about.");

	scanf("%f", &usrDeci); //This puts the next line that the user types into the math function.

	printf("THE MATH GODS HAVE SPOKEN!\n THEIR TRUTH CANNOT BE QUESTIONED!\n THE ANSWER TO THE SUPLICANT'S QUESTION IS: %f\n", mathTheFunTimes(usrDeci));
	
}//Closes Main
Пример #4
0
int main(int argc, char *argv[])
{
    Node root("root");

    Node etc("etc");
    root.add(&etc);
    Leaf hosts("hosts");
    etc.add(&hosts);
    Node apache("apache");
    etc.add(&apache);
    Leaf httpd("httpd.conf");
    apache.add(&httpd);


    Node home("home");
    root.add(&home);
    Node admin("admin");
    home.add(&admin);
    Leaf doc("document.txt");
    admin.add(&doc);

    Node piero("piero");
    home.add(&piero);
    Leaf song("song.mp3");
    piero.add(&song);

    root.dump();
}
Пример #5
0
MPDSongList MPDSongModel::songs(const QModelIndexList &indexes) const {
	MPDSongList songs;
	foreach (QModelIndex index, indexes) {
		MPDSong s = song(index);
		if (!s.isNull() && !songs.contains(s))
			songs << s;
	}
Пример #6
0
void QUAlbumArtExCollector::processSearchResults() {
	QRegExp rx = QRegExp(";src=(.*)\" width=.*(\\d+)&times;(\\d+)\"");

	rx.setMinimal(true);
	rx.setCaseSensitivity(Qt::CaseInsensitive);

	QString text(buffer()->data());
	QStringList allUrls;
	QList<QPair<int, int> > resolutions;
	int pos = 0;

	while ((pos = rx.indexIn(text, pos)) != -1) {
		allUrls << rx.cap(1).trimmed().replace("%2F", "/");
		resolutions << QPair<int, int>(QVariant(rx.cap(2)).toInt(), QVariant(rx.cap(3)).toInt());
		pos += rx.matchedLength();
	}

	rx.setPattern("Images (\\d+)\\-(\\d+) of (\\d+)\\.");
	rx.indexIn(text);
	int from = QVariant(rx.cap(1)).toInt();
	int to = QVariant(rx.cap(2)).toInt();
	int last = QVariant(rx.cap(3)).toInt();

	handleOldDownloads();

	QStringList urls;
	QPair<int, int> maxResolution(
			QVariant(source()->customDataField(source()->customDataFields().at(0))).toInt(),
			QVariant(source()->customDataField(source()->customDataFields().at(1))).toInt());
	for(int i = 0; i < allUrls.size(); i++)
		if(resolutions.at(i).first <= maxResolution.first and
		   resolutions.at(i).second <= maxResolution.second)
			urls << allUrls.at(i);

	ignoredUrls = allUrls.size() - qMin(urls.size(), source()->limit()) + last - to;

	if(urls.isEmpty()) {
		setState(Idle);
		if(ignoredUrls > 0)
			communicator()->send(tr("No results, %1 ignored.").arg(ignoredUrls));
		else
			communicator()->send(tr("No results."));
		communicator()->send(QUCommunicatorInterface::Done);
		return;
	}

	setState(ImageRequest);

	for(int i = 0; i < urls.size() and i < source()->limit(); i++) {
		QFile *file = openLocalFile(source()->imageFolder(song()).filePath(QFileInfo(urls.at(i)).fileName()));

//		song()->log(tr("[albumartex - result] ") + "http://" + source()->host() + urls.at(i), QU::Help);

		if(file) {
			http()->setHost(source()->host());
			http()->get("http://" + source()->host() + urls.at(i), file);
		}
	}
}
Пример #7
0
void QUHttpCollector::handleOldDownloads() {
	// remove old downloads, if necessary
	if(!source()->keepDownloads()) {
		QFileInfoList fiList = source()->imageFolder(song()).entryInfoList(QUSongSupport::allowedPictureFiles(), QDir::Files, QDir::Name);
		foreach(QFileInfo fi, fiList)
			QFile::remove(fi.filePath());
	}
}
Пример #8
0
/*!
 * Uses the selected cover for the song.
 */
void QUCoverGroup::copyCoverToSongPath(bool deleteCurrentCover) {
	if(currentFilePath().isEmpty()) {
		logSrv->add(QString(tr("Could not copy cover to song path. No cover selected for: \"%1 - %2\"")).arg(song()->artist()).arg(song()->title()), QU::Warning);
		return;
	}

	QFileInfo target(song()->songFileInfo().dir(), "cover_" + QFileInfo(currentFilePath()).fileName());

	if(!QFile::copy(currentFilePath(), target.filePath())) {
		logSrv->add(QString(tr("Could not copy the new cover \"%1\" to \"%2\".")).arg(currentFilePath()).arg(target.filePath()), QU::Warning);
		return;
	}

	QString oldName = song()->coverFileInfo().filePath();
	if(deleteCurrentCover) {
		if(!QFile::remove(oldName)) {
			logSrv->add(QString(tr("Could not delete current cover: \"%1\"")).arg(song()->coverFileInfo().filePath()), QU::Warning);
			song()->autoSetFile(target, true);
		} else {
			logSrv->add(QString(tr("Current cover was replaced successfully for: \"%1 - %2\"")).arg(song()->artist()).arg(song()->title()), QU::Information);
			QFile::rename(target.filePath(), oldName);
		}
	} else {
		// copy operation well done - now set the new cover
		song()->autoSetFile(target, true);
	}

	song()->save();
	_item->update();
}
Пример #9
0
void QUHttpCollector::collect() {
	if(http()->hasPendingRequests() or state() != Idle) {
		song()->log(tr("Could not get covers for \"%1 - %2\". HTTP connection is busy.").arg(song()->artist()).arg(song()->title()), QU::Warning);
		return;
	}

	QURequestUrl *url = this->url();

	setState(SearchRequest);

	clearBuffer();
	http()->setHost(url->host());
	http()->get(url->request(), buffer());

	delete url;
}
Пример #10
0
/**
 * @brief CMediaPlayer::setPlaylist the playlist is just a simple textfile with the absolute path to the song.
 * @param pl
 */
void CMediaPlayer::setPlaylist(const QString &pl){
    QFile playListFile(pl);

    if(playListFile.open(QIODevice::ReadOnly)){
        QTextStream in(&playListFile);
        while(!in.atEnd()){
            QString instring = in.readLine();
            QFile song(instring);
            m_playlist->addMedia(QUrl::fromLocalFile(song.fileName()));
            utils::FQLog::getInstance().info("Debug", "Track: "+QUrl::fromLocalFile(song.fileName()).toString());
        }
        m_playlist->setCurrentIndex(0);
        m_player->setPlaylist(m_playlist);
        utils::FQLog::getInstance().info("Debug", pl+" [Ok]");
    }else{
        utils::FQLog::getInstance().info("Debug", pl+" [Failed]");
    }
}
Пример #11
0
Song::Ptr SqlModelFactory::createSong(unsigned int id)
{
    // Check if the song has already been created
    if(mSongs.find(id) != mSongs.end())
        return mSongs[id]; // If yes we return it

    // Else, get a SqlModel* from create() method
    // Cast it in Song* (and we're sure it's a Song* or NULL)
    // Give the ownership to the shared_ptr (Song::Ptr)
    // Init the song
    // return boost::make_shared<Song> on the song
    Song::Ptr song(static_cast<Song*>(create("song")));

    song->setPrimaryKey(id);
    song->construct();
    mSongs[song->key()] = song; // Add the song to the map, for a future usage

    return song;
}
Пример #12
0
void Controller::fetch_playlist(const std::string &name, bool print_songs_after) {
	fetching_playlist_songs = true;
	playlist.name = name;

	requests.get(build_api("/playlists/" + playlist.name + "/songs/"),  [&, print_songs_after](const std::string &response, bool success) {
		fetching_playlist_songs = false;

		rapidjson::Document json;
		if (json.Parse(response.c_str()).HasParseError()) return;
		if (!json.HasMember("total") || !json.HasMember("data") || !json["data"].IsArray()) {
			add_message("playlist error");
			return;
		}

		add_message("retrieved playlist " + playlist.name);
		playlist.songs.clear();
		playlist.order.clear();

		const rapidjson::Value &songs_array = json["data"];
		for (auto i = 0; i < songs_array.Size(); i++) {
			add_message("%d. %s", i + 1, songs_array[i]["title"].GetString());
			int song_length = songs_array[i]["length"].GetInt();
			int id = songs_array[i]["id"].GetInt();
			Song song(songs_array[i]["title"].GetString(), songs_array[i]["youtube_url"].GetString(),
				song_length, songs_array[i]["filesize"].GetInt());
			song.priority = songs_array[i]["priority"].GetDouble();
			song.id = songs_array[i]["id"].GetInt();

			playlist.songs[id] = song;
		}

		for (auto &kv : playlist.songs) {
			playlist.order.push_back(kv.first);
		}

		std::sort(playlist.order.begin(), playlist.order.end(), [&](const int a, const int b) -> bool {
			return playlist.songs[a].priority < playlist.songs[b].priority;
		});

		if (print_songs_after) print_songs();
	});
}
Пример #13
0
void MadaoWindow::metaStateChanged(Phonon::State newState,Phonon::State oldState)
{
    if (newState == Phonon::ErrorState)
    {
        QMessageBox::warning(this, tr("Error opening files"),
            musicGetter->errorString());
        return;
    }

    if (newState != Phonon::StoppedState && newState != Phonon::PausedState)
        return;

    if (musicGetter->currentSource().type() == Phonon::MediaSource::Invalid)
        return;

    if(addToTable == songsNumber)
        return;

    MusicaMetaData song(musicGetter->currentSource().fileName());
    addToMusicTable(song);
}
Пример #14
0
void MainWindow::on_btnAgregar_clicked()
{
    QString song_path = QFileDialog::getOpenFileName(this, "Seleccione una cancion", "", "*.mp3");
    QFileInfo song(song_path);
    QString song_name = song.baseName();
    if(song_path == "")
        return;
    string name = disk.loadSong(song_path.toStdString());
    if(name == "NO")
    {
        cout << "La cancion no cabe en el disco";
        return;
    }
    cout << song_path.toStdString() << endl;

    ui->cmbSongs->addItem(name.c_str());
    int bloques_agregados = disk.super.used_blocks - this->cant_bloques_previo;
    this->cant_bloques_previo = disk.super.used_blocks;

    //loadTable();
}
Пример #15
0
void QUCoverGroup::showFailure() {
	logSrv->add(tr("Cover download failed for \"%1 - %2\"").arg(song()->artist()).arg(song()->title()), QU::Error);
}
Пример #16
0
/**
 * Process OI Op Codes passed by controller
 */
void OpenInterface::handleOpCode(byte oc)
{
#ifdef DEBUG_SERIAL
  switch (oc)
  {
    case ('s'):
        oc = OC_SAFE;
    break;
    case ('d'):
        oc = OC_DIRECT_DRIVE;
    break;
    case ('g'):
        oc = OC_SENSORS;
    break;
  }
#endif
  switch (oc)
  {

     case(OC_LOW_SIDE_DRIVERS):
       callCallbackWithOneByte(controlLsdOutputCallback);
     break;

     case(OC_LEDS):
       callCallbackWithThreeBytes(controlLedsCallback);
     break;

     case(OC_PWM_LOW_SIDE_DRIVERS):
       callCallbackWithThreeBytes(controlLsdPwmCallback);
     break;

     case(OC_DIGITAL_OUTPUTS):
       callCallbackWithOneByte(controlDigitalOutputCallback);
     break;

     case(OC_STREAM):
         stream();
     break;

     case(OC_PAUSE_RESUME_STREAM):
     break;

     case(OC_SEND_IR):
       callCallbackWithOneByte(sendIrCallback);
     break;

     case(OC_SHOW_SCRIPT):
       showScript();
     break;

     case(OC_WAIT_EVENT):
       callCallbackWithOneByte(waitEventCallback);
     break;

     case(OC_PLAY_SCRIPT):
        scriptPlay();
     break;

     case(OC_SCRIPT):
       scriptSet();
     break;

     case(OC_WAIT_ANGLE):
         if (waitAngleCallback)
         {
           waitAction(waitAngleCallback);
         }
     break;

     case(OC_WAIT_DISTANCE):
         if (waitDistanceCallback)
         {
           waitAction(waitDistanceCallback);
         }
     break;

     case(OC_WAIT_TIME):
       waitTime();
     break;

     case(OC_DEMO):
     case(OC_SPOT):
     case(OC_COVER):
     case(OC_COVER_AND_DOCK):
       // These are all demo codes. Implement?
     break;

     case(OC_QUERY_LIST):
       queryList();
     break;

     case (OC_START):
       sensor[OI_SENSOR_OI_MODE] = OI_MODE_PASSIVE;
     break;

     case (OC_BAUD):
     break;

     case (OC_CONTROL):
     case (OC_SAFE):
       sensor[OI_SENSOR_OI_MODE] = OI_MODE_SAFE;
     break;

     case (OC_SENSORS):
       getSensors();
     break;

     case (OC_SONG):
       song();
     break;

     case(OC_PLAY_SONG):
       songPlay();
     break;

     case (OC_DIRECT_DRIVE):
       driveDirect();
     break;

     case (OC_DRIVE):
       drive();
     break;

     case (OC_FULL):
       sensor[OI_SENSOR_OI_MODE] = OI_MODE_FULL;
     break;
  }
}
Пример #17
0
TagEditor::TagEditor(QWidget *parent, const QList<Song> &songs,
                     const QSet<QString> &existingArtists, const QSet<QString> &existingAlbumArtists, const QSet<QString> &existingComposers,
                     const QSet<QString> &existingAlbums, const QSet<QString> &existingGenres, const QString &udi)
    : Dialog(parent, "TagEditor", QSize(500, 200))
    #ifdef ENABLE_DEVICES_SUPPORT
    , deviceUdi(udi)
    #endif
    , currentSongIndex(-1)
    , updating(false)
    , haveArtists(false)
    , haveAlbumArtists(false)
    , haveComposers(false)
    , haveAlbums(false)
    , haveGenres(false)
    , saving(false)
{
    iCount++;
    foreach (const Song &s, songs) {
        if (CueFile::isCue(s.file)) {
            continue;
        }
        if (s.guessed) {
            Song song(s);
            song.revertGuessedTags();
            original.append(song);
        } else {
            original.append(s);
        }
    }

    if (original.isEmpty()) {
        deleteLater();
        return;
    }

    #ifdef ENABLE_DEVICES_SUPPORT
    if (deviceUdi.isEmpty()) {
        baseDir=MPDConnection::self()->getDetails().dir;
    } else {
        Device *dev=getDevice(udi, parentWidget());

        if (!dev) {
            deleteLater();
            return;
        }

        baseDir=dev->path();
    }
    #else
    Q_UNUSED(udi)
    baseDir=MPDConnection::self()->getDetails().dir;
    #endif
    qSort(original);

    QWidget *mainWidet = new QWidget(this);
    setupUi(mainWidet);
    track->setAllowEmpty();
    disc->setAllowEmpty();
    year->setAllowEmpty();
    setMainWidget(mainWidet);
    ButtonCodes buttons=Ok|Cancel|Reset|User3;
    if (songs.count()>1) {
        buttons|=User2|User1;
    }
    setButtons(buttons);
    setCaption(i18n("Tags"));
    progress->setVisible(false);
    if (songs.count()>1) {
        setButtonGuiItem(User2, StdGuiItem::back(true));
        setButtonGuiItem(User1,StdGuiItem::forward(true));
        enableButton(User1, false);
        enableButton(User2, false);
    }
    setButtonGuiItem(Ok, StdGuiItem::save());
    setButtonGuiItem(User3, GuiItem(i18n("Tools"), "tools-wizard"));
    QMenu *toolsMenu=new QMenu(this);
    toolsMenu->addAction(i18n("Apply \"Various Artists\" Workaround"), this, SLOT(applyVa()));
    toolsMenu->addAction(i18n("Revert \"Various Artists\" Workaround"), this, SLOT(revertVa()));
    toolsMenu->addAction(i18n("Set 'Album Artist' from 'Artist'"), this, SLOT(setAlbumArtistFromArtist()));
    toolsMenu->addAction(i18n("Capitalize"), this, SLOT(capitalise()));
    toolsMenu->addAction(i18n("Adjust Track Numbers"), this, SLOT(adjustTrackNumbers()));
    setButtonMenu(User3, toolsMenu, InstantPopup);
    enableButton(Ok, false);
    enableButton(Reset, false);

    setAttribute(Qt::WA_DeleteOnClose);

    QStringList strings=existingArtists.toList();
    strings.sort();
    artist->clear();
    artist->insertItems(0, strings);

    strings=existingAlbumArtists.toList();
    strings.sort();
    albumArtist->clear();
    albumArtist->insertItems(0, strings);

    strings=existingComposers.toList();
    strings.sort();
    composer->clear();
    composer->insertItems(0, strings);

    strings=existingAlbums.toList();
    strings.sort();
    album->clear();
    album->insertItems(0, strings);

    strings=existingGenres.toList();
    strings.sort();
    genre->clear();
    genre->insertItems(0, strings);

    trackName->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    trackName->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
    trackName->view()->setTextElideMode(Qt::ElideLeft);

    if (original.count()>1) {
        QSet<QString> songArtists;
        QSet<QString> songAlbumArtists;
        QSet<QString> songAlbums;
        QSet<QString> songGenres;
        QSet<QString> songComposers;
        QSet<int> songYears;
        QSet<int> songDiscs;

        foreach (const Song &s, original) {
            if (!s.artist.isEmpty()) {
                songArtists.insert(s.artist);
            }
            if (!s.albumartist.isEmpty()) {
                songAlbumArtists.insert(s.albumartist);
            }
            if (!s.album.isEmpty()) {
                songAlbums.insert(s.album);
            }
            if (!s.genre.isEmpty()) {
                songGenres.insert(s.genre);
            }
            if (!s.composer.isEmpty()) {
                songComposers.insert(s.composer);
            }
            songYears.insert(s.year);
            songDiscs.insert(s.disc);
            if (songArtists.count()>1 && songAlbumArtists.count()>1 && songAlbums.count()>1 &&
                songGenres.count()>1 && songYears.count()>1 && songDiscs.count()>1 && songComposers.count()>=1) {
                break;
            }
        }
        Song all;
        all.file.clear();
        all.title.clear();
        all.track=0;
        all.artist=1==songArtists.count() ? *(songArtists.begin()) : QString();
        all.composer=1==songComposers.count() ? *(songComposers.begin()) : QString();
        all.albumartist=1==songAlbumArtists.count() ? *(songAlbumArtists.begin()) : QString();
        all.album=1==songAlbums.count() ? *(songAlbums.begin()) : QString();
        all.genre=1==songGenres.count() ? *(songGenres.begin()) : QString();
        all.year=1==songYears.count() ? *(songYears.begin()) : 0;
        all.disc=1==songDiscs.count() ? *(songDiscs.begin()) : 0;
        original.prepend(all);
        artist->setFocus();
        haveArtists=!songArtists.isEmpty();
        haveAlbumArtists=!songAlbumArtists.isEmpty();
        haveAlbums=!songAlbums.isEmpty();
        haveGenres=!songGenres.isEmpty();
        haveComposers=!songComposers.isEmpty();
    } else {
Пример #18
0
QURequestUrl* QUAlbumArtExCollector::url() const {
	return new QUAlbumArtExRequestUrl(
			source()->host(),
			QStringList() << source()->songDataField("first") << source()->songDataField("second") << source()->songDataField("third"),
			song());
}
Пример #19
0
void QUCoverGroup::showStatus(const QString &status) {
	if(!status.isEmpty())
		group->setTitle(QString("%1 - %2 (%3)").arg(song()->artist()).arg(song()->title()).arg(status));
	else
		group->setTitle(QString("%1 - %2").arg(song()->artist()).arg(song()->title()));
}
Пример #20
0
void LyricsDialog::changed()
{
    Song s=song();
    enableButton(Ok, !s.artist.isEmpty() && !s.title.isEmpty() && (s.artist!=prev.artist || s.title!=prev.title));
}
Пример #21
0
int main()
{
    /**************************************************************************
     * 1. Create a Song containing a scale
     *************************************************************************/

    // First, we create a scale in a PhraseEdit

    TSE3::PhraseEdit phraseEdit;
    int              note = rootNote;
    TSE3::Clock      time = 0;
    for (int n = 0; n < 8; n++)
    {
        const int delta[]  = {2, 2, 1, 2, 2, 2, 1, 0};
        const int velocity = 0x60;
        const int channel  = 0;
        const int port     = 0;

        phraseEdit.insert
            (TSE3::MidiEvent(TSE3::MidiCommand(TSE3::MidiCommand_NoteOn,
                                               channel, port, note, velocity),
             time, velocity, time+duration));

        note += delta[n];
        time += duration;
    }

    // Now assemble the Song
    TSE3::Song    song(1);
    TSE3::Phrase *phrase = phraseEdit.createPhrase(song.phraseList());
    TSE3::Part   *part   = new TSE3::Part(0, phraseEdit.lastClock());
    part->setPhrase(phrase);
    song[0]->insert(part);

    /**************************************************************************
     * 2. Play the Song
     *************************************************************************/

    // Create transport objects
    // (You really want to create a MidiScheduler for your platform, perhaps
    // you'll use the UnixMidiSchedulerFactory)
    TSE3::Metronome                 metronome;
    TSE3::Util::StreamMidiScheduler scheduler;
    TSE3::Transport                 transport(&metronome, &scheduler);

    // Play and wait for the end
    transport.play(&song, 0);
    while (transport.status() != TSE3::Transport::Resting)
    {
        transport.poll();
        // perhaps sleep here to prevent slaughtering the CPU
    }

    /**************************************************************************
     * 3. Save the Song as a standard MIDI file
     *************************************************************************/

    TSE3::MidiFileExport mfe;
    mfe.save("export.midi", &song);

    /**************************************************************************
     * All done - note that there is no memory leak - when the Song is deleted
     * (it is on the stack, so this will happen automatically) all the other
     * components will be deleted by the Song's destructor.
     *************************************************************************/

    return 0;
}
Пример #22
0
QFileInfoList QUHttpCollector::results() const {
	return source()->imageFolder(song()).entryInfoList(QUSongSupport::allowedPictureFiles(), QDir::Files, QDir::Name);
}
Пример #23
0
void Vis_LCD ( volatile uint32_t Estado_LCD, volatile uint32_t AUX_LCD)
{

//volatile uint32_t Estado_LCD;
//volatile uint32_t AUX_LCD;


//Variable para el switch del E
    uint8_t a=1;

//Estados de inicializacion y escritura
    uint8_t estado_0=0;
    uint8_t estado_1=0;
    uint8_t estado_2=0;
    uint8_t estado_3=0;
    uint8_t estado_4=0;
    uint8_t estado_5=0;
    uint8_t estado_6=0;


//Contador de instrucciones LCD
    uint8_t cont_0=1;
    uint8_t cont_1=1;
    uint8_t cont_2=1;
    uint8_t cont_3=1;
    uint8_t cont_4=1;
    uint8_t cont_5=1;
    uint8_t cont_6=1;

    while(1) {

        if(t()==a) {

////inicio

            switch(Estado_LCD) { // corchete Estado_LCD

            // Bienvenido Key_PI

            case 0: //case 0 Estado_LCD

                switch(estado_0) {		//switch(estado_0)

                case 0:
                    lcd_iniciar(cont_0);
                    cont_0=cont_0+1;
                    if(cont_0==5)estado_0=estado_0+1;
                    break; //break del case 0

                case 1:
                    titulo1(cont_0);
                    cont_0=cont_0+1;
                    if(cont_0==16)estado_0=estado_0+1;
                    break; //break del case 1


                default:
                    if (cont_0==16)
                        cont_0=16;

                }	// end switch(estado_0)

                break;  //break case 0 Estado_LCD

            // Elegir cancion

            case 1://case 1 Estado_LCD

                switch (estado_1) { // 	//switch(estado_1)

                case 0:
                    lcd_iniciar(cont_1);
                    cont_1=cont_1+1;
                    if(cont_1==5)estado_1=estado_1+1;
                    break; //break del case 0

                case 1:
                    song(cont_1);
                    cont_1=cont_1+1;
                    if(cont_1==21)estado_1=estado_1+1;
                    break; //break del case 1

                case 2:
                    lcd_linea2(cont_1);
                    cont_1=cont_1+1;
                    if(cont_1==22)estado_1=estado_1+1;
                    break; //break del case 2

                case 3:

                    switch(AUX_LCD) {

                    case 0:
                        song1(cont_1);		//cancion 1
                        cont_1=cont_1+1;
                        if(cont_1==25)estado_1=estado_1+1;
                        break; //0

                    case 1:
                        song2(cont_1);		//cancion 2
                        cont_1=cont_1+1;
                        if(cont_1==25)estado_1=estado_1+1;
                        break; //1

                    case 2:
                        song3(cont_1);		//cancion 3
                        cont_1=cont_1+1;
                        if(cont_1==25)estado_1=estado_1+1;
                        break; //2

                    case 3:
                        song4(cont_1);		//cancion 4
                        cont_1=cont_1+1;
                        if(cont_1==25)estado_1=estado_1+1;
                        break;	//3

                    case 4:
                        song5(cont_1);		//cancion 5
                        cont_1=cont_1+1;
                        if(cont_1==25)estado_1=estado_1+1;
                        break;	//4

                    default:
                        if (cont_1==25)
                            cont_1=25;

                    } // End switch AUX_LCD

                    break;	//break del case 3


                } 	//switch(estado_1)

                break; //break case 1 Estado_LCD

//
            //Case 2 Elegir nivel
            case 2: //case 2 Estado_LCD

                switch (estado_2) { // 	//switch(estado_2)

                case 0:
                    lcd_iniciar(cont_2);
                    cont_2=cont_2+1;
                    if(cont_2==5)estado_2=estado_2+1;
                    break; //break del case 0

                case 1:
                    elige(cont_2);
                    cont_2=cont_2+1;
                    if(cont_2==21)estado_2=estado_2+1;
                    break; //break del case 1

                case 2:
                    lcd_linea2(cont_2);
                    cont_2=cont_2+1;
                    if(cont_2==22)estado_2=estado_2+1;
                    break; //break del case 2

                case 3:

                    switch(AUX_LCD) {

                    case 0:
                        normal(cont_2);
                        cont_2=cont_2+1;
                        if(cont_2==25)estado_2=estado_2+1;

                        break; //break del case 0 normal()

                    case 1:
                        experto(cont_2);
                        cont_2=cont_2+1;
                        if(cont_2==25)estado_2=estado_2+1;
                        break; //break del case 1 experto

                    default:
                        if (cont_2==25)
                            cont_2=25;

                    } //end switch AUX_LCD

                    break;	//break del case 3

                } //end switch(estado_2)


                break; // break //case 2 Estado_LCD

            //

            //Escuchar

// Escuchar cancion
            case 3: //case 3 Estado_LCD

                switch(estado_3) {		//switch(estado_3)

                case 0:
                    lcd_iniciar(cont_3);
                    cont_3=cont_3+1;
                    if(cont_3==5)estado_3=estado_3+1;
                    break; //break del case 0

                case 1:
                    escuchar(cont_3);
                    cont_3=cont_3+1;
                    if(cont_3==13)estado_3=estado_3+1;
                    break; //break del case 1

                default:
                    if (cont_3==13)
                        cont_3=13;

                }	//end //switch(estado_3)

                break;//case 3 Estado_LCD

// Preparado?????????????''''''

            case 4: //case 4 Estado_LCD

                switch(estado_4) {		//switch(estado_4)

                case 0:
                    lcd_iniciar(cont_4);
                    cont_4=cont_4+1;
                    if(cont_4==5)estado_4=estado_4+1;
                    break; //break del case 0

                case 1:
                    preparado(cont_4);
                    cont_4=cont_4+1;
                    if(cont_4==14)estado_4=estado_4+1;
                    break; //break del case 1

                default:
                    if (cont_4==14)
                        cont_4=14;

                }	//end //switch(estado_4)

                break;//case 4 Estado_LCD

// Adelante

            case 5: //case 5 Estado_LCD

                switch(estado_5) {		//switch(estado_5)

                case 0:
                    lcd_iniciar(cont_5);
                    cont_5=cont_5+1;
                    if(cont_5==5)estado_5=estado_5+1;
                    break; //break del case 0

                case 1:
                    adelante(cont_5);
                    cont_5=cont_5+1;
                    if(cont_5==14)estado_5=estado_5+1;
                    break; //break del case 1

                default:
                    if (cont_5==14)
                        cont_5=14;

                }	//end //switch(estado_5)

                break;//case 5 Estado_LCD

//Again
            case 6: //case 6 Estado_LCD

                switch (estado_6) { // 	//switch(estado_6)

                case 0:
                    lcd_iniciar(cont_6);
                    cont_6=cont_6+1;
                    if(cont_6==5)estado_6=estado_6+1;
                    break; //break del case 0

                case 1:
                    again(cont_6);
                    cont_6=cont_6+1;
                    if(cont_6==21)estado_6=estado_6+1;
                    break; //break del case 1

                case 2:
                    lcd_linea2(cont_6);
                    cont_6=cont_6+1;
                    if(cont_6==22)estado_6=estado_6+1;
                    break; //break del case 2

                case 3:

                    switch(AUX_LCD) {

                    case 0:
                        si(cont_6);
                        cont_6=cont_6+1;
                        if(cont_6==26)estado_6=estado_6+1;

                        break; //break del case 0 normal()

                    case 1:
                        no(cont_6);
                        cont_6=cont_6+1;
                        if(cont_6==26)estado_6=estado_6+1;
                        break; //break del case 1 experto

                    default:
                        if (cont_6==26)
                            cont_6=26;

                    } //end switch AUX_LCD

                    break;	//break del case 3

                } //end switch(estado_6)


                break; // break //case 6 Estado_LCD

            default:
                if (cont_6==0)
                    cont_6=0;



//

            } //corchete Estado_LCD
//fin del switch estado LCD
            a=0;
        }


        if(t()==0) a=1;

    }



//return 0;

}	//end main