xref: /illumos-gate/usr/src/cmd/audio/include/AudioExtent.h (revision 2a8bcb4efb45d99ac41c94a75c396b362c414f7f)
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 #include <values.h>
31 #include <Audio.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 // This class defines an extent of a referenced audio class
38 class AudioExtent : public Audio {
39 private:
40 	Audio*			ref;		// reference to audio object
41 	Double			start;		// start time
42 	Double			end;		// end time
43 
44 	AudioExtent operator=(AudioExtent);	// Assignment is illegal
45 
46 public:
47 	// Constructor
48 	AudioExtent(
49 	    Audio* obj,				// audio object
50 	    double s = 0.,			// start time
51 	    double e = AUDIO_UNKNOWN_TIME);	// end time
52 	virtual ~AudioExtent();				// Destructor
53 
54 	Audio* GetRef() const;				// Get audio obj
55 	void SetRef(Audio* r);				// Set audio obj
56 	Double GetStart() const;			// Get start time
57 	void SetStart(Double s);			// Set start time
58 	Double GetEnd() const;				// Get end time
59 	void SetEnd(Double e);				// Set end time
60 
61 	// class Audio methods specialized here
62 	virtual Double GetLength() const;		// Get length, in secs
63 	virtual char *GetName() const;			// Get name string
64 	virtual AudioHdr GetHeader();			// Get header
65 	virtual AudioHdr GetHeader(Double pos);		// Get header at pos
66 
67 	// Read from position
68 	virtual AudioError ReadData(
69 	    void* buf,				// buffer to fill
70 	    size_t& len,			// buffer length (updated)
71 	    Double& pos);			// start position (updated)
72 
73 	// Write is prohibited
74 	virtual AudioError WriteData(
75 	    void* buf,				// buffer to copy
76 	    size_t& len,			// buffer length (updated)
77 	    Double& pos);			// start position (updated)
78 
isExtent()79 	virtual Boolean isExtent() const { return (TRUE); }
80 };
81 
82 #ifdef __cplusplus
83 }
84 #endif
85 
86 #endif /* !_MULTIMEDIA_AUDIOEXTENT_H */
87