OpenShot Library | OpenShotAudio  0.2.2
juce_LAMEEncoderAudioFormat.h
1 
2 /** @weakgroup juce_audio_formats-codecs
3  * @{
4  */
5 /*
6  ==============================================================================
7 
8  This file is part of the JUCE library.
9  Copyright (c) 2017 - ROLI Ltd.
10 
11  JUCE is an open source library subject to commercial or open-source
12  licensing.
13 
14  By using JUCE, you agree to the terms of both the JUCE 5 End-User License
15  Agreement and JUCE 5 Privacy Policy (both updated and effective as of the
16  27th April 2017).
17 
18  End User License Agreement: www.juce.com/juce-5-licence
19  Privacy Policy: www.juce.com/juce-5-privacy-policy
20 
21  Or: You may also use this code under the terms of the GPL v3 (see
22  www.gnu.org/licenses).
23 
24  JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
25  EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
26  DISCLAIMED.
27 
28  ==============================================================================
29 */
30 
31 namespace juce
32 {
33 
34 #if JUCE_USE_LAME_AUDIO_FORMAT || defined (DOXYGEN)
35 
36 //==============================================================================
37 /**
38  An AudioFormat class which can use an installed version of the LAME mp3
39  encoder to encode a file.
40 
41  This format can't read MP3s, it just writes them. Internally, the
42  AudioFormatWriter object that is returned writes the incoming audio data
43  to a temporary WAV file, and then when the writer is deleted, it invokes
44  the LAME executable to convert the data to an MP3, whose data is then
45  piped into the original OutputStream that was used when first creating
46  the writer.
47 
48  @see AudioFormat
49 
50  @tags{Audio}
51 */
53 {
54 public:
55  /** Creates a LAMEEncoderAudioFormat that expects to find a working LAME
56  executable at the location given.
57  */
58  LAMEEncoderAudioFormat (const File& lameExecutableToUse);
60 
61  bool canHandleFile (const File&);
64  bool canDoStereo();
65  bool canDoMono();
66  bool isCompressed();
68 
69  AudioFormatReader* createReaderFor (InputStream*, bool deleteStreamIfOpeningFails);
70 
71  AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse,
72  unsigned int numberOfChannels, int bitsPerSample,
73  const StringPairArray& metadataValues, int qualityOptionIndex);
75 
76 private:
77  File lameApp;
78  class Writer;
79 
80  JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LAMEEncoderAudioFormat)
81 };
82 
83 #endif
84 
85 } // namespace juce
86 
87 /** @}*/
Reads samples from an audio file stream.
Writes samples to an audio file stream.
Subclasses of AudioFormat are used to read and write different audio file formats.
virtual AudioFormatWriter * createWriterFor(OutputStream *streamToWriteTo, double sampleRateToUse, unsigned int numberOfChannels, int bitsPerSample, const StringPairArray &metadataValues, int qualityOptionIndex)=0
Tries to create an object that can write to a stream with this audio format.
Represents a local file or directory.
Definition: juce_File.h:45
The base class for streams that read data.
An AudioFormat class which can use an installed version of the LAME mp3 encoder to encode a file.
LAMEEncoderAudioFormat(const File &lameExecutableToUse)
Creates a LAMEEncoderAudioFormat that expects to find a working LAME executable at the location given...
bool canDoMono()
Returns true if the format can do 1-channel audio.
bool isCompressed()
Returns true if the format uses compressed data.
Array< int > getPossibleBitDepths()
Returns a set of bit depths that the format can read and write.
Array< int > getPossibleSampleRates()
Returns a set of sample rates that the format can read and write.
AudioFormatReader * createReaderFor(InputStream *, bool deleteStreamIfOpeningFails)
Tries to create an object that can read from a stream containing audio data in this format.
bool canHandleFile(const File &)
Returns true if this the given file can be read by this format.
bool canDoStereo()
Returns true if the format can do 2-channel audio.
StringArray getQualityOptions()
Returns a list of different qualities that can be used when writing.
AudioFormatWriter * createWriterFor(OutputStream *, double sampleRateToUse, unsigned int numberOfChannels, int bitsPerSample, const StringPairArray &metadataValues, int qualityOptionIndex)
Tries to create an object that can write to a stream with this audio format.
The base class for streams that write data to some kind of destination.
A special array for holding a list of strings.
A container for holding a set of strings which are keyed by another string.
#define JUCE_API
This macro is added to all JUCE public class declarations.