MidiMusic::MidiMusic(QueenEngine *vm) : _isPlaying(false), _isLooping(false), _randomLoop(false), _masterVolume(192), _buf(0), _rnd("queenMusic") { memset(_channelsTable, 0, sizeof(_channelsTable)); _queuePos = _lastSong = _currentSong = 0; queueClear(); MidiDriver::DeviceHandle dev = MidiDriver::detectDevice(MDT_MIDI | MDT_ADLIB | MDT_PREFER_MT32); _adlib = (MidiDriver::getMusicType(dev) == MT_ADLIB); _nativeMT32 = ((MidiDriver::getMusicType(dev) == MT_MT32) || ConfMan.getBool("native_mt32")); const char *musicDataFile; if (vm->resource()->isDemo()) { _tune = Sound::_tuneDemo; musicDataFile = "AQ8.RL"; } else { _tune = Sound::_tune; musicDataFile = "AQ.RL"; } if (_adlib) { musicDataFile = "AQBANK.MUS"; } _musicData = vm->resource()->loadFile(musicDataFile, 0, &_musicDataSize); _numSongs = READ_LE_UINT16(_musicData); _tune = vm->resource()->isDemo() ? Sound::_tuneDemo : Sound::_tune; if (_adlib) { // int infoOffset = _numSongs * 4 + 2; // if (READ_LE_UINT16(_musicData + 2) != infoOffset) { // defaultAdLibVolume = _musicData[infoOffset]; // } _driver = new AdLibMidiDriver(); } else { _driver = MidiDriver::createMidi(dev); if (_nativeMT32) { _driver->property(MidiDriver::PROP_CHANNEL_MASK, 0x03FE); } } assert(_driver); int ret = _driver->open(); assert(ret == 0); _driver->setTimerCallback(this, &timerCallback); if (_nativeMT32) _driver->sendMT32Reset(); else _driver->sendGMReset(); _parser = MidiParser::createParser_SMF(); _parser->setMidiDriver(this); _parser->setTimerRate(_driver->getBaseTempo()); }
void Screen::notificate(std::string message, bool sendMail) { boost::mutex::scoped_lock lockClass(m_screenMutex); LOG_INFO2("NOTIFICATION: " << message); if(sendMail) { system(boost::str( boost::format(ConfigManager::instance()->getString(ConfigManager::NOTIFICATION_COMMAND)) % ConfigManager::instance()->getString(ConfigManager::NOTIFICATION_SUBJECT) % message ).c_str()); } m_notifications.push_front(boost::str(boost::format("%1% %2%") % getCurrentTimeString() % message)); while(m_notifications.size() > 6) { m_notifications.pop_back(); } queueClear(); }
bool PlaylistModel::handle_change (const Xmms::Dict &chg) { int32_t change = chg.get<int32_t> ("type"); int32_t pos = 0, npos = 0; int32_t id = 0; QString s; if (chg.contains ("position")) { pos = chg.get<int32_t> ("position"); } if (chg.contains ("id")) { #if HAVE_XMMSV id = chg.get<int32_t> ("id"); #else id = chg.get<uint32_t> ("id"); #endif } if (chg.contains ("name")) { s = XClient::stdToQ (chg.get<std::string> ("name")); } if (s != m_name) { return true; } QModelIndex idx = QModelIndex (); switch (change) { case XMMS_PLAYLIST_CHANGED_ADD: beginInsertRows (idx, pos, pos); m_plist.append (id); endInsertRows (); break; case XMMS_PLAYLIST_CHANGED_INSERT: beginInsertRows (idx, pos, pos); m_plist.insert (pos, id); endInsertRows (); break; case XMMS_PLAYLIST_CHANGED_MOVE: npos = chg.get<int32_t> ("newposition"); beginRemoveRows (idx, pos, pos); m_plist.removeAt (pos); endRemoveRows (); beginInsertRows (idx, npos, npos); m_plist.insert (npos, id); endInsertRows (); //if (pos < npos && pos) // pos --; emit entryMoved (index (pos, 0), index (npos, 0)); break; case XMMS_PLAYLIST_CHANGED_REMOVE: m_queue.removeAt(m_queue_index.take(m_plist[pos])); m_client->cache ()->invalidate (m_plist[pos]); beginRemoveRows (idx, pos, pos); m_plist.removeAt (pos); endRemoveRows (); break; case XMMS_PLAYLIST_CHANGED_CLEAR: queueClear(); case XMMS_PLAYLIST_CHANGED_SHUFFLE: case XMMS_PLAYLIST_CHANGED_SORT: m_client->cache ()->invalidate_all (); m_client->playlist ()->listEntries () (Xmms::bind (&PlaylistModel::handle_list, this)); break; } /* TODO: call this only for the necessary methods */ emitTotalPlaytime (); return true; }
void MidiMusic::playSong(uint16 songNum) { queueClear(); queueSong(songNum); playMusic(); }
BackgroundAtmosphere::~BackgroundAtmosphere() { queueClear(); }
void schedulerInit(void) { queueClear(); }
void schedulerInit(void) { queueClear(); queueAdd(&cfTasks[TASK_SYSTEM]); }
// Constructor : clear queues MIDIQ::MIDIQ () { queueClear(); }
void USBCDCClass_flush(IOStreamClass *stream) { USBCDCClass *usbCdc = USB_CDC_CLASS(stream); queueClear(&usbCdc->txQueue); queueClear(&usbCdc->rxQueue); }