|
dxd - dynax driver framework 3.0.1d223
cross platform open source driver development framework
|
USB MIDI packetizer. More...
#include <dx_usb_audio.h>
Classes | |
| union | msg |
| USB MIDI endpoint element types: defining the element size for a single USB MIDI pipe request. More... | |
Public Member Functions | |
| void | clear (uint64_t position, uint64_t bytes) |
| zero a just-consumed region, wrapping around - only safe for a single reader's own rx, never a shared/multi-reader position | |
| size_t | decode (volatile uint64_t &rx, uint8_t *dst, uint8_t cable) |
| the next message of the cable as MIDI 1.0 bytes into dst, which holds 8, their count returned - 0: none | |
| size_t | decode (volatile uint64_t &rx, union msg &msg, uint8_t cable) |
| USB MIDI msg word to OS MIDI stream format decoder. | |
| uint64_t | empty () const |
| uint64_t | empty (uint64_t position) const |
| bool | encode (const uint8_t *os_midi_package, size_t length, uint8_t cable) |
| OS MIDI stream to USB MIDI msg word format encoder. | |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | force_read (ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | force_read (ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<typename ext_t, typename circular_t = ext_t> | |
| bool | force_read (volatile uint64_t &position, ext_t *const *dst, uint64_t bulk, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| multi channel interleaved bulk read from circular buffer with format conversion if applicable | |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | force_read (volatile uint64_t &position, ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<typename ext_t, typename circular_t = ext_t> | |
| bool | force_write (const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | force_write (const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<typename data_t> | |
| bool | force_write (data_t *const *const *src, uint64_t clients, uint64_t channels, uint64_t bulk) |
| template<typename circular_t, typename src_t> | |
| bool | force_write (src_t *const *const *src, uint32_t clients, uint32_t channels=1, uint64_t bulk=1) |
| multi channel multi client bulk mix into circular buffer with format conversion if applicable src[client][channel][sample] | |
| template<typename ext_t, typename circular_t = ext_t> | |
| bool | force_write (volatile uint64_t &position, const ext_t *const *src, uint64_t bulk, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| multi channel interleaved bulk write into circular buffer with format conversion if applicable | |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | force_write (volatile uint64_t &position, const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| single channel convenience access templates | |
| void | initialize () |
| void | initialize (uint64_t backingstore_size) |
| uint64_t | loop () const |
| template<typename ext_t, typename circular_t = ext_t> | |
| bool | mix_write (volatile uint64_t &position, const ext_t *const *src, uint64_t bulk, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| multi channel interleaved bulk mix into circular buffer at position with format conversion if applicable | |
| template<typename callback_t> | |
| bool | move (callback_t &callback, uint64_t packet) |
| template<non_pointer data_t> | |
| bool | operator<< (const data_t &src) |
| template<non_pointer data_t> | |
| bool | operator>> (data_t &dst) |
| template<auto op, typename ext_t, typename circular_t> | |
| void | put (uint64_t position, const ext_t *const *src, uint64_t bulk, uint32_t channels_circular, uint32_t channels_src, uint32_t circular_offset, uint32_t interleaved, uint64_t src_offset=0) |
| multi channel interleaved bulk placement into circular space at position with wrap-around; channel operation (copy/add) selected at compile time | |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | read (ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | read (ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | read (volatile uint64_t &position, ext_t *const *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_dst=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | read (volatile uint64_t &position, ext_t *dst, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| void | reset (int64_t timestamp) |
| a session start: the indices at the ring's size, the content silence, the time the transport's | |
| template<typename dst_t = uint8_t> | |
| dst_t * | simulate_read (uint64_t bulk=1) |
| template<typename dst_t = uint8_t> | |
| dst_t * | simulate_read (volatile uint64_t &position, uint64_t bulk) |
| uint8_t * | simulate_write (uint64_t bulk) |
| simulate write by advancing write idx and take care of wrap write optimization | |
| uint64_t | used () const |
| uint64_t | used (uint64_t position) const |
| template<typename ext_t, typename circular_t = ext_t> | |
| bool | write (const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | write (const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| template<typename ext_t, typename circular_t = ext_t> | |
| bool | write (volatile uint64_t &position, const ext_t *const *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t channels_src=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
| bulk write into circular buffer with format conversion if applicable | |
| template<non_pointer ext_t, typename circular_t = ext_t> | |
| bool | write (volatile uint64_t &position, const ext_t *src, uint64_t bulk=1, uint32_t channels_circular=1, uint32_t circular_offset=0, uint32_t interleaved=1) |
Static Public Member Functions | |
| template<typename position_t> | |
| static position_t | advance (volatile position_t &position, position_t value) |
| lock-free max-publish; returns the position advanced from (>= value when nothing was advanced), so the winning caller alone owns the span [returned, value) | |
| template<typename dst_t> | |
| static void | atomic_add (dst_t *dst, int64_t added) |
| atomic clip-add of one sample: concurrent writers into the same mix target must never plain read-modify-write | |
| template<typename position_t> | |
| static position_t | exchange (volatile position_t &position, position_t comperator, position_t value) |
| lock-free monotonic publish: advance position to value unless already beyond | |
Public Attributes | |
| struct | cycle |
| uint8_t | data [1] |
| volatile uint64_t | dropout |
| dropout counter | |
| volatile uint64_t | rx |
| the reader side's index: a transport reader's own; every client reads at its own cursor (dx::stream::cursor) | |
| uint64_t | size |
| size of buffer in bytes | |
| volatile int64_t | timestamp |
| current rx/tx timestamp | |
| volatile uint64_t | tx |
| producers current write index | |
Static Public Attributes | |
| static constexpr dx::stream::format | format {.midi= dx::stream::format::midi::bytes, .size= sizeof(uint32_t),} |
| the format in the ring and on the bus: one USB MIDI 1.0 event packet per line - cable and CIN, then up to 3 MIDI bytes | |
USB MIDI packetizer.
|
inlinestaticinherited |
lock-free max-publish; returns the position advanced from (>= value when nothing was advanced), so the winning caller alone owns the span [returned, value)
|
inlinestaticinherited |
atomic clip-add of one sample: concurrent writers into the same mix target must never plain read-modify-write
zero a just-consumed region, wrapping around - only safe for a single reader's own rx, never a shared/multi-reader position
|
inline |
the next message of the cable as MIDI 1.0 bytes into dst, which holds 8, their count returned - 0: none
|
inline |
USB MIDI msg word to OS MIDI stream format decoder.
Pops a corresponding MIDI msg from the backing store
filters MIDI data only for this cable number and ignores: CIN misc function, future use & cable events,
generates event size out of USB-MIDI CIN (code index) classification look-up table,
| cable | USB MIDI cable number |
|
inlineinherited |
|
inline |
OS MIDI stream to USB MIDI msg word format encoder.
Encodes USB midi message from OS MIDI package and pushes it to USB MIDI backingstore buffer. It does not signal the buffer though so encode can be called for multiple MIDI packages and then manually signalled together. Although generally unusual handles SYSEX midi and any combination of general MIDI and SYSEX in the same OS package.
checks OS MIDI msg type validy,
handles SYSEX data
checks for sysex termination prior end of os_midi_stream
checks if USB SYSEX msg fits and pushes msg to the backingstore without signalization.
handles general USB MIDI messages
computes USB MIDI msg nibbles,
checks OS MIDI msg size,
selects MIDI cable number and synthesize USB MIDI msg word,
checks if USB MIDI msg fits and pushes msg to the backingstore without signalization.
| os_midi_package | OS MIDI package |
| length | length of the OS MIDI package |
| cable | USB MIDI cable number |
|
inlinestaticinherited |
lock-free monotonic publish: advance position to value unless already beyond
compare and swap: position takes value where it held comperator; returns what it held
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
multi channel interleaved bulk read from circular buffer with format conversion if applicable
return true if enough data is available in circular space
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
multi channel multi client bulk mix into circular buffer with format conversion if applicable src[client][channel][sample]
return true if data fit into empty space
|
inlineinherited |
multi channel interleaved bulk write into circular buffer with format conversion if applicable
return true if data fit into circular space false if data fit not or older data had to be overwritten
|
inlineinherited |
single channel convenience access templates
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
multi channel interleaved bulk mix into circular buffer at position with format conversion if applicable
concurrent writers each holding their own position share one circular and always atomically add (never overwrite) into it - the single reader (its own rx, see above) is responsible for zeroing a region once consumed, so every writer finds a clean slate regardless of write order
return true if data fit into circular space false if data fit not or older data had to be overwritten
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
multi channel interleaved bulk placement into circular space at position with wrap-around; channel operation (copy/add) selected at compile time
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
a session start: the indices at the ring's size, the content silence, the time the transport's
|
inlineinherited |
|
inlineinherited |
simulate write by advancing write idx and take care of wrap write optimization
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
|
inlineinherited |
bulk write into circular buffer with format conversion if applicable
return true if data fit into empty space
|
inlineinherited |
| struct dx::circular::[struct].cycle dx::circular::cycle |
|
inherited |
|
inherited |
dropout counter
|
staticconstexpr |
the format in the ring and on the bus: one USB MIDI 1.0 event packet per line - cable and CIN, then up to 3 MIDI bytes
|
inherited |
the reader side's index: a transport reader's own; every client reads at its own cursor (dx::stream::cursor)
|
inherited |
size of buffer in bytes
|
inherited |
current rx/tx timestamp
|
inherited |
producers current write index
| (c) copyright 2009 dynamic acoustics e.U. | generated on |