ADnote: started to use memset/memcpy

Started to use memset/memcpy based upon suggestion by Alan Calvert
(cherry picked from commit 0adbb0532845d8f10d3b4636a95c59b301d10d2c)
This commit is contained in:
fundamental
2009-10-08 21:19:40 -04:00
committed by Tobias Doerffel
parent 2a121fda50
commit 9996483dc3
2 changed files with 17 additions and 15 deletions

View File

@@ -944,3 +944,12 @@
02 Oct 2009 (Mark McCurry)
- Added OSS failsafe by J<>r<EFBFBD>mie Andr<64>i
04 Oct 2009 (Mark McCurry)
- fixed Ctest issues
06 Oct 2009 (Mark McCurry)
- Added first simple profiling test
08 Oct 2009 (Mark McCurry)
- Started to see if memset/memcpy offer performance benifits when
widely used

View File

@@ -22,7 +22,7 @@
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "../globals.h"
#include "../Misc/Util.h"
@@ -590,7 +590,7 @@ void ADnote::KillVoice(int nvoice)
if ((NoteVoicePar[nvoice].FMEnabled!=NONE)&&(NoteVoicePar[nvoice].FMVoice<0)) delete []NoteVoicePar[nvoice].FMSmp;
if (NoteVoicePar[nvoice].VoiceOut!=NULL)
for (int i=0;i<SOUND_BUFFER_SIZE;i++) NoteVoicePar[nvoice].VoiceOut[i]=0.0;//do not delete, yet: perhaps is used by another voice
memset(NoteVoicePar[nvoice].VoiceOut, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));//do not delete, yet: perhaps is used by another voice
NoteVoicePar[nvoice].Enabled=OFF;
};
@@ -1301,18 +1301,13 @@ int ADnote::noteout(REALTYPE *outl,REALTYPE *outr)
{
int i,nvoice;
for (i=0;i<SOUND_BUFFER_SIZE;i++) {
outl[i]=denormalkillbuf[i];
outr[i]=denormalkillbuf[i];
};
memcpy(outl, denormalkillbuf, SOUND_BUFFER_SIZE*sizeof(REALTYPE));
memcpy(outr, denormalkillbuf, SOUND_BUFFER_SIZE*sizeof(REALTYPE));
if (NoteEnabled==OFF) return(0);
for (i=0;i<SOUND_BUFFER_SIZE;i++) {
bypassl[i]=0.0;
bypassr[i]=0.0;
};
memset(bypassl, 0, SOUND_BUFFER_SIZE*sizeof(REALTYPE));
memset(bypassr, 0, SOUND_BUFFER_SIZE*sizeof(REALTYPE));
computecurrentparameters();
for (nvoice=0;nvoice<NUM_VOICES;nvoice++) {
@@ -1512,10 +1507,8 @@ int ADnote::noteout(REALTYPE *outl,REALTYPE *outr)
// Apply legato-specific sound signal modifications
if (Legato.silent) { // Silencer
if (Legato.msg!=LM_FadeIn) {
for (i=0;i<SOUND_BUFFER_SIZE;i++) {
outl[i]=0.0;
outr[i]=0.0;
}
memset(outl, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
memset(outl, 0, SOUND_BUFFER_SIZE * sizeof(REALTYPE));
}
}
switch (Legato.msg) {