Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
Index: apps/plugins/midi/midiutil.c =================================================================== --- apps/plugins/midi/midiutil.c (Revision 30427) +++ apps/plugins/midi/midiutil.c (Arbeitskopie) @@ -28,12 +28,12 @@ int chPBDepth[16] IBSS_ATTR; /* Channel pitch bend depth */ int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */ int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */ -unsigned char chLastCtrlMSB[16]; /* MIDI regs, used for Controller 6. */ -unsigned char chLastCtrlLSB[16]; /* The non-registered ones are ignored */ +unsigned char chLastCtrlMSB[16] IBSS_ATTR; /* MIDI regs, used for Controller 6. */ +unsigned char chLastCtrlLSB[16] IBSS_ATTR; /* The non-registered ones are ignored */ struct GPatch * gusload(char *); -struct GPatch * patchSet[128]; -struct GPatch * drumSet[128]; +struct GPatch * patchSet[128] IBSS_ATTR; +struct GPatch * drumSet[128] IBSS_ATTR; struct SynthObject voices[MAX_VOICES] IBSS_ATTR; Index: apps/plugins/midi/guspat.c =================================================================== --- apps/plugins/midi/guspat.c (Revision 30427) +++ apps/plugins/midi/guspat.c (Arbeitskopie) @@ -23,7 +23,7 @@ #include "midiutil.h" /* This came from one of the Gravis documents */ -const uint32_t gustable[]= +const uint32_t gustable[] ICONST_ATTR = { 8175, 8661, 9177, 9722, 10300, 10913, 11562, 12249, 12978, 13750, 14567, 15433, 16351, 17323, 18354, 19445, 20601, 21826, 23124, 24499, 25956, 27500, 29135, 30867, Index: apps/plugins/midi/midiutil.h =================================================================== --- apps/plugins/midi/midiutil.h (Revision 30427) +++ apps/plugins/midi/midiutil.h (Arbeitskopie) @@ -26,30 +26,21 @@ #define BUF_SIZE 16384 /* 64 kB output buffers */ #define NBUF 2 +#define SAMPLE_RATE SAMPR_44 /* Always use 44.1 kHz to avoid aliasing effects */ + #ifndef SIMULATOR -#if (HW_SAMPR_CAPS & SAMPR_CAP_22) /* use 22050Hz if we can */ -#define SAMPLE_RATE SAMPR_22 /* 22050 */ -#else -#define SAMPLE_RATE SAMPR_44 /* 44100 */ -#endif + #if (CONFIG_PLATFORM & PLATFORM_HOSTED) + #define MAX_VOICES 48 + #else + #define MAX_VOICES 24 /* Note: 24 midi channels is the minimum general midi spec implementation */ + #endif -/* Some of the pp based targets can't handle too many voices - mainly because they have to use 44100Hz sample rate, this could be - improved to increase MAX_VOICES for targets that can do 22kHz */ -#ifdef CPU_PP -#define MAX_VOICES 16 -#elif (CONFIG_PLATFORM & PLATFORM_HOSTED) -#define MAX_VOICES 48 #else -#define MAX_VOICES 24 /* Note: 24 midi channels is the minimum general midi spec implementation */ -#endif /* CPU_PP */ + + /* In sumulator we can afford to use more voices */ + #define MAX_VOICES 48 -#else /* Simulator requires 44100Hz, and we can afford to use more voices */ - -#define SAMPLE_RATE SAMPR_44 -#define MAX_VOICES 48 - #endif #define BYTE unsigned char @@ -160,8 +151,8 @@ extern int chPat[16]; /* Channel patch */ extern int chPW[16]; /* Channel pitch wheel, MSB only */ extern int chPBDepth[16]; /* Channel pitch bend depth (Controller 6 */ -extern int chPBNoteOffset[16] IBSS_ATTR; /* Pre-computed whole semitone offset */ -extern int chPBFractBend[16] IBSS_ATTR; /* Fractional bend applied to delta */ +extern int chPBNoteOffset[16]; /* Pre-computed whole semitone offset */ +extern int chPBFractBend[16]; /* Fractional bend applied to delta */ extern unsigned char chLastCtrlMSB[16]; /* MIDI regs, used for Controller 6. */ extern unsigned char chLastCtrlLSB[16]; /* The non-registered ones are ignored */ Index: apps/plugins/midi/synth.c =================================================================== --- apps/plugins/midi/synth.c (Revision 30427) +++ apps/plugins/midi/synth.c (Arbeitskopie) @@ -260,6 +260,21 @@ so->curOffset = 0; } +static inline void panSample(int32_t * out, int pan, int s1) +{ + if(LIKELY(pan == 64)) + { + /* s2 = s1 = s1 * 64 */ + *(out) += ((s1 << 16) & 0xFFFF0000) | ((s1) &0xFFFF); + } + else + { + int s2 = s1 * pan; + s1 = (s1 << 7) -s2; + *(out) += ((s1 << 9) & 0xFFFF0000) | ((s2 >> 7) &0xFFFF); + } +} + static inline void synthVoice(struct SynthObject * so, int32_t * out, unsigned int samples) { struct GWaveform * wf; @@ -299,9 +314,7 @@ so->isUsed = false; s1 = so->decay; - s2 = s1 * pan; - s1 = (s1 << 7) -s2; - *(out++) += ((s1 << 9) & 0xFFFF0000) | ((s2 >> 7) &0xFFFF); + panSample(out++, pan, s1); continue; } } else /* OK to advance voice */ @@ -430,9 +443,7 @@ so->decay = 1; /* stupid junk.. */ } - s2 = s1 * pan; - s1 = (s1 << 7) - s2; - *(out++) += ((s1 << 9) & 0xFFFF0000) | ((s2 >> 7) &0xFFFF); + panSample(out++, pan, s1); } /* store these again */ @@ -445,21 +456,22 @@ /* buffer to hold all the samples for the current tick, this is a hack neccesary for coldfire targets as pcm_play_data uses the dma which cannot access iram */ -int32_t samp_buf[512] IBSS_ATTR; +#define SAMP_BUF_SIZE 1024 +static int32_t samp_buf[SAMP_BUF_SIZE] IBSS_ATTR; /* synth num_samples samples and write them to the */ /* buffer pointed to by buf_ptr */ void synthSamples(int32_t *buf_ptr, unsigned int num_samples) ICODE_ATTR; void synthSamples(int32_t *buf_ptr, unsigned int num_samples) { - if (UNLIKELY(num_samples > 512)) + if (UNLIKELY(num_samples > SAMP_BUF_SIZE)) DEBUGF("num_samples is too big!\n"); else { int i; struct SynthObject *voicept; - rb->memset(samp_buf, 0, num_samples*4); + rb->memset(samp_buf, 0, num_samples*sizeof(int32_t)); for(i=0; i < MAX_VOICES; i++) { @@ -470,7 +482,7 @@ } } - rb->memcpy(buf_ptr, samp_buf, num_samples*4); + rb->memcpy(buf_ptr, samp_buf, num_samples*sizeof(int32_t)); } /* TODO: Automatic Gain Control, anyone? */ Index: apps/plugins/midi/sequencer.c =================================================================== --- apps/plugins/midi/sequencer.c (Revision 30427) +++ apps/plugins/midi/sequencer.c (Arbeitskopie) @@ -33,7 +33,7 @@ * I doubt anyone has made their own custom rockbox patchset * (if you have, please send a copy my way :) ) */ -static const unsigned char patchScale[]= +static const unsigned char patchScale[] ICONST_ATTR = { 125,115,115,100,100,80,115,100,100,100,100,80,100,100,100,100, 100,100,100,100,60,100,100,100,150,155,145,100,125,86,125,85, |