Add constant overloads for audio buffer pointers

This commit is contained in:
Robbert van der Helm
2021-06-11 12:58:46 +02:00
parent 964c150158
commit 340d376564
+14
View File
@@ -145,6 +145,13 @@ class AudioShmBuffer {
config.input_offsets[bus][channel];
}
template <typename T>
const T* input_channel_ptr(const uint32_t bus,
const uint32_t channel) const noexcept {
return reinterpret_cast<const T*>(buffer.get_address()) +
config.input_offsets[bus][channel];
}
/**
* Get a pointer to the part of the buffer where this output audio channel
* is stored in. Both the bus and the channel indices start at zero. These
@@ -156,6 +163,13 @@ class AudioShmBuffer {
config.output_offsets[bus][channel];
}
template <typename T>
const T* output_channel_ptr(const uint32_t bus,
const uint32_t channel) const noexcept {
return reinterpret_cast<const T*>(buffer.get_address()) +
config.output_offsets[bus][channel];
}
Config config;
private: