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


C++ MemoryOutputStream::getDataSize方法代码示例

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


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

示例1: create

        static void create (MemoryBlock& block, const StringPairArray& values)
        {
            auto numNotes = values.getValue ("NumCueNotes", "0").getIntValue();

            if (numNotes > 0)
            {
                MemoryOutputStream out (block, false);
                out.writeShortBigEndian ((short) numNotes);

                for (int i = 0; i < numNotes; ++i)
                {
                    auto prefix = "CueNote" + String (i);

                    out.writeIntBigEndian (values.getValue (prefix + "TimeStamp", "0").getIntValue());
                    out.writeShortBigEndian ((short) values.getValue (prefix + "Identifier", "0").getIntValue());

                    auto comment = values.getValue (prefix + "Text", String());
                    auto commentLength = jmin (comment.getNumBytesAsUTF8(), (size_t) 65534);

                    out.writeShortBigEndian ((short) commentLength + 1);
                    out.write (comment.toUTF8(), commentLength);
                    out.writeByte (0);

                    if ((out.getDataSize() & 1) != 0)
                        out.writeByte (0);
                }
            }
        }
开发者ID:Sentinel77,项目名称:dexed,代码行数:28,代码来源:juce_AiffAudioFormat.cpp

示例2: runTest

    void runTest() override
    {
        beginTest ("Basics");
        Random r = getRandom();

        int randomInt = r.nextInt();
        int64 randomInt64 = r.nextInt64();
        double randomDouble = r.nextDouble();
        String randomString (createRandomWideCharString (r));

        MemoryOutputStream mo;
        mo.writeInt (randomInt);
        mo.writeIntBigEndian (randomInt);
        mo.writeCompressedInt (randomInt);
        mo.writeString (randomString);
        mo.writeInt64 (randomInt64);
        mo.writeInt64BigEndian (randomInt64);
        mo.writeDouble (randomDouble);
        mo.writeDoubleBigEndian (randomDouble);

        MemoryInputStream mi (mo.getData(), mo.getDataSize(), false);
        expect (mi.readInt() == randomInt);
        expect (mi.readIntBigEndian() == randomInt);
        expect (mi.readCompressedInt() == randomInt);
        expectEquals (mi.readString(), randomString);
        expect (mi.readInt64() == randomInt64);
        expect (mi.readInt64BigEndian() == randomInt64);
        expect (mi.readDouble() == randomDouble);
        expect (mi.readDoubleBigEndian() == randomDouble);
    }
开发者ID:0x4d52,项目名称:JUCE,代码行数:30,代码来源:juce_MemoryInputStream.cpp

示例3: sendFullSyncCallback

void ValueTreeSynchroniser::sendFullSyncCallback()
{
    MemoryOutputStream m;
    writeHeader (m, ValueTreeSynchroniserHelpers::fullSync);
    valueTree.writeToStream (m);
    stateChanged (m.getData(), m.getDataSize());
}
开发者ID:COx2,项目名称:JUCE_JAPAN_DEMO,代码行数:7,代码来源:juce_ValueTreeSynchroniser.cpp

示例4: valueTreeChildRemoved

void ValueTreeSynchroniser::valueTreeChildRemoved (ValueTree& parentTree, ValueTree&, int oldIndex)
{
    MemoryOutputStream m;
    ValueTreeSynchroniserHelpers::writeHeader (*this, m, ValueTreeSynchroniserHelpers::childRemoved, parentTree);
    m.writeCompressedInt (oldIndex);
    stateChanged (m.getData(), m.getDataSize());
}
开发者ID:COx2,项目名称:JUCE_JAPAN_DEMO,代码行数:7,代码来源:juce_ValueTreeSynchroniser.cpp

示例5: createFromImageDataStream

Drawable* Drawable::createFromImageDataStream (InputStream& dataSource)
{
    MemoryOutputStream mo;
    mo.writeFromInputStream (dataSource, -1);

    return createFromImageData (mo.getData(), mo.getDataSize());
}
开发者ID:Labmind,项目名称:GUI,代码行数:7,代码来源:juce_Drawable.cpp

