コード例 #1
0
ファイル: recorder.cpp プロジェクト: slegroux/giada
void stopOverdub(int frame) 
{
	cmp.a2.frame  = frame;
	bool ringLoop = false;
	bool nullLoop = false;

	/* ring loop verification, i.e. a composite action with key_press at
	 * frame N and key_release at frame M, with M <= N */

	if (cmp.a2.frame < cmp.a1.frame) {
		ringLoop = true;
		gLog("[REC] ring loop! frame1=%d < frame2=%d\n", cmp.a1.frame, cmp.a2.frame);
		rec(cmp.a2.chan, cmp.a2.type, G_Mixer.totalFrames); 	// record at the end of the sequencer
	}
	else
	if (cmp.a2.frame == cmp.a1.frame) {
		nullLoop = true;
		gLog("[REC]  null loop! frame1=%d == frame2=%d\n", cmp.a1.frame, cmp.a2.frame);
		deleteAction(cmp.a1.chan, cmp.a1.frame, cmp.a1.type, false); // false == don't check values
	}

	SampleChannel *ch = (SampleChannel*) G_Mixer.getChannelByIndex(cmp.a2.chan);
	ch->readActions = false;      // don't use disableRead()

	/* remove any nested action between keypress----keyrel, then record */

	if (!nullLoop)
		deleteActions(cmp.a2.chan, cmp.a1.frame, cmp.a2.frame, cmp.a1.type);
		deleteActions(cmp.a2.chan, cmp.a1.frame, cmp.a2.frame, cmp.a2.type);

	if (!ringLoop && !nullLoop) {
		rec(cmp.a2.chan, cmp.a2.type, cmp.a2.frame);

		/* avoid underlying action truncation, if keyrel happens inside a
		* composite action */

		action *act = NULL;
		int res = getNextAction(cmp.a2.chan, cmp.a1.type | cmp.a2.type, cmp.a2.frame, &act);
		if (res == 1) {
			if (act->type == cmp.a2.type) {
				gLog("[REC] add truncation at frame %d, type=%d\n", act->frame, act->type);
				deleteAction(act->chan, act->frame, act->type, false); // false == don't check values
			}
		}
	}
}
コード例 #2
0
ファイル: ActionEditor.cpp プロジェクト: philouvb/KVIrc
ActionEditor::ActionEditor(QWidget * par)
: QWidget(par)
{

	QGridLayout * l = new QGridLayout(this);
	m_pSplitter = new QSplitter(Qt::Horizontal,this);
	m_pSplitter->setChildrenCollapsible(false);
	l->addWidget(m_pSplitter,0,0);


	KviTalVBox * box = new KviTalVBox(m_pSplitter);
	m_pTreeWidget = new ActionEditorTreeView(box);
	KviTalIconAndRichTextItemDelegate *itemDelegate=new KviTalIconAndRichTextItemDelegate(m_pTreeWidget);
	m_pTreeWidget->setItemDelegate(itemDelegate);
	//m_pTreeWidget->setShowSortIndicator(true);
	m_pTreeWidget->setFocusPolicy(Qt::StrongFocus);
	connect(m_pTreeWidget,SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),this,SLOT(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)));

	m_pNewActionButton = new QPushButton(__tr2qs_ctx("New Action","editor"),box);
	connect(m_pNewActionButton,SIGNAL(clicked()),this,SLOT(newAction()));

	m_pDeleteActionsButton = new QPushButton(__tr2qs_ctx("Delete Actions","editor"),box);
	connect(m_pDeleteActionsButton,SIGNAL(clicked()),this,SLOT(deleteActions()));

	m_pExportActionsButton = new QPushButton(__tr2qs_ctx("Export Actions...","editor"),box);
	connect(m_pExportActionsButton,SIGNAL(clicked()),this,SLOT(exportActions()));

	box->setSpacing(1);

	m_pSingleActionEditor = new SingleActionEditor(m_pSplitter,this);

	ActionEditorTreeWidgetItem * last = 0;
	ActionEditorTreeWidgetItem * first = 0;

	KviPointerHashTableIterator<QString,KviAction> it(*(KviActionManager::instance()->actions()));
	while(KviAction * a = it.current())
	{
		if(a->isKviUserActionNeverOverrideThis())
		{
			ActionData * ad = new ActionData(
					a->name(),
					((KviKvsUserAction *)a)->scriptCode(),
					((KviKvsUserAction *)a)->visibleNameCode(),
					((KviKvsUserAction *)a)->descriptionCode(),
					a->category() ? a->category()->name() : KviActionManager::categoryGeneric()->name(),
					a->bigIconId(),
					a->smallIconId(),
					a->flags(),
					a->keySequence(),
					0
				);
			ActionEditorTreeWidgetItem * lvi = new ActionEditorTreeWidgetItem(m_pTreeWidget,ad);
			ad->m_pItem = lvi;
			if(ad->m_szName == g_szLastEditedAction)
				last = lvi;
			if(!first)
				first = lvi;
		}
		++it;
	}

	if(!last)last = first; // try to sleect the first one then

	if(last)
	{
		m_pTreeWidget->setCurrentItem(last);
		currentItemChanged(last,last);
	} else {
		currentItemChanged(0,0);
	}

}
AREXPORT ArActionGroupInput::~ArActionGroupInput()
{
  removeActions();
  deleteActions();
}
AREXPORT ArActionGroupRatioDriveUnsafe::~ArActionGroupRatioDriveUnsafe()
{
  removeActions();
  deleteActions();  
}
// Destructor
AREXPORT ArActionGroupColorFollow::~ArActionGroupColorFollow()
{
  removeActions();
  deleteActions();
}
AREXPORT ArActionGroupWander::~ArActionGroupWander()
{
  removeActions();
  deleteActions();
}
AREXPORT ArActionGroupUnguardedTeleop::~ArActionGroupUnguardedTeleop()
{
  removeActions();
  deleteActions();
}
AREXPORT ArActionGroupTeleop::~ArActionGroupTeleop()
{
  removeActions();
  deleteActions();
}