当前位置: 首页>>代码示例>>C++>>正文


C++ OSCMessage::addString方法代码示例

本文整理汇总了C++中OSCMessage::addString方法的典型用法代码示例。如果您正苦于以下问题:C++ OSCMessage::addString方法的具体用法?C++ OSCMessage::addString怎么用?C++ OSCMessage::addString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OSCMessage的用法示例。


在下文中一共展示了OSCMessage::addString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sendOSC

void Ambix_encoderAudioProcessor::sendOSC() // send osc data
{
    
    if (osc_out)
    {
        OSCMessage mymsg = OSCMessage("/ambi_enc");
        mymsg.addInt32(m_id); // source id
        mymsg.addString("test"); // name... currently unused
        mymsg.addFloat32(2.0f); // distance... currently unused
        mymsg.addFloat32(360.f*(azimuth_param-0.5f)); // azimuth -180....180°
        mymsg.addFloat32(360.f*(elevation_param-0.5f)); // elevation -180....180°
        mymsg.addFloat32(size_param); // size param 0.0 ... 1.0
        mymsg.addFloat32(dpk); // digital peak value linear 0.0 ... 1.0 (=0dBFS)
        mymsg.addFloat32(rms); // rms value linear 0.0 ... 1.0 (=0dBFS)
        
        if(osc_in)
        {
            mymsg.addInt32(osc_in_port.getIntValue()); // osc receiver udp port
        }
        
        for (int i = 0; i < oscSenders.size(); i++) {
            oscSenders.getUnchecked(i)->send(mymsg);
        }
        
        _azimuth_param = azimuth_param; // change buffers
        _elevation_param = elevation_param;
        _size_param = size_param;
        _rms = rms;
        _dpk = dpk;
    }
    
}
开发者ID:JayaWei,项目名称:ambix,代码行数:32,代码来源:PluginProcessor.cpp

示例2: runTest

    void runTest()
    {
        beginTest ("Basic usage");
        {
            OSCMessage msg ("/test/param0");
            expectEquals (msg.size(), 0);
            expect (msg.getAddressPattern().toString() == "/test/param0");

            const int numTestArgs = 4;

            const int testInt = 42;
            const float testFloat = 3.14159f;
            const String testString = "Hello, World!";

            const uint8 testBlobData[5] = { 0xBB, 0xCC, 0xDD, 0xEE, 0xFF };
            const MemoryBlock testBlob (testBlobData,  sizeof (testBlobData));

            msg.addInt32 (testInt);
            msg.addFloat32 (testFloat);
            msg.addString (testString);
            msg.addBlob (testBlob);

            expectEquals (msg.size(), numTestArgs);

            expectEquals (msg[0].getType(), OSCTypes::int32);
            expectEquals (msg[1].getType(), OSCTypes::float32);
            expectEquals (msg[2].getType(), OSCTypes::string);
            expectEquals (msg[3].getType(), OSCTypes::blob);

            expect (msg[0].isInt32());
            expect (msg[1].isFloat32());
            expect (msg[2].isString());
            expect (msg[3].isBlob());

            expectEquals (msg[0].getInt32(), testInt);
            expectEquals (msg[1].getFloat32(), testFloat);
            expectEquals (msg[2].getString(), testString);
            expect (msg[3].getBlob() == testBlob);

            expect (msg.begin() + numTestArgs == msg.end());

            OSCArgument* arg = msg.begin();
            expect (arg->isInt32());
            expectEquals (arg->getInt32(), testInt);
            ++arg;
            expect (arg->isFloat32());
            expectEquals (arg->getFloat32(), testFloat);
            ++arg;
            expect (arg->isString());
            expectEquals (arg->getString(), testString);
            ++arg;
            expect (arg->isBlob());
            expect(arg->getBlob() == testBlob);
            ++arg;
            expect (arg == msg.end());
        }


        beginTest ("Initialisation with argument list (C++11 only)");
        {
            int testInt = 42;
            float testFloat = 5.5;
            String testString = "Hello, World!";

            {
                OSCMessage msg ("/test", testInt);
                expect (msg.getAddressPattern().toString() == String ("/test"));
                expectEquals (msg.size(), 1);
                expect (msg[0].isInt32());
                expectEquals (msg[0].getInt32(), testInt);
            }
            {
                OSCMessage msg ("/test", testFloat);
                expect (msg.getAddressPattern().toString() == String ("/test"));
                expectEquals (msg.size(), 1);
                expect (msg[0].isFloat32());
                expectEquals (msg[0].getFloat32(), testFloat);
            }
            {
                OSCMessage msg ("/test", testString);
                expect (msg.getAddressPattern().toString() == String ("/test"));
                expectEquals (msg.size(), 1);
                expect (msg[0].isString());
                expectEquals (msg[0].getString(), testString);
            }
            {
                OSCMessage msg ("/test", testInt, testFloat, testString, testFloat, testInt);
                expect (msg.getAddressPattern().toString() == String ("/test"));
                expectEquals (msg.size(), 5);
                expect (msg[0].isInt32());
                expect (msg[1].isFloat32());
                expect (msg[2].isString());
                expect (msg[3].isFloat32());
                expect (msg[4].isInt32());

                expectEquals (msg[0].getInt32(), testInt);
                expectEquals (msg[1].getFloat32(), testFloat);
                expectEquals (msg[2].getString(), testString);
                expectEquals (msg[3].getFloat32(), testFloat);
                expectEquals (msg[4].getInt32(), testInt);
//.........这里部分代码省略.........
开发者ID:olilarkin,项目名称:JUCE,代码行数:101,代码来源:juce_OSCMessage.cpp


注:本文中的OSCMessage::addString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。