home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_GEN / FACETV.ZIP / FACE_BOX.H < prev    next >
C/C++ Source or Header  |  1994-01-03  |  8KB  |  246 lines

  1. /************************************************************************
  2. **
  3. ** @(#)face_box.h    01/03/94    Chris Ahlstrom
  4. **
  5. **    C/C++ compatible.  Consists of three sections:
  6. **
  7. **    1.  The DAC (D/A converter) Parameters dialog box, stolen from
  8. **        the mod_dac modules of MODAPP, used here purely as a test
  9. **        bed for dialog box control.  This is a good test of the
  10. **        general data scheme.
  11. **
  12. **    2.  We also provide a section showing how to use the MappedField
  13. **        elements of tv_menu.h.  Here, the setup is a little more
  14. **        complex and indirect.
  15. **
  16. **    3.  The experimental parameters dialog box copped from the 
  17. **        mod_exp modules of MODAPP.  Just includes a few more type
  18. **        of data than item 1.
  19. **
  20. **    This header file describes sample data-structures that
  21. ** we can use with the dialog box code.  It illustrates the hard-wired
  22. ** DataTypes, byte-mapped data-types, and Extended data-types.
  23. **
  24. *************************************************************************/
  25.  
  26. #if !defined(FACE_BOX_h)                /* { FACE_BOX_h    */
  27. #define FACE_BOX_h
  28.  
  29. #include "rbuttons.h"            /* FACE_TV "button devices"    */
  30. #include "tvyesno.h"            /* FACE_TV dialog Yes/No types    */
  31. #include "tv_menu.h"            /* FACE_TV dialog menu types    */
  32.  
  33.  
  34. /************************************************************************
  35. ** Some convenient data types.  All this stuff was copped from the
  36. ** mod_dac and dt2801a modules of MODAPP, and stripped down just
  37. ** for creating a very simple testbed for the FACE_TV code.
  38. *************************************************************************/
  39.  
  40. #define AMPL_ONE 10000            /* our version of "1"        */
  41. #define DAC_RATE 10000            /* general default DAC rate     */
  42. #define DACNSIZE      15+1        /* size of the name string    */
  43. #define NOTESIZE     120+1        /* a large string        */
  44. #define MAX_DAC_VOLTAGE       9.9951    /* the realistic board maximum    */
  45. #define MAX_DAC_OUTPUT    4095        /* the board can put out this    */
  46. #define MIN_DAC_VOLTAGE      -9.9951    /* the realistic board minimum    */
  47. #define MIN_DAC_OUTPUT       1        /* ditto            */
  48.  
  49. typedef int DACSignal;
  50. typedef char DacnString[DACNSIZE];    /* test of String datatype    */
  51. typedef char CharString[DACNSIZE-1];    /* test of ByteString datatype    */
  52. typedef char NoteString[NOTESIZE];    /* test of SCROLL_END feature    */
  53.  
  54. typedef enum
  55. {
  56.     DT2801_DEVICE = 0,
  57.     NUCLEUS_DEVICE,
  58.     LSPSS_DEVICE,
  59.     TEST_DEVICE,            /* calls test routines        */
  60.     MISSING_DEVICE
  61.  
  62. } DeviceType;
  63.  
  64.  
  65. /************************************************************************
  66. ** DacByte
  67. **
  68. **    We define the different types of DAC data (apart from the
  69. ** normal types such as Integer and Float).  We use them in the
  70. ** sample menu shown in FACE_BOX.MEN.  Used for testing
  71. ** ExtendedDescriptors.
  72. **
  73. ** MidByte
  74. **
  75. **    Similar in concept, but used for testing MappedFieldDescriptors,
  76. ** which are a little more complex than ExtendedDescriptors.
  77. **
  78. *************************************************************************/
  79.  
  80. typedef enum
  81. {
  82.     DAC_FLOAT        = 0,
  83.     DAC_INTEGER,
  84.     DAC_UNSIGNED_BYTE
  85.  
  86. } DacByte;
  87.  
  88. typedef enum
  89. {
  90.     MID_BYTE        = 0,
  91.     MID_SBYTE,
  92.     MID_STRING,
  93.     MID_PART
  94.  
  95. } MidByte;
  96.  
  97.  
  98. /************************************************************************
  99. ** DACParameters (dialog box)    [stolen and modified from mod_dac]
  100. **
  101. **    Just a good, complex test structure.
  102. **
  103. *************************************************************************/
  104.  
  105. typedef struct
  106. {
  107.     DeviceType device;        /* device-type radio button        */
  108.     DacnString name;        /* nickname for the device?        */
  109.     CharString max;        /* bogus field for dialogue testing    */
  110.     double outputRate;        /* DAC sampling rate            */
  111.     int nPoints;        /* max number of points in the buffer    */
  112.     YesNoType testCode;        /* bogus test code for showing Yes/No's    */
  113.  
  114. #ifdef USE_DACRATE_CODE_INSTEAD    /* I have a more important test now    */
  115.     unsigned dacRate;        /* a mappable field            */
  116. #else
  117.     NoteString note;        /* string that is scrollable        */
  118. #endif
  119.  
  120.     int pt_start;        /* start point (usually 0)        */
  121.     double us_start;        /* start time (micro-sec, usually 0)    */
  122.     int pt_end;            /* end point (sometimes nPoints-1)    */
  123.     double us_end;        /* end time (in microseconds)        */
  124.     int dacMin;            /* lowest digital value (usually 0)    */
  125.     double mVmin;        /* lowest signal level in mV        */
  126.     int dacMax;            /* highest digital level        */
  127.     double mVmax;        /* highest signal level in mV        */
  128.  
  129.     double calibFreq;        /* calibration frequency        */
  130.     double calibVolts;        /* calibration voltage            */
  131.  
  132. } DACParameters;
  133.  
  134.  
  135. /************************************************************************
  136. ** MIDParameters (dialog box)
  137. **
  138. **    Just a good, complex test structure if MappedFieldDescriptors.
  139. **
  140. *************************************************************************/
  141.  
  142. typedef struct
  143. {
  144.     char name[10];
  145.     unsigned char tempo;
  146.     signed char pan;
  147.     char part;
  148.  
  149. } MIDParameters;
  150.  
  151.  
  152. /************************************************************************
  153. ** EXPParameters (dialog box)    [stolen and modified from mod_exp]
  154. **
  155. **    Just a good, complex test structure.
  156. **
  157. *************************************************************************/
  158.  
  159. /************************************************************************
  160. ** Various EXP macros
  161. **
  162. **    They had meaning in the original MODAPP code [mod_exp.men],
  163. ** but here they are included just to satisfy the compiler.
  164. **
  165. *************************************************************************/
  166.  
  167. #define NUMB_OUT          4
  168. #define MAX_REVERSALS         48
  169. #define MINUS_INFINITY_DB    -99.0
  170.  
  171.  
  172. /************************************************************************
  173. ** Various sample typedefs
  174. *************************************************************************/
  175.  
  176. typedef int DataWord;
  177. typedef DataWord ReverseArray[MAX_REVERSALS];
  178.  
  179. typedef enum
  180. {
  181.     INTENSITY_EXP    = 0,
  182.     FREQUENCY_EXP,
  183.     DURATION_EXP,
  184.     PULSE_DUR_EXP,
  185.     GAP_EXP,
  186.     MOD_DEPTH_EXP,
  187.     MOD_FREQ_EXP,
  188.     MOD_PHASE_EXP
  189.  
  190. } ExperimentType;
  191.  
  192. typedef enum
  193. {
  194.     DETECTION_EXP    = 0,
  195.     DISCRIMINATION_EXP
  196.  
  197. } ExperimentComparison;
  198.  
  199. typedef enum
  200. {
  201.     STEP_LINEAR        = 0,
  202.     STEP_NONLINEAR
  203.  
  204. } Linearity;
  205.  
  206.  
  207. /************************************************************************
  208. ** ExpParameters (dialog box)    [mod_exp]
  209. **
  210. **    An interface between the experimental-parameter dialog box
  211. ** and the AFCTask class.
  212. **
  213. **    Note the extra padding, which gives us some minor room to
  214. ** expand and still be able to read older configuration files.
  215. ** When the padding is used up, it's time to byte-edit your old
  216. ** configuration files, or recreate them!
  217. **
  218. *************************************************************************/
  219.  
  220. typedef struct
  221. {
  222.     ExperimentType expType;        /* type of experiment radiobox    */
  223.     ExperimentComparison expCode;    /* type of comparisons made    */
  224.     ResponseType responseDevice;    /* device subject can use    */
  225.     int numbCorrect;            /* number correct to change    */
  226.     int afcIntervals;            /* number of intervals (2 only)    */
  227.     int numbRevQuit;            /* number of 2-AFC reversals    */
  228.     int numbOut;            /* number to throw out at first    */
  229.     long afcSpeed;            /* long code for testing Longs    */
  230.     double afcStep;            /* control over step-size    */
  231.     double afcHalfStep;            /* control over half-step size    */
  232.     double afcFloor;            /* control over the floor value    */
  233.     double afcCeiling;            /* control over ceiling value    */
  234.     YesNoCheck valueTrack;        /* controls display of values    */
  235.     YesNoCheck stimPeek;        /* controls display of interval    */
  236.     YesNoCheck noisePeek;        /* controls display of noise    */
  237.     Linearity stimLinearity;        /* linearity of stimulus levels    */
  238.     Linearity stepLinearity;        /* linearity of steps        */
  239.  
  240.     char padding[10];            /* room for expansion        */
  241.  
  242. } ExpParameters;
  243.  
  244.  
  245. #endif                            /* } FACE_BOX_h    */
  246.