MusicKit  0.0.0
SndMeter.h
00001 /*
00002  * $Id$
00003  *
00004  * Description: Defines a NSView subclass displaying instantaneous amplitude of sound.
00005  *
00006  * Original Author: Lee Boynton
00007  *
00008  * Substantially based on Sound Kit, Release 2.0, Copyright (c) 1988, 1989, 1990, NeXT, Inc.  All rights reserved. 
00009  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
00010  *
00011  * @APPLE_LICENSE_HEADER_START@
00012  * 
00013  * "Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
00014  * Reserved.  This file contains Original Code and/or Modifications of
00015  * Original Code as defined in and that are subject to the Apple Public
00016  * Source License Version 1.0 (the 'License').  You may not use this file
00017  * except in compliance with the License.  Please obtain a copy of the
00018  * License at http://www.apple.com/publicsource and read it before using
00019  * this file.
00020  * 
00021  * The Original Code and all software distributed under the License are
00022  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
00023  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
00024  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
00025  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
00026  * License for the specific language governing rights and limitations
00027  * under the License."
00028  * 
00029  * @APPLE_LICENSE_HEADER_END@
00030  *
00031  * Portions Copyright (c) 2001-2003, The MusicKit project. All rights reserved.
00032  *
00033  * Legal Statement Covering Additions by The MusicKit Project:
00034  *
00035  *    Permission is granted to use and modify this code for commercial and
00036  *    non-commercial purposes so long as the author attribution and copyright
00037  *    messages remain intact and accompany all relevant code.
00038  *
00039  */ 
00040 #import <AppKit/AppKit.h>
00041 
00042 @class Snd;
00043 
00073 @interface SndMeter: NSView
00074 {
00075     Snd *sound;
00076     int currentSample;
00077     float currentValue;
00078     float currentPeak;
00079     float minValue;
00080     float maxValue;
00081     float holdTime;
00082     NSColor *backgroundColor;
00083     NSColor *foregroundColor;
00084     NSColor *peakColor;
00085     struct {
00086       unsigned int running:1;
00087       unsigned int bezeled:1;
00088       unsigned int shouldStop:1;
00089       unsigned int displayPeakValue:1;
00090       unsigned int _reservedFlags:12;
00091     } smFlags;
00092     void *_timedEntry;
00093     int _valTime;
00094     int _peakTime;
00095     float _valOneAgo;
00096     float _valTwoAgo;
00097 }
00098 
00133 - (id) initWithFrame: (NSRect) frameRect;
00134 
00135 - (id) initWithCoder: (NSCoder *) aStream;
00136 - (void) encodeWithCoder: (NSCoder *) aStream;
00137 
00145 - (float) holdTime;
00146 
00155 - (void) setHoldTime: (float) seconds;
00156 
00163 - (void) setBackgroundColor: (NSColor *) aColor;
00164 
00171 - (NSColor *) backgroundColor;
00172 
00179 - (void) setForegroundColor: (NSColor *) aColor;
00180 
00187 - (NSColor *) foregroundColor;
00188 
00195 - (void) setPeakColor: (NSColor *) aColor;
00196 
00203 - (NSColor *) peakColor;
00204 
00208 - (void) setDisplayPeak: (BOOL) yesOrNo;
00209 
00214 - (BOOL) isDisplayingPeak;
00215 
00220 - (Snd *) sound;
00221 
00226 - (void) setSound: (Snd *) aSound;
00227 
00237 - (void) run: (id) sender;
00238 
00246 - (void) stop: (id) sender;
00247 
00254 - (BOOL) isRunning;
00255 
00263 - (BOOL) isBezeled;
00264 
00271 - (void) setBezeled: (BOOL) aFlag;
00272 
00282 - (void) setFloatValue: (float) aValue;
00283 
00291 - (float) floatValue;
00292 
00300 - (float) peakValue;
00301 
00310 - (float) minValue;
00311 
00320 - (float) maxValue;
00321 
00330 - (void) drawRect: (NSRect) rects;
00331 
00339 - (void) drawCurrentValue;
00340 
00341 @end
00342