mirror of https://github.com/AxioDL/boo.git
MIDIEncoder: Make _sendMessage overload for the ContiguousContainer concept
We can utilize the std::data and std::size utility functions to support passthrough-ing data for any container that satisfies the ContiguousContainer concept, which would be either std::array, std::string, or std::vector. This way we can utilize std::array internally without exposing the inclusion within the header.
This commit is contained in:
parent
4d1c7d444d
commit
0eb9f2caeb
|
@ -1,5 +1,8 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <iterator>
|
||||||
|
|
||||||
#include "boo/audiodev/IMIDIReader.hpp"
|
#include "boo/audiodev/IMIDIReader.hpp"
|
||||||
|
|
||||||
namespace boo {
|
namespace boo {
|
||||||
|
@ -8,7 +11,14 @@ template <class Sender>
|
||||||
class MIDIEncoder : public IMIDIReader {
|
class MIDIEncoder : public IMIDIReader {
|
||||||
Sender& m_sender;
|
Sender& m_sender;
|
||||||
uint8_t m_status = 0;
|
uint8_t m_status = 0;
|
||||||
|
|
||||||
void _sendMessage(const uint8_t* data, size_t len);
|
void _sendMessage(const uint8_t* data, size_t len);
|
||||||
|
|
||||||
|
template <typename ContiguousContainer>
|
||||||
|
void _sendMessage(const ContiguousContainer& container) {
|
||||||
|
_sendMessage(std::data(container), std::size(container));
|
||||||
|
}
|
||||||
|
|
||||||
void _sendContinuedValue(uint32_t val);
|
void _sendContinuedValue(uint32_t val);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue