From: <rel...@us...> - 2008-12-07 23:59:18
|
Revision: 236 http://modplug.svn.sourceforge.net/modplug/?rev=236&view=rev Author: relabsoluness Date: 2008-12-07 23:59:12 +0000 (Sun, 07 Dec 2008) Log Message: ----------- (Patches from Jojo, merged slightly modified) / Instrument tab: Sample map can now map "No sample". + Sample tab: Ability to save sample as raw. / Setup: Updated directory browsing dialogs. . Misc: When adding channels from song properties, initialize new channels properly (bug 1814). Modified Paths: -------------- trunk/OpenMPT/mptrack/AutoSaver.cpp trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/mptrack/Modedit.cpp trunk/OpenMPT/mptrack/Moptions.cpp trunk/OpenMPT/mptrack/dlg_misc.cpp trunk/OpenMPT/soundlib/Sampleio.cpp trunk/OpenMPT/soundlib/Sndfile.h Modified: trunk/OpenMPT/mptrack/AutoSaver.cpp =================================================================== --- trunk/OpenMPT/mptrack/AutoSaver.cpp 2008-11-03 21:30:18 UTC (rev 235) +++ trunk/OpenMPT/mptrack/AutoSaver.cpp 2008-12-07 23:59:12 UTC (rev 236) @@ -378,8 +378,9 @@ GetDlgItemText(IDC_AUTOSAVE_PATH, szPath, sizeof(szPath)); memset(&bi, 0, sizeof(bi)); bi.hwndOwner = m_hWnd; + bi.lpszTitle = "Select a folder to store autosaved files in..."; bi.pszDisplayName = szPath; - bi.ulFlags = BIF_RETURNONLYFSDIRS; + bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI; LPITEMIDLIST pid = SHBrowseForFolder(&bi); if (pid != NULL) { @@ -442,4 +443,4 @@ } return CPropertyPage::OnKillActive(); -} \ No newline at end of file +} Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2008-11-03 21:30:18 UTC (rev 235) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2008-12-07 23:59:12 UTC (rev 236) @@ -959,7 +959,7 @@ void CCtrlSamples::OnSampleSave() //------------------------------- { - CHAR szFileName[_MAX_PATH] = ""; + CHAR szFileName[_MAX_PATH] = "", ext[_MAX_EXT]; if ((!m_pSndFile) || (!m_nSample) || (!m_pSndFile->Ins[m_nSample].pSample)) { @@ -979,7 +979,8 @@ CFileDialog dlg(FALSE, "wav", szFileName, OFN_HIDEREADONLY| OFN_ENABLESIZING | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_NOREADONLYRETURN, - "Wave File (*.wav)|*.wav||", + "Wave File (*.wav)|*.wav|" + "RAW Audio (*.raw)|*.raw||", this); if (CMainFrame::m_szCurSmpDir[0]) { @@ -987,7 +988,13 @@ } if (dlg.DoModal() != IDOK) return; BeginWaitCursor(); - BOOL bOk = m_pSndFile->SaveWAVSample(m_nSample, dlg.GetPathName()); + + _splitpath(dlg.GetPathName(), NULL, NULL, NULL, ext); + BOOL bOk = FALSE; + if (!lstrcmpi(ext, ".raw")) + bOk = m_pSndFile->SaveRAWSample(m_nSample, dlg.GetPathName()); + else + bOk = m_pSndFile->SaveWAVSample(m_nSample, dlg.GetPathName()); EndWaitCursor(); if (!bOk) { Modified: trunk/OpenMPT/mptrack/Modedit.cpp =================================================================== --- trunk/OpenMPT/mptrack/Modedit.cpp 2008-11-03 21:30:18 UTC (rev 235) +++ trunk/OpenMPT/mptrack/Modedit.cpp 2008-12-07 23:59:12 UTC (rev 236) @@ -409,6 +409,13 @@ m_SndFile.Patterns[i] = newp; CSoundFile::FreePattern(p); } + + //if channel was removed before and is added again, mute status has to be unset! (bug 1814) + for (UINT i=m_SndFile.m_nChannels; i<nNewChannels; i++) + { + m_SndFile.InitChannel(i); + } + m_SndFile.m_nChannels = nNewChannels; END_CRITICAL(); EndWaitCursor(); Modified: trunk/OpenMPT/mptrack/Moptions.cpp =================================================================== --- trunk/OpenMPT/mptrack/Moptions.cpp 2008-11-03 21:30:18 UTC (rev 235) +++ trunk/OpenMPT/mptrack/Moptions.cpp 2008-12-07 23:59:12 UTC (rev 236) @@ -786,8 +786,9 @@ GetDlgItemText(nID, szPath, sizeof(szPath)); memset(&bi, 0, sizeof(bi)); bi.hwndOwner = m_hWnd; + bi.lpszTitle = "Select a default folder..."; bi.pszDisplayName = szPath; - bi.ulFlags = BIF_RETURNONLYFSDIRS; + bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI; LPITEMIDLIST pid = SHBrowseForFolder(&bi); if (pid != NULL) { Modified: trunk/OpenMPT/mptrack/dlg_misc.cpp =================================================================== --- trunk/OpenMPT/mptrack/dlg_misc.cpp 2008-11-03 21:30:18 UTC (rev 235) +++ trunk/OpenMPT/mptrack/dlg_misc.cpp 2008-12-07 23:59:12 UTC (rev 236) @@ -2571,6 +2571,11 @@ } m_CbnSample.ResetContent(); bAll = IsDlgButtonChecked(IDC_CHECK1); + + UINT nInsertPos; + nInsertPos = m_CbnSample.AddString("0: No sample"); + m_CbnSample.SetItemData(nInsertPos, 0); + for (UINT i=1; i<=m_pSndFile->m_nSamples; i++) { BOOL bUsed = bAll; @@ -2585,10 +2590,10 @@ if (bUsed) { CString sampleName; sampleName.Format("%d: %s", i, m_pSndFile->GetSampleName(i)); - UINT nPos = m_CbnSample.AddString(sampleName); + nInsertPos = m_CbnSample.AddString(sampleName); - m_CbnSample.SetItemData(nPos, i); - if (i == nOldPos) nNewPos = nPos; + m_CbnSample.SetItemData(nInsertPos, i); + if (i == nOldPos) nNewPos = nInsertPos; } } m_CbnSample.SetCurSel(nNewPos); @@ -2647,7 +2652,7 @@ wsprintf(s, "%s", temp.c_str()); INSTRUMENTHEADER *penv = m_pSndFile->Headers[m_nInstrument]; - if ((wParam == KBDNOTIFY_LBUTTONDOWN) && (nSample > 0) && (nSample < MAX_SAMPLES) && (penv)) + if ((wParam == KBDNOTIFY_LBUTTONDOWN) && (nSample < MAX_SAMPLES) && (penv)) { UINT iNote = nBaseOctave*12+lParam; if (KeyboardMap[iNote] == nSample) Modified: trunk/OpenMPT/soundlib/Sampleio.cpp =================================================================== --- trunk/OpenMPT/soundlib/Sampleio.cpp 2008-11-03 21:30:18 UTC (rev 235) +++ trunk/OpenMPT/soundlib/Sampleio.cpp 2008-12-07 23:59:12 UTC (rev 236) @@ -682,6 +682,27 @@ return TRUE; } +/////////////////////////////////////////////////////////////// +// Save RAW + +BOOL CSoundFile::SaveRAWSample(UINT nSample, LPCSTR lpszFileName) +//--------------------------------------------------------------- +{ + MODINSTRUMENT *pins = &Ins[nSample]; + FILE *f; + + if ((f = fopen(lpszFileName, "wb")) == NULL) return FALSE; + + UINT nType; + if (pins->uFlags & CHN_STEREO) + nType = (pins->uFlags & CHN_16BIT) ? RS_STIPCM16S : RS_STIPCM8S; + else + nType = (pins->uFlags & CHN_16BIT) ? RS_PCM16S : RS_PCM8S; + WriteSample(f, pins, nType); + fclose(f); + return TRUE; +} + ///////////////////////////////////////////////////////////// // GUS Patches Modified: trunk/OpenMPT/soundlib/Sndfile.h =================================================================== --- trunk/OpenMPT/soundlib/Sndfile.h 2008-11-03 21:30:18 UTC (rev 235) +++ trunk/OpenMPT/soundlib/Sndfile.h 2008-12-07 23:59:12 UTC (rev 236) @@ -1239,6 +1239,7 @@ BOOL ReadITISample(UINT nSample, LPBYTE lpMemFile, DWORD dwFileLength); BOOL Read8SVXSample(UINT nInstr, LPBYTE lpMemFile, DWORD dwFileLength); BOOL SaveWAVSample(UINT nSample, LPCSTR lpszFileName); + BOOL SaveRAWSample(UINT nSample, LPCSTR lpszFileName); // Instrument file I/O BOOL ReadInstrumentFromFile(UINT nInstr, LPBYTE lpMemFile, DWORD dwFileLength); BOOL ReadXIInstrument(UINT nInstr, LPBYTE lpMemFile, DWORD dwFileLength); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |