AudioFileWave.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * AudioFileWave.h - AudioDevice which encodes wave-stream and writes it
  3. * into a WAVE-file. This is used for song-export.
  4. *
  5. * Copyright (c) 2004-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net>
  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 AUDIO_FILE_WAVE_H
  26. #define AUDIO_FILE_WAVE_H
  27. #include "lmmsconfig.h"
  28. #include "AudioFileDevice.h"
  29. #include <sndfile.h>
  30. class AudioFileWave : public AudioFileDevice
  31. {
  32. public:
  33. AudioFileWave( OutputSettings const & outputSettings,
  34. const ch_cnt_t channels,
  35. bool & successful,
  36. const QString & file,
  37. Mixer* mixer );
  38. virtual ~AudioFileWave();
  39. static AudioFileDevice * getInst( const QString & outputFilename,
  40. OutputSettings const & outputSettings,
  41. const ch_cnt_t channels,
  42. Mixer* mixer,
  43. bool & successful )
  44. {
  45. return new AudioFileWave( outputSettings, channels, successful,
  46. outputFilename, mixer );
  47. }
  48. private:
  49. virtual void writeBuffer( const surroundSampleFrame * _ab,
  50. const fpp_t _frames,
  51. float _master_gain );
  52. bool startEncoding();
  53. void finishEncoding();
  54. private:
  55. SF_INFO m_si;
  56. SNDFILE * m_sf;
  57. } ;
  58. #endif