CPU Use
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "Lv2Log.hpp"
|
||||
#include "VuUpdate.hpp"
|
||||
#include "JackHost.hpp"
|
||||
|
||||
namespace pipedal
|
||||
{
|
||||
|
||||
@@ -50,6 +49,8 @@ namespace pipedal
|
||||
|
||||
OnMidiListen = 16,
|
||||
|
||||
AtomOutput = 17,
|
||||
|
||||
};
|
||||
|
||||
class RealtimeMonitorPortSubscription
|
||||
@@ -186,6 +187,16 @@ namespace pipedal
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool read(size_t size, uint8_t*data)
|
||||
{
|
||||
if (!ringBuffer->read(size,data))
|
||||
{
|
||||
throw PiPedalStateException("Ringbuffer read failed. Did you forget to check for space?");
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
template <typename T>
|
||||
void readComplete(T *output)
|
||||
{
|
||||
@@ -251,6 +262,24 @@ namespace pipedal
|
||||
|
||||
}
|
||||
}
|
||||
template <typename T>
|
||||
void write(RingBufferCommand command, const T &value, size_t dataLength, uint8_t*variableData)
|
||||
{
|
||||
|
||||
// the goal: to atomically write the command and associated data.
|
||||
CommandBuffer<T> buffer(command, value);
|
||||
|
||||
if (!ringBuffer->write(buffer.size(),(uint8_t *)&buffer,dataLength,variableData))
|
||||
{
|
||||
Lv2Log::error("No space in audio service ringbuffer.");
|
||||
return;
|
||||
|
||||
}
|
||||
}
|
||||
void AtomOutput(uint64_t instanceId, size_t bytes, uint8_t*data)
|
||||
{
|
||||
write(RingBufferCommand::AtomOutput,instanceId,bytes,data);
|
||||
}
|
||||
void ParameterRequest(RealtimeParameterRequest *pRequest)
|
||||
{
|
||||
write(RingBufferCommand::ParameterRequest,pRequest);
|
||||
@@ -354,4 +383,25 @@ namespace pipedal
|
||||
}
|
||||
};
|
||||
|
||||
typedef RingBufferReader<true, false> RealtimeRingBufferReader;
|
||||
typedef RingBufferReader<false, true> HostRingBufferReader;
|
||||
typedef RingBufferWriter<true, false> HostRingBufferWriter;
|
||||
|
||||
// cures a forward-declaration problem.
|
||||
class RealtimeRingBufferWriter: public RingBufferWriter<false, true>
|
||||
{
|
||||
public:
|
||||
RealtimeRingBufferWriter()
|
||||
{
|
||||
}
|
||||
RealtimeRingBufferWriter(RingBuffer<false,true>*ringBuffer)
|
||||
: RingBufferWriter<false, true> (ringBuffer)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
} //namespace
|
||||
Reference in New Issue
Block a user