1
0

StreamEncoderSettings.cpp 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /*
  2. * StreamEncoderSettings.cpp
  3. * -------------------------
  4. * Purpose: Exporting streamed music files.
  5. * Notes : none
  6. * Authors: Joern Heusipp
  7. * OpenMPT Devs
  8. * The OpenMPT source code is released under the BSD license. Read LICENSE for more details.
  9. */
  10. #include "stdafx.h"
  11. #include "StreamEncoderSettings.h"
  12. #include "TrackerSettings.h"
  13. OPENMPT_NAMESPACE_BEGIN
  14. static mpt::ustring GetDefaultYear()
  15. {
  16. return mpt::ToUnicode(CTime::GetCurrentTime().Format(_T("%Y")));
  17. }
  18. StoredTags::StoredTags(SettingsContainer &conf)
  19. : artist(conf, U_("Export"), U_("TagArtist"), TrackerSettings::Instance().defaultArtist)
  20. , album(conf, U_("Export"), U_("TagAlbum"), U_(""))
  21. , trackno(conf, U_("Export"), U_("TagTrackNo"), U_(""))
  22. , year(conf, U_("Export"), U_("TagYear"), GetDefaultYear())
  23. , url(conf, U_("Export"), U_("TagURL"), U_(""))
  24. , genre(conf, U_("Export"), U_("TagGenre"), U_(""))
  25. {
  26. return;
  27. }
  28. EncoderSettingsConf::EncoderSettingsConf(SettingsContainer &conf, const mpt::ustring &encoderName, bool cues, bool tags, uint32 samplerate, uint16 channels, Encoder::Mode mode, int bitrate, float quality, Encoder::Format format, int dither)
  29. : Cues(conf, U_("Export"), encoderName + U_("_") + U_("Cues"), cues)
  30. , Tags(conf, U_("Export"), encoderName + U_("_") + U_("Tags"), tags)
  31. , Samplerate(conf, U_("Export"), encoderName + U_("_") + U_("Samplerate"), samplerate)
  32. , Channels(conf, U_("Export"), encoderName + U_("_") + U_("Channels"), channels)
  33. , Mode(conf, U_("Export"), encoderName + U_("_") + U_("Mode"), mode)
  34. , Bitrate(conf, U_("Export"), encoderName + U_("_") + U_("Bitrate"), bitrate)
  35. , Quality(conf, U_("Export"), encoderName + U_("_") + U_("Quality"), quality)
  36. , Format2(conf, U_("Export"), encoderName + U_("_") + U_("Format2"), format)
  37. , Dither(conf, U_("Export"), encoderName + U_("_") + U_("Dither"), dither)
  38. {
  39. return;
  40. }
  41. EncoderSettingsConf::operator Encoder::Settings() const
  42. {
  43. Encoder::Settings result;
  44. result.Cues = Cues;
  45. result.Tags = Tags;
  46. result.Samplerate = Samplerate;
  47. result.Channels = Channels;
  48. result.Mode = Mode;
  49. result.Bitrate = Bitrate;
  50. result.Quality = Quality;
  51. result.Format = Format2;
  52. result.Dither = Dither;
  53. return result;
  54. }
  55. StreamEncoderSettingsConf::StreamEncoderSettingsConf(SettingsContainer &conf, const mpt::ustring &section)
  56. : FLACCompressionLevel(conf, section, U_("FLACCompressionLevel"), Encoder::StreamSettings().FLACCompressionLevel)
  57. , AUPaddingAlignHint(conf, section, U_("AUPaddingAlignHint"), Encoder::StreamSettings().AUPaddingAlignHint)
  58. , MP3ID3v2MinPadding(conf, section, U_("MP3ID3v2MinPadding"), Encoder::StreamSettings().MP3ID3v2MinPadding)
  59. , MP3ID3v2PaddingAlignHint(conf, section, U_("MP3ID3v2PaddingAlignHint"), Encoder::StreamSettings().MP3ID3v2PaddingAlignHint)
  60. , MP3ID3v2WriteReplayGainTXXX(conf, section, U_("MP3ID3v2WriteReplayGainTXXX"), Encoder::StreamSettings().MP3ID3v2WriteReplayGainTXXX)
  61. , MP3LameQuality(conf, section, U_("MP3LameQuality"), Encoder::StreamSettings().MP3LameQuality)
  62. , MP3LameID3v2UseLame(conf, section, U_("MP3LameID3v2UseLame"), Encoder::StreamSettings().MP3LameID3v2UseLame)
  63. , MP3LameCalculateReplayGain(conf, section, U_("MP3LameCalculateReplayGain"), Encoder::StreamSettings().MP3LameCalculateReplayGain)
  64. , MP3LameCalculatePeakSample(conf, section, U_("MP3LameCalculatePeakSample"), Encoder::StreamSettings().MP3LameCalculatePeakSample)
  65. , OpusComplexity(conf, section, U_("OpusComplexity"), Encoder::StreamSettings().OpusComplexity)
  66. {
  67. return;
  68. }
  69. StreamEncoderSettingsConf::operator Encoder::StreamSettings() const
  70. {
  71. Encoder::StreamSettings result;
  72. result.FLACCompressionLevel = FLACCompressionLevel;
  73. result.AUPaddingAlignHint = AUPaddingAlignHint;
  74. result.MP3ID3v2MinPadding = MP3ID3v2MinPadding;
  75. result.MP3ID3v2PaddingAlignHint = MP3ID3v2PaddingAlignHint;
  76. result.MP3ID3v2WriteReplayGainTXXX = MP3ID3v2WriteReplayGainTXXX;
  77. result.MP3LameQuality = MP3LameQuality;
  78. result.MP3LameID3v2UseLame = MP3LameID3v2UseLame;
  79. result.MP3LameCalculateReplayGain = MP3LameCalculateReplayGain;
  80. result.MP3LameCalculatePeakSample = MP3LameCalculatePeakSample;
  81. result.OpusComplexity = OpusComplexity;
  82. return result;
  83. }
  84. OPENMPT_NAMESPACE_END