home *** CD-ROM | disk | FTP | other *** search
/ The Party 1994: Try This At Home / disk_image.bin / source / vexsrc / sin2048.cpp < prev    next >
C/C++ Source or Header  |  1995-03-29  |  6KB  |  108 lines

  1. /*****************************************************************************
  2.                                   ATTENTION!
  3.                            this source is VOTEWARE,
  4.               you may only use it to the conditions listed below:
  5.  
  6.   -You may modify it, or use parts of it in your own source as long as
  7.     this header stays on top of all files containing this source.
  8.   -You must give proper credit to the author, Niklas Beisert / pascal.
  9.   -You may not use it in commercial productions without the written
  10.     permission of the author.
  11.   -AND MOST IMPORTANT: you have to buy an Assembly '94 CD-ROM
  12.     by Sound Solutions (if you don't have it already) and vote for VEX-InTrO
  13.     in the PC-64k-Intro-Compo! (if you have already sent your voting card,
  14.     buy another one and fill it out CORRECTLY!!!)
  15. *****************************************************************************/
  16.  
  17.  
  18.  
  19. // a 16 bit fixed point, 2048 values sine table
  20.  
  21. static unsigned int sintab[512]=
  22.   {      0,    201,    402,    603,    804,   1005,   1206,   1407,
  23.       1608,   1809,   2010,   2211,   2412,   2613,   2814,   3014,
  24.       3215,   3416,   3617,   3818,   4018,   4219,   4420,   4620,
  25.       4821,   5021,   5222,   5422,   5622,   5823,   6023,   6223,
  26.       6423,   6623,   6823,   7023,   7223,   7423,   7623,   7822,
  27.       8022,   8221,   8421,   8620,   8819,   9019,   9218,   9417,
  28.       9616,   9814,  10013,  10212,  10410,  10609,  10807,  11006,
  29.      11204,  11402,  11600,  11797,  11995,  12193,  12390,  12588,
  30.      12785,  12982,  13179,  13376,  13573,  13769,  13966,  14162,
  31.      14359,  14555,  14751,  14946,  15142,  15338,  15533,  15728,
  32.      15923,  16118,  16313,  16508,  16702,  16897,  17091,  17285,
  33.      17479,  17672,  17866,  18059,  18253,  18446,  18638,  18831,
  34.      19024,  19216,  19408,  19600,  19792,  19983,  20175,  20366,
  35.      20557,  20748,  20938,  21129,  21319,  21509,  21699,  21889,
  36.      22078,  22267,  22456,  22645,  22833,  23022,  23210,  23398,
  37.      23586,  23773,  23960,  24147,  24334,  24521,  24707,  24893,
  38.      25079,  25265,  25450,  25635,  25820,  26005,  26189,  26373,
  39.      26557,  26741,  26925,  27108,  27291,  27473,  27656,  27838,
  40.      28020,  28201,  28383,  28564,  28745,  28925,  29105,  29285,
  41.      29465,  29645,  29824,  30003,  30181,  30360,  30538,  30715,
  42.      30893,  31070,  31247,  31424,  31600,  31776,  31952,  32127,
  43.      32302,  32477,  32651,  32826,  32999,  33173,  33346,  33519,
  44.      33692,  33864,  34036,  34208,  34379,  34550,  34721,  34891,
  45.      35061,  35231,  35400,  35569,  35738,  35906,  36074,  36242,
  46.      36409,  36576,  36743,  36909,  37075,  37241,  37406,  37571,
  47.      37736,  37900,  38064,  38227,  38390,  38553,  38716,  38878,
  48.      39039,  39201,  39362,  39522,  39682,  39842,  40002,  40161,
  49.      40319,  40478,  40636,  40793,  40950,  41107,  41263,  41419,
  50.      41575,  41730,  41885,  42040,  42194,  42347,  42501,  42653,
  51.      42806,  42958,  43110,  43261,  43412,  43562,  43712,  43862,
  52.      44011,  44160,  44308,  44456,  44603,  44750,  44897,  45043,
  53.      45189,  45335,  45480,  45624,  45768,  45912,  46055,  46198,
  54.      46340,  46482,  46624,  46765,  46906,  47046,  47186,  47325,
  55.      47464,  47602,  47740,  47878,  48015,  48151,  48288,  48423,
  56.      48558,  48693,  48828,  48961,  49095,  49228,  49360,  49492,
  57.      49624,  49755,  49886,  50016,  50146,  50275,  50403,  50532,
  58.      50660,  50787,  50914,  51040,  51166,  51291,  51416,  51541,
  59.      51665,  51788,  51911,  52033,  52155,  52277,  52398,  52518,
  60.      52639,  52758,  52877,  52996,  53114,  53231,  53348,  53465,
  61.      53581,  53696,  53811,  53926,  54040,  54153,  54266,  54379,
  62.      54491,  54602,  54713,  54823,  54933,  55043,  55152,  55260,
  63.      55368,  55475,  55582,  55688,  55794,  55899,  56004,  56108,
  64.      56212,  56315,  56417,  56519,  56621,  56722,  56822,  56922,
  65.      57022,  57120,  57219,  57316,  57414,  57510,  57606,  57702,
  66.      57797,  57892,  57986,  58079,  58172,  58264,  58356,  58447,
  67.      58538,  58628,  58718,  58807,  58895,  58983,  59070,  59157,
  68.      59243,  59329,  59414,  59499,  59583,  59666,  59749,  59831,
  69.      59913,  59994,  60075,  60155,  60235,  60313,  60392,  60470,
  70.      60547,  60624,  60700,  60775,  60850,  60924,  60998,  61071,
  71.      61144,  61216,  61288,  61359,  61429,  61499,  61568,  61637,
  72.      61705,  61772,  61839,  61905,  61971,  62036,  62100,  62164,
  73.      62228,  62291,  62353,  62414,  62475,  62536,  62596,  62655,
  74.      62714,  62772,  62829,  62886,  62942,  62998,  63053,  63108,
  75.      63162,  63215,  63268,  63320,  63371,  63422,  63473,  63522,
  76.      63571,  63620,  63668,  63715,  63762,  63808,  63854,  63899,
  77.      63943,  63987,  64030,  64073,  64115,  64156,  64197,  64237,
  78.      64276,  64315,  64353,  64391,  64428,  64465,  64501,  64536,
  79.      64571,  64605,  64638,  64671,  64703,  64735,  64766,  64796,
  80.      64826,  64855,  64884,  64912,  64939,  64966,  64992,  65018,
  81.      65043,  65067,  65091,  65114,  65136,  65158,  65179,  65200,
  82.      65220,  65239,  65258,  65276,  65294,  65311,  65327,  65343,
  83.      65358,  65372,  65386,  65400,  65412,  65424,  65436,  65446,
  84.      65457,  65466,  65475,  65483,  65491,  65498,  65505,  65511,
  85.      65516,  65520,  65524,  65528,  65531,  65533,  65534,  65535};
  86.  
  87. long* SinTab;
  88.  
  89. static void InstallSinTab()
  90. {
  91.   SinTab=new long[2048];
  92.   for (int i=0; i<512; i++)
  93.     SinTab[i]=sintab[i];
  94.   for (i=1; i<512; i++)
  95.     SinTab[1024-i]=SinTab[i];
  96.   SinTab[512]=65536;
  97.   for (i=0; i<1024; i++)
  98.     SinTab[i+1024]=-SinTab[i];
  99. }
  100.  
  101. static void FreeSinTab()
  102. {
  103.   delete SinTab;
  104. }
  105.  
  106. #pragma startup InstallSinTab
  107. #pragma exit FreeSinTab
  108.