Previous 15994 Revisions Next

r6111 Saturday 17th October, 2009 at 07:13:30 UTC by Harmony
[CDI] Greatly improved Level A ADPCM emulation, only issue is the same distortion as with Level B and Level C [Harmony]
[src/mess/drivers]cdi.c

src/mess/drivers/cdi.c
r6110r6111
10231023
10241024   for (b=0; b<18; b++)
10251025   {
1026      for (s=0; s<3; s++)
1026      for (s=0; s<4; s++)
10271027      {
10281028         unsigned char flags=xa[(4+s)^1],
10291029                              shift=flags&0xf,
r6110r6111
10341034
10351035         for (i=0; i<28; i++)
10361036         {
1037            short d=(xa[(16+(i<<2)+s)^1])<<8;
1037            short d=(xa[(16+(i<<2)+s)^1]<<8);
10381038            d=clamp((d>>shift)+(((l0*f0)+(l1*f1)+32)>>6));
10391039            *dp++=d;
10401040            l1=l0;
r6110r6111
11161116   int index = 0;
11171117   int size = 2;
11181118   INT16 samples[18*28*16];
1119   //FILE* temp_adpcm = fopen("temp_adpcm.bin","ab");
1119   FILE* temp_adpcm = fopen("temp_adpcm.bin","ab");
11201120
1121   //fseek(temp_adpcm, 0, SEEK_END);
1121   fseek(temp_adpcm, 0, SEEK_END);
11221122   printf( "%02x\n", hdr[2] & 0x3f );
11231123   switch(hdr[2] & 0x3f)   // ignore emphasis and reserved bits
11241124   {
r6110r6111
11541154         channels=1;
11551155         freq=37800.0f;
11561156         bits=8;
1157         size=2;
1157         size=1;
11581158         break;
11591159
11601160      default:
r6110r6111
11801180               break;
11811181            case 8:
11821182               cdic_decode_xa_mono8(hdr, samples);
1183               fwrite(samples, 1, 18*28*4, temp_adpcm);
11831184               for(index = 18*28*8 - 1; index >= 0; index--)
11841185               {
11851186                  samples[index*2 + 1] = samples[index];
11861187                  samples[index*2 + 0] = samples[index];
11871188               }
1188               for(index = 18*28*8 - 1; index >= 0; index--)
1189               {
1190                  samples[index*2 + 1] = samples[index];
1191                  samples[index*2 + 0] = samples[index];
1192               }
11931189               break;
11941190         }
11951191         break;
r6110r6111
12001196
12011197    dmadac_transfer(&dmadac[0], 2, 2, 2, 18*28*4 * size, samples);
12021198
1203   //fwrite(samples, 1, 18*28*8*2, temp_adpcm);
1204   //fclose(temp_adpcm);
1199   fclose(temp_adpcm);
12051200}
12061201
12071202static TIMER_CALLBACK( cdic_trigger_readback_int )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team