prepare to use FixedQueue
avoiding allocations in real-time code
This commit is contained in:
parent
90b76d20e3
commit
dbd200c279
3 changed files with 85 additions and 3 deletions
|
|
@ -22,7 +22,7 @@
|
|||
#include <math.h>
|
||||
|
||||
//#define rWrite(a,v) pendingWrites[a]=v;
|
||||
#define rWrite(a,v) if (!skipRegisterWrites) {writes.emplace(a,v); if (dumpWrites) {addWrite(a,v);} }
|
||||
#define rWrite(a,v) if (!skipRegisterWrites) {writes.push(QueuedWrite(a,v)); if (dumpWrites) {addWrite(a,v);} }
|
||||
#define chWrite(c,a,v) \
|
||||
if (!skipRegisterWrites) { \
|
||||
if (curChan!=c) { \
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#define _PCE_H
|
||||
|
||||
#include "../dispatch.h"
|
||||
#include <queue>
|
||||
#include "../fixedQueue.h"
|
||||
#include "../waveSynth.h"
|
||||
#include "sound/pce_psg.h"
|
||||
|
||||
|
|
@ -62,9 +62,10 @@ class DivPlatformPCE: public DivDispatch {
|
|||
struct QueuedWrite {
|
||||
unsigned char addr;
|
||||
unsigned char val;
|
||||
QueuedWrite(): addr(0), val(9) {}
|
||||
QueuedWrite(unsigned char a, unsigned char v): addr(a), val(v) {}
|
||||
};
|
||||
std::queue<QueuedWrite> writes;
|
||||
FixedQueue<QueuedWrite,512> writes;
|
||||
unsigned char lastPan;
|
||||
|
||||
int cycles, curChan, delay;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue