Skip to content

Commit

Permalink
Reinsert the MonoMixer.{cpp,h} with the cache blocking SAMMONOMIXER.
Browse files Browse the repository at this point in the history
This code was removed in tag 0.74d because it modify the "note tuning" of the synth.
The bad code was related to a value in a buffer16[index] which was return two time, so
it impact the "note tuning".

Change Machine class function tick :
- int     tick()
+ Sint16  tick()
  • Loading branch information
yoyz committed Oct 27, 2016
1 parent a480eeb commit 75cc6a6
Show file tree
Hide file tree
Showing 23 changed files with 82 additions and 25 deletions.
3 changes: 2 additions & 1 deletion picoloop/Machine.cpp
Expand Up @@ -47,9 +47,10 @@ void Machine::reset()
}


int Machine::tick()
Sint16 Machine::tick()
{
DPRINTF("Machine::tick()");
return 0;
}


Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine.h
Expand Up @@ -179,7 +179,7 @@ class Machine

virtual void init();
virtual void reset();
virtual int tick();
virtual Sint16 tick();

virtual int checkI(int what,int val);
virtual int checkITwoVal(int what,int val1,int val2);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Cursynth/CursynthMachine.cpp
Expand Up @@ -393,7 +393,7 @@ void CursynthMachine::reset()
}


int CursynthMachine::tick()
Sint16 CursynthMachine::tick()
{
float f_in;
float f_out;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Cursynth/CursynthMachine.h
Expand Up @@ -14,7 +14,7 @@ class CursynthMachine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Dbopl/DboplMachine.cpp
Expand Up @@ -404,7 +404,7 @@ void dboplMachine::setI(int what,int val)

}

int dboplMachine::tick()
Sint16 dboplMachine::tick()
{
Sint16 s_in;
Sint16 s_out;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Dbopl/DboplMachine.h
Expand Up @@ -27,7 +27,7 @@ class dboplMachine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/MDADrum/MDADrumMachine.cpp
Expand Up @@ -2216,7 +2216,7 @@ void MDADrumMachine::setI(int what,int val)
}


int MDADrumMachine::tick()
Sint16 MDADrumMachine::tick()
{
int i=0;
Sint16 s_in=0;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/MDADrum/MDADrumMachine.h
Expand Up @@ -29,7 +29,7 @@ class MDADrumMachine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/MidiOutSystem/MidiOutMachine.cpp
Expand Up @@ -309,7 +309,7 @@ void MidiOutMachine::reset()
}


int MidiOutMachine::tick()
Sint16 MidiOutMachine::tick()
{
float f_in;
float f_out;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/MidiOutSystem/MidiOutMachine.h
Expand Up @@ -14,7 +14,7 @@ class MidiOutMachine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Open303/Open303Machine.cpp
Expand Up @@ -329,7 +329,7 @@ void Open303Machine::reset()
}


int Open303Machine::tick()
Sint16 Open303Machine::tick()
{
double f_in;
Sint16 s_out;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Open303/Open303Machine.h
Expand Up @@ -14,7 +14,7 @@ class Open303Machine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/PBSynth/PBSynthMachine.cpp
Expand Up @@ -327,7 +327,7 @@ void PBSynthMachine::setI(int what,int val)

}

int PBSynthMachine::tick()
Sint16 PBSynthMachine::tick()
{
Sint16 s_in;
Sint32 s_in32;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/PBSynth/PBSynthMachine.h
Expand Up @@ -20,7 +20,7 @@ class PBSynthMachine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Picodrum/PicodrumMachine.cpp
Expand Up @@ -279,7 +279,7 @@ void PicodrumMachine::reset()
}


int PicodrumMachine::tick()
Sint16 PicodrumMachine::tick()
{
float f_in;
float f_out;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Picodrum/PicodrumMachine.h
Expand Up @@ -16,7 +16,7 @@ class PicodrumMachine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Picosynth/PicosynthMachine.cpp
Expand Up @@ -329,7 +329,7 @@ void PicosynthMachine::reset()
}


int PicosynthMachine::tick()
Sint16 PicosynthMachine::tick()
{
float f_in;
float f_out;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Picosynth/PicosynthMachine.h
Expand Up @@ -17,7 +17,7 @@ class PicosynthMachine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Twytch/TwytchsynthMachine.cpp
Expand Up @@ -520,7 +520,7 @@ void TwytchsynthMachine::reset()
}


