home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / SOUNDS.DI$ / SAXIS.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  1.3 KB  |  48 lines

  1. function [smin, smax] = saxis(v)
  2. %SAXIS    Sound axis scaling.
  3. %    The SOUND function ordinarily scales its input vector Y so that the
  4. %    maximum and minimum values in Y correspond to the maximum and
  5. %    minimum input ranges allowed by the sound hardware.
  6. %
  7. %    SAXIS(V), where V is the two element vector V = [SMIN SMAX], disables
  8. %    SOUND's automatic scaling and sets the scaling so that SMIN and SMAX
  9. %    correspond to the minimum and input maximum ranges allowed by the
  10. %    sound hardware. Values outside this range are clipped.
  11. %
  12. %    SAXIS('auto') sets sound axis scaling back to automatic.
  13. %    SAXIS, by itself, returns the two element row vector containing the
  14. %    [SMIN SMAX] currently in effect.
  15. %
  16. %    SAXIS is entirely analogous to CAXIS and AXIS, only its scaling applies
  17. %    to sounds rather than graphical limits.
  18. %
  19. %    See also SOUND, CAXIS, AXIS.
  20.  
  21. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  22.  
  23. global SAXIS_SCALE 
  24. global SAXIS_LIM
  25. if nargin == 0
  26.     if isempty(SAXIS_SCALE)
  27.         SAXIS_SCALE = 'auto';
  28.         SAXIS_LIM = [-1 1];
  29.     end
  30. else
  31.     if strcmp(v,'auto')
  32.         SAXIS_LIM = [-1 1];
  33.         SAXIS_SCALE = 'auto';
  34.     elseif length(v) ~= 2
  35.         error('Requires a two-element argument.')
  36.     else
  37.         SAXIS_SCALE = 'fixed';
  38.         SAXIS_LIM = v(:)';
  39.     end
  40.     return
  41. end
  42. if nargout <= 1
  43.     smin = SAXIS_LIM;
  44. elseif nargout == 2
  45.     smin = SAXIS_LIM(1);
  46.     smax = SAXIS_LIM(2);
  47. end
  48.