OutputSettings.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. class OutputSettings
  28. {
  29. public:
  30. enum BitDepth
  31. {
  32. Depth_16Bit,
  33. Depth_24Bit,
  34. Depth_32Bit,
  35. NumDepths
  36. };
  37. enum StereoMode
  38. {
  39. StereoMode_Stereo,
  40. StereoMode_JointStereo,
  41. StereoMode_Mono
  42. };
  43. class BitRateSettings
  44. {
  45. public:
  46. BitRateSettings(bitrate_t bitRate, bool isVariableBitRate) :
  47. m_bitRate(bitRate),
  48. m_isVariableBitRate(isVariableBitRate)
  49. {}
  50. bool isVariableBitRate() const { return m_isVariableBitRate; }
  51. void setVariableBitrate(bool variableBitRate = true) { m_isVariableBitRate = variableBitRate; }
  52. bitrate_t getBitRate() const { return m_bitRate; }
  53. void setBitRate(bitrate_t bitRate) { m_bitRate = bitRate; }
  54. private:
  55. bitrate_t m_bitRate;
  56. bool m_isVariableBitRate;
  57. };
  58. public:
  59. OutputSettings( sample_rate_t sampleRate,
  60. BitRateSettings const & bitRateSettings,
  61. BitDepth bitDepth,
  62. StereoMode stereoMode ) :
  63. m_sampleRate(sampleRate),
  64. m_bitRateSettings(bitRateSettings),
  65. m_bitDepth(bitDepth),
  66. m_stereoMode(stereoMode),
  67. m_compressionLevel(0.5)
  68. {
  69. }
  70. OutputSettings( sample_rate_t sampleRate,
  71. BitRateSettings const & bitRateSettings,
  72. BitDepth bitDepth ) :
  73. OutputSettings(sampleRate, bitRateSettings, bitDepth, StereoMode_Stereo )
  74. {
  75. }
  76. sample_rate_t getSampleRate() const { return m_sampleRate; }
  77. void setSampleRate(sample_rate_t sampleRate) { m_sampleRate = sampleRate; }
  78. BitRateSettings const & getBitRateSettings() const { return m_bitRateSettings; }
  79. void setBitRateSettings(BitRateSettings const & bitRateSettings) { m_bitRateSettings = bitRateSettings; }
  80. BitDepth getBitDepth() const { return m_bitDepth; }
  81. void setBitDepth(BitDepth bitDepth) { m_bitDepth = bitDepth; }
  82. StereoMode getStereoMode() const { return m_stereoMode; }
  83. void setStereoMode(StereoMode stereoMode) { m_stereoMode = stereoMode; }
  84. double getCompressionLevel() const{ return m_compressionLevel; }
  85. void setCompressionLevel(double level){
  86. // legal range is 0.0 to 1.0.
  87. m_compressionLevel = level;
  88. }
  89. private:
  90. sample_rate_t m_sampleRate;
  91. BitRateSettings m_bitRateSettings;
  92. BitDepth m_bitDepth;
  93. StereoMode m_stereoMode;
  94. double m_compressionLevel;
  95. };
  96. #endif