mod_specifications.h 4.7 KB

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