Permalink
Browse files

Merging various recent changes from trunk into 34 - inc sc.app menu t…

…weak, synthdef changes

git-svn-id: https://supercollider.svn.sourceforge.net/svnroot/supercollider/branches/3.4@10015 a380766d-ff14-0410-b294-a243070f3f08
  • Loading branch information...
danstowell committed Apr 5, 2010
1 parent 12932b2 commit c54cbbccac3514c79f8bbac73c021a33955ccb56
Showing with 2,846 additions and 1,694 deletions.
  1. +5 −0 common/Headers/lang/ByteCodeArray.h
  2. +5 −0 common/Headers/lang/MiscInlineMath.h
  3. +0 −4 common/Headers/lang/SC_LanguageClient.h
  4. +4 −0 common/Headers/lang/SimpleStack.h
  5. +5 −1 common/Headers/plugin_interface/SC_Unit.h
  6. +2 −0 common/Source/app/SCCocoaView.M
  7. +2 −3 common/Source/app/SCView.M
  8. +28 −28 common/Source/lang/LangSource/PyrInterpreter3.cpp
  9. +1 −9 common/Source/lang/LangSource/PyrMessage.cpp
  10. +19 −9 common/Source/plugins/DelayUGens.cpp
  11. +15 −15 common/Source/plugins/FilterUGens.cpp
  12. +7 −0 common/build/ChangeLog
  13. +126 −110 common/build/Help/Core/Kernel/Function.html
  14. +187 −49 common/build/Help/Core/Symbol.html
  15. +12 −12 common/build/Help/GUI/Cocoa-GUI/SCListView.html
  16. +5 −5 common/build/Help/GUI/Cocoa-GUI/SCNumberBox.html
  17. +8 −8 common/build/Help/GUI/Cocoa-GUI/SCTabletView.html
  18. +16 −19 common/build/Help/GUI/Cocoa-GUI/SCUserViewSubclassing/SCUserView-Subclassing.html
  19. +7 −7 common/build/Help/GUI/Cocoa-GUI/SCView.html
  20. +5 −5 common/build/Help/GUI/EZ-GUI/EZListView.html
  21. +2 −2 common/build/Help/GUI/EZ-GUI/EZLists.html
  22. +2 −2 common/build/Help/GUI/EZ-GUI/EZPopUpMenu.html
  23. +112 −112 common/build/Help/GUI/GUI-Tools/FlowLayout.html
  24. +24 −20 common/build/Help/Libraries/JITLib/extras/EnvirGui.html
  25. +148 −0 common/build/Help/Libraries/JITLib/extras/JITGui.html
  26. +25 −86 common/build/Help/Libraries/JITLib/extras/PdefEditor.html
  27. +212 −0 common/build/Help/Libraries/JITLib/extras/PdefGui.html
  28. +24 −86 common/build/Help/Libraries/JITLib/extras/TdefEditor.html
  29. +206 −0 common/build/Help/Libraries/JITLib/extras/TdefGui.html
  30. +202 −138 common/build/Help/Math/Complex.html
  31. +50 −49 common/build/Help/Math/Magnitude.html
  32. +125 −111 common/build/Help/Math/Number.html
  33. +18 −16 common/build/Help/UGens/Analysis/Pitch.html
  34. +2 −2 common/build/Help/UGens/Playback and Recording/VDiskIn.html
  35. +143 −87 common/build/Help/UGens/Synth control/Control.html
  36. +107 −55 common/build/SCClassLibrary/Common/Audio/SynthDef.sc
  37. +28 −0 common/build/SCClassLibrary/Common/Audio/SynthDesc.sc
  38. +2 −2 common/build/SCClassLibrary/Common/Audio/Trig.sc
  39. +1 −0 common/build/SCClassLibrary/Common/Audio/UGenCategories.sc
  40. +0 −40 common/build/SCClassLibrary/Common/Audio/asSynthDesc.sc
  41. +3 −0 common/build/SCClassLibrary/Common/Collections/Dictionary.sc
  42. +52 −11 common/build/SCClassLibrary/Common/Collections/SequenceableCollection.sc
  43. +4 −0 common/build/SCClassLibrary/Common/Control/Server.sc
  44. +4 −0 common/build/SCClassLibrary/Common/Core/Object.sc
  45. +1 −1 common/build/SCClassLibrary/Common/GUI/ViewRedirect.sc
  46. +14 −6 common/build/SCClassLibrary/Common/GUI/osx/scide_scapp/Base/SCPen.sc
  47. +14 −0 common/build/SCClassLibrary/Common/GUI/osx/scide_scapp/SCImage.sc
  48. +52 −50 common/build/SCClassLibrary/Common/GUI/osx/scide_scapp/SCLevelIndicator.sc
  49. +23 −1 common/build/SCClassLibrary/Common/Math/Complex.sc
  50. +327 −0 common/build/SCClassLibrary/JITLib/GUI/TaskProxyGui.sc
  51. +0 −336 common/build/SCClassLibrary/JITLib/GUI/TdefEditor.sc
  52. +40 −0 common/build/SCClassLibrary/JITLib/GUI/extJITgui.sc
  53. +27 −5 common/build/SCClassLibrary/JITLib/ProxySpace/InBus.sc
  54. +10 −4 common/build/SCClassLibrary/JITLib/ProxySpace/NodeMap.sc
  55. +3 −1 common/build/SCClassLibrary/JITLib/ProxySpace/NodeMapSetting.sc
  56. +14 −7 common/build/SCClassLibrary/JITLib/ProxySpace/NodeProxy.sc
  57. +92 −79 common/build/SCClassLibrary/JITLib/ProxySpace/ProxyInterfaces.sc
  58. +96 −97 common/build/SCClassLibrary/JITLib/basics/EnvirGui.sc
  59. +173 −0 common/build/SCClassLibrary/JITLib/basics/JITGui.sc
  60. +1 −1 common/build/SCClassLibrary/JITLib/basics/SkipJack.sc
  61. +1 −0 common/build/SCClassLibrary/Platform/osx/scide_scapp/CocoaGUI.sc
  62. +1 −1 common/build/SCClassLibrary/crucial/Editors/NumberEditor.sc
  63. +2 −2 mac/Resources/English.lproj/MainMenu.nib/info.nib
  64. BIN mac/Resources/English.lproj/MainMenu.nib/keyedobjects.nib
@@ -18,6 +18,10 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifndef LANG_BYTECODEARRAY_H
+#define LANG_BYTECODEARRAY_H
+
+
typedef unsigned char Byte;
#define BYTE_CODE_CHUNK_SIZE 64
@@ -48,3 +52,4 @@ void compileJump(long opcode, long jumplen);
int compileNumber(unsigned long value);
int compileNumber24(unsigned long value);
+#endif
@@ -18,6 +18,9 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifndef LANG_MISCINLINEMATH_H
+#define LANG_MISCINLINEMATH_H
+
#define NUMPRIMES 6542
long nthPrime(int n);
long findPrime(int n);
@@ -52,3 +55,5 @@ inline double linexp(double x, double a, double b, double c, double d)
if (x >= b) return d;
return pow(d/c, (x-a)/(b-a)) * c;
}
+
+#endif
@@ -38,11 +38,7 @@
struct PyrSymbol;
struct VMGlobals;
-#ifndef SC_WIN32
-extern long compiledOK;
-#else
extern bool compiledOK;
-#endif
extern pthread_mutex_t gLangMutex;
extern VMGlobals* gMainVMGlobals;
@@ -18,6 +18,8 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifndef LANG_SIMPLESTACK_H
+#define LANG_SIMPLESTACK_H
typedef struct {
long *stak;
@@ -30,3 +32,5 @@ void growLongStack(LongStack *self);
void pushls(LongStack *self, long value);
long popls(LongStack *self);
int emptyls(LongStack *self);
+
+#endif
@@ -29,6 +29,10 @@ typedef void (*UnitDtorFunc)(struct Unit* inUnit);
typedef void (*UnitCalcFunc)(struct Unit *inThing, int inNumSamples);
+struct SC_Unit_Extensions {
+ float * todo;
+};
+
struct Unit
{
struct World *mWorld;
@@ -39,9 +43,9 @@ struct Unit
int16 mSpecialIndex; // used by unary and binary ops
int16 mParentIndex;
int16 mDone;
-
struct Wire **mInput, **mOutput;
struct Rate *mRate;
+ SC_Unit_Extensions* mExtensions; //future proofing and backwards compatibility; used to be SC_Dimension struct pointer
float **mInBuf, **mOutBuf;
UnitCalcFunc mCalcFunc;
@@ -887,6 +887,8 @@ void QDDrawBevelRect(CGContextRef cgc, CGRect bounds, float width, bool inout);
[mFormatter setAlwaysShowsDecimalSeparator:NO];
[mFormatter setExponentSymbol:@"e"];
[mFormatter setMaximumFractionDigits:20];
+ [mFormatter setDecimalSeparator:@"."];
+ [mFormatter setUsesGroupingSeparator:NO];
[[self cell] setFormatter:mFormatter];
}
@@ -4232,15 +4232,14 @@ void SCUserView::draw(SCRect inDamage)
void SCUserView::clearDrawing()
{
- if( !mNSImageForLayering )
+ if( mClearOnRefresh )
return;
//SCRect bounds = getDrawBounds();
//CGContextClearRect ( mNSImageForLayering , CGRectMake( 0, 0, bounds.width, bounds.height));
[ mNSImageForLayering lockFocus ];
CGContextRef cgc = (CGContextRef)[[NSGraphicsContext currentContext]graphicsPort];
- if(mClearOnRefresh)
- CGContextClearRect( cgc, CGRectMake( 0.f, 0.f, [mNSImageForLayering size].width, [mNSImageForLayering size].height ) );
+ CGContextClearRect( cgc, CGRectMake( 0.f, 0.f, [mNSImageForLayering size].width, [mNSImageForLayering size].height ) );
[ mNSImageForLayering unlockFocus ];
}
@@ -97,7 +97,7 @@ bool gTraceInterpreter = false;
//bool gTraceInterpreter = true;
-char* byteCodeString(int code);
+const char* byteCodeString(int code);
extern int gNumClasses;
extern PyrClass *gClassList;
@@ -587,7 +587,7 @@ void Interpret(VMGlobals *g)
++sp; SetObject(sp, classobj);
} else {
postfl("Execution warning: Class '%s' not found\n", slotRawSymbol(&slotRawObject(&g->block->selectors)->slots[op2])->name);
- slotCopy(++sp, (PyrSlot*)&gSpecialValues[svNil]);
+ slotCopy(++sp, &gSpecialValues[svNil]);
}
break;
case 1 : // opExtended, opPushInstVar
@@ -639,7 +639,7 @@ void Interpret(VMGlobals *g)
if (classobj) {
++sp; SetObject(sp, classobj);
} else {
- slotCopy(++sp, (PyrSlot*)&gSpecialValues[svNil]);
+ slotCopy(++sp, &gSpecialValues[svNil]);
}
break;
case 7 : // opExtended, opStoreInstVar
@@ -745,7 +745,7 @@ void Interpret(VMGlobals *g)
++sp; SetObject(sp, closure);
break;
default :
- slotCopy(++sp, (PyrSlot*)&gSpecialValues[svNil]); break;
+ slotCopy(++sp, &gSpecialValues[svNil]); break;
}
break;
// opPushInstVar, 0..15
@@ -896,40 +896,40 @@ void Interpret(VMGlobals *g)
g->tailCall = 0;
#endif
} else {
- slotCopy(++sp, (PyrSlot*)&gSpecialValues[svOne]);
+ slotCopy(++sp, &gSpecialValues[svOne]);
g->sp = sp; g->ip = ip;
g->primitiveIndex = opSub;
prSubNum(g, -1);
sp = g->sp; ip = g->ip;
}
break;
- case 98 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svNegOne]); break;
- case 99 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svZero]); break;
- case 100 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svOne]); break;
- case 101 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svTwo]); break;
- case 102 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svFHalf]); break;
- case 103 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svFNegOne]); break;
- case 104 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svFZero]); break;
- case 105 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svFOne]); break;
- case 106 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svFTwo]); break;
+ case 98 : slotCopy(++sp, &gSpecialValues[svNegOne]); break;
+ case 99 : slotCopy(++sp, &gSpecialValues[svZero]); break;
+ case 100 : slotCopy(++sp, &gSpecialValues[svOne]); break;
+ case 101 : slotCopy(++sp, &gSpecialValues[svTwo]); break;
+ case 102 : slotCopy(++sp, &gSpecialValues[svFHalf]); break;
+ case 103 : slotCopy(++sp, &gSpecialValues[svFNegOne]); break;
+ case 104 : slotCopy(++sp, &gSpecialValues[svFZero]); break;
+ case 105 : slotCopy(++sp, &gSpecialValues[svFOne]); break;
+ case 106 : slotCopy(++sp, &gSpecialValues[svFTwo]); break;
case 107 : // push one and add
if (IsInt(sp)) {
SetRaw(sp, slotRawInt(sp) + 1);
#if TAILCALLOPTIMIZE
g->tailCall = 0;
#endif
} else {
- slotCopy(++sp, (PyrSlot*)&gSpecialValues[svOne]);
+ slotCopy(++sp, &gSpecialValues[svOne]);
g->sp = sp; g->ip = ip;
g->primitiveIndex = opAdd;
prAddNum(g, -1);
sp = g->sp; ip = g->ip;
}
break;
- case 108 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svTrue]); break;
- case 109 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svFalse]); break;
- case 110 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svNil]); break;
- case 111 : slotCopy(++sp, (PyrSlot*)&gSpecialValues[svInf]); break;
+ case 108 : slotCopy(++sp, &gSpecialValues[svTrue]); break;
+ case 109 : slotCopy(++sp, &gSpecialValues[svFalse]); break;
+ case 110 : slotCopy(++sp, &gSpecialValues[svNil]); break;
+ case 111 : slotCopy(++sp, &gSpecialValues[svInf]); break;
// opStoreInstVar, 0..15
#if 1
@@ -1578,7 +1578,7 @@ void Interpret(VMGlobals *g)
if ( NotNil(sp) ) {
jmplen = (ip[1]<<8) | ip[2];
ip += jmplen + 2;
- slotCopy(sp, (PyrSlot*)&gSpecialValues[svNil]);
+ slotCopy(sp, &gSpecialValues[svNil]);
} else {
ip+=2;
--sp;
@@ -1832,15 +1832,15 @@ void Interpret(VMGlobals *g)
if (IsNil(&sp[0])) {
SetTagRaw(&sp[0], tagTrue);
} else {
- slotCopy(sp, (PyrSlot*)&gSpecialValues[svFalse]);
+ slotCopy(sp, &gSpecialValues[svFalse]);
}
#if TAILCALLOPTIMIZE
g->tailCall = 0;
#endif
break;
case 211 : // opNotNil
if (NotNil(&sp[0])) {
- slotCopy(sp, (PyrSlot*)&gSpecialValues[svTrue]);
+ slotCopy(sp, &gSpecialValues[svTrue]);
} else {
SetTagRaw(&sp[0], tagFalse);
}
@@ -1952,19 +1952,19 @@ void Interpret(VMGlobals *g)
sp = g->sp; ip = g->ip;
break;
case 245 : // opcReturnTrue
- slotCopy(++sp, (PyrSlot*)&gSpecialValues[svTrue]);
+ slotCopy(++sp, &gSpecialValues[svTrue]);
g->sp = sp; g->ip = ip;
returnFromMethod(g);
sp = g->sp; ip = g->ip;
break;
case 246 : // opcReturnFalse
- slotCopy(++sp, (PyrSlot*)&gSpecialValues[svFalse]);
+ slotCopy(++sp, &gSpecialValues[svFalse]);
g->sp = sp; g->ip = ip;
returnFromMethod(g);
sp = g->sp; ip = g->ip;
break;
case 247 : // opcReturnNil
- slotCopy(++sp, (PyrSlot*)&gSpecialValues[svNil]);
+ slotCopy(++sp, &gSpecialValues[svNil]);
g->sp = sp; g->ip = ip;
returnFromMethod(g);
sp = g->sp; ip = g->ip;
@@ -1990,7 +1990,7 @@ void Interpret(VMGlobals *g)
if ( IsFalse(sp)) {
jmplen = (ip[1]<<8) | ip[2];
ip += jmplen + 2;
- slotCopy(sp, (PyrSlot*)&gSpecialValues[svNil]);
+ slotCopy(sp, &gSpecialValues[svNil]);
} else if ( IsTrue(sp)) {
--sp;
ip+=2;
@@ -2025,7 +2025,7 @@ void Interpret(VMGlobals *g)
} else if (IsTrue(sp)) {
jmplen = (ip[1]<<8) | ip[2];
ip += jmplen + 2;
- slotCopy(sp, (PyrSlot*)&gSpecialValues[svTrue]);
+ slotCopy(sp, &gSpecialValues[svTrue]);
} else {
numArgsPushed = 1;
selector = gSpecialSelectors[opmNonBooleanError];
@@ -2114,7 +2114,7 @@ void Interpret(VMGlobals *g)
slotCopy(&obj->slots[index], &sp[1]);
g->gc->GCWrite(obj, sp + 1);
} else {
- slotCopy(&obj->slots[index], (PyrSlot*)&gSpecialValues[svNil]);
+ slotCopy(&obj->slots[index], &gSpecialValues[svNil]);
}
slotCopy(sp, slot);
}
@@ -22,6 +22,7 @@
#include "PyrPrimitiveProto.h"
#include "PyrInterpreter.h"
#include "PyrPrimitive.h"
+#include "PyrListPrim.h"
#include "GC.h"
#include "bullet.h"
#include <stdlib.h>
@@ -39,11 +40,7 @@ bool gKeywordError = true;
extern bool gTraceInterpreter;
long cvxUniqueMethods;
-#ifdef SC_WIN32
extern int ivxIdentDict_array;
-#else
-extern long ivxIdentDict_array;
-#endif
void StoreToImmutableB(VMGlobals *g, PyrSlot *& sp, unsigned char *& ip);
@@ -692,11 +689,6 @@ void sendSuperMessage(VMGlobals *g, PyrSymbol *selector, long numArgsPushed)
//postfl("<-sendMessage\n");
}
-#ifdef SC_WIN32
-int arrayAtIdentityHashInPairs(PyrObject *array, PyrSlot *key); // this is the implementation prototype
-#else
-long arrayAtIdentityHashInPairs(PyrObject *array, PyrSlot *key);
-#endif
extern PyrClass *class_identdict;
void doesNotUnderstandWithKeys(VMGlobals *g, PyrSymbol *selector,
@@ -111,6 +111,7 @@ struct Pitch : public Unit
int m_minperiod, m_maxperiod, m_execPeriod, m_index, m_readp, m_size;
int m_downsamp, m_maxlog2bins, m_medianSize;
int m_state;
+ bool m_getClarity;
};
struct BufDelayUnit : public Unit
@@ -1629,7 +1630,8 @@ enum {
kPitchMedian,
kPitchAmpThreshold,
kPitchPeakThreshold,
- kPitchDownsamp
+ kPitchDownsamp,
+ kPitchGetClarity
};
void Pitch_Ctor(Pitch *unit)
@@ -1675,6 +1677,8 @@ void Pitch_Ctor(Pitch *unit)
unit->m_hasfreq = 0.f;
initMedian(unit->m_values, unit->m_ages, unit->m_medianSize, unit->m_freq);
+
+ unit->m_getClarity = ZIN0(kPitchGetClarity) > 0.f;
ZOUT0(0) = 0.f;
ZOUT0(1) = 0.f;
@@ -1731,11 +1735,11 @@ void Pitch_next_a(Pitch *unit, int inNumSamples)
int maxlog2bins = unit->m_maxlog2bins;
int octave;
// calculate the zero lag value and compute the threshold based on that
- float threshold = 0.f;
+ float zerolagval = 0.f;
for (int j = 0; j < maxperiod; ++j) {
- threshold += bufData[j] * bufData[j];
+ zerolagval += bufData[j] * bufData[j];
}
- threshold *= unit->m_peakthresh;
+ float threshold = zerolagval * unit->m_peakthresh;
// skip until drop below threshold
int binstep, peakbinstep = 0;
@@ -1850,7 +1854,10 @@ void Pitch_next_a(Pitch *unit, int inNumSamples)
if (unit->m_medianSize > 1) {
freq = insertMedian(unit->m_values, unit->m_ages, unit->m_medianSize, freq);
}
- hasfreq = 1.f;
+ if(unit->m_getClarity)
+ hasfreq = maxsum / zerolagval; // "clarity" measure is normalised size of first peak
+ else
+ hasfreq = 1.f;
startperiod = (ksamps+downsamp-1)/downsamp;
}
@@ -1930,11 +1937,11 @@ void Pitch_next_k(Pitch *unit, int inNumSamples)
int maxlog2bins = unit->m_maxlog2bins;
int octave;
// calculate the zero lag value and compute the threshold based on that
- float threshold = 0.f;
+ float zerolagval = 0.f;
for (int j = 0; j < maxperiod; ++j) {
- threshold += bufData[j] * bufData[j];
+ zerolagval += bufData[j] * bufData[j];
}
- threshold *= unit->m_peakthresh;
+ float threshold = zerolagval * unit->m_peakthresh;
// skip until drop below threshold
int binstep, peakbinstep = 0;
@@ -2049,7 +2056,10 @@ void Pitch_next_k(Pitch *unit, int inNumSamples)
if (unit->m_medianSize > 1) {
freq = insertMedian(unit->m_values, unit->m_ages, unit->m_medianSize, freq);
}
- hasfreq = 1.f;
+ if(unit->m_getClarity)
+ hasfreq = maxsum / zerolagval; // "clarity" measure is normalised size of first peak
+ else
+ hasfreq = 1.f;
// nescivi: not sure about this one?
startperiod = 1; // (ksamps+downsamp-1)/downsamp;
Oops, something went wrong.

0 comments on commit c54cbbc

Please sign in to comment.