SndMeter Class Reference

Not ready for operation just yet! More...

#import <SndMeter.h>

List of all members.

Public Member Functions

(id) - initWithFrame:
 Initializes the SndMeter, fitting its graphic components within frameRect.
(float) - holdTime
 Returns the SndMeter's hold time - the amount of time during which a peak amplitude is detected and displayed by the peak bubble - in seconds.
(void) - setHoldTime:
 Sets the SndMeter's peak value hold time in seconds.
(void) - setBackgroundColor:
 Sets the SndMeter's background color.
(NSColor *) - backgroundColor
 Returns the SndMeter's background color.
(void) - setForegroundColor:
 Sets the SndMeter's running bar color.
(NSColor *) - foregroundColor
 Returns the color of the running bar.
(void) - setPeakColor:
 Sets the SndMeter's peak bubble color.
(NSColor *) - peakColor
 Returns the SndMeter's peak bubble gray.
(Snd *) - sound
 Returns the Snd object that the SndMeter is metering.
(void) - setSound:
 Sets the SndMeter's Snd object.
(void) - run:
 Starts the SndMeter running.
(void) - stop:
 Stops the SndMeter's metering activity.
(BOOL) - isRunning
 Returns YES if the SndMeter is currently running; otherwise, returns NO.
(BOOL) - isBezeled
 Returns YES (the default) if the SndMeter has a border; otherwise, returns NO.
(void) - setBezeled:
 If aFlag is YES, a bezeled border is drawn around the SndMeter.
(void) - setFloatValue:
 Sets the current running value to aValue.
(float) - floatValue
 Returns the current running amplitude value as a floating-point number between 0.0 and 1.0.
(float) - peakValue
 Returns the most recently detected peak value as a floating-point number between 0.0 and 1.0.
(float) - minValue
 Returns the minimum running value so far.
(float) - maxValue
 Returns the maximum running value so far.
(void) - drawRect:
 Draws all the components of the SndMeter (frame, running bar, and peak bubble).
(void) - drawCurrentValue
 Draws the SndMeter's running bar and peak bubble.


Detailed Description

Not ready for operation just yet!

A SndMeter is a view that displays the amplitude level of a sound as it's being recorded or played back. There are two working parts to the meter: A continuously-updated “running bar” that lengthens ands shrinks to depict the current amplitude level, and a “peak bubble” that displays and holds the greatest amplitude that was detected within the last few samples. An optional bezeled border is drawn around the object's frame.

To use a SndMeter, you must first associate it with a Snd object, through the setSound: method, and then send the SndMeter a run: message. To stop the meter's display, you send the object a stop: message. Neither run:nor stop: affect the performance of the meter's sound.

You can retrieve a SndMeter's running and peak values through the floatValue and peakValue methods. The values that these methods return are valid only while the SndMeter is running. A SndMeter also keeps track of the minimum and maximum amplitude over the duration of a run; these can be retrieved through minValue and maxValue. All SndMeter amplitude levels are normalized to fit between 0.0 (inaudible) and 1.0 (maximum amplitude).


Member Function Documentation

- (id) initWithFrame: (NSRect)  frameRect  

Initializes the SndMeter, fitting its graphic components within frameRect.

Parameters:
frameRect is a NSRect.
Returns:
Returns an id. The object's attributes are initialized as follows:
Attribute Value
Peak hold time 0.7 seconds
Background gray [NSColor darkGrayColor] Running bar gray [NSColor lightGrayColor]
Peak bubble gray [NSColor whiteColor] Border bezeled

- (float) holdTime  

Returns the SndMeter's hold time - the amount of time during which a peak amplitude is detected and displayed by the peak bubble - in seconds.

The default is 0.7 seconds.

Returns:
Returns a float.

- (void) setHoldTime: (float)  seconds  

Sets the SndMeter's peak value hold time in seconds.

This is the amount of time during which peak amplitudes are detected and held by the peak bubble.

Parameters:
seconds is a float.
Returns:
Returns an id.

- (void) setBackgroundColor: (NSColor *)  aColor  

Sets the SndMeter's background color.

