本文整理汇总了C++中Pattern::addNote方法的典型用法代码示例。如果您正苦于以下问题:C++ Pattern::addNote方法的具体用法?C++ Pattern::addNote怎么用?C++ Pattern::addNote使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern::addNote方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addNote
void addNote( Note & n )
{
if( !p || n.pos() > lastEnd + DefaultTicksPerTact )
{
MidiTime pPos = MidiTime( n.pos().getTact(), 0 );
p = dynamic_cast<Pattern*>( it->createTCO( 0 ) );
p->movePosition( pPos );
}
hasNotes = true;
lastEnd = n.pos() + n.length();
n.setPos( n.pos( p->startPosition() ) );
p->addNote( n, false );
}
示例2: testInlineAutomation
void testInlineAutomation()
{
auto song = Engine::getSong();
InstrumentTrack* instrumentTrack =
dynamic_cast<InstrumentTrack*>(Track::create(Track::InstrumentTrack, song));
Pattern* notePattern = dynamic_cast<Pattern*>(instrumentTrack->createTCO(0));
notePattern->changeLength(MidiTime(4, 0));
Note* note = notePattern->addNote(Note(MidiTime(4, 0)), false);
note->createDetuning();
DetuningHelper* dh = note->detuning();
auto pattern = dh->automationPattern();
pattern->setProgressionType( AutomationPattern::LinearProgression );
pattern->putValue(MidiTime(0, 0), 0.0);
pattern->putValue(MidiTime(4, 0), 1.0);
QCOMPARE(pattern->valueAt(MidiTime(0, 0)), 0.0f);
QCOMPARE(pattern->valueAt(MidiTime(1, 0)), 0.25f);
QCOMPARE(pattern->valueAt(MidiTime(2, 0)), 0.5f);
QCOMPARE(pattern->valueAt(MidiTime(4, 0)), 1.0f);
}
示例3: tryImport
//.........这里部分代码省略.........
// process all dots
for( QList<int>::ConstIterator jt = it->dots.begin();
jt != it->dots.end(); ++jt )
{
const int pat = *jt / 256;
const int pos = *jt % 256;
Pattern* p = dynamic_cast<Pattern*>( t->getTCO( pat ) );
if( p == NULL )
{
continue;
}
p->setStep( pos, true );
}
// TODO: use future layering feature
if( it->layerParent >= 0 )
{
it->notes += p.channels[it->layerParent].notes;
}
// process all notes
for( FL_Channel::noteVector::ConstIterator jt = it->notes.begin();
jt != it->notes.end(); ++jt )
{
const int pat = jt->first;
if( pat > 100 )
{
continue;
}
Pattern* p = dynamic_cast<Pattern*>( t->getTCO( pat ) );
if( p != NULL )
{
p->addNote( jt->second, false );
}
}
// process automation data
for( QList<FL_Automation>::ConstIterator jt =
it->automationData.begin();
jt != it->automationData.end(); ++jt )
{
AutomatableModel * m = NULL;
float value = jt->value;
bool scale = false;
switch( jt->control )
{
case FL_Automation::ControlVolume:
m = t->volumeModel();
value *= ( 100.0f / 128.0f ) / p.versionSpecificFactor;
break;
case FL_Automation::ControlPanning:
m = t->panningModel();
value = ( value / p.versionSpecificFactor ) *200/128 - PanningRight;
break;
case FL_Automation::ControlPitch:
m = t->pitchModel();
break;
case FL_Automation::ControlFXChannel:
m = t->effectChannelModel();
value = value*200/128 - PanningRight;
break;
case FL_Automation::ControlFilterCut:
scale = true;
m = &t->m_soundShaping.m_filterCutModel;
value /= ( 255 * 2.5f );