示例6: findTempoEvents

    static void findTempoEvents (MidiFile& midiFile, StringPairArray& midiMetadata)
    {
        MidiMessageSequence tempoEvents;
        midiFile.findAllTempoEvents (tempoEvents);

        const int numTempoEvents = tempoEvents.getNumEvents();
        MemoryOutputStream tempoSequence;

        for (int i = 0; i < numTempoEvents; ++i)
        {
            const double tempo = getTempoFromTempoMetaEvent (tempoEvents.getEventPointer (i));

            if (tempo > 0.0)
            {
                if (i == 0)
                    midiMetadata.set (CoreAudioFormat::tempo, String (tempo));

                if (numTempoEvents > 1)
                    tempoSequence << String (tempo) << ',' << tempoEvents.getEventTime (i) << ';';
            }
        }

        if (tempoSequence.getDataSize() > 0)
            midiMetadata.set ("tempo sequence", tempoSequence.toUTF8());
    }
开发者ID:AlessandroGiacomini,项目名称:pyplasm,代码行数:25,代码来源:juce_CoreAudioFormat.cpp

示例7: timerCallback

void Robot::timerCallback() {
  MemoryOutputStream * out = messageBuffer.getReader();
  if (out != nullptr) {
    send(out->getData(), out->getDataSize());
    messageBuffer.readDone();
  }
}
开发者ID:yvanvds,项目名称:pianola,代码行数:7,代码来源:Robot.cpp

示例8: findTimeSigEvents

    static void findTimeSigEvents (MidiFile& midiFile, StringPairArray& midiMetadata)
    {
        MidiMessageSequence timeSigEvents;
        midiFile.findAllTimeSigEvents (timeSigEvents);
        const int numTimeSigEvents = timeSigEvents.getNumEvents();

        MemoryOutputStream timeSigSequence;

        for (int i = 0; i < numTimeSigEvents; ++i)
        {
            int numerator, denominator;
            timeSigEvents.getEventPointer(i)->message.getTimeSignatureInfo (numerator, denominator);

            String timeSigString;
            timeSigString << numerator << '/' << denominator;

            if (i == 0)
                midiMetadata.set (CoreAudioFormat::timeSig, timeSigString);

            if (numTimeSigEvents > 1)
                timeSigSequence << timeSigString << ',' << timeSigEvents.getEventTime (i) << ';';
        }

        if (timeSigSequence.getDataSize() > 0)
            midiMetadata.set ("time signature sequence", timeSigSequence.toUTF8());
    }
开发者ID:AlessandroGiacomini,项目名称:pyplasm,代码行数:26,代码来源:juce_CoreAudioFormat.cpp

示例9: create

void create (MemoryBlock& block, const StringPairArray& values)
{
    const int numNotes = values.getValue ("NumCueNotes", "0").getIntValue();

    if (numNotes > 0)
    {
        MemoryOutputStream out (block, false);
        out.writeShortBigEndian ((short) numNotes);

        for (int i = 0; i < numNotes; ++i)
        {
            const String prefix ("CueNote" + String (i));

            out.writeIntBigEndian (values.getValue (prefix + "TimeStamp", "0").getIntValue());
            out.writeShortBigEndian ((short) values.getValue (prefix + "Identifier", "0").getIntValue());

            const String comment (values.getValue (prefix + "Text", String::empty));
            out.write (comment.toUTF8(), jmin (comment.getNumBytesAsUTF8(), 65534));
            out.writeByte (0);

            if ((out.getDataSize() & 1) != 0)
                out.writeByte (0);
        }
    }
}
开发者ID:EQ4,项目名称:editor,代码行数:25,代码来源:juce_AiffAudioFormat.cpp

示例10: getStateInformation

void HelmPlugin::getStateInformation(MemoryBlock& dest_data) {
  var state = LoadSave::stateToVar(&synth_, gui_state_, getCallbackLock());
  String data_string = JSON::toString(state);
  MemoryOutputStream stream;
  stream.writeString(data_string);
  dest_data.append(stream.getData(), stream.getDataSize());
}
开发者ID:grimtraveller,项目名称:helm,代码行数:7,代码来源:helm_plugin.cpp

