audio code

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

audio code

Postby Ian » Fri Nov 25, 2016 1:55 pm

is this broken?

Code: Select all
   else if(addr<0x700)
      v=SCSP->RINGBUF[(addr-0x600)/2];
   return v;


RINGBUF is 64 elements

But (0x700-0x600) / 2 = 128

Array out of bounds by 2x ?

Something static code analysis picked up
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: audio code

Postby Bart » Fri Nov 25, 2016 2:38 pm

It does look wrong to me, too, but I've never seen it cause a crash because I think the games never make an out-of-bounds access. Probably wouldn't hurt to increase the ring buffer size to 128 and add a comment about it.
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: audio code

Postby Ian » Sun Nov 27, 2016 6:26 am

It may not crash :p
It might just start overwriting the values in the memory directly following it.
I guess I can put an assert in there to see if values higher than 0x680 are ever written
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: audio code

Postby Spindizzi » Mon Dec 19, 2016 10:46 am

Hi,
I don't know if this can point you in the right direction
May be I found a solution to correct vf3 music in 2 players stage related here
https://www.supermodel3.com/Forum/viewtopic.php?f=2&t=1306

line 1807 SCSP.cpp
Code: Select all
#ifdef USEDSP
//SCSPDSP_SetSample(&SCSPs[0].DSP,/*sample>>5*/(sample*LPANTABLE[(Enc|0xE0)&0xFFE0])>>(SHIFT+3)/*>>SHIFT*/,ISEL(slot),IMXL(slot));
SCSPDSP_SetSample(&SCSPs[0].DSP,/*sample>>5*/(sample*LPANTABLE[Enc | 0xE0]) >> (SHIFT + 3)/*>>SHIFT*/, ISEL(slot), IMXL(slot));
#endif


I Hope is doesn't break something else because I can't understand the purpose of the mask 0xffe0. Is this correct another sound in other game ?
Notice : If I remove the OR 0xe0, these is no more motor sound in sr2

For test only
The exe x32-x64(svn514) include this sound patch for vf3 and also the sr2 music patch. I've added a save state for vf3 just before the music bug
https://www.dropbox.com/s/0vhoxbrf1bbf8o6/Supermodel-vf3-test.rar?raw=1
++
Spindizzi
 
Posts: 196
Joined: Thu Nov 17, 2016 8:55 am
Location: France

Re: audio code

Postby Ian » Mon Dec 19, 2016 11:44 am

Mame also has working audio for the model3 I think
always worth looking at that

Edit: here it is i think
https://github.com/mamedev/mame/blob/ma ... d/scsp.cpp
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: audio code

Postby Bart » Tue Dec 20, 2016 1:58 pm

Spindizzi wrote:Hi,
I don't know if this can point you in the right direction
May be I found a solution to correct vf3 music in 2 players stage related here
https://www.supermodel3.com/Forum/viewtopic.php?f=2&t=1306

line 1807 SCSP.cpp
Code: Select all
#ifdef USEDSP
//SCSPDSP_SetSample(&SCSPs[0].DSP,/*sample>>5*/(sample*LPANTABLE[(Enc|0xE0)&0xFFE0])>>(SHIFT+3)/*>>SHIFT*/,ISEL(slot),IMXL(slot));
SCSPDSP_SetSample(&SCSPs[0].DSP,/*sample>>5*/(sample*LPANTABLE[Enc | 0xE0]) >> (SHIFT + 3)/*>>SHIFT*/, ISEL(slot), IMXL(slot));
#endif


I Hope is doesn't break something else because I can't understand the purpose of the mask 0xffe0. Is this correct another sound in other game ?
Notice : If I remove the OR 0xe0, these is no more motor sound in sr2

For test only
The exe x32-x64(svn514) include this sound patch for vf3 and also the sr2 music patch. I've added a save state for vf3 just before the music bug
https://www.dropbox.com/s/0vhoxbrf1bbf8o6/Supermodel-vf3-test.rar?raw=1
++


I thought the DSP is not being used in Supermodel?
User avatar
Bart
Site Admin
 
Posts: 3086
Joined: Thu Sep 01, 2011 2:13 pm
Location: Reno, Nevada

Re: audio code

Postby Ian » Tue Dec 20, 2016 3:26 pm

#define USEDSP

is defined at the top of that file?
So I guess it must be
Ian
 
Posts: 2044
Joined: Tue Feb 23, 2016 9:23 am

Re: audio code

Postby Spindizzi » Wed Dec 21, 2016 2:11 am

Hi,
Just a notice
Looking real arcade video, it seems the dsp is in use (at least reverb effect in vf3).
In the code, if we undef USEDSP and def REVERBE (sort of software reverb effect I think) and def RB_VOLUME (to correct very very low motor sound in sr2) -> all work as normal too
++
Spindizzi
 
Posts: 196
Joined: Thu Nov 17, 2016 8:55 am
Location: France


Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 1 guest

cron