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.

81 lines
2.7KB

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