From: <sag...@us...> - 2012-12-20 00:41:51
|
Revision: 1468 http://sourceforge.net/p/modplug/code/1468 Author: saga-games Date: 2012-12-20 00:41:45 +0000 (Thu, 20 Dec 2012) Log Message: ----------- [Imp] Sample Editor: If no sample filename is specified in IT/S3M/MPTM modules, the sample name is used for suggesting a filename when saving a sample. [Imp] Sample Editor: Added hidden INI setting "FLACCompressionLevel" in [Sample Editor] to set the compression level (0...8) when saving WAV samples. Modified Paths: -------------- trunk/OpenMPT/mptrack/Ctrl_smp.cpp trunk/OpenMPT/soundlib/SampleFormats.cpp Modified: trunk/OpenMPT/mptrack/Ctrl_smp.cpp =================================================================== --- trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2012-12-20 00:24:17 UTC (rev 1467) +++ trunk/OpenMPT/mptrack/Ctrl_smp.cpp 2012-12-20 00:41:45 UTC (rev 1468) @@ -1028,7 +1028,7 @@ { if(!m_pSndFile) return; - TCHAR szFileName[_MAX_PATH]; + TCHAR szFileName[_MAX_PATH] = ""; bool doBatchSave = CMainFrame::GetInputHandler()->ShiftPressed(); bool defaultFLAC = false; @@ -1043,7 +1043,8 @@ if(m_pSndFile->GetType() & (MOD_TYPE_S3M|MOD_TYPE_IT|MOD_TYPE_MPT)) { strncpy(szFileName, m_pSndFile->GetSample(m_nSample).filename, Util::Min(CountOf(m_pSndFile->GetSample(m_nSample).filename), CountOf(szFileName) - 1)); - } else + } + if(!szFileName[0]) { strncpy(szFileName, m_pSndFile->m_szNames[m_nSample], Util::Min(CountOf(m_pSndFile->m_szNames[m_nSample]), CountOf(szFileName) - 1)); } Modified: trunk/OpenMPT/soundlib/SampleFormats.cpp =================================================================== --- trunk/OpenMPT/soundlib/SampleFormats.cpp 2012-12-20 00:24:17 UTC (rev 1467) +++ trunk/OpenMPT/soundlib/SampleFormats.cpp 2012-12-20 00:41:45 UTC (rev 1468) @@ -2140,8 +2140,11 @@ FLAC__stream_encoder_set_sample_rate(encoder, sample.GetSampleRate(GetType())); FLAC__stream_encoder_set_total_samples_estimate(encoder, sample.nLength); FLAC__stream_encoder_set_metadata(encoder, metadata, writeLoopData ? 3 : 2); - // TODO custom compression level (0...8) - //FLAC__stream_encoder_set_compression_level(encoder, ); +#ifdef MODPLUG_TRACKER + // Custom compression level (0...8) + static const int compression = CMainFrame::GetPrivateProfileLong("Sample Editor", "FLACCompressionLevel", 5, theApp.GetConfigFileName()); + FLAC__stream_encoder_set_compression_level(encoder, compression); +#endif // MODPLUG_TRACKER if(FLAC__stream_encoder_init_file(encoder, lpszFileName, nullptr, nullptr) != FLAC__STREAM_ENCODER_INIT_STATUS_OK) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |