Skip to content

Commit 937ead6

Browse files
committed
OSCContainerDecoder: addParserCallback()
1 parent c173008 commit 937ead6

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/AudioTools/AudioCodecs/ContainerOSC.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,16 @@ class OSCContainerDecoder : public ContainerDecoder {
170170
/// Provides the mime type from the encoder
171171
const char *mime() { return mime_str.c_str(); };
172172

173+
/// Provides the sequence number of the last packet
174+
uint64_t getSequenceNumber() { return seq_no; }
175+
176+
/// Adds an new parser callback for a specific address matching string
177+
void addParserCallback(const char *address,
178+
bool (*callback)(OSCData &data, void *ref),
179+
OSCCompare compare = OSCCompare::Matches) {
180+
osc.addCallback(address, callback, compare);
181+
}
182+
173183
/// Replace the write to the decoder with a callback:
174184
void setWriteCallback(bool (*write_callback)(uint64_t time, uint64_t seq,
175185
uint8_t *data, size_t len,
@@ -180,8 +190,6 @@ class OSCContainerDecoder : public ContainerDecoder {
180190
/// Provide a reference object to the callback
181191
void setReference(void *ref) { this->ref = ref; }
182192

183-
/// Provides the sequence number of the last packet
184-
uint64_t getSequenceNumber() { return seq_no; }
185193

186194
protected:
187195
bool is_active = false;

0 commit comments

Comments
 (0)