The default is NSColor's darkGrayColor.

Parameters:
aColor is a NSColor instance.

- (NSColor *) backgroundColor  

Returns the SndMeter's background color.

The default background color is NSColor's darkGrayColor.

Returns:
Returns a NSColor instance.

- (void) setForegroundColor: (NSColor *)  aColor  

Sets the SndMeter's running bar color.

The default is NSColor's lightGrayColor.

Parameters:
aColor is a NSColor instance.

- (NSColor *) foregroundColor  

Returns the color of the running bar.

The default foreground color is NSColor's lightGrayColor.

Returns:
Returns a NSColor instance.

- (void) setPeakColor: (NSColor *)  aColor  

Sets the SndMeter's peak bubble color.

The default is NSColor's whiteColor.

Parameters:
aColor is a NSColor instance.

- (NSColor *) peakColor  

Returns the SndMeter's peak bubble gray.

The default is NSColor's whiteColor.

Returns:
Returns a NSColor instance.

- (Snd *) sound  

Returns the Snd object that the SndMeter is metering.

Returns:
Returns a Snd instance.

- (void) setSound: (Snd *)  aSound  

Sets the SndMeter's Snd object.

Parameters:
aSound is a Snd instance.

- (void) run: (id)  sender  

Starts the SndMeter running.

The SndMeter object must have a Snd object associated with it for this method to have an effect. Note that this method only affects the state of the SndMeter - it doesn't trigger any activity in the Snd.

Parameters:
sender is an id.

- (void) stop: (id)  sender  

Stops the SndMeter's metering activity.

Note that this method only affects the state of the SndMeter

  • it doesn't trigger any activity in the Snd.
    Parameters:
    sender is an id.

- (BOOL) isRunning  

Returns YES if the SndMeter is currently running; otherwise, returns NO.

The SndMeter's status doesn't depend on the activity of its Snd object.

Returns:
Returns a BOOL.

- (BOOL) isBezeled  

Returns YES (the default) if the SndMeter has a border; otherwise, returns NO.

Note that the SndMeter class doesn't provide a method to change the type of border - it can display a bezeled border or none at all.

Returns:
Returns a BOOL.

- (void) setBezeled: (BOOL)  aFlag  

If aFlag is YES, a bezeled border is drawn around the SndMeter.

If aFlag is NO and the SndMeter has a frame, the frame is removed.

Parameters:
aFlag is a BOOL.

- (void) setFloatValue: (float)  aValue  

Sets the current running value to aValue.

You never invoke this method directly; it's invoked automatically when the SndMeter is running. However, you can reimplement this method in a subclass of SndMeter.

Parameters:
aValue is a float.

- (float) floatValue  

Returns the current running amplitude value as a floating-point number between 0.0 and 1.0.

This is the amplitude level that's displayed by the running bar.

Returns:
Returns a float.

- (float) peakValue  

Returns the most recently detected peak value as a floating-point number between 0.0 and 1.0.

This is the amplitude level that's displayed by the peak bubble.

Returns:
Returns a float.

- (float) minValue  

Returns the minimum running value so far.

You can invoke this method after you stop this SndMeter to retrieve the overall minimum value for the previous performance. The minimum value is cleared when you restart the SndMeter.

Returns:
Returns a float.

- (float) maxValue  

Returns the maximum running value so far.

You can invoke this method after you stop this SndMeter to retrieve the overall maximum value for the previous performance. The maximum value is cleared when you restart the SndMeter.

Returns:
Returns a float.

- (void) drawRect: (NSRect)  rects  

Draws all the components of the SndMeter (frame, running bar, and peak bubble).

You never invoke this method directly; however, you can override it in a subclass to change the way the components are displayed.

Parameters:
rects is a NSRect.

- (void) drawCurrentValue  

Draws the SndMeter's running bar and peak bubble.

You never invoke this method directly; it's invoked automatically while the SndMeter is running. You can override this method to change the look of the running bar and peak bubble.


The documentation for this class was generated from the following file:

Generated on Sat Dec 5 17:01:16 2009 for MusicKit by  doxygen 1.5.6