mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added an optional thread name parameter to the OSCReceiver constructor
This commit is contained in:
parent
d90add3307
commit
7b736feb2a
2 changed files with 19 additions and 13 deletions
|
|
@ -101,9 +101,9 @@ namespace
|
|||
if (input.getNumBytesRemaining() < 4)
|
||||
throw OSCFormatError ("OSC input stream exhausted while reading string");
|
||||
|
||||
const size_t posBegin = (size_t) getPosition();
|
||||
String s (input.readString());
|
||||
const size_t posEnd = (size_t) getPosition();
|
||||
auto posBegin = (size_t) getPosition();
|
||||
auto s = input.readString();
|
||||
auto posEnd = (size_t) getPosition();
|
||||
|
||||
if (static_cast<const char*> (getData()) [posEnd - 1] != '\0')
|
||||
throw OSCFormatError ("OSC input stream exhausted before finding null terminator of string");
|
||||
|
|
@ -119,14 +119,14 @@ namespace
|
|||
if (input.getNumBytesRemaining() < 4)
|
||||
throw OSCFormatError ("OSC input stream exhausted while reading blob");
|
||||
|
||||
const size_t blobDataSize = (size_t) input.readIntBigEndian();
|
||||
auto blobDataSize = (size_t) input.readIntBigEndian();
|
||||
|
||||
if ((size_t) input.getNumBytesRemaining() < (blobDataSize + 3) % 4)
|
||||
throw OSCFormatError ("OSC input stream exhausted before reaching end of blob");
|
||||
|
||||
MemoryBlock blob;
|
||||
|
||||
const size_t bytesRead = input.readIntoMemoryBlock (blob, (ssize_t) blobDataSize);
|
||||
auto bytesRead = input.readIntoMemoryBlock (blob, (ssize_t) blobDataSize);
|
||||
readPaddingZeros (bytesRead);
|
||||
|
||||
return blob;
|
||||
|
|
@ -203,8 +203,8 @@ namespace
|
|||
//==============================================================================
|
||||
OSCMessage readMessage()
|
||||
{
|
||||
OSCAddressPattern ap = readAddressPattern();
|
||||
OSCTypeList types = readTypeTagString();
|
||||
auto ap = readAddressPattern();
|
||||
auto types = readTypeTagString();
|
||||
|
||||
OSCMessage msg (ap);
|
||||
|
||||
|
|
@ -321,7 +321,7 @@ namespace
|
|||
struct OSCReceiver::Pimpl : private Thread,
|
||||
private MessageListener
|
||||
{
|
||||
Pimpl() : Thread ("JUCE OSC server")
|
||||
Pimpl (const String& threadName) : Thread (threadName)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -387,8 +387,7 @@ struct OSCReceiver::Pimpl : private Thread,
|
|||
addListenerWithAddress (listenerToAdd, addressToMatch, listenersWithAddress);
|
||||
}
|
||||
|
||||
void addListener (ListenerWithOSCAddress<RealtimeCallback>* listenerToAdd,
|
||||
OSCAddress addressToMatch)
|
||||
void addListener (ListenerWithOSCAddress<RealtimeCallback>* listenerToAdd, OSCAddress addressToMatch)
|
||||
{
|
||||
addListenerWithAddress (listenerToAdd, addressToMatch, realtimeListenersWithAddress);
|
||||
}
|
||||
|
|
@ -429,7 +428,7 @@ struct OSCReceiver::Pimpl : private Thread,
|
|||
|
||||
try
|
||||
{
|
||||
OSCBundle::Element content = inStream.readElementWithKnownSize (dataSize);
|
||||
auto content = inStream.readElementWithKnownSize (dataSize);
|
||||
|
||||
// realtime listeners should receive the OSC content first - and immediately
|
||||
// on this thread:
|
||||
|
|
@ -587,7 +586,11 @@ private:
|
|||
};
|
||||
|
||||
//==============================================================================
|
||||
OSCReceiver::OSCReceiver() : pimpl (new Pimpl())
|
||||
OSCReceiver::OSCReceiver (const String& threadName) : pimpl (new Pimpl (threadName))
|
||||
{
|
||||
}
|
||||
|
||||
OSCReceiver::OSCReceiver() : OSCReceiver ("JUCE OSC server")
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,9 +42,12 @@ class JUCE_API OSCReceiver
|
|||
{
|
||||
public:
|
||||
//==============================================================================
|
||||
/** Constructs a new OSCReceiver. */
|
||||
/** Creates an OSCReceiver. */
|
||||
OSCReceiver();
|
||||
|
||||
/** Creates an OSCReceiver with a specific name for its thread. */
|
||||
OSCReceiver (const String& threadName);
|
||||
|
||||
/** Destructor. */
|
||||
~OSCReceiver();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue