JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins

« « « Anklang Documentation
Loading...
Searching...
No Matches
juce_AudioFormat.cpp
Go to the documentation of this file.
1 /*
2 ==============================================================================
3
4 This file is part of the JUCE library.
5 Copyright (c) 2022 - Raw Material Software Limited
6
7 JUCE is an open source library subject to commercial or open-source
8 licensing.
9
10 By using JUCE, you agree to the terms of both the JUCE 7 End-User License
11 Agreement and JUCE Privacy Policy.
12
13 End User License Agreement: www.juce.com/juce-7-licence
14 Privacy Policy: www.juce.com/juce-privacy-policy
15
16 Or: You may also use this code under the terms of the GPL v3 (see
17 www.gnu.org/licenses).
18
19 JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
20 EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
21 DISCLAIMED.
22
23 ==============================================================================
24*/
25
26namespace juce
27{
28
30 : formatName (name), fileExtensions (extensions)
31{
32}
33
35 : formatName (name.text), fileExtensions (StringArray::fromTokens (extensions, false))
36{
37}
38
42
44{
45 for (auto& e : getFileExtensions())
46 if (f.hasFileExtension (e))
47 return true;
48
49 return false;
50}
51
52const String& AudioFormat::getFormatName() const { return formatName; }
53StringArray AudioFormat::getFileExtensions() const { return fileExtensions; }
54bool AudioFormat::isCompressed() { return false; }
56
61
63{
64 delete fin;
65 return nullptr;
66}
67
75
77 double sampleRateToUse,
78 const AudioChannelSet& channelLayout,
79 int bitsPerSample,
80 const StringPairArray& metadataValues,
82{
83 if (isChannelLayoutSupported (channelLayout))
85 static_cast<unsigned int> (channelLayout.size()),
86 bitsPerSample, metadataValues, qualityOptionIndex);
87
88 return nullptr;
89}
90
91} // namespace juce
Represents a set of audio channel types.
int size() const noexcept
Returns the number of channels in the set.
static AudioChannelSet JUCE_CALLTYPE mono()
Creates a one-channel mono set (centre).
static AudioChannelSet JUCE_CALLTYPE stereo()
Creates a set containing a stereo set (left, right).
Writes samples to an audio file stream.
virtual StringArray getFileExtensions() const
Returns all the file extensions that might apply to a file of this format.
virtual bool isChannelLayoutSupported(const AudioChannelSet &channelSet)
Returns true if the channel layout is supported by this format.
virtual MemoryMappedAudioFormatReader * createMemoryMappedReader(const File &file)
Attempts to create a MemoryMappedAudioFormatReader, if possible for this format.
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.
virtual bool canDoStereo()=0
Returns true if the format can do 2-channel audio.
virtual StringArray getQualityOptions()
Returns a list of different qualities that can be used when writing.
virtual bool canDoMono()=0
Returns true if the format can do 1-channel audio.
virtual bool canHandleFile(const File &fileToTest)
Returns true if this the given file can be read by this format.
AudioFormat(String formatName, StringArray fileExtensions)
Creates an AudioFormat object.
virtual ~AudioFormat()
Destructor.
const String & getFormatName() const
Returns the name of this format.
virtual bool isCompressed()
Returns true if the format uses compressed data.
An input stream that reads from a local file.
Represents a local file or directory.
Definition juce_File.h:45
bool hasFileExtension(StringRef extensionToTest) const
Checks whether the file has a given extension.
A specialised type of AudioFormatReader that uses a MemoryMappedFile to read directly from an audio f...
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.
A simple class for holding temporary references to a string literal or String.
The JUCE String class!
Definition juce_String.h:53
JUCE Namespace.
Type unalignedPointerCast(void *ptr) noexcept
Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes ar...
Definition juce_Memory.h:88