home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Palettes / MiscSoundPalette / MiscSoundUtil.subproj / MiscSoundView.h < prev    next >
Encoding:
Text File  |  1995-03-25  |  4.6 KB  |  149 lines

  1. /*
  2.  
  3. MiscSoundView
  4. Version 1.2
  5. Copyright (c) 1995 by Sean Luke
  6. Donated to the MiscKit
  7.  
  8. Permission to use, copy, modify, and distribute this material 
  9. for any purpose and without fee, under the restrictions as noted 
  10. in the MiscKit copyright notice, is hereby granted, provided that
  11. the MiscKit copyright notice and this permission notice 
  12. appear in all source copies, and that the author's name shall not
  13. be used in advertising or publicity pertaining to this 
  14. material without the specific, prior written permission 
  15. of the author.  SEAN O. LUKE  MAKES NO REPRESENTATIONS ABOUT THE
  16. ACCURACY OR SUITABILITY OF THIS MATERIAL FOR ANY PURPOSE.  
  17. IT IS PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
  18.  
  19. */
  20.  
  21. #import <soundkit/SoundView.h>
  22. #import <soundkit/NXSoundDevice.h>
  23. #import <appkit/appkit.h>
  24.  
  25. // Defines
  26.  
  27. #define MISCSOUNDVIEW_RULER_HEIGHT 16            // minimum
  28. #define MISCSOUNDVIEW_PLAY_MARK_HEIGHT 4
  29.  
  30. #define MISCSOUNDVIEW_TICK_MINIMUM_SPACING 2.0
  31. #define MISCSOUNDVIEW_TICK_MINIMUM_SPACING_WITH_LABELS 40.0
  32.  
  33. #define MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SAMPLES 1
  34. #define MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_SECONDS 0
  35. #define MISCSOUNDVIEW_XAXIS_SPACING_FORMAT_PERCENT 2
  36.  
  37. #define MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_DECIBEL 1
  38. #define MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_SIXTEEN 2
  39. #define MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTY 3
  40. #define MISCSOUNDVIEW_YAXIS_DISPLAY_FORMAT_TWENTYFOUR 4
  41.  
  42.  
  43. @interface MiscSoundView:SoundView
  44. {
  45.     // X Axis information
  46.     
  47.     BOOL display_x_axis_marks;            // Display the Ruler
  48.     float minor_tick_spacing;            // Minor Tick Spacing
  49.     int minor_tick_spacing_format;        // Tick Format
  50.     int major_tick_spacing;                // Number of minor ticks per major tick
  51.     BOOL display_labels;                // Draw label information with ruler
  52.     float play_mark;                    // Current play mark position    
  53.     float old_play_mark;                // Old play mark position...
  54.                                         // if -1.0, no old play mark exists
  55.  
  56.     // Y Axis information
  57.     
  58.     BOOL display_y_axis_grid;            // display the amplitude
  59.     BOOL display_zero_line;                // display the zero line
  60.     int y_display_format;                // amplitude format
  61.  
  62.     // Scrolling
  63.             
  64.     BOOL scroll_to_reflect_playing;        // Scroll to reflect playing
  65.     
  66.     // Temporary Updates
  67.     
  68.     BOOL only_change_play_mark;            // On next display, only update
  69.                                         // play mark.
  70.     BOOL wipe_clean;                    // On next display, wipe X Axis clean
  71.                                         // before redrawing    
  72.     }
  73.  
  74.  
  75. // OVERRIDDEN TO FIX BUGS IN SOUNDVIEW
  76.  
  77. - getSelection:(int *)firstSample size:(int *)sampleCount;
  78. - setSelection:(int)firstSample size:(int)sampleCount;
  79. - selectAll:sender;
  80.  
  81.  
  82. // UTILITY METHODS
  83.  
  84. - scrollToSelection:sender;            // Tries to scroll to place selection
  85.                                     // starting at far left of visible rect
  86. - scrollToSample:(int)samp;            // Tries to scroll to place sample in
  87.                                     // far left of visible rect
  88. - (int) scrollSample;                // Sample at far left of visible rect
  89. - setPlayMark:(int)sample;            // Erases the old play mark and draws
  90.                                     // a new one at sample if the ruler is 
  91.                                     // displayed.  If sample is -1, no new
  92.                                     // play mark is drawn but old one is
  93.                                     // erased.
  94. - zoomAllIn:sender;                    // Scales to maximum detail, scrolls to
  95.                                     // selection
  96. - zoomAllOut:sender;                // Scales to minimum detail, scrolls to
  97.                                     // selection
  98. - zoomInOneReduction:sender;        // Scales to one more level of detail,
  99.                                     // scrolls to selection
  100. - zoomOutOneReduction:sender;        // Scales to one less level of detail,
  101.                                     // scrolls to selection
  102. - zoomToSelection:sender;            // Scales and scrolls to selection
  103. - getZoomValueFrom:sender;            // Scales to a value between 0 and 1,
  104.                                     // and scrolls to selection
  105. - takeIntValueFrom:sender;            // Sets the play mark to the int value
  106.                                     // of sender.  Used in conjunction with
  107.                                     // a SoundTracker on the SoundView,
  108.                                     // tracking on SAMPLES.
  109. - adjustBounds:sender;                // adjusts the SoundView's bounds so
  110.                                     // the ruler will fit within its parent
  111.                                     // ScrollView.
  112.  
  113.  
  114. // SETTING VALUES        (should be done immediately after initFrame)
  115.  
  116. - set:
  117.     (BOOL) displayXAxis:
  118.     (BOOL) displayYAxis:
  119.     (BOOL) displayLabels:
  120.     (BOOL) displayZeroLine:
  121.     (int) majorTickSpacing:
  122.     (float) minorTickSpacing:
  123.     (int) minorTickSpacingFormat:
  124.     (int) thisYDisplayFormat:
  125.     (BOOL) scrollToReflectPlaying;
  126.  
  127. // TO DEMO SOUNDVIEW 
  128.  
  129. - toggleXAxisDisplayed:sender;
  130. - toggleYAxisDisplayed:sender;
  131. - toggleLabelsDisplayed:sender;
  132. - toggleZeroLineDisplayed:sender;
  133. - toggleScrollToReflectPlaying:sender;
  134.  
  135. // QUERYING VALUES    
  136.     
  137. - (BOOL) xAxisDisplayed;
  138. - (BOOL) yAxisDisplayed;
  139. - (BOOL) zeroLineDisplayed;
  140. - (BOOL) labelsDisplayed;
  141. - (BOOL) scrollToReflectPlaying;
  142. - (int) majorTickSpacing;
  143. - (float) minorTickSpacing;
  144. - (int) minorTickSpacingFormat;
  145. - (int) yDisplayFormat;
  146.  
  147.  
  148. @end
  149.