c++ - How to get rid of memcpy in QIoDevice -
i'm using qt create sound output. there illustration audioouput, pure virtual function qint64 qiodevice::readdata ( char * data, qint64 maxsize ) reimplemented this(this not actual code example).
qint64 generator::readdata(char *data, qint64 len) { memcpy(data, m_buffer.data(), len); homecoming len; } so, pointer data, re-create memory our buffer data. i'm wondering whether can assign pointer info new location, this:
qint64 generator::readdata(char *data, qint64 len) { info = m_buffer.data(); homecoming len; } because, memcpy slow , c. can i? give thanks you!
ok, not receive comments "what slow": first - memcpy slower pointer assignment sec - yes, have latency in sound playing, want create programme optimal @ every point.
p.s. i'm trying it, , have no sound, maybe reply no. why?
the signature of method lets homecoming info copying them. assigning pointer pointless because parameter passed copy, assigned value won't visible outside method.
memcpy not @ slow realtime sound output (unless doing on 8-bit processor).
too slow sound code can cause gaps in sound not latency. latency result of big sound buffer.
c++ qt audio qiodevice
No comments:
Post a Comment