const char *SidTuneMod::createMD5(char *md5) { if (!md5) md5 = m_md5; *md5 = '\0'; if (status) { // Include C64 data. MD5 myMD5; md5_byte_t tmp[2]; myMD5.append (cache.get()+fileOffset,info.c64dataLen); // Include INIT and PLAY address. endian_little16 (tmp,info.initAddr); myMD5.append (tmp,sizeof(tmp)); endian_little16 (tmp,info.playAddr); myMD5.append (tmp,sizeof(tmp)); // Include number of songs. endian_little16 (tmp,info.songs); myMD5.append (tmp,sizeof(tmp)); { // Include song speed for each song. uint_least16_t currentSong = info.currentSong; for (uint_least16_t s = 1; s <= info.songs; s++) { selectSong (s); myMD5.append (&info.songSpeed,sizeof(info.songSpeed)); } // Restore old song selectSong (currentSong); } // Deal with PSID v2NG clock speed flags: Let only NTSC // clock speed change the MD5 fingerprint. That way the // fingerprint of a PAL-speed sidtune in PSID v1, v2, and // PSID v2NG format is the same. if (info.clockSpeed == SIDTUNE_CLOCK_NTSC) myMD5.append (&info.clockSpeed,sizeof(info.clockSpeed)); // NB! If the fingerprint is used as an index into a // song-lengths database or cache, modify above code to // allow for PSID v2NG files which have clock speed set to // SIDTUNE_CLOCK_ANY. If the SID player program fully // supports the SIDTUNE_CLOCK_ANY setting, a sidtune could // either create two different fingerprints depending on // the clock speed chosen by the player, or there could be // two different values stored in the database/cache. myMD5.finish(); // Construct fingerprint. char *m = md5; for (int di = 0; di < 16; ++di) { sprintf (m, "%02x", (int) myMD5.getDigest()[di]); m += 2; } } return md5; }
void Widget::setupGUI() { m_layout = new QStackedLayout(this); m_player = new MusicWidget(); m_layout->addWidget(m_player); connect(m_player, SIGNAL(selectSong()), this, SLOT(onSelectSong())); }
bool SidTuneMD5::GetMD5(char *buf) { guint16 t; int i; MD5 md5; if (!status) return false; md5.append(cache.get()+fileOffset, info.c64dataLen); t = GUINT16_TO_LE (info.initAddr); md5.append(&t, sizeof (t)); t = GUINT16_TO_LE (info.playAddr); md5.append(&t, sizeof (t)); t = GUINT16_TO_LE (info.songs); md5.append(&t, sizeof (t)); for (i = 1; i <= info.songs; i++) { selectSong (i); md5.append(&info.songSpeed, sizeof (info.songSpeed)); } selectSong (1); if (info.clockSpeed == SIDTUNE_CLOCK_NTSC) md5.append(&info.clockSpeed, sizeof (info.clockSpeed)); md5.finish(); const char *d = (const char *)md5.getDigest (); for (int i = 0; i < 16; i++) { static const char hexchars[] = "0123456789abcdef"; buf[2*i] = hexchars[(d[i]&0xf0)>>4]; buf[2*i+1] = hexchars[d[i]&0xf]; } buf[33] = 0; return true; }
void MusicWidget::setupGUI() { QVBoxLayout *layout = new QVBoxLayout(this); layout->addSpacing(10); m_playlistView = new QTableWidget(); RowDelegate *rowDelegate = new RowDelegate(this); m_playlistView->setItemDelegate(rowDelegate); m_playlistView->setStyleSheet(PLAYLIST_VIEW_STYLE); m_playlistView->setSelectionMode(QAbstractItemView::SingleSelection); m_playlistView->setSelectionBehavior(QAbstractItemView::SelectRows); m_playlistView->setVerticalScrollMode(QAbstractItemView::ScrollPerItem); m_playlistView->setEditTriggers(QAbstractItemView::NoEditTriggers); m_playlistView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_playlistView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); m_playlistView->setShowGrid(false); layout->addWidget(m_playlistView); connect(m_playlistView, SIGNAL(cellClicked(int,int)) , this, SLOT(onCellClicked(int,int))); layout->addSpacing(4); m_currentSongLabel = new QLabel(); m_currentSongLabel->setStyleSheet(CURRENT_LABEL_STYLE); layout->addWidget(m_currentSongLabel); QSize buttonSize(41, 33); m_playModeButton = new QPushButton(g_playmodeTexts[QMediaPlaylist::Loop], this); m_playModeButton->adjustSize(); #ifdef ANDROID QSize screenSize = qApp->primaryScreen()->size(); if(screenSize.width() > 960 || screenSize.height() > 960) { buttonSize *= (m_playModeButton->height() / 33); } #endif QHBoxLayout * controlLayout = new QHBoxLayout; controlLayout->setSpacing(4); layout->addLayout(controlLayout); controlLayout->addStretch(1); m_folderButton = new ImageButton(QPixmap(":/images/openfile.png") , QPixmap(":/images/openfile_down.png")); connect(m_folderButton, SIGNAL(clicked()), this, SIGNAL(selectSong())); m_folderButton->setFixedSize(buttonSize); controlLayout->addWidget(m_folderButton); m_prevButton = new ImageButton(QPixmap(":/images/preSong.png"), QPixmap(":/images/preSong_down.png")); m_prevButton->setFixedSize(buttonSize); connect(m_prevButton, SIGNAL(clicked()), m_playlist, SLOT(previous())); controlLayout->addWidget(m_prevButton); m_playpauseButton = new ImageButton(QPixmap(":/images/playpause.png") ,QPixmap(":/images/playpause_down.png")); m_playpauseButton->setFixedSize(buttonSize); connect(m_playpauseButton, SIGNAL(clicked()), this, SLOT(onPlayPauseButton())); controlLayout->addWidget(m_playpauseButton); m_stopButton = new ImageButton(QPixmap(":/images/stop.png") , QPixmap(":/images/stop_down.png")); m_stopButton->setFixedSize(buttonSize); connect(m_stopButton, SIGNAL(clicked()), this, SLOT(onStopButton())); controlLayout->addWidget(m_stopButton); m_nextButton = new ImageButton(QPixmap(":/images/nextSong.png") , QPixmap(":/images/nextSong_down.png")); m_nextButton->setFixedSize(buttonSize); connect(m_nextButton, SIGNAL(clicked()), m_playlist, SLOT(next())); controlLayout->addWidget(m_nextButton); QCheckBox *muteBox = new QCheckBox(); muteBox->setStyleSheet(MUTE_CHECKBOX_STYLE); connect(muteBox, SIGNAL(stateChanged(int)), this, SLOT(onMuteButtonStateChanged(int))); controlLayout->addWidget(muteBox); connect(m_playModeButton, SIGNAL(clicked()), this, SLOT(onPlayModeButton())); controlLayout->addWidget(m_playModeButton); controlLayout->addStretch(1); QGridLayout *progressLayout = new QGridLayout(); layout->addLayout(progressLayout); m_playProgress = new QSlider(Qt::Horizontal); //m_playProgress->setFixedWidth(280); m_playProgress->setStyleSheet(SLIDER_STYLE); progressLayout->addWidget(m_playProgress, 0, 0, 1, 2); connect(m_playProgress, SIGNAL(sliderPressed()), this, SLOT(onSliderPressed())); connect(m_playProgress, SIGNAL(sliderReleased()), this, SLOT(onSliderReleased())); m_positionLabel = new QLabel(); m_positionLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop); progressLayout->addWidget(m_positionLabel, 1, 0, Qt::AlignLeft | Qt::AlignTop); m_durationLabel = new QLabel(); m_durationLabel->setAlignment(Qt::AlignRight | Qt::AlignTop); progressLayout->addWidget(m_durationLabel, 1, 1, Qt::AlignRight | Qt::AlignTop); }
const SidTuneInfo* SidTuneBase::getInfo(unsigned int songNum) { selectSong(songNum); return info.get(); }