mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
New class: WindowsMediaAudioFormat.
This commit is contained in:
parent
dc78a37f46
commit
38eb7f8a5b
58 changed files with 583 additions and 164 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_audio_basics",
|
||||
"name": "JUCE audio and midi data classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for audio buffer manipulation, midi message handling, synthesis, etc",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_audio_devices",
|
||||
"name": "JUCE audio and midi I/O device classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes to play and record from audio and midi i/o devices.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
static const char* const aiffFormatName = "AIFF file";
|
||||
static const char* const aiffExtensions[] = { ".aiff", ".aif", 0 };
|
||||
|
|
@ -719,5 +717,3 @@ AudioFormatWriter* AiffAudioFormat::createWriterFor (OutputStream* out,
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
|
||||
#define __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
|
||||
|
||||
#include "../format/juce_AudioFormat.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Reads and Writes AIFF format audio files.
|
||||
|
|
@ -70,6 +64,3 @@ public:
|
|||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(AiffAudioFormat);
|
||||
};
|
||||
|
||||
|
||||
#endif // __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
namespace
|
||||
{
|
||||
|
|
@ -260,6 +258,4 @@ AudioFormatWriter* CoreAudioFormat::createWriterFor (OutputStream* streamToWrite
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,11 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_COREAUDIOFORMAT_JUCEHEADER__
|
||||
#define __JUCE_COREAUDIOFORMAT_JUCEHEADER__
|
||||
|
||||
#include "../format/juce_AudioFormat.h"
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -71,4 +66,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
#endif // __JUCE_COREAUDIOFORMAT_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
|
||||
#if JUCE_USE_FLAC
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
namespace FlacNamespace
|
||||
{
|
||||
#if JUCE_INCLUDE_FLAC_CODE || ! defined (JUCE_INCLUDE_FLAC_CODE)
|
||||
|
|
@ -535,6 +533,4 @@ StringArray FlacAudioFormat::getQualityOptions()
|
|||
return StringArray (options);
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,14 +23,8 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
|
||||
#define __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
|
||||
|
||||
#include "../format/juce_AudioFormat.h"
|
||||
|
||||
#if JUCE_USE_FLAC || defined (DOXYGEN)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Reads and writes the lossless-compression FLAC audio format.
|
||||
|
|
@ -70,4 +64,3 @@ private:
|
|||
|
||||
|
||||
#endif
|
||||
#endif // __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@
|
|||
*/
|
||||
#if JUCE_USE_MP3AUDIOFORMAT
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
namespace MP3Decoder
|
||||
{
|
||||
|
||||
|
|
@ -3168,5 +3166,4 @@ AudioFormatWriter* MP3AudioFormat::createWriterFor (OutputStream*, double /*samp
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,27 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-11 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online 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.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#if JUCE_USE_MP3AUDIOFORMAT
|
||||
|
||||
|
|
|
|||
|
|
@ -29,8 +29,6 @@
|
|||
#define __MACOSX__ 1
|
||||
#endif
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
namespace OggVorbisNamespace
|
||||
{
|
||||
#if JUCE_INCLUDE_OGGVORBIS_CODE || ! defined (JUCE_INCLUDE_OGGVORBIS_CODE)
|
||||
|
|
@ -483,6 +481,4 @@ int OggVorbisAudioFormat::estimateOggFileQuality (const File& source)
|
|||
return 1;
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,14 +23,8 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
|
||||
#define __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
|
||||
|
||||
#include "../format/juce_AudioFormat.h"
|
||||
|
||||
#if JUCE_USE_OGGVORBIS || defined (DOXYGEN)
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Reads and writes the Ogg-Vorbis audio format.
|
||||
|
|
@ -90,4 +84,3 @@ private:
|
|||
|
||||
|
||||
#endif
|
||||
#endif // __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#if JUCE_QUICKTIME && ! (JUCE_64BIT || JUCE_IOS)
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
||||
#if ! JUCE_WINDOWS
|
||||
#define Point CarbonDummyPointName // (workaround to avoid definition of "Point" by old Carbon headers)
|
||||
#define Component CarbonDummyCompName
|
||||
|
|
@ -382,6 +384,4 @@ AudioFormatWriter* QuickTimeAudioFormat::createWriterFor (OutputStream* /*stream
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -23,13 +23,8 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
|
||||
#define __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
|
||||
|
||||
#include "../format/juce_AudioFormat.h"
|
||||
#if JUCE_QUICKTIME
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Uses QuickTime to read the audio track a movie or media file.
|
||||
|
|
@ -73,4 +68,3 @@ private:
|
|||
|
||||
|
||||
#endif
|
||||
#endif // __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
static const char* const wavFormatName = "WAV file";
|
||||
static const char* const wavExtensions[] = { ".wav", ".bwf", 0 };
|
||||
|
|
@ -1100,6 +1098,3 @@ bool WavAudioFormat::replaceMetadataInFile (const File& wavFile, const StringPai
|
|||
|
||||
return slowCopyWavFileWithNewMetadata (wavFile, newMetadata);
|
||||
}
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,12 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
|
||||
#define __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
|
||||
|
||||
#include "../format/juce_AudioFormat.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Reads and Writes WAV format audio files.
|
||||
|
|
@ -147,6 +141,3 @@ public:
|
|||
private:
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WavAudioFormat);
|
||||
};
|
||||
|
||||
|
||||
#endif // __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
|
||||
|
|
|
|||
|
|
@ -0,0 +1,330 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-11 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online 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.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
|
||||
namespace WindowsMediaCodec
|
||||
{
|
||||
|
||||
class JuceIStream : public ComBaseClassHelper <IStream>
|
||||
{
|
||||
public:
|
||||
JuceIStream (InputStream& source_) noexcept
|
||||
: source (source_)
|
||||
{
|
||||
resetReferenceCount();
|
||||
}
|
||||
|
||||
JUCE_COMRESULT Commit (DWORD) { return S_OK; }
|
||||
JUCE_COMRESULT Write (void const*, ULONG, ULONG*) { return E_NOTIMPL; }
|
||||
JUCE_COMRESULT Clone (IStream**) { return E_NOTIMPL; }
|
||||
JUCE_COMRESULT SetSize (ULARGE_INTEGER) { return E_NOTIMPL; }
|
||||
JUCE_COMRESULT Revert() { return E_NOTIMPL; }
|
||||
JUCE_COMRESULT LockRegion (ULARGE_INTEGER, ULARGE_INTEGER, DWORD) { return E_NOTIMPL; }
|
||||
JUCE_COMRESULT UnlockRegion (ULARGE_INTEGER, ULARGE_INTEGER, DWORD) { return E_NOTIMPL; }
|
||||
|
||||
JUCE_COMRESULT Read (void* dest, ULONG numBytes, ULONG* bytesRead)
|
||||
{
|
||||
const int numRead = source.read (dest, numBytes);
|
||||
|
||||
if (bytesRead != nullptr)
|
||||
*bytesRead = numRead;
|
||||
|
||||
return numRead == (int) numBytes ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT Seek (LARGE_INTEGER position, DWORD origin, ULARGE_INTEGER* resultPosition)
|
||||
{
|
||||
int64 newPos = (int64) position.QuadPart;
|
||||
|
||||
if (origin == STREAM_SEEK_CUR)
|
||||
{
|
||||
newPos += source.getPosition();
|
||||
}
|
||||
else if (origin == STREAM_SEEK_END)
|
||||
{
|
||||
const int64 len = source.getTotalLength();
|
||||
if (len < 0)
|
||||
return E_NOTIMPL;
|
||||
|
||||
newPos += len;
|
||||
}
|
||||
|
||||
if (resultPosition != nullptr)
|
||||
resultPosition->QuadPart = newPos;
|
||||
|
||||
return source.setPosition (newPos) ? S_OK : E_NOTIMPL;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT CopyTo (IStream* destStream, ULARGE_INTEGER numBytesToDo,
|
||||
ULARGE_INTEGER* bytesRead, ULARGE_INTEGER* bytesWritten)
|
||||
{
|
||||
uint64 totalCopied = 0;
|
||||
int64 numBytes = numBytesToDo.QuadPart;
|
||||
|
||||
while (numBytes > 0 && ! source.isExhausted())
|
||||
{
|
||||
char buffer [1024];
|
||||
|
||||
const int numToCopy = (int) jmin ((int64) sizeof (buffer), (int64) numBytes);
|
||||
const int numRead = source.read (buffer, numToCopy);
|
||||
|
||||
if (numRead <= 0)
|
||||
break;
|
||||
|
||||
destStream->Write (buffer, numRead, nullptr);
|
||||
totalCopied += numRead;
|
||||
}
|
||||
|
||||
if (bytesRead != nullptr) bytesRead->QuadPart = totalCopied;
|
||||
if (bytesWritten != nullptr) bytesWritten->QuadPart = totalCopied;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
JUCE_COMRESULT Stat (STATSTG* stat, DWORD)
|
||||
{
|
||||
if (stat == nullptr)
|
||||
return STG_E_INVALIDPOINTER;
|
||||
|
||||
zerostruct (*stat);
|
||||
stat->type = STGTY_STREAM;
|
||||
stat->cbSize.QuadPart = jmax ((int64) 0, source.getTotalLength());
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
InputStream& source;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (JuceIStream);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
static const char* wmFormatName = "Windows Media";
|
||||
static const char* const extensions[] = { ".mp3", ".wmv", ".asf", 0 };
|
||||
|
||||
//==============================================================================
|
||||
class WMAudioReader : public AudioFormatReader
|
||||
{
|
||||
public:
|
||||
WMAudioReader (InputStream* const input_)
|
||||
: AudioFormatReader (input_, TRANS (wmFormatName)),
|
||||
ok (false),
|
||||
wmvCoreLib ("Wmvcore.dll"),
|
||||
currentPosition (0),
|
||||
bufferStart (0), bufferEnd (0)
|
||||
{
|
||||
typedef HRESULT (*WMCreateSyncReaderType) (IUnknown*, DWORD, IWMSyncReader**);
|
||||
WMCreateSyncReaderType wmCreateSyncReader = nullptr;
|
||||
wmCreateSyncReader = (WMCreateSyncReaderType) wmvCoreLib.getFunction ("WMCreateSyncReader");
|
||||
|
||||
if (wmCreateSyncReader != nullptr)
|
||||
{
|
||||
HRESULT hr = wmCreateSyncReader (nullptr, WMT_RIGHT_PLAYBACK, wmSyncReader.resetAndGetPointerAddress());
|
||||
hr = wmSyncReader->OpenStream (new JuceIStream (*input));
|
||||
hr = wmSyncReader->SetReadStreamSamples (0, false);
|
||||
|
||||
scanFileForDetails();
|
||||
ok = sampleRate > 0;
|
||||
}
|
||||
}
|
||||
|
||||
~WMAudioReader()
|
||||
{
|
||||
if (wmSyncReader != nullptr)
|
||||
{
|
||||
wmSyncReader->Close();
|
||||
wmSyncReader = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool readSamples (int** destSamples, int numDestChannels, int startOffsetInDestBuffer,
|
||||
int64 startSampleInFile, int numSamples)
|
||||
{
|
||||
if (! ok)
|
||||
return false;
|
||||
|
||||
if (startSampleInFile != currentPosition)
|
||||
{
|
||||
currentPosition = startSampleInFile;
|
||||
wmSyncReader->SetRange (((QWORD) startSampleInFile * 10000000) / sampleRate, 0);
|
||||
bufferStart = bufferEnd = 0;
|
||||
}
|
||||
|
||||
while (numSamples > 0)
|
||||
{
|
||||
if (bufferEnd <= bufferStart)
|
||||
{
|
||||
INSSBuffer* sampleBuffer = nullptr;
|
||||
QWORD sampleTime, duration;
|
||||
DWORD flags, outputNum;
|
||||
WORD streamNum;
|
||||
|
||||
HRESULT hr = wmSyncReader->GetNextSample (0, &sampleBuffer, &sampleTime,
|
||||
&duration, &flags, &outputNum, &streamNum);
|
||||
|
||||
if (SUCCEEDED (hr))
|
||||
{
|
||||
BYTE* rawData = nullptr;
|
||||
DWORD dataLength = 0;
|
||||
hr = sampleBuffer->GetBufferAndLength (&rawData, &dataLength);
|
||||
jassert (SUCCEEDED (hr));
|
||||
|
||||
bufferStart = 0;
|
||||
bufferEnd = (int) dataLength;
|
||||
|
||||
if (bufferEnd <= 0)
|
||||
return false;
|
||||
|
||||
buffer.ensureSize (bufferEnd);
|
||||
memcpy (buffer.getData(), rawData, bufferEnd);
|
||||
}
|
||||
else
|
||||
{
|
||||
bufferStart = 0;
|
||||
bufferEnd = 512;
|
||||
buffer.ensureSize (bufferEnd);
|
||||
buffer.fillWith (0);
|
||||
}
|
||||
}
|
||||
|
||||
const int stride = numChannels * sizeof (int16);
|
||||
const int16* const rawData = static_cast <const int16*> (addBytesToPointer (buffer.getData(), bufferStart));
|
||||
const int numToDo = jmin (numSamples, (bufferEnd - bufferStart) / stride);
|
||||
|
||||
for (int i = 0; i < numDestChannels; ++i)
|
||||
{
|
||||
jassert (destSamples[i] != nullptr);
|
||||
|
||||
const int srcChan = jmin (i, (int) numChannels - 1);
|
||||
const int16* src = rawData + srcChan;
|
||||
int* const dst = destSamples[i] + startOffsetInDestBuffer;
|
||||
|
||||
for (int j = 0; j < numToDo; ++j)
|
||||
{
|
||||
dst[j] = ((uint32) *src) << 16;
|
||||
src += numChannels;
|
||||
}
|
||||
}
|
||||
|
||||
bufferStart += numToDo * stride;
|
||||
startOffsetInDestBuffer += numToDo;
|
||||
numSamples -= numToDo;
|
||||
currentPosition += numToDo;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
|
||||
private:
|
||||
DynamicLibrary wmvCoreLib;
|
||||
ComSmartPtr<IWMSyncReader> wmSyncReader;
|
||||
int64 currentPosition;
|
||||
MemoryBlock buffer;
|
||||
int bufferStart, bufferEnd;
|
||||
|
||||
void scanFileForDetails()
|
||||
{
|
||||
ComSmartPtr<IWMHeaderInfo> wmHeaderInfo;
|
||||
HRESULT hr = wmSyncReader.QueryInterface (wmHeaderInfo);
|
||||
|
||||
QWORD lengthInNanoseconds = 0;
|
||||
WORD lengthOfLength = sizeof (lengthInNanoseconds);
|
||||
WORD wmStreamNum = 0;
|
||||
WMT_ATTR_DATATYPE wmAttrDataType;
|
||||
hr = wmHeaderInfo->GetAttributeByName (&wmStreamNum, L"Duration", &wmAttrDataType,
|
||||
(BYTE*) &lengthInNanoseconds, &lengthOfLength);
|
||||
|
||||
ComSmartPtr<IWMStreamConfig> wmStreamConfig;
|
||||
ComSmartPtr<IWMProfile> wmProfile;
|
||||
hr = wmSyncReader.QueryInterface (wmProfile);
|
||||
hr = wmProfile->GetStream (0, wmStreamConfig.resetAndGetPointerAddress());
|
||||
|
||||
ComSmartPtr<IWMMediaProps> wmMediaProperties;
|
||||
hr = wmStreamConfig.QueryInterface (wmMediaProperties);
|
||||
|
||||
DWORD sizeMediaType;
|
||||
hr = wmMediaProperties->GetMediaType (0, &sizeMediaType);
|
||||
|
||||
HeapBlock<WM_MEDIA_TYPE> mediaType;
|
||||
mediaType.malloc (sizeMediaType, 1);
|
||||
hr = wmMediaProperties->GetMediaType (mediaType, &sizeMediaType);
|
||||
|
||||
if (mediaType->majortype == WMMEDIATYPE_Audio)
|
||||
{
|
||||
const WAVEFORMATEX* const inputFormat = reinterpret_cast<WAVEFORMATEX*> (mediaType->pbFormat);
|
||||
|
||||
sampleRate = inputFormat->nSamplesPerSec;
|
||||
numChannels = inputFormat->nChannels;
|
||||
bitsPerSample = inputFormat->wBitsPerSample;
|
||||
lengthInSamples = (lengthInNanoseconds * sampleRate) / 10000000;
|
||||
}
|
||||
}
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (WMAudioReader);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
WindowsMediaAudioFormat::WindowsMediaAudioFormat()
|
||||
: AudioFormat (TRANS (WindowsMediaCodec::wmFormatName), StringArray (WindowsMediaCodec::extensions))
|
||||
{
|
||||
}
|
||||
|
||||
WindowsMediaAudioFormat::~WindowsMediaAudioFormat() {}
|
||||
|
||||
Array<int> WindowsMediaAudioFormat::getPossibleSampleRates() { return Array<int>(); }
|
||||
Array<int> WindowsMediaAudioFormat::getPossibleBitDepths() { return Array<int>(); }
|
||||
|
||||
bool WindowsMediaAudioFormat::canDoStereo() { return true; }
|
||||
bool WindowsMediaAudioFormat::canDoMono() { return true; }
|
||||
|
||||
//==============================================================================
|
||||
AudioFormatReader* WindowsMediaAudioFormat::createReaderFor (InputStream* sourceStream, bool deleteStreamIfOpeningFails)
|
||||
{
|
||||
ScopedPointer<WindowsMediaCodec::WMAudioReader> r (new WindowsMediaCodec::WMAudioReader (sourceStream));
|
||||
|
||||
if (r->ok)
|
||||
return r.release();
|
||||
|
||||
if (! deleteStreamIfOpeningFails)
|
||||
r->input = nullptr;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AudioFormatWriter* WindowsMediaAudioFormat::createWriterFor (OutputStream* /*streamToWriteTo*/, double /*sampleRateToUse*/,
|
||||
unsigned int /*numberOfChannels*/, int /*bitsPerSample*/,
|
||||
const StringPairArray& /*metadataValues*/, int /*qualityOptionIndex*/)
|
||||
{
|
||||
jassertfalse; // not yet implemented!
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-11 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online 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.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
Audio format which uses the Windows Media codecs (Windows only).
|
||||
*/
|
||||
class WindowsMediaAudioFormat : public AudioFormat
|
||||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
WindowsMediaAudioFormat();
|
||||
~WindowsMediaAudioFormat();
|
||||
|
||||
//==============================================================================
|
||||
Array<int> getPossibleSampleRates();
|
||||
Array<int> getPossibleBitDepths();
|
||||
bool canDoStereo();
|
||||
bool canDoMono();
|
||||
|
||||
//==============================================================================
|
||||
AudioFormatReader* createReaderFor (InputStream*, bool deleteStreamIfOpeningFails);
|
||||
|
||||
AudioFormatWriter* createWriterFor (OutputStream*, double sampleRateToUse,
|
||||
unsigned int numberOfChannels, int bitsPerSample,
|
||||
const StringPairArray& metadataValues, int qualityOptionIndex);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -23,8 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
AudioFormat::AudioFormat (const String& name, const StringArray& extensions)
|
||||
: formatName (name),
|
||||
|
|
@ -50,6 +48,3 @@ const String& AudioFormat::getFormatName() const { return formatN
|
|||
const StringArray& AudioFormat::getFileExtensions() const { return fileExtensions; }
|
||||
bool AudioFormat::isCompressed() { return false; }
|
||||
StringArray AudioFormat::getQualityOptions() { return StringArray(); }
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
AudioFormatManager::AudioFormatManager()
|
||||
: defaultFormatIndex (0)
|
||||
|
|
@ -192,6 +190,3 @@ AudioFormatReader* AudioFormatManager::createReaderFor (InputStream* audioFileSt
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
AudioFormatReader::AudioFormatReader (InputStream* const in,
|
||||
const String& formatName_)
|
||||
: sampleRate (0),
|
||||
|
|
@ -389,6 +386,3 @@ int64 AudioFormatReader::searchForLevel (int64 startSample,
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
AudioFormatReaderSource::AudioFormatReaderSource (AudioFormatReader* const reader_,
|
||||
const bool deleteReaderWhenThisIsDeleted)
|
||||
: reader (reader_, deleteReaderWhenThisIsDeleted),
|
||||
|
|
@ -87,5 +84,3 @@ void AudioFormatReaderSource::getNextAudioBlock (const AudioSourceChannelInfo& i
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
AudioFormatWriter::AudioFormatWriter (OutputStream* const out,
|
||||
const String& formatName_,
|
||||
const double rate,
|
||||
|
|
@ -297,5 +294,3 @@ void AudioFormatWriter::ThreadedWriter::setDataReceiver (AudioFormatWriter::Thre
|
|||
{
|
||||
buffer->setDataReceiver (receiver);
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,9 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
AudioSubsectionReader::AudioSubsectionReader (AudioFormatReader* const source_,
|
||||
const int64 startSample_,
|
||||
const int64 length_,
|
||||
|
|
@ -84,5 +81,3 @@ void AudioSubsectionReader::readMaxLevels (int64 startSampleInFile,
|
|||
lowestLeft, highestLeft,
|
||||
lowestRight, highestRight);
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -78,14 +78,21 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include <wmsdk.h>
|
||||
#endif
|
||||
|
||||
//==============================================================================
|
||||
#elif JUCE_ANDROID
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
#if JUCE_ANDROID
|
||||
#include "../juce_core/native/juce_android_JNIHelpers.h"
|
||||
END_JUCE_NAMESPACE
|
||||
#undef JUCE_QUICKTIME
|
||||
#endif
|
||||
|
||||
#if JUCE_WINDOWS
|
||||
#include "../juce_core/native/juce_win32_ComSmartPtr.h"
|
||||
#endif
|
||||
|
||||
// START_AUTOINCLUDE format/*.cpp, sampler/*.cpp, codecs/*.cpp
|
||||
#include "format/juce_AudioFormat.cpp"
|
||||
#include "format/juce_AudioFormatManager.cpp"
|
||||
|
|
@ -101,4 +108,7 @@
|
|||
#include "codecs/juce_OggVorbisAudioFormat.cpp"
|
||||
#include "codecs/juce_QuickTimeAudioFormat.cpp"
|
||||
#include "codecs/juce_WavAudioFormat.cpp"
|
||||
#include "codecs/juce_WindowsMediaAudioFormat.cpp"
|
||||
// END_AUTOINCLUDE
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -85,25 +85,14 @@ BEGIN_JUCE_NAMESPACE
|
|||
#ifndef __JUCE_AUDIOSUBSECTIONREADER_JUCEHEADER__
|
||||
#include "format/juce_AudioSubsectionReader.h"
|
||||
#endif
|
||||
#ifndef __JUCE_AIFFAUDIOFORMAT_JUCEHEADER__
|
||||
#include "codecs/juce_AiffAudioFormat.h"
|
||||
#endif
|
||||
#ifndef __JUCE_COREAUDIOFORMAT_JUCEHEADER__
|
||||
#include "codecs/juce_CoreAudioFormat.h"
|
||||
#endif
|
||||
#ifndef __JUCE_FLACAUDIOFORMAT_JUCEHEADER__
|
||||
#include "codecs/juce_FlacAudioFormat.h"
|
||||
#endif
|
||||
#include "codecs/juce_AiffAudioFormat.h"
|
||||
#include "codecs/juce_CoreAudioFormat.h"
|
||||
#include "codecs/juce_FlacAudioFormat.h"
|
||||
#include "codecs/juce_MP3AudioFormat.h"
|
||||
#ifndef __JUCE_OGGVORBISAUDIOFORMAT_JUCEHEADER__
|
||||
#include "codecs/juce_OggVorbisAudioFormat.h"
|
||||
#endif
|
||||
#ifndef __JUCE_QUICKTIMEAUDIOFORMAT_JUCEHEADER__
|
||||
#include "codecs/juce_QuickTimeAudioFormat.h"
|
||||
#endif
|
||||
#ifndef __JUCE_WAVAUDIOFORMAT_JUCEHEADER__
|
||||
#include "codecs/juce_WavAudioFormat.h"
|
||||
#endif
|
||||
#include "codecs/juce_OggVorbisAudioFormat.h"
|
||||
#include "codecs/juce_QuickTimeAudioFormat.h"
|
||||
#include "codecs/juce_WavAudioFormat.h"
|
||||
#include "codecs/juce_WindowsMediaAudioFormat.h"
|
||||
#ifndef __JUCE_SAMPLER_JUCEHEADER__
|
||||
#include "sampler/juce_Sampler.h"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_audio_formats",
|
||||
"name": "JUCE audio file format codecs",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for reading and writing various audio file formats.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
BEGIN_JUCE_NAMESPACE
|
||||
|
||||
//==============================================================================
|
||||
SamplerSound::SamplerSound (const String& name_,
|
||||
AudioFormatReader& source,
|
||||
|
|
@ -236,5 +234,3 @@ void SamplerVoice::renderNextBlock (AudioSampleBuffer& outputBuffer, int startSa
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
END_JUCE_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_audio_plugin_client",
|
||||
"name": "JUCE audio plugin wrapper classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for building VST, RTAS and AU plugins.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_audio_processors",
|
||||
"name": "JUCE audio plugin hosting classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for loading and playing VST, AU, or internally-generated audio processors.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_audio_utils",
|
||||
"name": "JUCE extra audio utility classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for audio-related GUI and miscellaneous tasks.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_browser_plugin_client",
|
||||
"name": "JUCE browser plugin wrapper classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for building NPAPI and ActiveX browser plugins.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_core",
|
||||
"name": "JUCE core classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "The essential set of basic JUCE classes, as required by all the other JUCE modules. Includes text, container, memory, threading and i/o functionality.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
*/
|
||||
#define JUCE_MAJOR_VERSION 2
|
||||
#define JUCE_MINOR_VERSION 0
|
||||
#define JUCE_BUILDNUMBER 10
|
||||
#define JUCE_BUILDNUMBER 11
|
||||
|
||||
/** Current Juce version number.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_cryptography",
|
||||
"name": "JUCE cryptography classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for various basic cryptography functions, including RSA, Blowfish, MD5, SHA, etc.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_data_structures",
|
||||
"name": "JUCE data model helper classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for undo/redo management, and smart data structures.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_events",
|
||||
"name": "JUCE message and event handling classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for running an application's main event loop and sending/receiving messages, timers, etc.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_graphics",
|
||||
"name": "JUCE graphics classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for 2D vector graphics, image loading/saving, font handling, etc.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_gui_basics",
|
||||
"name": "JUCE GUI core classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Basic user-interface components and related classes.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_gui_extra",
|
||||
"name": "JUCE extended GUI classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Miscellaneous GUI classes for specialised tasks.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_opengl",
|
||||
"name": "JUCE OpenGL classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for rendering OpenGL in a JUCE window.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "juce_video",
|
||||
"name": "JUCE video playback and capture classes",
|
||||
"version": "2.0.10",
|
||||
"version": "2.0.11",
|
||||
"description": "Classes for playing video and capturing camera input.",
|
||||
"website": "http://www.juce.com/juce",
|
||||
"license": "GPL/Commercial",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue