summaryrefslogtreecommitdiff
path: root/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp')
-rw-r--r--libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp50
1 files changed, 25 insertions, 25 deletions
diff --git a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp
index fd329f84e8..cef3a50bf7 100644
--- a/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp
+++ b/libs/appleutility/CoreAudio/AudioUnits/AUPublic/AUInstrumentBase/SynthElement.cpp
@@ -2,14 +2,14 @@
File: SynthElement.cpp
Abstract: SynthElement.h
Version: 1.1
-
+
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of
this Apple software constitutes acceptance of these terms. If you do
not agree with these terms, please do not use, install, modify or
redistribute this Apple software.
-
+
In consideration of your agreement to abide by the following terms, and
subject to these terms, Apple grants you a personal, non-exclusive
license, under Apple's copyrights in this original Apple software (the
@@ -25,13 +25,13 @@
implied, are granted by Apple herein, including but not limited to any
patent rights that may be infringed by your derivative works or by other
works in which the Apple Software may be incorporated.
-
+
The Apple Software is provided by Apple on an "AS IS" basis. APPLE
MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND
OPERATION ALONE OR IN COMBINATION WITH YOUR PRODUCTS.
-
+
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
@@ -40,9 +40,9 @@
AND WHETHER UNDER THEORY OF CONTRACT, TORT (INCLUDING NEGLIGENCE),
STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
-
+
Copyright (C) 2014 Apple Inc. All Rights Reserved.
-
+
*/
#include "SynthElement.h"
#include "AUInstrumentBase.h"
@@ -78,7 +78,7 @@ void MidiControls::Reset()
}
-SynthElement::SynthElement(AUInstrumentBase *audioUnit, UInt32 inElement)
+SynthElement::SynthElement(AUInstrumentBase *audioUnit, UInt32 inElement)
: AUElement(audioUnit), mIndex(inElement)
{
}
@@ -87,7 +87,7 @@ SynthElement::~SynthElement()
{
}
-SynthGroupElement::SynthGroupElement(AUInstrumentBase *audioUnit, UInt32 inElement, MIDIControlHandler *inHandler)
+SynthGroupElement::SynthGroupElement(AUInstrumentBase *audioUnit, UInt32 inElement, MIDIControlHandler *inHandler)
: SynthElement(audioUnit, inElement),
mCurrentAbsoluteFrame(-1),
mMidiControlHandler(inHandler),
@@ -109,7 +109,7 @@ void SynthGroupElement::SetGroupID (MusicDeviceGroupID inGroup)
mGroupID = inGroup;
}
-void SynthGroupElement::Reset()
+void SynthGroupElement::Reset()
{
#if DEBUG_PRINT
printf("SynthGroupElement::Reset\n");
@@ -119,7 +119,7 @@ void SynthGroupElement::Reset()
mNoteList[i].Empty();
}
-SynthPartElement::SynthPartElement(AUInstrumentBase *audioUnit, UInt32 inElement)
+SynthPartElement::SynthPartElement(AUInstrumentBase *audioUnit, UInt32 inElement)
: SynthElement(audioUnit, inElement)
{
}
@@ -132,7 +132,7 @@ SynthNote *SynthGroupElement::GetNote(NoteInstanceID inNoteID, bool unreleasedOn
#if DEBUG_PRINT_RENDER
printf("SynthGroupElement::GetNote %d, unreleased = %d\n", inNoteID, unreleasedOnly);
#endif
- const UInt32 lastNoteState = unreleasedOnly ?
+ const UInt32 lastNoteState = unreleasedOnly ?
(mSostenutoIsOn ? kNoteState_Sostenutoed : kNoteState_Attacked)
: kNoteState_Released;
SynthNote *note = NULL;
@@ -176,7 +176,7 @@ void SynthGroupElement::NoteOn(SynthNote *note,
}
void SynthGroupElement::NoteOff(NoteInstanceID inNoteID, UInt32 inFrame)
-{
+{
#if DEBUG_PRINT_NOTE
printf("SynthGroupElement::NoteOff %d\n", inNoteID);
#endif
@@ -217,7 +217,7 @@ void SynthGroupElement::NoteEnded(SynthNote *inNote, UInt32 inFrame)
SynthNoteList *list = &mNoteList[inNote->GetState()];
list->RemoveNote(inNote);
}
-
+
GetAUInstrument()->AddFreeNote(inNote);
}
@@ -245,7 +245,7 @@ bool SynthGroupElement::ChannelMessage(UInt16 controllerID, UInt16 inValue)
// Sustain and sostenuto are "pedal events", and are handled during render cycle
if (controllerID <= kMidiController_RPN_MSB && controllerID != kMidiController_Sustain && controllerID != kMidiController_Sostenuto)
handled = mMidiControlHandler->SetController(controllerID, UInt8(inValue));
- else
+ else
{
switch (controllerID)
{
@@ -296,7 +296,7 @@ void SynthGroupElement::SostenutoOff(UInt32 inFrame)
mMidiControlHandler->SetController(kMidiController_Sostenuto, 0);
mSostenutoIsOn = false;
mNoteList[kNoteState_Attacked].TransferAllFrom(&mNoteList[kNoteState_Sostenutoed], inFrame);
- if (mSustainIsOn)
+ if (mSustainIsOn)
mNoteList[kNoteState_ReleasedButSustained].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSostenutoed], inFrame);
else
mNoteList[kNoteState_Released].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSostenutoed], inFrame);
@@ -323,7 +323,7 @@ void SynthGroupElement::SustainOff(UInt32 inFrame)
if (mSustainIsOn) {
mMidiControlHandler->SetController(kMidiController_Sustain, 0);
mSustainIsOn = false;
-
+
mNoteList[kNoteState_Released].TransferAllFrom(&mNoteList[kNoteState_ReleasedButSustained], inFrame);
}
}
@@ -342,14 +342,14 @@ void SynthGroupElement::AllNotesOff(UInt32 inFrame)
while (note)
{
SynthNote *nextNote = note->mNext;
-
+
mNoteList[i].RemoveNote(note);
note->Release(inFrame);
mNoteList[newState].AddNote(note);
-
+
note = nextNote;
}
- }
+ }
}
void SynthGroupElement::AllSoundOff(UInt32 inFrame)
@@ -358,21 +358,21 @@ void SynthGroupElement::AllSoundOff(UInt32 inFrame)
printf("SynthGroupElement::AllSoundOff\n");
#endif
SynthNote *note;
-
+
for (UInt32 i=0 ; i<kNumberOfActiveNoteStates; ++i)
{
note = mNoteList[i].mHead;
while (note)
{
SynthNote *nextNote = note->mNext;
-
+
mNoteList[i].RemoveNote(note);
note->FastRelease(inFrame);
mNoteList[kNoteState_FastReleased].AddNote(note);
GetAUInstrument()->DecNumActiveNotes();
note = nextNote;
}
- }
+ }
}
void SynthGroupElement::ResetAllControllers(UInt32 inFrame)
@@ -395,7 +395,7 @@ OSStatus SynthGroupElement::Render(SInt64 inAbsoluteSampleFrame, UInt32 inNumber
{
buffArray[outBus] = &GetAudioUnit()->GetOutput(outBus)->GetBufferList();
}
-
+
for (UInt32 i=0 ; i<kNumberOfSoundingNoteStates; ++i)
{
SynthNote *note = mNoteList[i].mHead;
@@ -405,10 +405,10 @@ OSStatus SynthGroupElement::Render(SInt64 inAbsoluteSampleFrame, UInt32 inNumber
printf("SynthGroupElement::Render: state %d, note %p\n", i, note);
#endif
SynthNote *nextNote = note->mNext;
-
+
OSStatus err = note->Render(inAbsoluteSampleFrame, inNumberFrames, buffArray, numOutputs);
if (err) return err;
-
+
note = nextNote;
}
}