Exemplo n.º 1
0
bool JSAudioContext::JSGetter_channels(JSContext *cx, JS::MutableHandleValue vp)
{
    AudioParameters *params = m_Audio->m_OutputParameters;
    vp.setInt32(params->m_Channels);

    return true;
}
Exemplo n.º 2
0
bool JSAudioContext::JSGetter_sampleRate(JSContext *cx,
                                         JS::MutableHandleValue vp)
{
    AudioParameters *params = m_Audio->m_OutputParameters;
    vp.setInt32(params->m_SampleRate);

    return true;
}
CEXPORT bool def_timestep_image_map_get_width(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp) {
	JS_BeginRequest(cx);
	timestep_image_map *thiz = (timestep_image_map*)JS_GetPrivate(obj.get());
	if (thiz) {
		
		vp.setInt32(thiz->width);
		
	}
	JS_EndRequest(cx);
	return true;
}
Exemplo n.º 4
0
void IdWrapper::toValue(JS::MutableHandleValue value) const {
    if (isInt()) {
        value.setInt32(toInt32());
        return;
    }

    if (isString()) {
        auto str = JSID_TO_STRING(_value);
        value.setString(str);
        return;
    }

    uasserted(ErrorCodes::BadValue, "Failed to toValue() non-string and non-integer jsid");
}
static void
convertValue(JSContext *             jct,
             JS::MutableHandleValue  theData,
             const yarp::os::Value & inputValue)
{
    ODL_ENTER(); //####
    ODL_P2("jct = ", jct, "inputValue = ", &inputValue); //####
    if (inputValue.isBool())
    {
        theData.setBoolean(inputValue.asBool());
    }
    else if (inputValue.isInt())
    {
        theData.setInt32(inputValue.asInt());
    }
    else if (inputValue.isString())
    {
        YarpString value = inputValue.asString();
        JSString * aString = JS_NewStringCopyZ(jct, value.c_str());

        if (aString)
        {
            theData.setString(aString);
        }
    }
    else if (inputValue.isDouble())
    {
        theData.setDouble(inputValue.asDouble());
    }
    else if (inputValue.isDict())
    {
        yarp::os::Property * value = inputValue.asDict();

        if (value)
        {
            yarp::os::Bottle asList(value->toString());

            convertDictionary(jct, theData, asList);
        }
    }
    else if (inputValue.isList())
    {
        yarp::os::Bottle * value = inputValue.asList();

        if (value)
        {
            yarp::os::Property asDict;

            if (ListIsReallyDictionary(*value, asDict))
            {
                convertDictionary(jct, theData, *value);
            }
            else
            {
                convertList(jct, theData, *value);
            }
        }
    }
    else
    {
        // We don't know what to do with this...
        theData.setNull();
    }
    ODL_EXIT(); //####
} // convertValue
Exemplo n.º 6
0
bool JSAudioContext::JSGetter_bufferSize(JSContext *cx,
                                         JS::MutableHandleValue vp)
{
    vp.setInt32(m_Audio->m_OutputParameters->m_FramesPerBuffer);
    return true;
}