OutputSettings.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. /*
  2. * OutputSettings.h - Stores the settings for file rendering
  3. *
  4. * Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  5. * Copyright (c) 2017 Michael Gregorius <michael.gregorius.git/at/arcor[dot]de>
  6. *
  7. * This file is part of LMMS - https://lmms.io
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public
  20. * License along with this program (see COPYING); if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  22. * Boston, MA 02110-1301 USA.
  23. *
  24. */
  25. #ifndef OUTPUT_SETTINGS_H
  26. #define OUTPUT_SETTINGS_H
  27. #include "lmms_basics.h"
  28. class OutputSettings
  29. {
  30. public:
  31. enum BitDepth
  32. {
  33. Depth_16Bit,
  34. Depth_24Bit,
  35. Depth_32Bit,
  36. NumDepths
  37. };
  38. enum StereoMode
  39. {
  40. StereoMode_Stereo,
  41. StereoMode_JointStereo,
  42. StereoMode_Mono
  43. };
  44. class BitRateSettings
  45. {
  46. public:
  47. BitRateSettings(bitrate_t bitRate, bool isVariableBitRate) :
  48. m_bitRate(bitRate),
  49. m_isVariableBitRate(isVariableBitRate)
  50. {}
  51. bool isVariableBitRate() const { return m_isVariableBitRate; }
  52. void setVariableBitrate(bool variableBitRate = true) { m_isVariableBitRate = variableBitRate; }
  53. bitrate_t getBitRate() const { return m_bitRate; }
  54. void setBitRate(bitrate_t bitRate) { m_bitRate = bitRate; }
  55. private:
  56. bitrate_t m_bitRate;
  57. bool m_isVariableBitRate;
  58. };
  59. public:
  60. OutputSettings( sample_rate_t sampleRate,
  61. BitRateSettings const & bitRateSettings,
  62. BitDepth bitDepth,
  63. StereoMode stereoMode ) :
  64. m_sampleRate(sampleRate),
  65. m_bitRateSettings(bitRateSettings),
  66. m_bitDepth(bitDepth),
  67. m_stereoMode(stereoMode),
  68. m_compressionLevel(0.625) // 5/8
  69. {
  70. }
  71. OutputSettings( sample_rate_t sampleRate,
  72. BitRateSettings const & bitRateSettings,
  73. BitDepth bitDepth ) :
  74. OutputSettings(sampleRate, bitRateSettings, bitDepth, StereoMode_Stereo )
  75. {
  76. }
  77. sample_rate_t getSampleRate() const { return m_sampleRate; }
  78. void setSampleRate(sample_rate_t sampleRate) { m_sampleRate = sampleRate; }
  79. BitRateSettings const & getBitRateSettings() const { return m_bitRateSettings; }
  80. void setBitRateSettings(BitRateSettings const & bitRateSettings) { m_bitRateSettings = bitRateSettings; }
  81. BitDepth getBitDepth() const { return m_bitDepth; }
  82. void setBitDepth(BitDepth bitDepth) { m_bitDepth = bitDepth; }
  83. StereoMode getStereoMode() const { return m_stereoMode; }
  84. void setStereoMode(StereoMode stereoMode) { m_stereoMode = stereoMode; }
  85. double getCompressionLevel() const{ return m_compressionLevel; }
  86. void setCompressionLevel(double level){
  87. // legal range is 0.0 to 1.0.
  88. m_compressionLevel = level;
  89. }
  90. private:
  91. sample_rate_t m_sampleRate;
  92. BitRateSettings m_bitRateSettings;
  93. BitDepth m_bitDepth;
  94. StereoMode m_stereoMode;
  95. double m_compressionLevel;
  96. };
  97. #endif