ProjectRenderer.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * ProjectRenderer.h - ProjectRenderer class for easily rendering projects
  3. *
  4. * Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  5. *
  6. * This file is part of LMMS - https://lmms.io
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2 of the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public
  19. * License along with this program (see COPYING); if not, write to the
  20. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  21. * Boston, MA 02110-1301 USA.
  22. *
  23. */
  24. #ifndef PROJECT_RENDERER_H
  25. #define PROJECT_RENDERER_H
  26. #include "AudioFileDevice.h"
  27. #include "lmmsconfig.h"
  28. #include "AudioEngine.h"
  29. #include "OutputSettings.h"
  30. #include "lmms_export.h"
  31. class LMMS_EXPORT ProjectRenderer : public QThread
  32. {
  33. Q_OBJECT
  34. public:
  35. enum ExportFileFormats: int
  36. {
  37. WaveFile,
  38. FlacFile,
  39. OggFile,
  40. MP3File,
  41. NumFileFormats
  42. } ;
  43. struct FileEncodeDevice
  44. {
  45. bool isAvailable() const { return m_getDevInst != nullptr; }
  46. ExportFileFormats m_fileFormat;
  47. const char * m_description;
  48. const char * m_extension;
  49. AudioFileDeviceInstantiaton m_getDevInst;
  50. } ;
  51. ProjectRenderer( const AudioEngine::qualitySettings & _qs,
  52. const OutputSettings & _os,
  53. ExportFileFormats _file_format,
  54. const QString & _out_file );
  55. virtual ~ProjectRenderer();
  56. bool isReady() const
  57. {
  58. return m_fileDev != nullptr;
  59. }
  60. static ExportFileFormats getFileFormatFromExtension(
  61. const QString & _ext );
  62. static QString getFileExtensionFromFormat( ExportFileFormats fmt );
  63. static const FileEncodeDevice fileEncodeDevices[];
  64. public slots:
  65. void startProcessing();
  66. void abortProcessing();
  67. void updateConsoleProgress();
  68. signals:
  69. void progressChanged( int );
  70. private:
  71. void run() override;
  72. AudioFileDevice * m_fileDev;
  73. AudioEngine::qualitySettings m_qualitySettings;
  74. volatile int m_progress;
  75. volatile bool m_abort;
  76. } ;
  77. #endif