当前位置: 首页>>代码示例>>C++>>正文


C++ CFamiTrackerDoc::GetExpansionChip方法代码示例

本文整理汇总了C++中CFamiTrackerDoc::GetExpansionChip方法的典型用法代码示例。如果您正苦于以下问题:C++ CFamiTrackerDoc::GetExpansionChip方法的具体用法?C++ CFamiTrackerDoc::GetExpansionChip怎么用?C++ CFamiTrackerDoc::GetExpansionChip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CFamiTrackerDoc的用法示例。


在下文中一共展示了CFamiTrackerDoc::GetExpansionChip方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SwitchOnNote

void CInstrumentEditDlg::SwitchOnNote(int x, int y)
{
	CFamiTrackerView *pView = CFamiTrackerView::GetView();
	CFamiTrackerDoc *pDoc = static_cast<CFamiTrackerDoc*>(static_cast<CFrameWnd*>(GetParent())->GetActiveDocument());
	CMainFrame *pFrameWnd = static_cast<CMainFrame*>(GetParent());
	int Channel = pView->GetSelectedChannel();		// // //
	int Chip = pDoc->GetExpansionChip();

	stChanNote NoteData { };

	// // // Send to respective channels whenever cursor is outside instrument chip
	if (m_iSelectedInstType == INST_2A03) {
		if (m_pPanels[0]->IsWindowVisible() && Channel > CHANID_NOISE)
			pView->SelectChannel(pDoc->GetChannelIndex(CHANID_SQUARE1));
		if (m_pPanels[1]->IsWindowVisible())
			pView->SelectChannel(pDoc->GetChannelIndex(CHANID_DPCM));
	}
	else {
		chan_id_t First = CHANNELS;
		switch (m_iSelectedInstType) {
		case INST_VRC6: First = CHANID_VRC6_PULSE1; break;
		case INST_N163: First = CHANID_N163_CH1; break;
		case INST_FDS:  First = CHANID_FDS; break;
		case INST_VRC7: First = CHANID_VRC7_CH1; break;
		case INST_S5B:  First = CHANID_S5B_CH1; break;
		}
		int Index = pDoc->GetChannelIndex(First);
		if (Index != -1 && pDoc->GetChipType(Index) != pDoc->GetChipType(Channel))
			pView->SelectChannel(Index);
	}
	Channel = pView->GetSelectedChannel();		// // //

	if (m_KeyboardRect.PtInRect({x, y})) {
		int KeyPos = (x - m_KeyboardRect.left) % 70;		// // //
		int Octave = (x - m_KeyboardRect.left) / 70;
		int Note;

		if (y > m_KeyboardRect.top + 38) {
			// Only white keys
			     if (KeyPos >= 60) Note = NOTE_B;
			else if (KeyPos >= 50) Note = NOTE_A;
			else if (KeyPos >= 40) Note = NOTE_G;
			else if (KeyPos >= 30) Note = NOTE_F;
			else if (KeyPos >= 20) Note = NOTE_E;
			else if (KeyPos >= 10) Note = NOTE_D;
			else if (KeyPos >=  0) Note = NOTE_C;
		}
		else {
			// Black and white keys
			     if (KeyPos >= 62) Note = NOTE_B;
			else if (KeyPos >= 56) Note = NOTE_As;
			else if (KeyPos >= 53) Note = NOTE_A;
			else if (KeyPos >= 46) Note = NOTE_Gs;
			else if (KeyPos >= 43) Note = NOTE_G;
			else if (KeyPos >= 37) Note = NOTE_Fs;
			else if (KeyPos >= 30) Note = NOTE_F;
			else if (KeyPos >= 23) Note = NOTE_E;
			else if (KeyPos >= 16) Note = NOTE_Ds;
			else if (KeyPos >= 13) Note = NOTE_D;
			else if (KeyPos >=  7) Note = NOTE_Cs;
			else if (KeyPos >=  0) Note = NOTE_C;
		}

		int NewNote = MIDI_NOTE(Octave, Note);		// // //
		if (NewNote != m_iLastKey) {
			NoteData.Note			= Note;
			NoteData.Octave			= Octave;
			NoteData.Vol			= MAX_VOLUME - 1;
			NoteData.Instrument		= pFrameWnd->GetSelectedInstrument();
			memset(NoteData.EffNumber, 0, 4);
			memset(NoteData.EffParam, 0, 4);

			theApp.GetSoundGenerator()->QueueNote(Channel, NoteData, NOTE_PRIO_2);
			theApp.GetSoundGenerator()->ForceReloadInstrument(Channel);		// // //
			m_iLastKey = NewNote;
		}
	}
	else {
		NoteData.Note			= pView->DoRelease() ? RELEASE : HALT;//HALT;
		NoteData.Vol			= MAX_VOLUME;
		NoteData.Instrument		= pFrameWnd->GetSelectedInstrument();;
		memset(NoteData.EffNumber, 0, 4);
		memset(NoteData.EffParam, 0, 4);

		theApp.GetSoundGenerator()->QueueNote(Channel, NoteData, NOTE_PRIO_2);

		m_iLastKey = -1;
	}
}
开发者ID:fourks,项目名称:0CC-FamiTracker,代码行数:89,代码来源:InstrumentEditDlg.cpp


注:本文中的CFamiTrackerDoc::GetExpansionChip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。