Skip to content

Commit

Permalink
(juce library code update)
Browse files Browse the repository at this point in the history
  • Loading branch information
hemmer committed Aug 18, 2012
1 parent dc351df commit a3655e1
Show file tree
Hide file tree
Showing 330 changed files with 12,133 additions and 10,724 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void AudioSampleBuffer::allocateData()
channels [numChannels] = 0;
}

AudioSampleBuffer::AudioSampleBuffer (float** dataToReferTo,
AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo,
const int numChannels_,
const int numSamples) noexcept
: numChannels (numChannels_),
Expand All @@ -73,7 +73,7 @@ AudioSampleBuffer::AudioSampleBuffer (float** dataToReferTo,
allocateChannels (dataToReferTo, 0);
}

AudioSampleBuffer::AudioSampleBuffer (float** dataToReferTo,
AudioSampleBuffer::AudioSampleBuffer (float* const* dataToReferTo,
const int numChannels_,
const int startSample,
const int numSamples) noexcept
Expand All @@ -100,7 +100,7 @@ void AudioSampleBuffer::setDataToReferTo (float** dataToReferTo,
allocateChannels (dataToReferTo, 0);
}

void AudioSampleBuffer::allocateChannels (float** const dataToReferTo, int offset)
void AudioSampleBuffer::allocateChannels (float* const* const dataToReferTo, int offset)
{
// (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools)
if (numChannels < (int) numElementsInArray (preallocatedChannelSpace))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class JUCE_API AudioSampleBuffer
@param numSamples the number of samples to use - this must correspond to the
size of the arrays passed in
*/
AudioSampleBuffer (float** dataToReferTo,
AudioSampleBuffer (float* const* dataToReferTo,
int numChannels,
int numSamples) noexcept;

Expand All @@ -83,7 +83,7 @@ class JUCE_API AudioSampleBuffer
@param numSamples the number of samples to use - this must correspond to the
size of the arrays passed in
*/
AudioSampleBuffer (float** dataToReferTo,
AudioSampleBuffer (float* const* dataToReferTo,
int numChannels,
int startSample,
int numSamples) noexcept;
Expand Down Expand Up @@ -421,7 +421,7 @@ class JUCE_API AudioSampleBuffer
float* preallocatedChannelSpace [32];

void allocateData();
void allocateChannels (float** dataToReferTo, int offset);
void allocateChannels (float* const* dataToReferTo, int offset);

JUCE_LEAK_DETECTOR (AudioSampleBuffer);
};
Expand Down
2 changes: 1 addition & 1 deletion JuceLibraryCode/modules/juce_audio_basics/juce_module_info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "juce_audio_basics",
"name": "JUCE audio and midi data classes",
"version": "2.0.21",
"version": "2.0.25",
"description": "Classes for audio buffer manipulation, midi message handling, synthesis, etc",
"website": "http://www.juce.com/juce",
"license": "GPL/Commercial",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@
Analogous to the AudioSampleBuffer, this holds a set of midi events with
integer time-stamps. The buffer is kept sorted in order of the time-stamps.
If you're working with a sequence of midi events that may need to be manipulated
or read/written to a midi file, then MidiMessageSequence is probably a more
appropriate container. MidiBuffer is designed for lower-level streams of raw
midi data.
@see MidiMessage
*/
class JUCE_API MidiBuffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,8 @@ void MidiFile::readNextTrack (const uint8* data, int size)
MidiFileHelpers::Sorter sorter;
result.list.sort (sorter, true);

result.updateMatchedPairs();

addTrack (result);
tracks.getLast()->updateMatchedPairs();
}

//==============================================================================
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,5 @@ void MidiKeyboardState::addListener (MidiKeyboardStateListener* const listener)
void MidiKeyboardState::removeListener (MidiKeyboardStateListener* const listener)
{
const ScopedLock sl (lock);
listeners.removeValue (listener);
listeners.removeFirstMatchingValue (listener);
}
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,9 @@ bool MidiMessage::isTextMetaEvent() const noexcept

String MidiMessage::getTextFromTextMetaEvent() const
{
return String (reinterpret_cast <const char*> (getMetaEventData()), (size_t) getMetaEventLength());
const char* const textData = reinterpret_cast <const char*> (getMetaEventData());
return String (CharPointer_UTF8 (textData),
CharPointer_UTF8 (textData + getMetaEventLength()));
}

bool MidiMessage::isTrackNameEvent() const noexcept { return (data[1] == 3) && (*data == 0xff); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ void ChannelRemappingAudioSource::getNextAudioBlock (const AudioSourceChannelInf

const int numChans = bufferToFill.buffer->getNumChannels();

int i;
for (i = 0; i < buffer.getNumChannels(); ++i)
for (int i = 0; i < buffer.getNumChannels(); ++i)
{
const int remappedChan = getRemappedInputChannel (i);

Expand All @@ -133,7 +132,7 @@ void ChannelRemappingAudioSource::getNextAudioBlock (const AudioSourceChannelInf

bufferToFill.clearActiveBufferRegion();

for (i = 0; i < requiredNumberOfChannels; ++i)
for (int i = 0; i < requiredNumberOfChannels; ++i)
{
const int remappedChan = getRemappedOutputChannel (i);

Expand All @@ -150,16 +149,14 @@ void ChannelRemappingAudioSource::getNextAudioBlock (const AudioSourceChannelInf
XmlElement* ChannelRemappingAudioSource::createXml() const
{
XmlElement* e = new XmlElement ("MAPPINGS");

String ins, outs;
int i;

const ScopedLock sl (lock);

for (i = 0; i < remappedInputs.size(); ++i)
for (int i = 0; i < remappedInputs.size(); ++i)
ins << remappedInputs.getUnchecked(i) << ' ';

for (i = 0; i < remappedOutputs.size(); ++i)
for (int i = 0; i < remappedOutputs.size(); ++i)
outs << remappedOutputs.getUnchecked(i) << ' ';

e->setAttribute ("inputs", ins.trimEnd());
Expand All @@ -180,11 +177,10 @@ void ChannelRemappingAudioSource::restoreFromXml (const XmlElement& e)
ins.addTokens (e.getStringAttribute ("inputs"), false);
outs.addTokens (e.getStringAttribute ("outputs"), false);

int i;
for (i = 0; i < ins.size(); ++i)
for (int i = 0; i < ins.size(); ++i)
remappedInputs.add (ins[i].getIntValue());

for (i = 0; i < outs.size(); ++i)
for (int i = 0; i < outs.size(); ++i)
remappedOutputs.add (outs[i].getIntValue());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void MixerAudioSource::removeInputSource (AudioSource* const input)
if (inputsToDelete [index])
toDelete = input;

inputsToDelete.shiftBits (index, 1);
inputsToDelete.shiftBits (-1, index);
inputs.remove (index);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,10 @@ void ResamplingAudioSource::getNextAudioBlock (const AudioSourceChannelInfo& inf
for (int m = info.numSamples; --m >= 0;)
{
const float alpha = (float) subSampleOffset;
const float invAlpha = 1.0f - alpha;

for (int channel = 0; channel < channelsToProcess; ++channel)
*destBuffers[channel]++ = srcBuffers[channel][bufferPos] * invAlpha + srcBuffers[channel][nextPos] * alpha;
*destBuffers[channel]++ = srcBuffers[channel][bufferPos]
+ alpha * (srcBuffers[channel][nextPos] - srcBuffers[channel][bufferPos]);

subSampleOffset += localRatio;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ void AudioDeviceManager::removeAudioCallback (AudioIODeviceCallback* callbackToR
const ScopedLock sl (audioCallbackLock);

needsDeinitialising = needsDeinitialising && callbacks.contains (callbackToRemove);
callbacks.removeValue (callbackToRemove);
callbacks.removeFirstMatchingValue (callbackToRemove);
}

if (needsDeinitialising)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ class JUCE_API AudioDeviceManager : public ChangeBroadcaster

/** The current sample rate.
This rate is used for both the input and output devices.
A value of 0 indicates the default rate.
A value of 0 indicates that you don't care what rate is used, and the
device will choose a sensible rate for you.
*/
double sampleRate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ namespace juce
//==============================================================================
#if JUCE_MAC
#include "../juce_core/native/juce_osx_ObjCHelpers.h"
#include "../juce_core/native/juce_mac_ObjCSuffix.h"
#include "native/juce_mac_CoreAudio.cpp"
#include "native/juce_mac_CoreMidi.cpp"

Expand Down
5 changes: 3 additions & 2 deletions JuceLibraryCode/modules/juce_audio_devices/juce_module_info
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "juce_audio_devices",
"name": "JUCE audio and midi I/O device classes",
"version": "2.0.21",
"version": "2.0.25",
"description": "Classes to play and record from audio and midi i/o devices.",
"website": "http://www.juce.com/juce",
"license": "GPL/Commercial",
Expand All @@ -22,5 +22,6 @@
"native/*" ],

"OSXFrameworks": "CoreAudio CoreMIDI DiscRecording",
"iOSFrameworks": "AudioToolbox CoreMIDI"
"iOSFrameworks": "AudioToolbox CoreMIDI",
"LinuxLibs": "asound"
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class IPhoneAudioIODevice : public AudioIODevice

~IPhoneAudioIODevice()
{
getSessionHolder().activeDevices.removeValue (this);
getSessionHolder().activeDevices.removeFirstMatchingValue (this);
close();
}

Expand Down Expand Up @@ -99,8 +99,16 @@ class IPhoneAudioIODevice : public AudioIODevice

AudioSessionSetActive (true);

UInt32 audioCategory = audioInputIsAvailable ? kAudioSessionCategory_PlayAndRecord
: kAudioSessionCategory_MediaPlayback;
UInt32 audioCategory = kAudioSessionCategory_MediaPlayback;

if (numInputChannels > 0 && audioInputIsAvailable)
{
audioCategory = kAudioSessionCategory_PlayAndRecord;

UInt32 allowBluetoothInput = 1;
AudioSessionSetProperty (kAudioSessionProperty_OverrideCategoryEnableBluetoothInput,
sizeof (allowBluetoothInput), &allowBluetoothInput);
}

AudioSessionSetProperty (kAudioSessionProperty_AudioCategory, sizeof (audioCategory), &audioCategory);
AudioSessionAddPropertyListener (kAudioSessionProperty_AudioRouteChange, routingChangedStatic, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
#define JUCE_ALSA_MIDI_OUTPUT_NAME "Juce Midi Output"
#endif

#ifndef JUCE_ALSA_MIDI_INPUT_PORT_NAME
#define JUCE_ALSA_MIDI_INPUT_PORT_NAME "Juce Midi In Port"
#endif

#ifndef JUCE_ALSA_MIDI_OUTPUT_PORT_NAME
#define JUCE_ALSA_MIDI_OUTPUT_PORT_NAME "Juce Midi Out Port"
#endif

//==============================================================================
namespace
{
Expand Down Expand Up @@ -74,7 +82,7 @@ namespace
{
snd_seq_set_client_name (seqHandle, JUCE_ALSA_MIDI_INPUT_NAME);

const int portId = snd_seq_create_simple_port (seqHandle, "Juce Midi In Port",
const int portId = snd_seq_create_simple_port (seqHandle, JUCE_ALSA_MIDI_INPUT_PORT_NAME,
SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE,
SND_SEQ_PORT_TYPE_MIDI_GENERIC);

Expand All @@ -84,7 +92,7 @@ namespace
{
snd_seq_set_client_name (seqHandle, JUCE_ALSA_MIDI_OUTPUT_NAME);

const int portId = snd_seq_create_simple_port (seqHandle, "Juce Midi Out Port",
const int portId = snd_seq_create_simple_port (seqHandle, JUCE_ALSA_MIDI_OUTPUT_PORT_NAME,
SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ,
SND_SEQ_PORT_TYPE_MIDI_GENERIC);

Expand Down
Loading

0 comments on commit a3655e1

Please sign in to comment.