1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
|
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2015 - ROLI Ltd.
Permission is granted to use this software under the terms of either:
a) the GPL v2 (or any later version)
b) the Affero GPL v3
Details of these licenses can be found at: www.gnu.org/licenses
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.juce.com for more information.
==============================================================================
*/
//==============================================================================
/**
Reads and Writes WAV format audio files.
@see AudioFormat
*/
class JUCE_API WavAudioFormat : public AudioFormat
{
public:
//==============================================================================
/** Creates a format object. */
WavAudioFormat();
/** Destructor. */
~WavAudioFormat();
//==============================================================================
/** Metadata property name used by wav readers and writers for adding
a BWAV chunk to the file.
@see AudioFormatReader::metadataValues, createWriterFor
*/
static const char* const bwavDescription;
/** Metadata property name used by wav readers and writers for adding
a BWAV chunk to the file.
@see AudioFormatReader::metadataValues, createWriterFor
*/
static const char* const bwavOriginator;
/** Metadata property name used by wav readers and writers for adding
a BWAV chunk to the file.
@see AudioFormatReader::metadataValues, createWriterFor
*/
static const char* const bwavOriginatorRef;
/** Metadata property name used by wav readers and writers for adding
a BWAV chunk to the file.
Date format is: yyyy-mm-dd
@see AudioFormatReader::metadataValues, createWriterFor
*/
static const char* const bwavOriginationDate;
/** Metadata property name used by wav readers and writers for adding
a BWAV chunk to the file.
Time format is: hh-mm-ss
@see AudioFormatReader::metadataValues, createWriterFor
*/
static const char* const bwavOriginationTime;
/** Metadata property name used by wav readers and writers for adding
a BWAV chunk to the file.
This is the number of samples from the start of an edit that the
file is supposed to begin at. Seems like an obvious mistake to
only allow a file to occur in an edit once, but that's the way
it is..
@see AudioFormatReader::metadataValues, createWriterFor
*/
static const char* const bwavTimeReference;
/** Metadata property name used by wav readers and writers for adding
a BWAV chunk to the file.
@see AudioFormatReader::metadataValues, createWriterFor
*/
static const char* const bwavCodingHistory;
/** Utility function to fill out the appropriate metadata for a BWAV file.
This just makes it easier than using the property names directly, and it
fills out the time and date in the right format.
*/
static StringPairArray createBWAVMetadata (const String& description,
const String& originator,
const String& originatorRef,
const Time dateAndTime,
const int64 timeReferenceSamples,
const String& codingHistory);
//==============================================================================
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidOneShot;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidRootSet;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidStretch;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidDiskBased;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidizerFlag;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidRootNote;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidBeats;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidDenominator;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidNumerator;
/** Metadata property name used when reading a WAV file with an acid chunk. */
static const char* const acidTempo;
//==============================================================================
/** Metadata property name used when reading an ISRC code from an AXML chunk. */
static const char* const ISRC;
/** Metadata property name used when reading a WAV file with a Tracktion chunk. */
static const char* const tracktionLoopInfo;
//==============================================================================
Array<int> getPossibleSampleRates() override;
Array<int> getPossibleBitDepths() override;
bool canDoStereo() override;
bool canDoMono() override;
//==============================================================================
AudioFormatReader* createReaderFor (InputStream* sourceStream,
bool deleteStreamIfOpeningFails) override;
MemoryMappedAudioFormatReader* createMemoryMappedReader (const File& file) override;
AudioFormatWriter* createWriterFor (OutputStream* streamToWriteTo,
double sampleRateToUse,
unsigned int numberOfChannels,
int bitsPerSample,
const StringPairArray& metadataValues,
int qualityOptionIndex) override;
//==============================================================================
/** Utility function to replace the metadata in a wav file with a new set of values.
If possible, this cheats by overwriting just the metadata region of the file, rather
than by copying the whole file again.
*/
bool replaceMetadataInFile (const File& wavFile, const StringPairArray& newMetadata);
private:
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WavAudioFormat)
};
|