本文整理汇总了C++中Note::getVolume方法的典型用法代码示例。如果您正苦于以下问题:C++ Note::getVolume方法的具体用法?C++ Note::getVolume怎么用?C++ Note::getVolume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::getVolume方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wheelEvent
void PatternView::wheelEvent( QWheelEvent * _we )
{
if( m_pat->m_patternType == Pattern::BeatPattern &&
( fixedTCOs() || pixelsPerTact() >= 96 ||
m_pat->m_steps != MidiTime::stepsPerTact() ) &&
_we->y() > height() - s_stepBtnOff->height() )
{
// get the step number that was wheeled on and
// do calculations in floats to prevent rounding errors...
float tmp = ( ( float(_we->x()) - TCO_BORDER_WIDTH ) *
float( m_pat -> m_steps ) ) / float(width() - TCO_BORDER_WIDTH*2);
int step = int( tmp );
if( step >= m_pat->m_steps )
{
return;
}
int vol = 0;
int len = 0;
Note * n = m_pat->noteAtStep( step );
if( n != NULL )
{
vol = n->getVolume();
len = n->length();
if( len == 0 && _we->delta() > 0 )
{
n->setLength( -DefaultTicksPerTact );
n->setVolume( 5 );
}
else if( _we->delta() > 0 )
{
n->setVolume( qMin( 100, vol + 5 ) );
}
else
{
n->setVolume( qMax( 0, vol - 5 ) );
}
Engine::getSong()->setModified();
update();
if( gui->pianoRoll()->currentPattern() == m_pat )
{
gui->pianoRoll()->update();
}
}
_we->accept();
}
else
{
TrackContentObjectView::wheelEvent( _we );
}
}
示例2: cloneSteps
void Pattern::cloneSteps()
{
int oldLength = m_steps;
m_steps += MidiTime::stepsPerTact();
ensureBeatNotes();
for(int i = 0; i < MidiTime::stepsPerTact(); ++i )
{
Note *toCopy = noteAtStep( i );
if( toCopy )
{
setStep( oldLength + i, true );
Note *newNote = noteAtStep( oldLength + i );
newNote->setKey( toCopy->key() );
newNote->setLength( toCopy->length() );
newNote->setPanning( toCopy->getPanning() );
newNote->setVolume( toCopy->getVolume() );
}
}
ensureBeatNotes();
emit dataChanged();
updateBBTrack();
}
示例3: paintEvent
//.........这里部分代码省略.........
}
}
}
}
// beat pattern paint event
else if( m_pat->m_patternType == Pattern::BeatPattern &&
( fixedTCOs() || ppt >= 96
|| m_pat->m_steps != MidiTime::stepsPerTact() ) )
{
QPixmap stepon;
QPixmap stepoverlay;
QPixmap stepoff;
QPixmap stepoffl;
const int steps = qMax( 1,
m_pat->m_steps );
const int w = width() - 2 * TCO_BORDER_WIDTH;
// scale step graphics to fit the beat pattern length
stepon = s_stepBtnOn->scaled( w / steps,
s_stepBtnOn->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoverlay = s_stepBtnOverlay->scaled( w / steps,
s_stepBtnOn->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoff = s_stepBtnOff->scaled( w / steps,
s_stepBtnOff->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
stepoffl = s_stepBtnOffLight->scaled( w / steps,
s_stepBtnOffLight->height(),
Qt::IgnoreAspectRatio,
Qt::SmoothTransformation );
for( int it = 0; it < steps; it++ ) // go through all the steps in the beat pattern
{
Note * n = m_pat->noteAtStep( it );
// figure out x and y coordinates for step graphic
const int x = TCO_BORDER_WIDTH + static_cast<int>( it * w / steps );
const int y = height() - s_stepBtnOff->height() - 1;
// get volume and length of note, if noteAtStep returned null
// (meaning, note at step doesn't exist for some reason)
// then set both at zero, ie. treat as an off step
const int vol = ( n != NULL ? n->getVolume() : 0 );
const int len = ( n != NULL ? int( n->length() ) : 0 );
if( len < 0 )
{
p.drawPixmap( x, y, stepoff );
for( int i = 0; i < vol / 5 + 1; ++i )
{
p.drawPixmap( x, y, stepon );
}
for( int i = 0; i < ( 25 + ( vol - 75 ) ) / 5;
++i )
{
p.drawPixmap( x, y, stepoverlay );
}
}
else if( ( it / 4 ) % 2 )
{
p.drawPixmap( x, y, stepoffl );
}
else
{
p.drawPixmap( x, y, stepoff );
}
} // end for loop
}
p.setFont( pointSize<8>( p.font() ) );
QColor text_color = ( m_pat->isMuted() || m_pat->getTrack()->isMuted() )
? QColor( 30, 30, 30 )
: textColor();
if( m_pat->name() != m_pat->instrumentTrack()->name() )
{
p.setPen( QColor( 0, 0, 0 ) );
p.drawText( 4, p.fontMetrics().height()+1, m_pat->name() );
p.setPen( text_color );
p.drawText( 3, p.fontMetrics().height(), m_pat->name() );
}
if( m_pat->isMuted() )
{
p.drawPixmap( 3, p.fontMetrics().height() + 1,
embed::getIconPixmap( "muted", 16, 16 ) );
}
p.end();
_p.drawPixmap( 0, 0, m_paintPixmap );
}
示例4: BaseDetuning
NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack,
const f_cnt_t _offset,
const f_cnt_t _frames,
const Note& n,
NotePlayHandle *parent,
int midiEventChannel,
Origin origin ) :
PlayHandle( TypeNotePlayHandle, _offset ),
Note( n.length(), n.pos(), n.key(), n.getVolume(), n.getPanning(), n.detuning() ),
m_pluginData( NULL ),
m_filter( NULL ),
m_instrumentTrack( instrumentTrack ),
m_frames( 0 ),
m_totalFramesPlayed( 0 ),
m_framesBeforeRelease( 0 ),
m_releaseFramesToDo( 0 ),
m_releaseFramesDone( 0 ),
m_subNotes(),
m_released( false ),
m_hasParent( parent != NULL ),
m_parent( parent ),
m_hadChildren( false ),
m_muted( false ),
m_bbTrack( NULL ),
m_origTempo( Engine::getSong()->getTempo() ),
m_origBaseNote( instrumentTrack->baseNote() ),
m_frequency( 0 ),
m_unpitchedFrequency( 0 ),
m_baseDetuning( NULL ),
m_songGlobalParentOffset( 0 ),
m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack->midiPort()->realOutputChannel() ),
m_origin( origin ),
m_frequencyNeedsUpdate( false )
{
lock();
if( hasParent() == false )
{
m_baseDetuning = new BaseDetuning( detuning() );
m_instrumentTrack->m_processHandles.push_back( this );
}
else
{
m_baseDetuning = parent->m_baseDetuning;
parent->m_subNotes.push_back( this );
parent->m_hadChildren = true;
m_bbTrack = parent->m_bbTrack;
parent->setUsesBuffer( false );
}
updateFrequency();
setFrames( _frames );
// inform attached components about new MIDI note (used for recording in Piano Roll)
if( m_origin == OriginMidiInput )
{
m_instrumentTrack->midiNoteOn( *this );
}
if( hasParent() || ! m_instrumentTrack->isArpeggioEnabled() )
{
const int baseVelocity = m_instrumentTrack->midiPort()->baseVelocity();
// send MidiNoteOn event
m_instrumentTrack->processOutEvent(
MidiEvent( MidiNoteOn, midiChannel(), midiKey(), midiVelocity( baseVelocity ) ),
MidiTime::fromFrames( offset(), Engine::framesPerTick() ),
offset() );
}
if( m_instrumentTrack->instrument()->flags() & Instrument::IsSingleStreamed )
{
setUsesBuffer( false );
}
setAudioPort( instrumentTrack->audioPort() );
unlock();
}