void AutomationPattern::removeValue( const MidiTime & _time, const bool _quant_pos ) { cleanObjects(); MidiTime newTime = _quant_pos && engine::automationEditor() ? note::quantized( _time, engine::automationEditor()->quantization() ) : _time; m_timeMap.remove( newTime ); m_tangents.remove( newTime ); timeMap::const_iterator it = m_timeMap.lowerBound( newTime ); if( it != m_timeMap.begin() ) { it--; } generateTangents(it, 3); if( getTrack() && getTrack()->type() == track::HiddenAutomationTrack ) { changeLength( length() ); } emit dataChanged(); }
MidiTime AutomationPattern::putValue( const MidiTime & _time, const float _value, const bool _quant_pos ) { cleanObjects(); MidiTime newTime = _quant_pos && engine::automationEditor() ? note::quantized( _time, engine::automationEditor()->quantization() ) : _time; m_timeMap[newTime] = _value; timeMap::const_iterator it = m_timeMap.find( newTime ); if( it != m_timeMap.begin() ) { it--; } generateTangents(it, 3); // we need to maximize our length in case we're part of a hidden // automation track as the user can't resize this pattern if( getTrack() && getTrack()->type() == track::HiddenAutomationTrack ) { changeLength( length() ); } emit dataChanged(); return newTime; }
void AutomationPattern::removeValue( const MidiTime & time ) { cleanObjects(); m_timeMap.remove( time ); m_tangents.remove( time ); timeMap::const_iterator it = m_timeMap.lowerBound( time ); if( it != m_timeMap.begin() ) { --it; } generateTangents(it, 3); if( getTrack() && getTrack()->type() == Track::HiddenAutomationTrack ) { updateLength(); } emit dataChanged(); }
MidiTime AutomationPattern::putValue( const MidiTime & time, const float value, const bool quantPos, const bool ignoreSurroundingPoints ) { cleanObjects(); MidiTime newTime = quantPos ? Note::quantized( time, quantization() ) : time; m_timeMap[ newTime ] = value; timeMap::const_iterator it = m_timeMap.find( newTime ); // Remove control points that are covered by the new points // quantization value. Control Key to override if( ! ignoreSurroundingPoints ) { for( int i = newTime + 1; i < newTime + quantization(); ++i ) { AutomationPattern::removeValue( i ); } } if( it != m_timeMap.begin() ) { --it; } generateTangents( it, 3 ); // we need to maximize our length in case we're part of a hidden // automation track as the user can't resize this pattern if( getTrack() && getTrack()->type() == Track::HiddenAutomationTrack ) { updateLength(); } emit dataChanged(); return newTime; }
void bmPost::run() { THREAD_MONITOR_POINT; NetThread::run(); switch(postType) { case POST_HTTP_TYPE_HANDLE_ITEM: { //QString bm_handle_url; qsrand((unsigned) NOW_SECONDS); uint key=qrand()%(getkeylength()); QString auth_encrypt_str=tz::encrypt(QString("username=%1 password=%2").arg(username).arg(password),key); if(action==POST_HTTP_ACTION_ADD_ITEM||action==POST_HTTP_ACTION_ADD_DIR) { url=QString(BM_SERVER_ADD_URL).arg(parentid).arg(browserid).arg(auth_encrypt_str).arg(key); } else if(action==POST_HTTP_ACTION_DELETE_ITEM) { url=QString(BM_SERVER_DELETE_URL).arg(bmid).arg(browserid).arg(auth_encrypt_str).arg(key); } else if(action==POST_HTTP_ACTION_DELETE_DIR) { url=QString(BM_SERVER_DELETE_DIR).arg(bmid).arg(browserid).arg(auth_encrypt_str).arg(key); } } break; case POST_HTTP_TYPE_TESTACCOUNT: url = QString(BM_TEST_ACCOUNT_URL); break; } NetThread::newHttp(TRUE,TRUE,FALSE,FALSE); connect(http, SIGNAL(done(bool)), this, SLOT(httpDone(bool)), Qt::DirectConnection); http->request(*header, postString.toUtf8(), resultBuffer); exec(); if(http) disconnect(http, 0, 0, 0); cleanObjects(); }
void AutomationPattern::flipX( int length ) { timeMap tempMap; timeMap::ConstIterator iterate = m_timeMap.lowerBound(0); float tempValue = 0; int numPoints = 0; for( int i = 0; ( iterate + i + 1 ) != m_timeMap.end() && ( iterate + i ) != m_timeMap.end() ; i++) { numPoints++; } float realLength = ( iterate + numPoints ).key(); if ( length != -1 && length != realLength) { if ( realLength < length ) { tempValue = valueAt( ( iterate + numPoints ).key() ); putValue( MidiTime( length ) , tempValue, false); numPoints++; for( int i = 0; i <= numPoints; i++ ) { tempValue = valueAt( ( iterate + i ).key() ); MidiTime newTime = MidiTime( length - ( iterate + i ).key() ); tempMap[newTime] = tempValue; } } else { for( int i = 0; i <= numPoints; i++ ) { tempValue = valueAt( ( iterate + i ).key() ); MidiTime newTime; if ( ( iterate + i ).key() <= length ) { newTime = MidiTime( length - ( iterate + i ).key() ); } else { newTime = MidiTime( ( iterate + i ).key() ); } tempMap[newTime] = tempValue; } } } else { for( int i = 0; i <= numPoints; i++ ) { tempValue = valueAt( ( iterate + i ).key() ); cleanObjects(); MidiTime newTime = MidiTime( realLength - ( iterate + i ).key() ); tempMap[newTime] = tempValue; } } m_timeMap.clear(); m_timeMap = tempMap; generateTangents(); emit dataChanged(); }