Exemplo n.º 1
0
//==============================================================================
void AdmvAudioProcessor::getStateInformation (MemoryBlock& destData)
{
	uint8 version = getStateVersion();

	destData.ensureSize(sizeof(mState) + 1, false);
	destData.copyFrom(&version, 0, 1);
	destData.copyFrom(&mState, 1, sizeof(mState));
}
//==============================================================================
bool InterprocessConnection::sendMessage (const MemoryBlock& message)
{
    uint32 messageHeader[2] = { ByteOrder::swapIfBigEndian (magicMessageHeader),
                                ByteOrder::swapIfBigEndian ((uint32) message.getSize()) };

    MemoryBlock messageData (sizeof (messageHeader) + message.getSize());
    messageData.copyFrom (messageHeader, 0, sizeof (messageHeader));
    messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize());

    return writeData (messageData.getData(), (int) messageData.getSize()) == (int) messageData.getSize();
}
Exemplo n.º 3
0
const MemoryBlock CtrlrMIDITransaction::getDataFromResponse(const MidiMessage &messageToExtractFrom)
{
	MemoryBlock returnData;
	MemoryBlock temp(messageToExtractFrom.getRawData(), messageToExtractFrom.getRawDataSize());

	returnData.copyFrom (temp.getData(), getResponsePrefixLength(), getResponseDataLength());
	return (returnData);
}
Exemplo n.º 4
0
MemoryBlock CtrlrMIDITransaction::getDataFromCurrentResponse()
{
	MemoryBlock returnData;

	if (responseReceived.getSize() > 0)
	{
		returnData.copyFrom (responseReceived.getData(), getResponsePrefixLength(), getResponseDataLength());
	}

	return (returnData);
}
//==============================================================================
bool InterprocessConnection::sendMessage (const MemoryBlock& message)
{
    uint32 messageHeader[2];
    messageHeader [0] = ByteOrder::swapIfBigEndian (magicMessageHeader);
    messageHeader [1] = ByteOrder::swapIfBigEndian ((uint32) message.getSize());

    MemoryBlock messageData (sizeof (messageHeader) + message.getSize());
    messageData.copyFrom (messageHeader, 0, sizeof (messageHeader));
    messageData.copyFrom (message.getData(), sizeof (messageHeader), message.getSize());

    int bytesWritten = 0;

    const ScopedLock sl (pipeAndSocketLock);

    if (socket != nullptr)
        bytesWritten = socket->write (messageData.getData(), (int) messageData.getSize());
    else if (pipe != nullptr)
        bytesWritten = pipe->write (messageData.getData(), (int) messageData.getSize(), pipeReceiveMessageTimeout);

    return bytesWritten == (int) messageData.getSize();
}