本文整理汇总了C++中CFamiTrackerDoc类的典型用法代码示例。如果您正苦于以下问题:C++ CFamiTrackerDoc类的具体用法?C++ CFamiTrackerDoc怎么用?C++ CFamiTrackerDoc使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFamiTrackerDoc类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDocument
void CInstrumentEditorN163::OnCloneSequence()
{
CFamiTrackerDoc *pDoc = GetDocument();
int FreeIndex = pDoc->GetFreeSequenceN163(m_iSelectedSetting);
CSequence *pSeq = pDoc->GetSequence(SNDCHIP_N163, FreeIndex, m_iSelectedSetting);
pSeq->Copy(m_pSequence);
SetDlgItemInt(IDC_SEQ_INDEX, FreeIndex, FALSE);
}
示例2: onSave
void MusicEditorForm::onSave()
{
CDesignerEditorBase::onSave();
CFamiTrackerDoc* pDoc = (CFamiTrackerDoc*)AfxGetMainWnd()->GetActiveDocument();
pDoc->OnSaveDocument((TCHAR*)m_fileName.toAscii().constData());
setModified(false);
}
示例3: OnBnClickedOk
void CCommentsDlg::OnBnClickedOk()
{
CMainFrame *pMainFrame = (CMainFrame*)GetParentFrame();
CFamiTrackerDoc *pDoc = (CFamiTrackerDoc*)pMainFrame->GetActiveDocument();
CString comment;
GetDlgItemText(IDC_COMMENTS, comment);
pDoc->SetComment(comment);
EndDialog(0);
}
示例4: Update
void CFrameAction::Update(CMainFrame *pMainFrm)
{
CFamiTrackerView *pView = (CFamiTrackerView*)pMainFrm->GetActiveView();
CFamiTrackerDoc *pDocument = pView->GetDocument();
switch (m_iAction) {
case ACT_CHANGE_COUNT:
pDocument->SetFrameCount(m_iNewFrameCount);
pDocument->UpdateAllViews(NULL, CHANGED_FRAMES);
break;
// TODO add change pattern
}
}
示例5: onCloseQuery
QMessageBox::StandardButton MusicEditorForm::onCloseQuery()
{
QMessageBox::StandardButton doSave;
doSave = CDesignerEditorBase::onCloseQuery();
if ( doSave == QMessageBox::No )
{
// Need to nix the MFC modified flag.
CFamiTrackerDoc* pDoc = (CFamiTrackerDoc*)AfxGetMainWnd()->GetActiveDocument();
pDoc->SetModifiedFlag(FALSE);
}
return doSave;
}
示例6: OnBnClickedBegin
void CCreateWaveDlg::OnBnClickedBegin()
{
RENDER_END EndType;
int EndParam;
CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc();
CString FileName = pDoc->GetFileTitle();
CWavProgressDlg ProgressDlg;
CFileDialog SaveDialog(FALSE, _T("wav"), FileName, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, _T("Microsoft PCM files (*.wav)|*.wav|All files (*.*)|*.*||"));
// Close this dialog
EndDialog(0);
// Ask for file location
if (SaveDialog.DoModal() == IDCANCEL)
return;
// Save
if (IsDlgButtonChecked(IDC_RADIO_LOOP)) {
EndType = SONG_LOOP_LIMIT;
EndParam = GetFrameLoopCount();
}
else if (IsDlgButtonChecked(IDC_RADIO_TIME)) {
EndType = SONG_TIME_LIMIT;
EndParam = GetTimeLimit();
}
CFamiTrackerView *pView = CFamiTrackerView::GetView();
pView->UnmuteAllChannels();
// Mute selected channels
for (int i = 0; i < m_ctlChannelList.GetCount(); ++i) {
if (m_ctlChannelList.GetCheck(i) == 0)
pView->ToggleChannel(i);
}
// m_sFileName = SaveDialog.GetPathName();
ProgressDlg.SetFile(SaveDialog.GetPathName().GetString());
ProgressDlg.SetOptions(EndType, EndParam);
ProgressDlg.DoModal();
// Unmute all channels
pView->UnmuteAllChannels();
}
示例7: InsertInstrument
void CInstrumentList::InsertInstrument(int Index)
{
// Inserts an instrument in the list (Index = instrument number)
CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc();
if (!pDoc->IsInstrumentUsed(Index))
return;
char Name[CInstrument::INST_NAME_MAX];
pDoc->GetInstrumentName(Index, Name);
int Type = pDoc->GetInstrumentType(Index);
// Name is of type index - name
CString Text;
Text.Format(_T("%02X - %s"), Index, A2T(Name));
InsertItem(Index, Text, Type - 1);
}
示例8: sizeof
BOOL CChannelsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_pAvailableTree = (CTreeCtrl*)GetDlgItem(IDC_AVAILABLE_TREE);
m_pAddedChannels = (CListCtrl*)GetDlgItem(IDC_ADDED_LIST);
int RootItems = sizeof(ROOT_ITEMS) / sizeof(TCHAR);
// m_pAddedChannels->GetWIndowLon
m_pAddedChannels->InsertColumn(0, _T("Name"), 0, 150);
for (int i = 0; i < ROOT_ITEM_COUNT; ++i) {
HTREEITEM hItem = m_pAvailableTree->InsertItem(ROOT_ITEMS[i]);
m_hRootItems[i] = hItem;
for (int j = 0; CHILD_ITEMS[i][j] != NULL; ++j) {
CString str;
str.Format(_T("%i: %s"), j + 1, CHILD_ITEMS[i][j]);
HTREEITEM hChild = m_pAvailableTree->InsertItem(str, hItem);
m_pAvailableTree->SetItemData(hChild, CHILD_ITEMS_ID[i][j]);
}
m_pAvailableTree->SortChildren(hItem);
}
CChannelMap *map = theApp.GetChannelMap();
CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc();
for (unsigned i = 0; i < pDoc->GetAvailableChannels(); ++i) {
CTrackerChannel *pChannel = pDoc->GetChannel(i);
AddChannel(pChannel->GetID());
}
/*
AddChannel(CHANID_SQUARE1);
AddChannel(CHANID_SQUARE2);
AddChannel(CHANID_TRIANGLE);
AddChannel(CHANID_NOISE);
AddChannel(CHANID_DPCM);
*/
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例9: OnInitDialog
BOOL CCommentsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CMainFrame *pMainFrame = (CMainFrame*)GetParentFrame();
CFamiTrackerDoc *pDoc = (CFamiTrackerDoc*)pMainFrame->GetActiveDocument();
CString comment = pDoc->GetComment();
SetDlgItemText(IDC_COMMENTS, comment);
CEdit *pEdit = (CEdit*)GetDlgItem(IDC_COMMENTS);
CFont *pFont = new CFont();
pFont->CreateFont(12, 0, 0, 0, 0,0, 0, 0, 0, 0, 0, 0, 0, FONT_FACE);
pEdit->SetFont(pFont);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例10: instContainer
bool CChannelHandlerVRC6::HandleInstrument(int Instrument, bool Trigger, bool NewInstrument)
{
CFamiTrackerDoc *pDocument = m_pSoundGen->GetDocument();
CInstrumentContainer<CInstrumentVRC6> instContainer(pDocument, Instrument);
CInstrumentVRC6 *pInstrument = instContainer();
if (!pInstrument)
return false;
// Setup instrument
for (int i = 0; i < CInstrumentVRC6::SEQUENCE_COUNT; ++i) {
const CSequence *pSequence = pDocument->GetSequence(SNDCHIP_VRC6, pInstrument->GetSeqIndex(i), i);
if (Trigger || !IsSequenceEqual(i, pSequence) || pInstrument->GetSeqEnable(i) > GetSequenceState(i)) {
if (pInstrument->GetSeqEnable(i) == 1)
SetupSequence(i, pSequence);
else
ClearSequence(i);
}
}
return true;
}
示例11: CheckDlgButton
BOOL CCreateWaveDlg::OnInitDialog()
{
CheckDlgButton(IDC_RADIO_LOOP, BST_CHECKED);
CheckDlgButton(IDC_RADIO_TIME, BST_UNCHECKED);
SetDlgItemText(IDC_TIMES, _T("1"));
SetDlgItemText(IDC_SECONDS, _T("01:00"));
m_ctlChannelList.SubclassDlgItem(IDC_CHANNELS, this);
m_ctlChannelList.ResetContent();
m_ctlChannelList.SetCheckStyle(BS_AUTOCHECKBOX);
CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc();
for (int i = 0; i < pDoc->GetChannelCount(); ++i) {
m_ctlChannelList.AddString(pDoc->GetChannel(i)->GetChannelName());
m_ctlChannelList.SetCheck(i, 1);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例12: 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;
}
}
示例13: SetCurrentInstrument
void CInstrumentEditDlg::SetCurrentInstrument(int Index)
{
CFamiTrackerDoc *pDoc = CFamiTrackerDoc::GetDoc();
std::shared_ptr<CInstrument> pInstrument = pDoc->GetInstrument(Index);
int InstType = pInstrument->GetType();
// Dialog title
char Name[256];
pDoc->GetInstrumentName(Index, Name);
CString Suffix;
Suffix.Format(_T("%02X. %s (%s)"), Index, Name, CHIP_NAMES[InstType]);
CString Title;
AfxFormatString1(Title, IDS_INSTRUMENT_EDITOR_TITLE, Suffix);
SetWindowText(Title);
if (InstType != m_iSelectedInstType) {
ShowWindow(SW_HIDE);
ClearPanels();
switch (InstType) {
case INST_2A03: {
int Channel = CFamiTrackerView::GetView()->GetSelectedChannel();
int Type = pDoc->GetChannelType(Channel);
bool bShowDPCM = (Type == CHANID_DPCM) || (std::static_pointer_cast<CInstrument2A03>(pInstrument)->AssignedSamples());
InsertPane(new CInstrumentEditorSeq(NULL, _T("2A03 settings"), CInstrument2A03::SEQUENCE_NAME, 15, 3, INST_2A03), !bShowDPCM); // // //
InsertPane(new CInstrumentEditorDPCM(), bShowDPCM);
}
break;
case INST_VRC6:
InsertPane(new CInstrumentEditorSeq(NULL, _T("Konami VRC6"), CInstrumentVRC6::SEQUENCE_NAME, 15, 7, INST_VRC6), true);
break;
case INST_VRC7:
InsertPane(new CInstrumentEditorVRC7(), true);
break;
case INST_FDS:
InsertPane(new CInstrumentEditorFDS(), true);
InsertPane(new CInstrumentEditorFDSEnvelope(), false);
break;
case INST_N163:
InsertPane(new CInstrumentEditorSeq(
NULL, _T("Envelopes"), CInstrumentN163::SEQUENCE_NAME, 15, CInstrumentN163::MAX_WAVE_COUNT - 1, INST_N163
), true);
InsertPane(new CInstrumentEditorN163Wave(), false);
break;
case INST_S5B:
InsertPane(new CInstrumentEditorSeq(NULL, _T("Sunsoft 5B"), CInstrumentS5B::SEQUENCE_NAME, 15, 255, INST_S5B), true);
break;
}
m_iSelectedInstType = InstType;
}
for (int i = 0; i < PANEL_COUNT; ++i) {
if (m_pPanels[i] != NULL) {
m_pPanels[i]->SelectInstrument(pInstrument);
}
}
ShowWindow(SW_SHOW);
UpdateWindow();
m_iSelectedInstType = InstType;
}
示例14: onIdleSlot
void MainWindow::onIdleSlot()
{
CFamiTrackerApp* pApp = (CFamiTrackerApp*)AfxGetApp();
CMainFrame* pMainFrame = (CMainFrame*)pApp->m_pMainWnd;
CFamiTrackerDoc* pDoc = (CFamiTrackerDoc*)pMainFrame->GetActiveDocument();
CFamiTrackerView* pView = (CFamiTrackerView*)pMainFrame->GetActiveView();
static int lastFrame = -1;
ui->sampleWindow->update();
if ( m_bCheck )
{
// Move to next song if playing and the current song has reached a stop.
if ( m_bCheck && m_bPlaying && !m_bChangeSong )
{
// Check if time is at time limit and if so, advance to next song.
int timeLimit = m_pWndMFC->GetTimeLimit();
CString playTime;
int totalPlayTime;
pMainFrame->GetDescendantWindow(AFX_IDW_STATUS_BAR)->GetDlgItemText(ID_INDICATOR_TIME,playTime);
totalPlayTime = m_pWndMFC->ConvertTime(playTime);
if ( lastFrame != pView->GetPlayFrame() )
{
lastFrame = pView->GetPlayFrame();
m_iFramesPlayed++;
}
if ( m_bTimeLimited &&
(timeLimit == totalPlayTime) )
{
// Force stop...
m_bPlaying = false;
pApp->OnCmdMsg(ID_TRACKER_TOGGLE_PLAY,0,0,0);
m_bChangeSong = true;
// Create a bit of a delay between songs.
m_pTimer->start(500);
}
else if ( m_bLoopLimited &&
m_iFramesPlayed > pDoc->ScanActualLength(pDoc->GetSelectedTrack(),m_pWndMFC->GetFrameLoopCount()) )
{
// Force stop...
m_bPlaying = false;
pApp->OnCmdMsg(ID_TRACKER_TOGGLE_PLAY,0,0,0);
m_bChangeSong = true;
// Create a bit of a delay between songs.
m_pTimer->start(500);
}
if ( !pApp->GetSoundGenerator()->IsPlaying() )
{
m_bPlaying = false;
m_bChangeSong = true;
// Create a bit of a delay between songs.
m_pTimer->start(500);
}
}
// Wait until player starts playing before turning the above logic back on.
else if ( m_bChangeSong )
{
on_playStop_clicked();
if ( !ui->repeat->isChecked() )
{
on_next_clicked();
}
m_bChangeSong = false;
ui->position->setValue((pView->GetPatternView()->GetPlayFrame()*pDoc->GetPatternLength())+pView->GetPatternView()->GetPlayRow());
startSettleTimer();
m_pTimer->start(0);
}
}
if ( m_bDraggingPosition )
{
// FF/RW
m_bCheck = false;
pView->PlayerCommand(CMD_JUMP_TO,(ui->position->value()/pDoc->GetPatternLength())-1);
pView->GetPatternView()->JumpToRow(ui->position->value()%pDoc->GetPatternLength());
}
else
{
m_bCheck = true;
ui->frames->setText(QString::number(m_iFramesPlayed)+"/"+QString::number(pDoc->ScanActualLength(pDoc->GetSelectedTrack(),m_pWndMFC->GetFrameLoopCount())));
ui->position->setValue((pView->GetPatternView()->GetPlayFrame()*pDoc->GetPatternLength())+pView->GetPatternView()->GetPlayRow());
}
}
示例15: Redo
void CFrameAction::Redo(CMainFrame *pMainFrm)
{
// Redo action
CFamiTrackerView *pView = (CFamiTrackerView*)pMainFrm->GetActiveView();
CFamiTrackerDoc *pDocument = pView->GetDocument();
switch (m_iAction) {
case ACT_ADD:
pDocument->InsertFrame(m_iUndoFramePos + 1);
pDocument->UpdateAllViews(NULL, CHANGED_FRAMES);
break;
case ACT_REMOVE:
pDocument->RemoveFrame(m_iUndoFramePos);
pDocument->UpdateAllViews(NULL, CHANGED_FRAMES);
break;
case ACT_DUPLICATE:
pDocument->DuplicateFrame(m_iUndoFramePos);
pDocument->UpdateAllViews(NULL, CHANGED_FRAMES);
break;
case ACT_DUPLICATE_PATTERNS:
pDocument->DuplicatePatterns(m_iUndoFramePos + 1);
pDocument->UpdateAllViews(NULL, CHANGED_FRAMES);
break;
case ACT_CHANGE_COUNT:
pDocument->SetFrameCount(m_iNewFrameCount);
pDocument->UpdateAllViews(NULL, CHANGED_FRAMES);
break;
case ACT_SET_PATTERN:
pDocument->SetPatternAtFrame(m_iUndoFramePos, m_iUndoChannelPos, m_iNewPattern);
pDocument->UpdateAllViews(NULL, CHANGED_PATTERN);
pMainFrm->UpdateControls();
break;
case ACT_SET_PATTERN_ALL:
{
int Channels = pDocument->GetAvailableChannels();
for (int i = 0; i < Channels; ++i) {
pDocument->SetPatternAtFrame(m_iUndoFramePos, i, m_iNewPattern);
}
pDocument->UpdateAllViews(NULL, CHANGED_PATTERN);
}
break;
case ACT_CHANGE_PATTERN:
pDocument->SetPatternAtFrame(m_iUndoFramePos, m_iUndoChannelPos, m_iOldPattern + m_iPatternDelta);
pDocument->UpdateAllViews(NULL, CHANGED_PATTERN);
break;
case ACT_CHANGE_PATTERN_ALL:
{
int Channels = pDocument->GetAvailableChannels();
for (int i = 0; i < Channels; ++i) {
pDocument->SetPatternAtFrame(m_iUndoFramePos, i, m_iPatterns[i] + m_iPatternDelta);
}
pDocument->UpdateAllViews(NULL, CHANGED_PATTERN);
}
break;
case ACT_MOVE_DOWN:
pDocument->MoveFrameDown(m_iUndoFramePos);
pDocument->UpdateAllViews(NULL, CHANGED_FRAMES);
break;
case ACT_MOVE_UP:
pDocument->MoveFrameUp(m_iUndoFramePos);
pDocument->UpdateAllViews(NULL, CHANGED_FRAMES);
break;
case ACT_PASTE:
{
int Channels = pDocument->GetAvailableChannels();
for (int i = 0; i < Channels; ++i)
pDocument->SetPatternAtFrame(m_iUndoFramePos, i, m_iPasteData[i]);
}
pDocument->UpdateAllViews(NULL, CHANGED_PATTERN);
break;
}
pView->SelectFrame(m_iRedoFramePos);
pView->SelectChannel(m_iRedoChannelPos);
}