prepare new chan osc code
chan osc output will be 65536Hz - always new functions for initializing the osc buffer and all
This commit is contained in:
parent
e94d99d79e
commit
c83ecfe993
|
@ -424,6 +424,7 @@ struct DivSamplePos {
|
|||
freq(0) {}
|
||||
};
|
||||
|
||||
// the actual output of all DivDispatchOscBuffer instanced runs at 65536Hz.
|
||||
struct DivDispatchOscBuffer {
|
||||
bool follow;
|
||||
unsigned int rate;
|
||||
|
@ -432,6 +433,20 @@ struct DivDispatchOscBuffer {
|
|||
unsigned short followNeedle;
|
||||
short data[65536];
|
||||
|
||||
// TODO: all of this
|
||||
inline void putSample(unsigned short pos, short val) {
|
||||
unsigned short realPos=needle+pos;
|
||||
if (val==0xffff) {
|
||||
data[needle+pos]=0xfffe;
|
||||
return;
|
||||
}
|
||||
data[needle+pos]=val;
|
||||
}
|
||||
inline void begin(unsigned short len) {
|
||||
}
|
||||
inline void end(unsigned short len) {
|
||||
needle+=len;
|
||||
}
|
||||
DivDispatchOscBuffer():
|
||||
follow(true),
|
||||
rate(65536),
|
||||
|
|
|
@ -134,6 +134,10 @@ bool DivDispatch::hasAcquireDirect() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool DivDispatch::isOscBufPositional() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DivDispatch::getWantPreNote() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -210,6 +210,8 @@ void DivPlatformPCSpeaker::acquire_unfilt(blip_buffer_t** bb, size_t off, size_t
|
|||
}
|
||||
out=(posToggle && !isMuted[0])?32767:0;
|
||||
blip_add_delta(bb[0],off,out-oldOut);
|
||||
oscBuf->data[oscBuf->needle++]=oscBufPos;
|
||||
oscBuf->data[oscBuf->needle++]=out;
|
||||
oldOut=out;
|
||||
if (freq>=1) {
|
||||
size_t boff=off;
|
||||
|
@ -222,6 +224,7 @@ void DivPlatformPCSpeaker::acquire_unfilt(blip_buffer_t** bb, size_t off, size_t
|
|||
i-=timeToNextToggle;
|
||||
boff+=timeToNextToggle;
|
||||
pos-=timeToNextToggle;
|
||||
oscBufPos+=timeToNextToggle;
|
||||
if (pos<=0) {
|
||||
pos=freq1;
|
||||
}
|
||||
|
@ -234,6 +237,8 @@ void DivPlatformPCSpeaker::acquire_unfilt(blip_buffer_t** bb, size_t off, size_t
|
|||
}
|
||||
out=(posToggle && !isMuted[0])?32767:0;
|
||||
blip_add_delta(bb[0],boff,out-oldOut);
|
||||
oscBuf->data[oscBuf->needle++]=oscBufPos;
|
||||
oscBuf->data[oscBuf->needle++]=out;
|
||||
oldOut=out;
|
||||
}
|
||||
}
|
||||
|
@ -641,6 +646,10 @@ bool DivPlatformPCSpeaker::hasAcquireDirect() {
|
|||
return (speakerType==0 || speakerType==3);
|
||||
}
|
||||
|
||||
bool DivPlatformPCSpeaker::isOscBufPositional() {
|
||||
return (speakerType==0 || speakerType==3);
|
||||
}
|
||||
|
||||
void DivPlatformPCSpeaker::setFlags(const DivConfig& flags) {
|
||||
switch (flags.getInt("clockSel",0)) {
|
||||
case 1: // PC-98
|
||||
|
@ -705,6 +714,7 @@ int DivPlatformPCSpeaker::init(DivEngine* p, int channels, int sugRate, const Di
|
|||
for (int i=0; i<1; i++) {
|
||||
isMuted[i]=false;
|
||||
}
|
||||
oscBufPos=0;
|
||||
oscBuf=new DivDispatchOscBuffer;
|
||||
setFlags(flags);
|
||||
|
||||
|
|
|
@ -88,6 +88,7 @@ class DivPlatformPCSpeaker: public DivDispatch {
|
|||
void muteChannel(int ch, bool mute);
|
||||
bool keyOffAffectsArp(int ch);
|
||||
bool hasAcquireDirect();
|
||||
bool isOscBufPositional();
|
||||
void setFlags(const DivConfig& flags);
|
||||
void notifyInsDeletion(void* ins);
|
||||
void notifyPlaybackStop();
|
||||
|
|
Loading…
Reference in a new issue