xref: /titanic_50/usr/src/cmd/audio/include/AudioExtent.h (revision 74e20cfe817b82802b16fac8690dadcda76f54f5)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 1990-2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 #ifndef _MULTIMEDIA_AUDIOEXTENT_H
28 #define	_MULTIMEDIA_AUDIOEXTENT_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <values.h>
33 #include <Audio.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 // This class defines an extent of a referenced audio class
40 class AudioExtent : public Audio {
41 private:
42 	Audio*			ref;		// reference to audio object
43 	Double			start;		// start time
44 	Double			end;		// end time
45 
46 	AudioExtent operator=(AudioExtent);	// Assignment is illegal
47 
48 public:
49 	// Constructor
50 	AudioExtent(
51 	    Audio* obj,				// audio object
52 	    double s = 0.,			// start time
53 	    double e = AUDIO_UNKNOWN_TIME);	// end time
54 	virtual ~AudioExtent();				// Destructor
55 
56 	Audio* GetRef() const;				// Get audio obj
57 	void SetRef(Audio* r);				// Set audio obj
58 	Double GetStart() const;			// Get start time
59 	void SetStart(Double s);			// Set start time
60 	Double GetEnd() const;				// Get end time
61 	void SetEnd(Double e);				// Set end time
62 
63 	// class Audio methods specialized here
64 	virtual Double GetLength() const;		// Get length, in secs
65 	virtual char *GetName() const;			// Get name string
66 	virtual AudioHdr GetHeader();			// Get header
67 	virtual AudioHdr GetHeader(Double pos);		// Get header at pos
68 
69 	// Read from position
70 	virtual AudioError ReadData(
71 	    void* buf,				// buffer to fill
72 	    size_t& len,			// buffer length (updated)
73 	    Double& pos);			// start position (updated)
74 
75 	// Write is prohibited
76 	virtual AudioError WriteData(
77 	    void* buf,				// buffer to copy
78 	    size_t& len,			// buffer length (updated)
79 	    Double& pos);			// start position (updated)
80 
81 	virtual Boolean isExtent() const { return (TRUE); }
82 };
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* !_MULTIMEDIA_AUDIOEXTENT_H */
89