mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 06:53:01 +00:00
SNES: more more more work
This commit is contained in:
parent
ffa0181704
commit
023bdf2f9a
3 changed files with 6 additions and 6 deletions
|
@ -56,15 +56,16 @@ long brrEncode(short* buf, unsigned char* out, long len, long loopStart) {
|
|||
|
||||
range=0;
|
||||
for (int j=0; j<16; j++) {
|
||||
short s=buf[j];
|
||||
short s=buf[j]-(buf[j]>>13);
|
||||
if (s<0) s=-s;
|
||||
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) {
|
||||
case 0:
|
||||
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<-8) o0=-8;
|
||||
if (range>=12) if (o0<-7) o0=-7;
|
||||
|
|
|
@ -32,7 +32,7 @@ extern "C" {
|
|||
* @param buf input data.
|
||||
* @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 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.
|
||||
*/
|
||||
long brrEncode(short* buf, unsigned char* out, long len, long loopStart);
|
||||
|
|
|
@ -911,8 +911,7 @@ void DivSample::render() {
|
|||
}
|
||||
if (depth!=DIV_SAMPLE_DEPTH_BRR) { // BRR
|
||||
if (!initInternal(DIV_SAMPLE_DEPTH_BRR,samples)) return;
|
||||
// TODO: loop point
|
||||
brrEncode(data16,dataBRR,(samples+15)&(~15),0);
|
||||
brrEncode(data16,dataBRR,(samples+15)&(~15),loop?loopStart:-1);
|
||||
}
|
||||
if (depth!=DIV_SAMPLE_DEPTH_VOX) { // VOX
|
||||
if (!initInternal(DIV_SAMPLE_DEPTH_VOX,samples)) return;
|
||||
|
|
Loading…
Reference in a new issue