示例#1
0
void DataBlockFile::setData(const std::string& s)
{
  //  std::cerr << "DataBlockFile::setData() : setting data to " << m_fileName << std::endl;
    prepareToWrite();

    QDataStream stream(&m_file);
    stream.writeRawData(s.data(), s.length());
}
bool MemoryOutputStream::write (const void* const buffer, size_t howMany)
{
    jassert (buffer != nullptr && ((ssize_t) howMany) >= 0);

    if (howMany > 0)
        memcpy (prepareToWrite (howMany), buffer, howMany);

    return true;
}
bool MemoryOutputStream::appendUTF8Char (juce_wchar c)
{
    if (char* dest = prepareToWrite (CharPointer_UTF8::getBytesRequiredFor (c)))
    {
        CharPointer_UTF8 (dest).write (c);
        return true;
    }

    return false;
}
void MemoryOutputStream::writeRepeatedByte (uint8 byte, int howMany)
{
    if (howMany > 0)
    {
        prepareToWrite (howMany);
        memset (static_cast<char*> (data.getData()) + position, byte, (size_t) howMany);
        position += howMany;
        size = jmax (size, position);
    }
}
bool MemoryOutputStream::write (const void* const buffer, int howMany)
{
    if (howMany > 0)
    {
        prepareToWrite (howMany);
        memcpy (static_cast<char*> (data.getData()) + position, buffer, howMany);
        position += howMany;
        size = jmax (size, position);
    }

    return true;
}
bool MemoryOutputStream::writeRepeatedByte (uint8 byte, size_t howMany)
{
    if (howMany == 0)
        return true;

    if (char* dest = prepareToWrite (howMany))
    {
        memset (dest, byte, howMany);
        return true;
    }

    return false;
}
bool MemoryOutputStream::write (const void* const buffer, size_t howMany)
{
    jassert (buffer != nullptr);

    if (howMany == 0)
        return true;

    if (char* dest = prepareToWrite (howMany))
    {
        memcpy (dest, buffer, howMany);
        return true;
    }

    return false;
}
    bool write (const float** data, int numSamples)
    {
        if (numSamples <= 0 || ! isRunning)
            return true;

        jassert (timeSliceThread.isThreadRunning());  // you need to get your thread running before pumping data into this!

        int start1, size1, start2, size2;
        prepareToWrite (numSamples, start1, size1, start2, size2);

        if (size1 + size2 < numSamples)
            return false;

        for (int i = buffer.getNumChannels(); --i >= 0;)
        {
            buffer.copyFrom (i, start1, data[i], size1);
            buffer.copyFrom (i, start2, data[i] + size1, size2);
        }

        finishedWrite (size1 + size2);
        timeSliceThread.notify();
        return true;
    }
void MemoryOutputStream::writeRepeatedByte (uint8 byte, size_t howMany)
{
    if (howMany > 0)
        memset (prepareToWrite (howMany), byte, howMany);
}
void MemoryOutputStream::appendUTF8Char (juce_wchar c)
{
    CharPointer_UTF8 (prepareToWrite (CharPointer_UTF8::getBytesRequiredFor (c))).write (c);
}
示例#11
0
void DataBlockFile::addDataString(const std::string& s)
{
    prepareToWrite();
    QDataStream stream(&m_file);
    stream.writeRawData(s.data(), s.length());
}
示例#12
0
void DataBlockFile::addDataByte(MidiByte byte)
{
    prepareToWrite();
    m_file.putChar(byte);
}