1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-04 03:40:07 +00:00
This commit is contained in:
jules 2007-10-16 10:19:26 +00:00
parent 5eea51a781
commit e76fe601bf
3 changed files with 54 additions and 6 deletions

View file

@ -292,9 +292,7 @@ int JUCEApplication::main (int argc, char* argv[],
void JUCEApplication::actionListenerCallback (const String& message)
{
if (message.startsWith (getApplicationName() + "/"))
{
anotherInstanceStarted (message.fromFirstOccurrenceOf (T("/"), false, false));
}
anotherInstanceStarted (message.substring (getApplicationName().length() + 1));
}
//==============================================================================

View file

@ -63,15 +63,38 @@ AudioSampleBuffer::AudioSampleBuffer (const int numChannels_,
AudioSampleBuffer::AudioSampleBuffer (float** dataToReferTo,
const int numChannels_,
const int numSamples) throw()
: numChannels (numChannels_),
size (numSamples),
allocatedBytes (0),
allocatedData (0)
{
jassert (((unsigned int) numChannels_) <= (unsigned int) maxNumAudioSampleBufferChannels);
for (int i = 0; i < numChannels_; ++i)
{
// you have to pass in the same number of valid pointers as numChannels
jassert (dataToReferTo[i] != 0);
channels[i] = dataToReferTo[i];
}
channels [numChannels_] = 0;
}
void AudioSampleBuffer::setDataToReferTo (float** dataToReferTo,
const int numChannels_,
const int numSamples) throw()
{
jassert (((unsigned int) numChannels_) <= (unsigned int) maxNumAudioSampleBufferChannels);
juce_free (allocatedData);
allocatedData = 0;
allocatedBytes = 0;
numChannels = numChannels_;
size = numSamples;
allocatedBytes = 0;
allocatedData = 0;
for (int i = numChannels_; --i >= 0;)
for (int i = 0; i < numChannels_; ++i)
{
// you have to pass in the same number of valid pointers as numChannels
jassert (dataToReferTo[i] != 0);

View file

@ -59,6 +59,10 @@ public:
/** Creates a buffer using a pre-allocated block of memory.
Note that if the buffer is resized or its number of channels is changed, it
will re-allocate memory internally and copy the existing data to this new area,
so it will then stop directly addressing this memory.
@param dataToReferTo a pre-allocated array containing pointers to the data
for each channel that should be used by this buffer. The
buffer will only refer to this memory, it won't try to delete
@ -137,6 +141,29 @@ public:
const bool clearExtraSpace = false,
const bool avoidReallocating = false) throw();
/** Makes this buffer point to a pre-allocated set of channel data arrays.
There's also a constructor that lets you specify arrays like this, but this
lets you change the channels dynamically.
Note that if the buffer is resized or its number of channels is changed, it
will re-allocate memory internally and copy the existing data to this new area,
so it will then stop directly addressing this memory.
@param dataToReferTo a pre-allocated array containing pointers to the data
for each channel that should be used by this buffer. The
buffer will only refer to this memory, it won't try to delete
it when the buffer is deleted or resized.
@param numChannels the number of channels to use - this must correspond to the
number of elements in the array passed in
@param numSamples the number of samples to use - this must correspond to the
size of the arrays passed in
*/
void setDataToReferTo (float** dataToReferTo,
const int numChannels,
const int numSamples) throw();
//==============================================================================
/** Clears all the samples in all channels. */
void clear() throw();