The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.4KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE 6 technical preview.
  4. Copyright (c) 2020 - Raw Material Software Limited
  5. You may use this code under the terms of the GPL v3
  6. (see www.gnu.org/licenses).
  7. For this technical preview, this file is not subject to commercial licensing.
  8. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  9. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  10. DISCLAIMED.
  11. ==============================================================================
  12. */
  13. namespace juce
  14. {
  15. #if JUCE_USE_LAME_AUDIO_FORMAT || defined (DOXYGEN)
  16. //==============================================================================
  17. /**
  18. An AudioFormat class which can use an installed version of the LAME mp3
  19. encoder to encode a file.
  20. This format can't read MP3s, it just writes them. Internally, the
  21. AudioFormatWriter object that is returned writes the incoming audio data
  22. to a temporary WAV file, and then when the writer is deleted, it invokes
  23. the LAME executable to convert the data to an MP3, whose data is then
  24. piped into the original OutputStream that was used when first creating
  25. the writer.
  26. @see AudioFormat
  27. @tags{Audio}
  28. */
  29. class JUCE_API LAMEEncoderAudioFormat : public AudioFormat
  30. {
  31. public:
  32. /** Creates a LAMEEncoderAudioFormat that expects to find a working LAME
  33. executable at the location given.
  34. */
  35. LAMEEncoderAudioFormat (const File& lameExecutableToUse);
  36. ~LAMEEncoderAudioFormat();
  37. bool canHandleFile (const File&);
  38. Array<int> getPossibleSampleRates();
  39. Array<int> getPossibleBitDepths();
  40. bool canDoStereo();
  41. bool canDoMono();
  42. bool isCompressed();
  43. StringArray getQualityOptions();
  44. AudioFormatReader* createReaderFor (InputStream*, bool deleteStreamIfOpeningFails);
  45. AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse,
  46. unsigned int numberOfChannels, int bitsPerSample,
  47. const StringPairArray& metadataValues, int qualityOptionIndex);
  48. using AudioFormat::createWriterFor;
  49. private:
  50. File lameApp;
  51. class Writer;
  52. JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LAMEEncoderAudioFormat)
  53. };
  54. #endif
  55. } // namespace juce