示例11: findKeySigEvents

    static void findKeySigEvents (MidiFile& midiFile, StringPairArray& midiMetadata)
    {
        MidiMessageSequence keySigEvents;
        midiFile.findAllKeySigEvents (keySigEvents);
        const int numKeySigEvents = keySigEvents.getNumEvents();

        MemoryOutputStream keySigSequence;

        for (int i = 0; i < numKeySigEvents; ++i)
        {
            const MidiMessage& message (keySigEvents.getEventPointer (i)->message);
            const int key = jlimit (0, 14, message.getKeySignatureNumberOfSharpsOrFlats() + 7);
            const bool isMajor = message.isKeySignatureMajorKey();

            static const char* majorKeys[] = { "Cb", "Gb", "Db", "Ab", "Eb", "Bb", "F", "C", "G", "D", "A", "E", "B", "F#", "C#" };
            static const char* minorKeys[] = { "Ab", "Eb", "Bb", "F", "C", "G", "D", "A", "E", "B", "F#", "C#", "G#", "D#", "A#" };

            String keySigString (isMajor ? majorKeys[key]
                                         : minorKeys[key]);

            if (! isMajor)
                keySigString << 'm';

            if (i == 0)
                midiMetadata.set (CoreAudioFormat::keySig, keySigString);

            if (numKeySigEvents > 1)
                keySigSequence << keySigString << ',' << keySigEvents.getEventTime (i) << ';';
        }

        if (keySigSequence.getDataSize() > 0)
            midiMetadata.set ("key signature sequence", keySigSequence.toUTF8());
    }
开发者ID:AlessandroGiacomini,项目名称:pyplasm,代码行数:33,代码来源:juce_CoreAudioFormat.cpp

示例12:

OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const MemoryOutputStream& streamToRead)
{
    const size_t dataSize = streamToRead.getDataSize();

    if (dataSize > 0)
        stream.write (streamToRead.getData(), dataSize);

    return stream;
}
开发者ID:DISTRHO,项目名称:DISTRHO-Ports,代码行数:9,代码来源:juce_MemoryOutputStream.cpp

示例13: valueTreeChildAdded

void ValueTreeSynchroniser::valueTreeChildAdded (ValueTree& parentTree, ValueTree& childTree)
{
    const int index = parentTree.indexOf (childTree);
    jassert (index >= 0);

    MemoryOutputStream m;
    ValueTreeSynchroniserHelpers::writeHeader (*this, m, ValueTreeSynchroniserHelpers::childAdded, parentTree);
    m.writeCompressedInt (index);
    childTree.writeToStream (m);
    stateChanged (m.getData(), m.getDataSize());
}
开发者ID:COx2,项目名称:JUCE_JAPAN_DEMO,代码行数:11,代码来源:juce_ValueTreeSynchroniser.cpp

示例14: jojo_write

void jojo_write (t_jojo *x, const File& aFile)
{
    MemoryOutputStream myText;
    GZIPCompressorOutputStream zipper (&myText);
    
    zipper << "Stately, plump Buck Mulligan came from the stairhead, " << newLine
           << "bearing a bowl of lather on which a mirror and a razor lay crossed." << newLine;

    zipper.flush();
    
    aFile.replaceWithData (myText.getData(), myText.getDataSize());
}
开发者ID:frantic0,项目名称:Jojo,代码行数:12,代码来源:jojoZip.cpp

示例15: writeToStream

    void writeToStream (const ValueUnion& data, OutputStream& output) const
    {
        MemoryOutputStream buffer (512);
        const int numItems = data.arrayValue->size();
        buffer.writeCompressedInt (numItems);

        for (int i = 0; i < numItems; ++i)
            data.arrayValue->getReference(i).writeToStream (buffer);

        output.writeCompressedInt (1 + (int) buffer.getDataSize());
        output.writeByte (varMarker_Array);
        output << buffer;
    }
开发者ID:anthonyhuecouret,项目名称:argotlunar,代码行数:13,代码来源:juce_Variant.cpp


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