int TwytchsynthMachine::tick()
Sint16 TwytchsynthMachine::tick()
{
float f_in;
float f_out;
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Machine/Twytch/TwytchsynthMachine.h
Expand Up @@ -14,7 +14,7 @@ class TwytchsynthMachine : public Machine

void init();
void reset();
int tick();
Sint16 tick();

void setI(int what,int val);
void setF(int what,float val);
Expand Down
2 changes: 1 addition & 1 deletion picoloop/Makefile.PatternPlayer_debian_RtAudio
Expand Up @@ -18,7 +18,7 @@ CFLAGS= -c -O3 -D__LINUX__ -DLINUX -I. -LSDL/lib -D__RTAUDIO__ -DLINUX_DESKTOP -
CFLAGS= -c -O3 -D__LINUX__ -DLINUX -I. -LSDL/lib -D__RTAUDIO__ -DLINUX_DESKTOP -ggdb -DDUMP_AUDIO=1 -DFIXED
CFLAGS= -c -std=c++11 -O3 -D__LINUX__ -DLINUX -I. -LSDL/lib -D__RTAUDIO__ -D __RTMIDI__ -DLINUX_DESKTOP -ggdb -DDUMP_AUDIO=1 -fpermissive
CFLAGS= -c -std=c++11 -O3 -D__LINUX__ -DLINUX -I. -LSDL/lib -D__RTAUDIO__ -D __RTMIDI__ -DLINUX_DESKTOP -ggdb -DDUMP_AUDIO=1 -DDEBUGPRINTF -fpermissive
CFLAGS= -c -std=c++11 -O3 -D__LINUX__ -DLINUX -I. -LSDL/lib -D__RTAUDIO__ -D __RTMIDI__ -DPC_DESKTOP -ggdb -DDEBUGPRINTF -DSCREEN_MULT=2 -fpermissive
CFLAGS= -c -std=c++11 -O3 -D__LINUX__ -DLINUX -I. -LSDL/lib -D__RTAUDIO__ -D __RTMIDI__ -DPC_DESKTOP -ggdb -DDEBUGPRINTF -DSCREEN_MULT=2 -DDUMP_AUDIO=1 -fpermissive

LDFLAGS=-lasound -lSDL -lSDL_gfx -lSDL_ttf -lpthread -pg
LDFLAGS=-lasound -lSDL -lSDL_ttf -lpthread -pg
Expand Down
60 changes: 56 additions & 4 deletions picoloop/MonoMixer.cpp
Expand Up @@ -6,12 +6,19 @@ MonoMixer::MonoMixer(): PD(), PS(), OPLM(), PBS(), CS(), O303(), TW(), MD(), MID
#endif

#if defined(__FPU__) && !defined(__RTMIDI__)
MonoMixer::MonoMixer(): PD(), PS(), OPLM(), PBS(), CS(), O303(), TW(), FXDelay(), FXDisabled()
MonoMixer::MonoMixer(): PD(), PS(), OPLM(), PBS(), CS(), O303(), TW(), FXDelay(), FXDisabled()
#endif

#if !defined(__FPU__) && defined(__RTMIDI__)
MonoMixer::MonoMixer(): PD(), PS(), OPLM(), PBS(), MIDIOUTM(), FXDelay(), FXDisabled()
#endif

#if !defined(__FPU__) && !defined(__RTMIDI__)
MonoMixer::MonoMixer(): PD(), PS(), OPLM(), PBS(), FXDelay(), FXDisabled()
#endif

#define SAMMONOMIXER 32

{
DPRINTF("MonoMixer::MonoMixer()");
amplitude=127;
Expand All @@ -28,6 +35,10 @@ MonoMixer::MonoMixer(): PD(), PS(), OPLM(), PBS(),

fx_depth=125;
fx_speed=90;

index=0;
buffer16=NULL;
buffer32=NULL;
}

MonoMixer::~MonoMixer()
Expand All @@ -38,6 +49,8 @@ MonoMixer::~MonoMixer()

void MonoMixer::init()
{
int i=0;

PS.init();
PD.init();
OPLM.init();
Expand Down Expand Up @@ -87,6 +100,16 @@ void MonoMixer::init()
if (machine_type==SYNTH_MIDIOUT)
M=&MIDIOUTM;
#endif

if (buffer16==NULL)
buffer16=(Sint16*)malloc(sizeof(Sint16)*SAMMONOMIXER);
if (buffer32==NULL)
buffer32=(Sint32*)malloc(sizeof(Sint32)*SAMMONOMIXER);
for (i=0;i<SAMMONOMIXER;i++)
{
buffer16[i]=0;
buffer32[i]=0;
}
}


Expand Down Expand Up @@ -180,16 +203,45 @@ Sint16 MonoMixer::tick()
Sint32 res32=0;
Sint16 tick=0;
Sint16 res16=0;
int i=0;
//tick=M->tick();
//tick=FX.process(M->tick());
//tick=FXDelay.process(M->tick());

tick=FX->process(M->tick());
res32=tick*amplitude;
if (index+1<SAMMONOMIXER)
{
index++;
return buffer16[index];
}

for (i=0;i<SAMMONOMIXER;i++)
{
buffer32[i]=0;
buffer32[i]=M->tick();
}

for (i=0;i<SAMMONOMIXER;i++)
buffer32[i]=FX->process(buffer32[i]);


for (i=0;i<SAMMONOMIXER;i++)
{
buffer32[i]=(buffer32[i]*amplitude) >> 4;
if (buffer32[i]>32000) buffer32[i]=32000;
if (buffer32[i]<-32000) buffer32[i]=-32000;
}
for (i=0;i<SAMMONOMIXER;i++)
buffer16[i]=(Sint16)buffer32[i];

index=0;
return buffer16[index];

//tick=FX->process(M->tick());
//res32=tick*amplitude;
// res32=tick*127;
//res32=res32/127;

res32=res32>>4;
//res32=res32>>4;

//if (res32>32000) res32=32000-(res32>>6);
//if (res32<-32000) res32=-32000+(res32>>6);
Expand Down
4 changes: 4 additions & 0 deletions picoloop/MonoMixer.h
Expand Up @@ -64,6 +64,10 @@ class MonoMixer

int fx_depth;
int fx_speed;

int index;
Sint16 * buffer16;
Sint32 * buffer32;
};


Expand Down

0 comments on commit 75cc6a6

Please sign in to comment.