home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 106 / EnigmaAmiga106CD.iso / software / sviluppo / ahisrc / device / addtest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-29  |  3.5 KB  |  121 lines

  1.  
  2. #include "addroutines.h"
  3.  
  4.  
  5. /*
  6. ** Samples          Number of samples to calculate.
  7. ** ScaleLeft        Left volume multiplier.
  8. ** ScaleRight       Right volume multiplier (not used for mono sounds).
  9. ** StartPointLeft   Sample value from last session, for interpolation. Update!
  10. ** StartPointRight  Sample value from last session, for interpolation. Update!
  11. ** Src              Pointer to source samples.
  12. ** Dst              Pointer to pointer to destination buffer. Update!
  13. ** FirstOffsetI     The offset value of the first sample (when StartPoint* 
  14. **                  should be used).
  15. ** Offset           The offset (fix-point). Update!
  16. ** Add              Add value (fix-point).
  17. ** StopAtZero       If true, abort at next zero-crossing.
  18. */
  19.  
  20. /*
  21. #define ADDARGS LONG      Samples,\
  22.                 LONG      ScaleLeft,\
  23.                 LONG      ScaleRight,\
  24.                 LONG     *StartPointLeft,\
  25.                 LONG     *StartPointRight,\
  26.                 void     *Src,\
  27.                 void    **Dst,\
  28.                 LONG      FirstOffsetI,\
  29.                 Fixed64   Add,\
  30.                 Fixed64  *Offset,\
  31.                 BOOL      StopAtZero
  32. */
  33.  
  34. /*
  35.             processed = ((ADDFUNC *) cd->cd_AddRoutine)( try_samples,
  36.                                                          cd->cd_ScaleLeft,
  37.                                                          cd->cd_ScaleRight,
  38.                                                         &cd->cd_TempStartPointL,
  39.                                                         &cd->cd_TempStartPointR,
  40.                                                          cd->cd_DataStart,
  41.                                                         &dstptr,
  42.                                                          cd->cd_FirstOffsetI,
  43.                                                          cd->cd_Add,
  44.                                                         &cd->cd_Offset, 
  45.                                                          TRUE );
  46. */
  47.  
  48. #include <stdio.h>
  49. #include <string.h>
  50.  
  51. static long outbuffer[ 4096 ];
  52. static char sample[16] =
  53. {
  54.   0, 16, 32, 48, 64, 48, 32, 16, 0, -16, -32, -48, -64, -48, -32, -16
  55. };
  56.  
  57. int
  58. main( void )
  59. {
  60.   int       i;
  61.   int       num              = 10;
  62.   long      startpointleft   = 0;
  63.   long      startpointright  = 0;
  64.   void*     dst              = outbuffer;
  65.   long long offset           = 0x00000000;
  66.  
  67.   ADDFUNC* af = AddByteMono;
  68.  
  69.   memset( outbuffer, 0x00, sizeof( outbuffer ) );
  70.  
  71.   printf( "spl: %08x, spr: %08x, dst: %08lx, offset: %ld\n",
  72.           startpointleft, startpointright, dst, offset );
  73.  
  74.   num = (*af)( num, 0x1, 0x00000,
  75.          &startpointleft,
  76.          &startpointright,
  77.          sample,
  78.          &dst,
  79.          0,
  80.          0x080000000,
  81.          &offset,
  82.          FALSE );
  83.  
  84.   printf( "Iterations: %d\n", num );
  85.  
  86.   for( i = 0; i < num * 2; i++ )
  87.   {
  88.     printf( "%3d: %08x\n", i, outbuffer[ i ] );
  89.   }
  90.  
  91.   printf( "spl: %08x, spr: %08x, dst: %08lx, offset: %ld\n",
  92.           startpointleft, startpointright, dst, offset );
  93.  
  94.   startpointleft = startpointright = 0;
  95.   dst            = outbuffer;
  96.   offset         = 0;
  97.  
  98.   num = (*af)( num, 0x0, 0x00000,
  99.          &startpointleft,
  100.          &startpointright,
  101.          sample,
  102.          &dst,
  103.          0,
  104.          0x080000000,
  105.          &offset,
  106.          FALSE );
  107.  
  108.   printf( "Iterations: %d\n", num );
  109.  
  110.   for( i = 0; i < num * 2; i++ )
  111.   {
  112.     printf( "%3d: %08x\n", i, outbuffer[ i ] );
  113.   }
  114.  
  115.   printf( "spl: %08x, spr: %08x, dst: %08lx, offset: %ld\n",
  116.           startpointleft, startpointright, dst, offset );
  117.  
  118.   return 0;
  119. }
  120.  
  121.