From: <sv...@op...> - 2024-12-01 11:36:03
|
Author: sagamusix Date: Sun Dec 1 12:35:40 2024 New Revision: 22380 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22380 Log: Merged revision(s) 22056, 22377 from trunk/OpenMPT: [Imp] Warn when Startrekker AM companion file for synthesized instruments is most likely missing. ........ [Imp] Allow Startrekker AM external sample check to also work for libopenmpt. ........ Modified: branches/OpenMPT-1.29/ (props changed) branches/OpenMPT-1.29/soundlib/Load_mod.cpp Modified: branches/OpenMPT-1.29/soundlib/Load_mod.cpp ============================================================================== --- branches/OpenMPT-1.29/soundlib/Load_mod.cpp Sun Dec 1 12:35:15 2024 (r22379) +++ branches/OpenMPT-1.29/soundlib/Load_mod.cpp Sun Dec 1 12:35:40 2024 (r22380) @@ -1038,6 +1038,7 @@ // Reading patterns Patterns.ResizeArray(numPatterns); + std::bitset<32> referencedSamples; for(PATTERNINDEX pat = 0; pat < numPatterns; pat++) { ModCommand *rowBase = nullptr; @@ -1145,6 +1146,8 @@ if(m.instr != 0) { lastInstrument[chn] = m.instr; + if(isStartrekker) + referencedSamples.set(m.instr & 0x1F); } } if(hasSpeedOnRow && hasTempoOnRow) @@ -1271,7 +1274,7 @@ m_nInstruments = 31; #endif - for(SAMPLEINDEX smp = 1; smp <= m_nInstruments; smp++) + for(SAMPLEINDEX smp = 1; smp <= GetNumInstruments(); smp++) { // For Startrekker AM synthesis, we need instrument envelopes. ModInstrument *ins = AllocateInstrument(smp, smp); @@ -1294,6 +1297,32 @@ } #endif // MPT_EXTERNAL_SAMPLES || MPT_BUILD_FUZZER + if((loadFlags & loadSampleData) && isStartrekker && !m_nInstruments) + { + uint8 emptySampleReferences = 0; + for(SAMPLEINDEX smp = 1; smp <= 31; smp++) + { + if(referencedSamples[smp] && !Samples[smp].nLength) + { + if(++emptySampleReferences > 1) + { + mpt::ustring filenameHint; + if(file.GetOptionalFileName()) + { + const auto filename = file.GetOptionalFileName()->GetFilename().ToUnicode(); + filenameHint = MPT_UFORMAT(" ({}.nt or {}.as)")(filename, filename); + } +#ifdef MPT_EXTERNAL_SAMPLES + AddToLog(LogWarning, MPT_UFORMAT("This Startrekker AM file is most likely missing its companion file{}. Synthesized instruments will not play.")(filenameHint)); +#else + AddToLog(LogWarning, U_("This appears to be a Startrekker AM file with external synthesizes instruments. External instruments are currently not supported.")); +#endif // MPT_EXTERNAL_SAMPLES + break; + } + } + } + } + // Fix VBlank MODs. Arbitrary threshold: 8 minutes (enough for "frame of mind" by Dascon...). // Basically, this just converts all tempo commands into speed commands // for MODs which are supposed to have VBlank timing (instead of CIA timing). |