1 /* 2 * mod_specifications.h 3 * -------------------- 4 * Purpose: Mod specifications characterise the features of every editable module format in OpenMPT, such as the number of supported channels, samples, effects, etc... 5 * Notes : (currently none) 6 * Authors: OpenMPT Devs 7 * The OpenMPT source code is released under the BSD license. Read LICENSE for more details. 8 */ 9 10 11 #pragma once 12 13 #include "openmpt/all/BuildSettings.hpp" 14 15 #include "Snd_defs.h" 16 #include "modcommand.h" // ModCommand:: 17 #include "../soundlib/SoundFilePlayConfig.h" // mixlevel constants. 18 19 20 OPENMPT_NAMESPACE_BEGIN 21 22 23 struct CModSpecifications 24 { 25 /// Returns modtype corresponding to given file extension. The extension string 26 /// may begin with or without dot, e.g. both ".it" and "it" will be handled correctly. 27 static MODTYPE ExtensionToType(std::string ext); // (encoded in UTF8) 28 29 // Return true if format supports given note. 30 bool HasNote(ModCommand::NOTE note) const; 31 bool HasVolCommand(ModCommand::VOLCMD volcmd) const; 32 bool HasCommand(ModCommand::COMMAND cmd) const; 33 // Return corresponding effect letter for this format 34 char GetEffectLetter(ModCommand::COMMAND cmd) const; 35 char GetVolEffectLetter(ModCommand::VOLCMD cmd) const; 36 37 // NOTE: If changing order, update all initializations in .cpp file. 38 MODTYPE internalType; // Internal MODTYPE value 39 const char *fileExtension; // File extension without dot (encoded in UTF8). 40 ModCommand::NOTE noteMin; // Minimum note index (index starts from 1) 41 ModCommand::NOTE noteMax; // Maximum note index (index starts from 1) 42 PATTERNINDEX patternsMax; 43 ORDERINDEX ordersMax; 44 SEQUENCEINDEX sequencesMax; 45 CHANNELINDEX channelsMin; // Minimum number of editable channels in pattern. 46 CHANNELINDEX channelsMax; // Maximum number of editable channels in pattern. 47 uint32 tempoMinInt; 48 uint32 tempoMaxInt; 49 uint32 speedMin; // Minimum ticks per frame 50 uint32 speedMax; // Maximum ticks per frame 51 ROWINDEX patternRowsMin; 52 ROWINDEX patternRowsMax; 53 uint16 modNameLengthMax; // Meaning 'usable letters', possible null character is not included. 54 uint16 sampleNameLengthMax; // Ditto 55 uint16 sampleFilenameLengthMax; // Ditto 56 uint16 instrNameLengthMax; // Ditto 57 uint16 instrFilenameLengthMax; // Ditto 58 uint16 commentLineLengthMax; // not including line break, 0 for unlimited 59 SAMPLEINDEX samplesMax; // Max number of samples == Highest possible sample index 60 INSTRUMENTINDEX instrumentsMax; // Max number of instruments == Highest possible instrument index 61 MixLevels defaultMixLevels; // Default mix levels that are used when creating a new file in this format 62 FlagSet<SongFlags> songFlags; // Supported song flags 63 uint8 MIDIMappingDirectivesMax; // Number of MIDI Mapping directives that the format can store (0 = none) 64 uint8 envelopePointsMax; // Maximum number of points of each envelope 65 bool hasNoteCut; // True if format has note cut (^^). 66 bool hasNoteOff; // True if format has note off (==). 67 bool hasNoteFade; // True if format has note fade (~~). 68 bool hasReleaseNode; // Envelope release node 69 bool hasComments; // True if format has a comments field 70 bool hasIgnoreIndex; // Does "+++" pattern exist? 71 bool hasStopIndex; // Does "---" pattern exist? 72 bool hasRestartPos; // Format has an automatic restart order position 73 bool supportsPlugins; // Format can store plugins 74 bool hasPatternSignatures; // Can patterns have a custom time signature? 75 bool hasPatternNames; // Can patterns have a name? 76 bool hasArtistName; // Can artist name be stored in file? 77 bool hasDefaultResampling; // Can default resampling be saved? (if not, it can still be modified in the GUI but won't set the module as modified) 78 bool hasFractionalTempo; // Are fractional tempos allowed? 79 const char *commands; // An array holding all commands this format supports; commands that are not supported are marked with "?" 80 const char *volcommands; // Ditto, but for volume column GetTempoMinCModSpecifications81 MPT_CONSTEXPRINLINE TEMPO GetTempoMin() const { return TEMPO(tempoMinInt, 0); } GetTempoMaxCModSpecifications82 MPT_CONSTEXPRINLINE TEMPO GetTempoMax() const { return TEMPO(tempoMaxInt, 0); } 83 }; 84 85 86 namespace ModSpecs 87 { 88 extern const CModSpecifications & mptm; 89 extern const CModSpecifications & mod; 90 extern const CModSpecifications & s3m; 91 extern const CModSpecifications & s3mEx; 92 extern const CModSpecifications & xm; 93 extern const CModSpecifications & xmEx; 94 extern const CModSpecifications & it; 95 extern const CModSpecifications & itEx; 96 extern const std::array<const CModSpecifications *, 8> Collection; 97 } 98 99 100 OPENMPT_NAMESPACE_END 101