SNES: more more more work

This commit is contained in:
tildearrow 2022-09-25 02:00:46 -05:00
parent ffa0181704
commit 023bdf2f9a
3 changed files with 6 additions and 6 deletions

View file

@ -56,15 +56,16 @@ long brrEncode(short* buf, unsigned char* out, long len, long loopStart) {
range=0; range=0;
for (int j=0; j<16; j++) { for (int j=0; j<16; j++) {
short s=buf[j]; short s=buf[j]-(buf[j]>>13);
if (s<0) s=-s; if (s<0) s=-s;
while (range<12 && s>((8<<range)-1)) range++; while (range<12 && s>((8<<range)-1)) range++;
} }
next[0]=(range<<4)|(filter<<2)|((i+16>=len)?1:0); next[0]=(range<<4)|(filter<<2)|((i+16>=len)?((loopStart>=0)?3:1):0);
switch (filter) { switch (filter) {
case 0: case 0:
for (int j=0; j<16; j++) { for (int j=0; j<16; j++) {
o0=buf[j]>>range; short s=buf[j]-(buf[j]>>13);
o0=s>>range;
if (o0>7) o0=7; if (o0>7) o0=7;
if (o0<-8) o0=-8; if (o0<-8) o0=-8;
if (range>=12) if (o0<-7) o0=-7; if (range>=12) if (o0<-7) o0=-7;

View file

@ -32,7 +32,7 @@ extern "C" {
* @param buf input data. * @param buf input data.
* @param out output buffer. shall be at least 9*(len/16) shorts in size. * @param out output buffer. shall be at least 9*(len/16) shorts in size.
* @param len input length (should be a multiple of 16. if it isn't, the output will be padded). * @param len input length (should be a multiple of 16. if it isn't, the output will be padded).
* @param loopStart beginning of loop area (may be 0 for no loop). this is used to ensure the respective block has no filter in order to loop properly. * @param loopStart beginning of loop area (may be -1 for no loop). this is used to ensure the respective block has no filter in order to loop properly.
* @return number of written samples. * @return number of written samples.
*/ */
long brrEncode(short* buf, unsigned char* out, long len, long loopStart); long brrEncode(short* buf, unsigned char* out, long len, long loopStart);

View file

@ -911,8 +911,7 @@ void DivSample::render() {
} }
if (depth!=DIV_SAMPLE_DEPTH_BRR) { // BRR if (depth!=DIV_SAMPLE_DEPTH_BRR) { // BRR
if (!initInternal(DIV_SAMPLE_DEPTH_BRR,samples)) return; if (!initInternal(DIV_SAMPLE_DEPTH_BRR,samples)) return;
// TODO: loop point brrEncode(data16,dataBRR,(samples+15)&(~15),loop?loopStart:-1);
brrEncode(data16,dataBRR,(samples+15)&(~15),0);
} }
if (depth!=DIV_SAMPLE_DEPTH_VOX) { // VOX if (depth!=DIV_SAMPLE_DEPTH_VOX) { // VOX
if (!initInternal(DIV_SAMPLE_DEPTH_VOX,samples)) return; if (!initInternal(DIV_SAMPLE_DEPTH_VOX,samples)) return;