home *** CD-ROM | disk | FTP | other *** search
/ Point Programming 1 / PPROG1.ISO / c / pas_sdk1 / pas / pcm / recfile.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-09-25  |  18.3 KB  |  867 lines

  1. /*$Author:   DCODY  $*/
  2. /*$Date:   24 Sep 1992 08:59:04  $*/
  3. /*$Header:   X:/sccs/pcmapps/recfile.c_v   1.11   24 Sep 1992 08:59:04   DCODY  $*/
  4. /*$Log:   X:/sccs/pcmapps/recfile.c_v  $
  5.  * 
  6.  *    Rev 1.11   24 Sep 1992 08:59:04   DCODY
  7.  * changed MVGetHardware to mvGetHardware
  8.  * 
  9.  *    Rev 1.10   18 Sep 1992 08:47:58   DCODY
  10.  * added '+' option to the 'M' switch.
  11.  * 
  12.  *    Rev 1.9   14 Sep 1992 17:23:50   SHAO_M
  13.  * Put all the text strings used in printf into rectext.h
  14.  * 
  15.  *    Rev 1.0   14 Sep 1992 17:02:20   unknown
  16.  * Initial revision.
  17.  * 
  18.  *    Rev 1.8   02 Sep 1992 12:48:52   DCODY
  19.  * made one simple change that now allows 44khz stereo 16bit recordings.
  20.  * Took out the writting of the WAV header before starting the record
  21.  * process. It is now done after the recording is finished. This allows
  22.  * the data blocks to be written on sector boundaries.
  23.  * 
  24.  *    Rev 1.7   20 Aug 1992 14:36:28   DCODY
  25.  * error exit now reports proper T&L product name.
  26.  * 
  27.  *    Rev 1.6   04 Aug 1992 11:39:42   DCODY
  28.  * corrected t&l spelling
  29.  * 
  30.  *    Rev 1.5   28 Jul 1992 14:29:30   DCODY
  31.  * updated for Thunderboard and Thunder&Lightning
  32.  * 
  33.  *    Rev 1.4   20 Jul 1992 11:39:18   DCODY
  34.  * call to mvGetHWVersion now uses active I/O address detection.
  35.  * 
  36.  *    Rev 1.3   13 Jul 1992 18:54:00   DCODY
  37.  * removed initmvsound call
  38.  * 
  39.  *    Rev 1.2   01 Jul 1992 11:57:16   DCODY
  40.  * GaryL: Added OEM compiler flag checking for Welcome()
  41.  * to use the generic board name and to not displau the MVI copyright.
  42.  * Note that the copyright is still present, as an imbedded static string.
  43.  * 
  44.  *    Rev 1.1   23 Jun 1992 16:10:02   DCODY
  45.  * pas2 update...
  46.  * 
  47.  *    Rev 1.0   15 Jun 1992 09:26:48   BCRANE
  48.  * Initial revision.
  49. */
  50. /*$Logfile:   X:/sccs/pcmapps/recfile.c_v  $*/
  51. /*$Modtimes$*/
  52. /*$Revision:   1.11  $*/
  53. /*$Workfile:   recfile.c  $*/
  54.  
  55.  
  56.     /*\
  57.     |*|----====< RECFILE.C >====----
  58.     |*|
  59.     |*| Record 8 bit PCM to disk in .WAV format
  60.     |*|
  61.     |*| Copyright (c) 1991, Media Vision, Inc. All rights reserved.
  62.     |*|
  63.     \*/
  64.  
  65. #ifndef OEM
  66. #define OEM 0
  67. #endif
  68.  
  69. #ifndef PROAS
  70. #define PROAS 0
  71. #endif
  72.  
  73. #ifndef THUNDER
  74. #define THUNDER 0
  75. #endif
  76.  
  77. #include <stdio.h>
  78. #include <stdlib.h>
  79. #include <malloc.h>
  80. #include <signal.h>
  81. #include "rectext.h"
  82.  
  83.  
  84. #if PROAS
  85. #include "play.h"
  86. #include "common.h"
  87. #include "pcmio.h"
  88. #include "binary.h"
  89. #endif
  90.  
  91. #if THUNDER
  92. #include "proto.h"
  93. #include "play.h"
  94. #include "common.h"
  95. #include "pcmio.h"
  96. #endif
  97.  
  98.  
  99.     /*\
  100.     |*|----====< Global Variables >====----
  101.     \*/
  102.  
  103.         extern int ProcessedBlockCount;
  104.  
  105.         long mvGetHWVersion (int);
  106.  
  107.  
  108.     /*\
  109.     |*|----====< Local Variables >====----
  110.     \*/
  111.  
  112.         static FILE *ouf = 0;           /* temp output file             */
  113.  
  114.         static long SampleRate = 11025L;/* default sample rate          */
  115.         static int  StereoMono = 0;     /* default to mono              */
  116.  
  117.         static char TargetFile[100];    /* holds output file name       */
  118.         static int    FilterIndex = -1;    /* -1 means no override         */
  119.  
  120.         static int    DMAChannel = -1;    /* default to standard DMA        */
  121.         static int    IRQChannel = -1;    /* default to standard IRQ        */
  122.  
  123.         static int    DebugFlag = FALSE;
  124.         static int    Compression = 0;        /* no compression - 8 bits    */
  125.  
  126.         static int  VoiceActivated = FALSE;
  127.         static int    VoiceActivatedNonStop = FALSE;
  128.         static int    NoiseLevel = 5;
  129.  
  130.         static int    maxsize = 16;        /* 16k DMA buffer size            */
  131.         static int    maxdiv    = 4;        /* 4k divisions on the DMA        */
  132.         static int    datasize= 8;        /* 8 or 16 bit samples            */
  133.  
  134. #define WAVEFILE    1
  135. #define VOCFILE     2
  136.         static int    FileType;
  137.  
  138.     /*\
  139.     |*|----====< Data Structures >====----
  140.     \*/
  141.  
  142.         RiffWave fhd = {
  143.             { "RIFF", 0L },
  144.             { "WAVE",
  145.                 { "fmt ", sizeof(WaveInfo) , { 1, 1, 11025L, 11025L, 1, 8}, },
  146.                 { "data", 0L },
  147.             }
  148.         };
  149.  
  150.     /* .VOC simple (cheat) header definition                            */
  151.  
  152.         typedef struct {
  153.             VOCHDR     vhdr;
  154.             bVOCDATA vdta;
  155.         } VOCHeader;
  156.  
  157.     /* our pre-defined data block                                        */
  158.  
  159.         static VOCHeader vhd = {
  160.             { "Creative Voice File\x1a", 0x001a, 0x010a, 0x1129 },
  161.             { 0x01, 0x0,0x0,0x0, 0xa5, 0x0 }
  162.         };
  163.  
  164.  
  165.     /*\
  166.     |*|-----------------=============================-------------------
  167.     |*|-----------------====< Start of Exection >====-------------------
  168.     |*|-----------------=============================-------------------
  169.     \*/
  170.  
  171.     /*\
  172.     |*|----====< Main >====----
  173.     |*|
  174.     |*| Play the voice file out to the PCM hardware
  175.     |*|
  176.     \*/
  177.  
  178. main(argc,argv)
  179.     int  argc;
  180.     char *argv[];
  181. {
  182. char c;
  183.  
  184.     /* Give the welcome & checkout the hardware                         */
  185.  
  186.         Welcome();
  187.  
  188.     /* disable the ^C                                                   */
  189.  
  190.         signal(SIGINT,SIG_IGN);
  191.  
  192.     /* set the runtime switches                                         */
  193.  
  194.         CommandLine (argc,argv);
  195.  
  196.     /* need a file name to play, exit if not found                      */
  197.  
  198.         PreProcessFile (TargetFile);
  199.  
  200. #if THUNDER
  201.     /* last minute weirdness check...                                    */
  202.  
  203.         LastChanceStop();
  204. #endif
  205.  
  206. #if PROAS
  207.     /* turn off the digital input mixer channel to avoid feedback       */
  208.  
  209.         TurnItOff();
  210.  
  211. #endif
  212.  
  213.     /* setup the DMA operations                                         */
  214.  
  215.         if (OpenPCMBuffering(DMAChannel,IRQChannel,maxsize,maxdiv)) {
  216.             printf (TXT_MSG1);
  217.             DoExit (-1);
  218.         }
  219.  
  220.     /* setup how this file sounds                                        */
  221.  
  222. #if PROAS
  223.         ChooseFilter( SampleRate, FilterIndex );
  224. #endif
  225.  
  226.         PCMState (SampleRate, StereoMono, Compression, datasize);
  227.  
  228.     /* Start the DMA & wait till an ESC is typed or data ends           */
  229.  
  230.         printf (TXT_MSG2);
  231.  
  232.         if (StartFileInput( ouf )) {
  233.  
  234.             while (1) {
  235.  
  236.                 /* process some PCM data, if available                    */
  237.  
  238.                     if (VoiceActivated) {
  239.                         if (!ASpecialContinueFileInput(NoiseLevel,VoiceActivatedNonStop))
  240.                             DoExit(PCMIOERR_FILEFULL);
  241.                     }
  242.                     else {
  243.                         if (!ContinueFileInput())
  244.                             DoExit(PCMIOERR_FILEFULL);
  245.                     }
  246.  
  247.                 /* if ESC typed, kill the DMA & exit                    */
  248.  
  249.                     if (kbhit()) {
  250.                         if ((c = getch()) == 0x1b) {
  251.                             StopDMAIO();
  252.                             break;
  253.                         }
  254.                         if (c == ' ') {
  255.                             PausePCM();
  256.                             printf (TXT_MSG3);
  257.                             GetKey();
  258.                             printf (TXT_MSG4);
  259.                             ResumePCM();
  260.                         }
  261.                     }
  262.             }
  263.         }
  264.         else
  265.             DoExit (PCMIOERR_OPENPCM);
  266.  
  267.     /* exit to DOS                                                      */
  268.  
  269.         DoExit(0);
  270.  
  271. }
  272.  
  273.     /*\
  274.     |*|--------------------=======================----------------------
  275.     |*|--------------------====< Subroutines >====----------------------
  276.     |*|--------------------=======================----------------------
  277.     \*/
  278.  
  279.  
  280.     /*\
  281.     |*|----====< BuildFileName( char *, char *, char *, int ); >====----
  282.     |*|
  283.     |*| This routine takes the source name, scans it for an extension,
  284.     |*| then may append the new extension. The entire file name is
  285.     |*| returned in the callers target string.
  286.     |*|
  287.     \*/
  288. void BuildFileName(trg,src,ext,force)
  289.     char *trg;
  290.     char *src;
  291.     char *ext;
  292.     int force;
  293. {
  294. int n;
  295. char *t,*o;
  296.  
  297.     // save a copy of the starting target address
  298.  
  299.         o = trg;
  300.  
  301.     // copy the source over to the target
  302.  
  303.         while ((*trg++ = *src++)) ;
  304.  
  305.     // move back to the terminator and save the pointer
  306.  
  307.         t = --trg;
  308.  
  309.     // search for an extension, if found, just return, we're all done...
  310.  
  311.         for (n=0;n<=4;n++) {
  312.  
  313.             // if no extension, go add one...
  314.  
  315.             if (o == trg)
  316.                 break;
  317.  
  318.             // if an extension...
  319.  
  320.             if (*trg == '.') {
  321.  
  322.                 // and do not force it, just return.
  323.  
  324.                 if (!force)
  325.                     return;
  326.  
  327.                 // else point to this extension, and break out...
  328.  
  329.                 else {
  330.                     t = trg;
  331.                     break;
  332.                 }
  333.             }
  334.  
  335.             // move back to the prior character
  336.  
  337.             trg--;
  338.         }
  339.  
  340.     // add the extension
  341.  
  342.         strcpy (t,ext);
  343.  
  344. }
  345.  
  346.  
  347.     /*\
  348.     |*|----====< CommandLine >====----
  349.     |*|
  350.     |*| process the command line switches
  351.     |*|
  352.     \*/
  353. int CommandLine(argc,argv)
  354.     int argc;
  355.     char *argv[];
  356. {
  357. char *s;
  358. int n,temp;
  359. long l;
  360.  
  361.     /* exit if no additional parameters                                 */
  362.  
  363.         if (argc < 2) {
  364.             GiveHelps();
  365.             DoExit(-1);
  366.         }
  367.  
  368.         n = 2;
  369.         while (n < argc) {
  370.  
  371.             s = argv[n++];
  372.  
  373.             if (*s == '/') s++;
  374.             if (*s == '-') s++;
  375.  
  376.             switch (*s & 0x5f) {
  377.  
  378. #if THUNDER
  379.                 case 'C':
  380.                     Compression = 01;    /* 4 bit compression            */
  381.                     break;
  382. #endif
  383.  
  384. #if PROAS
  385.                 case '8' & 0x5f:
  386.                 case '1' & 0x5f:
  387.                     if (*++s == '6')
  388.                         datasize = 16;
  389.                     break;
  390.  
  391.                 case 'F':
  392.                     FilterIndex = *++s - 0x30;
  393.                     if ((FilterIndex<0) || (FilterIndex>6))
  394.                         FilterIndex = -1;
  395.                     break;
  396. #endif
  397.  
  398.                 case 'D':
  399.                     temp = *++s - 0x30;
  400.                     if ((temp <= 7) && (temp >= 1)) {
  401.                         if (temp == 4) temp = 0;
  402.                         DMAChannel = temp;
  403.                     }
  404.                     break;
  405.  
  406.                 case 'I':
  407.                     if (sscanf (++s,"%d",&temp) == 1) {
  408.                         if ((1 << temp) & 0x9CBC)
  409.                             IRQChannel = temp;
  410.                     }
  411.                     break;
  412.  
  413.                 case 'M':
  414.                     maxsize = 64;
  415.                     maxdiv    = 16;
  416.                     if (*++s == '+')
  417.                         maxdiv    = 4;
  418.                     break;
  419.  
  420.                 case 'R':
  421.                     if (sscanf (++s,"%ld",&SampleRate) != 1) {
  422.                         printf (TXT_MSG5,s);
  423.                         SampleRate = 11025L;
  424.                     }
  425. #if PROAS
  426.                     if ((SampleRate < 4000L) || (SampleRate > 44100L)) {
  427.                         printf (TXT_MSG5,s);
  428.                         SampleRate = 11025L;
  429.                     }
  430. #endif
  431. #if THUNDER
  432.                     if ((SampleRate < 4000L) || (SampleRate > 23300L)) {
  433.                         printf (TXT_MSG5,s);
  434.                         SampleRate = 11025L;
  435.                     }
  436. #endif
  437.                     break;
  438.  
  439.                 case 'S':
  440.                     StereoMono = 1;
  441.                     break;
  442.  
  443.                 case 'V':
  444.                     VoiceActivated = TRUE;
  445.                     if (*(s+1) == '+') {
  446.                         VoiceActivatedNonStop = TRUE;
  447.                         s++;
  448.                     }
  449.                     if (sscanf (++s,"%d",&temp) == 1)
  450.                         NoiseLevel = temp;
  451.                     break;
  452.  
  453.                 case '+' & 0x5f:
  454.                     DebugFlag = TRUE;
  455.                     break;
  456.  
  457.                 default:
  458.                     break;
  459.             }
  460.         }
  461.  
  462.     /* determine the type of output file                                */
  463.  
  464.         BuildFileName (TargetFile,argv[1],".WAV",FALSE);
  465.  
  466.     /* scan the last portion of the name for the type                    */
  467.  
  468.         FileType = WAVEFILE;
  469.         s = TargetFile;
  470.         while (*s) s++;
  471.  
  472.         if ((*(s-1) & 0x5f) == 'C')
  473.             if ((*(s-2) & 0x5f) == 'O')
  474.                 if ((*(s-3) & 0x5f) == 'V')
  475.                     FileType = VOCFILE;
  476.  
  477.     /* if a bad sample rate, time to bomb out...                        */
  478.  
  479.         if (FileType == WAVEFILE) {
  480.             if ((SampleRate<<StereoMono) > 88200L) {
  481.                 printf (TXT_MSG6);
  482.                 DoExit(-1);
  483.             }
  484.         }
  485.         else {
  486.             if ((SampleRate<<StereoMono) > 23300L) {
  487.                 printf (TXT_MSG7,l);
  488.                 DoExit(-1);
  489.             }
  490.         }
  491. }
  492.  
  493.  
  494.     /*\
  495.     |*|----====< DoExit() >====----
  496.     |*|
  497.     |*| Exit to DOS
  498.     |*|
  499.     \*/
  500. int DoExit(cc)
  501.     int cc;
  502. {
  503.  
  504. #if PROAS
  505.     /* restore the PCM mixer channel                                    */
  506.  
  507.         TurnItOn();
  508. #endif
  509.  
  510.     /* print any error messages                                         */
  511.  
  512.         switch (cc) {
  513.  
  514.             case PCMIOERR_SAMPLERATE:
  515.                 printf (TXT_MSG8);
  516.                 break;
  517.  
  518.             case PCMIOERR_OPENFILE:
  519.                 printf (TXT_MSG9);
  520.                 break;
  521.  
  522.             case PCMIOERR_OPENPCM:
  523.                 printf (TXT_MSG10);
  524.                 break;
  525.  
  526.             case PCMIOERR_NOMEM:
  527.                 printf (TXT_MSG11);
  528.                 break;
  529.  
  530.             case PCMIOERR_BADDMA:
  531.                 printf (TXT_MSG12);
  532.                 break;
  533.  
  534.             case PCMIOERR_BADIRQ:
  535.                 printf (TXT_MSG13);
  536.                 break;
  537.  
  538.             case PCMIOERR_FILEFULL:
  539.                 printf (TXT_MSG14);
  540.                 printf (TXT_MSG15);
  541.                 break;
  542.  
  543.             default:
  544.             case PCMIOERR_HELPS:
  545.                 break;
  546.         }
  547.  
  548.     /* if there is data, flush it and zip up the file                    */
  549.  
  550.         if (ouf) {
  551.             if (ProcessedBlockCount) {
  552.                 if (FileType == VOCFILE)
  553.                     fputc (0x00,ouf);    /* set the terminating record    */
  554.                 fclose (ouf);
  555.                 if ((ouf = fopen(TargetFile,"r+b")) == 0) {
  556.                     printf (TXT_MSG16,TargetFile);
  557.                     ClosePCMBuffering();
  558.                     exit(cc);
  559.                 }
  560.                 SetupHeader();
  561.                 WriteBlockHeader();
  562.             }
  563.             fclose (ouf);
  564.         }
  565.  
  566.     /* shut down the hardware                                           */
  567.  
  568.         ClosePCMBuffering();
  569.         exit (cc);
  570. }
  571.  
  572.  
  573.     /*\
  574.     |*|----====< GetKey() >====----
  575.     |*|
  576.     |*| Get a new key
  577.     |*|
  578.     \*/
  579. int GetKey()
  580. {
  581. char c;
  582.  
  583.     while (kbhit()) getch();
  584.  
  585.     while (!kbhit()) ;
  586.     if (getch() == 0) getch();
  587.  
  588. }
  589.  
  590.  
  591.     /*\
  592.     |*|----====< GiveHelps >====----
  593.     |*|
  594.     |*| Print the Help messages & returen
  595.     |*|
  596.     \*/
  597. int GiveHelps()
  598. {
  599.  
  600.     /* print & return...                                                */
  601.  
  602. #if PROAS
  603.         printf (TXT_MSG17);
  604.         printf (TXT_MSG18);
  605.         printf (TXT_MSG19);
  606.         printf (TXT_MSG20);
  607.         printf (TXT_MSG21);
  608.         printf (TXT_MSG22);
  609.         printf (TXT_MSG23);
  610.         printf (TXT_MSG24);
  611.         printf (TXT_MSG25);
  612.         printf (TXT_MSG26);
  613.         printf (TXT_MSG27);
  614.         printf (TXT_MSG28);
  615. #endif
  616. #if THUNDER
  617.         printf (TXT_MSG29);
  618.         printf (TXT_MSG30);
  619.         printf (TXT_MSG31);
  620.         printf (TXT_MSG32);
  621.  #if THUNDER==2
  622.         printf (TXT_MSG33);
  623.         printf (TXT_MSG34);
  624.  #else
  625.         printf (TXT_MSG35);
  626.  #endif
  627.         printf (TXT_MSG36);
  628.         printf (TXT_MSG37);
  629.         printf (TXT_MSG38);
  630.         printf (TXT_MSG39);
  631. #endif
  632. }
  633.  
  634. #if THUNDER
  635.     /*\
  636.     |*|----====< LastChanceStop() >====----
  637.     |*|
  638.     |*| Stop if there are some illegal setups
  639.     |*|
  640.     \*/
  641. LastChanceStop()
  642. {
  643.  
  644.     /* .WAV cannot support compression...                                */
  645.  
  646.         if ((FileType == WAVEFILE) && (Compression)) {
  647.             printf (TXT_MSG40);
  648.             GiveHelps();
  649.             DoExit(-1);
  650.         }
  651. }
  652. #endif
  653.  
  654.     /*\
  655.     |*|----====< PreProcessFile >====----
  656.     |*|
  657.     |*| Validate the User's output file & load the 1st header block
  658.     |*|
  659.     \*/
  660. int PreProcessFile (fn)
  661.     char *fn;
  662. {
  663.  
  664.     /* see if the file already exists                                   */
  665.  
  666.         if ((ouf = fopen(fn,"rb"))) {
  667.  
  668.             printf (TXT_MSG41,fn);
  669.  
  670.             while (!kbhit()) ;
  671.  
  672.             if ((getchar() & 0x5f) != 'Y') {
  673. #if PROAS
  674.                 TurnItOn();
  675. #endif
  676.                 exit(1);
  677.             }
  678.             fclose (ouf);
  679.         }
  680.  
  681.     /* attempt to open the users disk file                              */
  682.  
  683.         if ((ouf = fopen(fn,"wb")) == 0) {
  684.             printf (TXT_MSG42,fn);
  685.             DoExit (-1);
  686.         }
  687.  
  688.     /* send the header to disk                                          */
  689.  
  690. ////////WriteBlockHeader();
  691.  
  692. }
  693.  
  694.  
  695.     /*\
  696.     |*|----====< SetupHeader >====----
  697.     |*|
  698.     |*| Load the RIFF header with the critical data
  699.     |*|
  700.     \*/
  701. int SetupHeader()
  702. {
  703. long l,n;
  704.  
  705.     /* calculate the block size of each buffer division                 */
  706.  
  707.         n = maxsize / maxdiv * 1024;
  708.  
  709.     /* get the # of processed blocks                                    */
  710.  
  711.         l = LONG(ProcessedBlockCount) * n - sizeof(RiffWave);
  712.  
  713.     /* set the data size                                                */
  714.  
  715.         fhd.wave.data.length = l;
  716.  
  717.     /* set the RIFF length                                              */
  718.  
  719.         fhd.riff.length = l + sizeof(WaveHeader);
  720.  
  721.     /* set the length of the FORMAT block                               */
  722.  
  723.         fhd.wave.fmt.length = sizeof(WaveInfo);
  724.  
  725.     /* set up the sample rate, etc...                                   */
  726.  
  727.         fhd.wave.fmt.info.nChannels        = StereoMono + 1;
  728.         fhd.wave.fmt.info.nSamplesPerSec   = SampleRate;
  729.         fhd.wave.fmt.info.nAvgBytesPerSec  = (SampleRate << StereoMono) <<
  730.                                                 ((datasize == 8) ? 0 : 1);
  731.         fhd.wave.fmt.info.nBlockAlign       = (1 + ((datasize == 8) ? 0 : 1))
  732.                                                 << StereoMono;
  733.         fhd.wave.fmt.info.nBitsPerSample   = datasize;
  734.  
  735.     /* setup the .VOC header                                            */
  736.  
  737.         l += 2;     // .VOC wants a block length 2 bytes too long!
  738.  
  739.         vhd.vdta.bsize[0] = (char) (l       & 0xff);
  740.         vhd.vdta.bsize[1] = (char)((l>>8)  & 0xff);
  741.         vhd.vdta.bsize[2] = (char)((l>>16) & 0xff);
  742.         vhd.vdta.sampler  = (char)(256-(1000000L/SampleRate)) & 0xff;
  743.         vhd.vdta.packtype = Compression;
  744.  
  745.         if (StereoMono)
  746.             vhd.vdta.packtype = 5;
  747.  
  748. }
  749.  
  750.  
  751.     /*\
  752.     |*|----====< Welcome >====----
  753.     |*|
  754.     |*| Print the logo & check for the appropriate hardware
  755.     |*|
  756.     \*/
  757. Welcome()
  758. {
  759. long ver;
  760.  
  761.     /* give the normal stuff...                                         */
  762.  
  763. #if OEM
  764.  #if PROAS
  765.         printf (TXT_MSG43);
  766.         {
  767.                 static char    zsCopyright[] = "Copyright (c) 1991,1992 Media Vision, Inc. All Rights Reserved\n\n";
  768.         }
  769.  
  770.         ver = mvGetHWVersion(USE_ACTIVE_ADDR);/* get the version              */
  771.         if (ver == -1) {
  772.             printf (TXT_MSG44);
  773.             GiveHelps();
  774.             exit(-1);
  775.         }
  776.  #endif
  777.  
  778.  #if THUNDER
  779.         printf (TXT_MSG45);
  780.         {
  781.                 static char    zsCopyright[] = "Copyright (c) 1991,1992 Media Vision, Inc. All Rights Reserved\n\n";
  782.         }
  783.  
  784.         ver = InitMVHardware();         /* get the version, or something.. */
  785.         if ((ver < 0) || ((ver & 0xffff0000) != 0x00010000)) {
  786.             printf (TXT_MSG46);
  787.             GiveHelps();
  788.             exit(-1);
  789.         }
  790.  #endif
  791. #else    //OEM
  792.  #if PROAS
  793.         printf (TXT_MSG47);
  794.         printf (TXT_MSG48);
  795.  
  796.         ver = mvGetHWVersion(USE_ACTIVE_ADDR);/* get the version              */
  797.         if (ver == -1) {
  798.             printf (TXT_MSG49);
  799.             GiveHelps();
  800.             exit(-1);
  801.         }
  802.  #endif
  803.  
  804.  #if THUNDER
  805.   #if THUNDER==2
  806.         printf (TXT_MSG50);
  807.   #else
  808.         printf (TXT_MSG51);
  809.   #endif
  810.         printf (TXT_MSG52);
  811.  
  812.         ver = mvGetHWVersion(0);        /* get the version, or something.. */
  813.         if ((ver < 0) || ((ver & 0xffff0000) != 0x00010000)) {
  814.   #if THUNDER==2
  815.             printf (TXT_MSG53);
  816.   #else
  817.             printf (TXT_MSG54);
  818.   #endif
  819.             GiveHelps();
  820.             exit(-1);
  821.         }
  822.  #endif
  823. #endif    //OEM
  824.  
  825. }
  826.  
  827.  
  828.     /*\
  829.     |*|----====< WriteBlockHeader >====----
  830.     |*|
  831.     |*| Output the one and only voice block header
  832.     |*|
  833.     \*/
  834.  
  835. int WriteBlockHeader()
  836. {
  837. long l;
  838. char *s;
  839. int n;
  840. WaveFormat wf;
  841.  
  842.     /* point to the start of the file                                   */
  843.  
  844.         fseek (ouf,0L,SEEK_SET);
  845.  
  846.     /* depending on the type of file, output the data...                */
  847.  
  848.         if (FileType == WAVEFILE) {
  849.  
  850.             s = (char*) &fhd;
  851.             for (n=sizeof(RiffWave);n;n--)
  852.                 fputc(*s++,ouf);
  853.         }
  854.         else {
  855.  
  856.             s = (char*) &vhd;
  857.             for (n=sizeof(VOCHeader);n;n--)
  858.                 fputc(*s++,ouf);
  859.         }
  860. }
  861.  
  862.  
  863.     /*\
  864.     |*| end of RECFILE.C
  865.     \*/
  866.  
  867.