Пример #1
0
void in_update_amplitude(TTPtr self)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
	TTInputPtr		anInput = (TTInputPtr)x->wrappedObject;
	TTValue			storedObject;
	TTObjectBasePtr		anObject;
	TTErr			err;
	
	if (anInput) {
		
		if (x->internals) {
			if (!x->internals->isEmpty()) {
				
				// get internal data object used to return amplitude
				err = x->internals->lookup(TTSymbol("amplitude"), storedObject);
				
				if (!err) {
					
					anObject = storedObject[0];
					
					// set current meter value
					anObject->setAttributeValue(kTTSym_value, EXTRA->meter);
				}
			}
		}
		
		// restart the clock
		if (EXTRA->pollInterval)
			clock_delay(EXTRA->clock, EXTRA->pollInterval);
	}
}
Пример #2
0
TTErr TTList::iterateObjectsSendingMessage(const TTSymbol& messageName)
{
	lock();
	for (TTListIter iter = theList.begin(); iter != theList.end(); iter++) {
		TTObjectBasePtr obj = NULL;
		
		//(iter)->get(0, &obj);
		obj = iter->at(0);
		if (obj && obj->valid)
			obj->sendMessage(messageName);
	}
	unlock();
	return kTTErrNone;
}
Пример #3
0
TTErr TTList::iterate(const TTObjectBasePtr target, const TTSymbol& messageName)
{
	lock();
	for (TTListIter iter = theList.begin(); iter != theList.end(); iter++) {
		TTValue v;
		target->sendMessage(messageName, *iter, v);
	}
	unlock();
	return kTTErrNone;	
}
Пример #4
0
TTObjectBasePtr OSCSenderManager::add(TTSymbol applicationName, TTSymbol ip, TTUInt16 port)
{
    TTValue     v;
    TTObjectBasePtr anObject = NULL;
    TTErr       err;
    
    err = TTObjectBaseInstantiate(TTSymbol("osc.send"), &anObject, kTTValNONE);
    if (!err) {
        anObject->setAttributeValue(TTSymbol("address"), ip);
        anObject->setAttributeValue(TTSymbol("port"), port);
        
        v.append(anObject);
        v.append(ip);
        v.append(port);
        
        mSenders->append(applicationName, v);
    }
    
    return anObject;
}
Пример #5
0
TTErr TTObjectBase::extendAttribute(const TTSymbol name, const TTObjectBasePtr extendedObject, const TTSymbol extendedName)
{
	TTAttributePtr	extendedAttribute = NULL;
	TTAttributePtr	newAttribute;
	TTErr			err = extendedObject->findAttribute(extendedName, &extendedAttribute);

	if (!err) {
		newAttribute = new TTAttribute(extendedAttribute, extendedObject);
		attributes->append(name, TTPtr(newAttribute));
		return kTTErrNone;
	}
	else
		return err;
}
Пример #6
0
TTErr TTAttribute::extendedSetter(const TTAttribute& attribute, TTValue& value)
{
	TTObjectBasePtr anExtendedObject = (TTObjectBasePtr)attribute.setterObject;
	
	return anExtendedObject->setAttributeValue(attribute.name, value);
}
Пример #7
0
TTErr ColorDataspace::test(TTValue& returnedTestInfo)
{
    int					errorCount = 0;
	int					testAssertionCount = 0;    
    
    // Create dataspace object and set to angle
    TTObjectBasePtr         myDataspace = NULL;
    TTErr err;
    err = TTObjectBaseInstantiate(TT("dataspace"), (TTObjectBasePtr*)&myDataspace, kTTValNONE);
	myDataspace->setAttributeValue(TT("dataspace"), TT("color"));
    
    TTValue v;
    TTValue expected;
    
    
    /************************************************/
    /*                                              */
    /* Test conversions to neutral unit             */
    /*                                              */
    /************************************************/
    
    // rgb => rgb
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("rgb"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("rgb"));    
	
	v.setSize(3);
    v.set(0, TTFloat64(124.2));
    v.set(1, TTFloat64(162.9));
    v.set(2, TTFloat64(13.163));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(124.2));
    expected.set(1, TTFloat64(162.9));
    expected.set(2, TTFloat64(13.163));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("rgb to rgb", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);

    
    // cmy => rgb
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("cmy"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("rgb"));    
	
	v.setSize(3);
    v.set(0, TTFloat64(255.));
    v.set(1, TTFloat64(127.5));
    v.set(2, TTFloat64(0.));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(0.));
    expected.set(1, TTFloat64(0.5));
    expected.set(2, TTFloat64(1.0));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("cmy to rgb", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);
    
    
    // hsl => rgb
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("hsl"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("rgb"));    
	
	v.setSize(3);
    v.set(0, TTFloat64(120.));
    v.set(1, TTFloat64(100.));
    v.set(2, TTFloat64(50.));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(0.));
    expected.set(1, TTFloat64(1.0));
    expected.set(2, TTFloat64(0.));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("hsl to rgb", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);
    
    
    // rgb8 => rgb
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("rgb8"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("rgb"));    
	
	v.setSize(3);
    v.set(0, TTFloat64(255.));
    v.set(1, TTFloat64(127.5));
    v.set(2, TTFloat64(0.));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(1.));
    expected.set(1, TTFloat64(0.5));
    expected.set(2, TTFloat64(0.0));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("rgb8 to rgb", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);
    
    
    // hsv => rgb
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("hsv"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("rgb"));    
	
	v.setSize(3);
    v.set(0, TTFloat64(120.));
    v.set(1, TTFloat64(100.));
    v.set(2, TTFloat64(100.));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(0.));
    expected.set(1, TTFloat64(1.0));
    expected.set(2, TTFloat64(0.));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("hsv to rgb", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);
    
    
    
    /************************************************/
    /*                                              */
    /* Test conversions from neutral unit           */
    /*                                              */
    /************************************************/
    
    
    // rgb => cmy
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("rgb"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("cmy"));    
	
    v.setSize(3);
    v.set(0, TTFloat64(0.));
    v.set(1, TTFloat64(0.5));
    v.set(2, TTFloat64(1.));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(255.));
    expected.set(1, TTFloat64(127.5));
    expected.set(2, TTFloat64(0.0));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("rgb to cmy", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);
    
    
    // rgb => hsl
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("rgb"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("hsl"));    

    v.setSize(3);
    v.set(0, TTFloat64(0.));
    v.set(1, TTFloat64(1.));
    v.set(2, TTFloat64(0.));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(120.));
    expected.set(1, TTFloat64(100.0));
    expected.set(2, TTFloat64(50.));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("rgb to hsl", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);
    
    
    // rgb => rgb8
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("rgb"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("rgb8"));    

    v.setSize(3);
    v.set(0, TTFloat64(1.));
    v.set(1, TTFloat64(0.5));
    v.set(2, TTFloat64(0.));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(255.));
    expected.set(1, TTFloat64(127.5));
    expected.set(2, TTFloat64(0.0));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("rgb to rgb8", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);
    
    
    // rgb => hsv
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("rgb"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("hsv"));    
	
    v.setSize(3);
    v.set(0, TTFloat64(0.));
    v.set(1, TTFloat64(1.));
    v.set(2, TTFloat64(0.));
    
    expected.setSize(3);
    expected.set(0, TTFloat64(120.));
    expected.set(1, TTFloat64(100.0));
    expected.set(2, TTFloat64(100.));
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("rgb to hsv", 
					TTTestFloat64ArrayEquivalence(v, expected),
					testAssertionCount,
					errorCount);
    
    
    return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
}
Пример #8
0
TTErr wrapAsMaxGraph(TTSymbol& ttClassName, char* maxClassName, WrappedClassPtr* c, WrappedClassOptionsPtr options)
{
	TTObjectBasePtr	o = NULL;
	TTValue			v;
	TTUInt16		numChannels = 1;
	WrappedClass*	wrappedMaxClass = NULL;
	TTSymbol		name;
	TTCString		nameCString = NULL;
	t_symbol*		nameMaxSymbol = NULL;
	TTUInt32		nameSize = 0;

	common_symbols_init();
	TTGraphInit();
	
	if (!wrappedMaxClasses)
		wrappedMaxClasses = hashtab_new(0);
	
	wrappedMaxClass = new WrappedClass;
	wrappedMaxClass->maxClassName = gensym(maxClassName);
	wrappedMaxClass->maxClass = class_new(	maxClassName, 
											(method)wrappedClass_new, 
											(method)wrappedClass_free, 
											sizeof(WrappedInstance), 
											(method)0L, 
											A_GIMME, 
											0);
	wrappedMaxClass->ttClassName = ttClassName;
	wrappedMaxClass->validityCheck = NULL;
	wrappedMaxClass->validityCheckArgument = NULL;
	wrappedMaxClass->options = options;
	wrappedMaxClass->maxNamesToTTNames = hashtab_new(0);
	
	// Create a temporary instance of the class so that we can query it.
	TTObjectBaseInstantiate(ttClassName, &o, numChannels);

	o->getMessageNames(v);
	for (TTUInt16 i=0; i<v.size(); i++) {
		name = v[i];
		nameSize = strlen(name.c_str());
		nameCString = new char[nameSize+1];
		strncpy_zero(nameCString, name.c_str(), nameSize+1);

		nameMaxSymbol = gensym(nameCString);			
		hashtab_store(wrappedMaxClass->maxNamesToTTNames, nameMaxSymbol, (t_object*)name.rawpointer());
		class_addmethod(wrappedMaxClass->maxClass, (method)wrappedClass_anything, nameCString, A_GIMME, 0);

		delete nameCString;
		nameCString = NULL;
	}
	
	o->getAttributeNames(v);
	for (TTUInt16 i=0; i<v.size(); i++) {
		TTAttributePtr	attr = NULL;
		t_symbol*		maxType = _sym_long;
		
		name = v[i];
		nameSize = strlen(name.c_str());
		nameCString = new char[nameSize+1];
		strncpy_zero(nameCString, name.c_str(), nameSize+1);
		nameMaxSymbol = gensym(nameCString);
				
		if (name == TT("MaxNumChannels"))
			continue;						// don't expose these attributes to Max users
		if (name == TT("Bypass")) {
			if (wrappedMaxClass->options && !wrappedMaxClass->options->lookup(TT("generator"), v))
				continue;					// generators don't have inputs, and so don't really provide a bypass
		}
		
		o->findAttribute(name, &attr);
		
		if (attr->type == kTypeFloat32)
			maxType = _sym_float32;
		else if (attr->type == kTypeFloat64)
			maxType = _sym_float64;
		else if (attr->type == kTypeSymbol || attr->type == kTypeString)
			maxType = _sym_symbol;
		
		hashtab_store(wrappedMaxClass->maxNamesToTTNames, nameMaxSymbol, (t_object*)name.rawpointer());
		class_addattr(wrappedMaxClass->maxClass, attr_offset_new(nameCString, maxType, 0, (method)wrappedClass_attrGet, (method)wrappedClass_attrSet, 0));
		
		// Add display styles for the Max 5 inspector
		if (attr->type == kTypeBoolean)
			CLASS_ATTR_STYLE(wrappedMaxClass->maxClass, (char*)name.c_str(), 0, "onoff");
		if (name == TT("fontFace"))
			CLASS_ATTR_STYLE(wrappedMaxClass->maxClass,	"fontFace", 0, "font");

		delete nameCString;
		nameCString = NULL;
	}
	
	TTObjectBaseRelease(&o);
	
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxGraphReset,		"graph.reset",		A_CANT, 0);
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxGraphSetup,		"graph.setup",		A_CANT, 0);
	class_addmethod(wrappedMaxClass->maxClass, (method)MaxGraphConnect,		"graph.connect",	A_OBJ, A_LONG, 0);
    class_addmethod(wrappedMaxClass->maxClass, (method)object_obex_dumpout, "dumpout",			A_CANT, 0); 
	class_addmethod(wrappedMaxClass->maxClass, (method)wrappedClass_assist, "assist",			A_CANT, 0L);
	class_addmethod(wrappedMaxClass->maxClass, (method)stdinletinfo,		"inletinfo",		A_CANT, 0);
	
	class_register(_sym_box, wrappedMaxClass->maxClass);
	if (c)
		*c = wrappedMaxClass;
	
	hashtab_store(wrappedMaxClasses, wrappedMaxClass->maxClassName, (t_object*)wrappedMaxClass);
	return kTTErrNone;
}
Пример #9
0
TTErr TimeDataspace::test(TTValue& returnedTestInfo)
{
    int					errorCount = 0;
	int					testAssertionCount = 0;
    
    // Create dataspace object and set to time
    TTObjectBasePtr         myDataspace = NULL;
    TTErr err;
    err = TTObjectBaseInstantiate(TT("dataspace"), (TTObjectBasePtr*)&myDataspace, kTTValNONE);
	myDataspace->setAttributeValue(TT("dataspace"), TT("time"));
    
    TTValue v;
    TTValue expected;
    
    
    /************************************************/
    /*                                              */
    /* Test conversions to neutral unit             */
    /*                                              */
    /************************************************/
    
    
    // Second to second
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));    
    
    v = TTValue(256.);
    expected = TTValue(256.);
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("Second to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    
    
    // Millisecond => second
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("millisecond"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));
    
    v = TTValue(1234.5);
    expected = TTValue(1.2345);
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("Millisecond to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    
    // Sample => second
    // We need to find the sample rate
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("sample"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));    
    
    TTValue globalSampleRate;
    ttEnvironment->getAttributeValue(kTTSym_sampleRate, globalSampleRate);

    v = TTValue(1.23*TTFloat64(globalSampleRate));
    expected = TTValue(1.23);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Sample to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);

    
    // Rate (Hz) => second
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("Hz"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));    
    
    v = TTValue(4.);
    expected = TTValue(0.25);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Frequency (Hz) to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    

    // Beats per minute => second
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("bpm"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));    
    
    v = TTValue(120.);
    expected = TTValue(0.5);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Beats per minute to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);

    // MIDI => second (2 tests at MIDI notes 57 and 69)
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("midi"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));    
    
    v = TTValue(57.);
    expected = TTValue(1./220.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("MIDI note 57 to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);

    v = TTValue(69.);
    expected = TTValue(1./440.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("MIDI note 69 to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);

    
    // cents => second (2 tests at cents values 5700 and 6900)
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("cents"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));    
    
    v = TTValue(5700.);
    expected = TTValue(1./220.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Cent value 5700 to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    v = TTValue(6900.);
    expected = TTValue(1./440.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Cent value 6900 to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
	
    // Bark => second
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("bark"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));    
    
    v = TTValue(5.0);
    expected = TTValue(0.001785990780318596);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Bark to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
	// Mel => second
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("mel"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("second"));    
    
    v = TTValue(1000.0);
    expected = TTValue(0.0009999781840186604);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Mel to second", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
	
	// speed => seconds
    // Rather than checking this, there are tests for speed <=> midi further down
	
    /************************************************/
    /*                                              */
    /* Test conversions from neutral unit           */
    /*                                              */
    /************************************************/
    
    // Second => Millisecond
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("millisecond"));
    
    v = TTValue(1.2345);
    expected = TTValue(1234.5);
    
    myDataspace->sendMessage(TT("convert"), v, v);
    
    TTTestAssertion("Second to millisecond", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    
    // Second => sample
    // We need to find the sample rate
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("sample"));    
    
    ttEnvironment->getAttributeValue(kTTSym_sampleRate, globalSampleRate);
    
    v = TTValue(192000./TTFloat64(globalSampleRate));
    expected = TTValue(192000.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Second to sample", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    
    // Second => rate (Hz)
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("Hz"));    
    
    v = TTValue(0.25);
    expected = TTValue(4.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Second to frequency (Hz)", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    
    // Second => Beats per minute
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("bpm"));    
    
    v = TTValue(0.5);
    expected = TTValue(120.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Seconds to beats per minute", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    // Second => MIDI (2 tests at MIDI notes 57 and 69)
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("midi"));    
    
    v = TTValue(1./220.);
    expected = TTValue(57.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Second to MIDI note 57", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    v = TTValue(1./440.);
    expected = TTValue(69.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Second to MIDI note 69", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);

    
    // Second => cents (2 tests at cent values 5700 and 6900)
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("cents"));    
    
    v = TTValue(1./220.);
    expected = TTValue(5700.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Second to cent value 5700", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    v = TTValue(1./440.);
    expected = TTValue(6900.);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Second to cent value 6900", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
	// Second => Bark
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("bark"));    
    
    v = TTValue(0.001785990780318596);
    expected = TTValue(5.0);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Seconds to bark scale", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
	// Second => Mel
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("second"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("mel"));    
    
    v = TTValue(0.001);
    expected = TTValue(999.9855371396243);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Seconds to mel scale", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
	
    // Second => Speed
	// Rather than checking this, there are tests for speed <=> midi further down
	
    /************************************************/
    /*                                              */
    /* Tests bypassing neutral unit                 */
    /* - where this helps predict expected result   */
    /*                                              */
    /************************************************/

    // Speed => MIDI (tests for Speed = 0.5, 1.0 and 2)
    
	myDataspace->setAttributeValue(TT("inputUnit"), TT("speed"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("midi"));
    
    v = TTValue(0.5);
    expected = TTValue(-12.0);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("0.5 speed to MIDI", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);

    v = TTValue(1.0);
    expected = TTValue(0.0);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("1.0 speed to MIDI", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    v = TTValue(2.0);
    expected = TTValue(12.0);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("2.0 speed to MIDI", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    // MIDI => Speed (tests for Speed = 0.5, 1.0 and 2)*/
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("midi"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("speed")); 
    
    v = TTValue(-12.0);
    expected = TTValue(0.5);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("-12 MIDI to speed", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    v = TTValue(0.0);
    expected = TTValue(1.0);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("0 MIDI to speed", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    v = TTValue(12.0);
    expected = TTValue(2.0);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("12 MIDI to speed", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);  


    // Hz => Mel
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("Hz"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("mel"));    
    
    v = TTValue(1000.0);
    expected = TTValue(999.9855371396243);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("Hz to mel scale", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);

    // Mel => Hz
    
    myDataspace->setAttributeValue(TT("inputUnit"), TT("mel"));
    myDataspace->setAttributeValue(TT("outputUnit"), TT("Hz"));    
    
    v = TTValue(999.9855371396243);
    expected = TTValue(1000.0);
    
    myDataspace->sendMessage(TT("convert"), v, v);    
    
    TTTestAssertion("mel scale to Hz", 
					TTTestFloatEquivalence(TTFloat64(v), TTFloat64(expected)),
					testAssertionCount, 
					errorCount);
    
    
    
    return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
}