dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / audio / include / AudioStream.h
blob00d0a1622e51d824b0d377900b0f77f34e404734
1 /*
2 * CDDL HEADER START
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.
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.
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]
20 * CDDL HEADER END
23 * Copyright (c) 1990-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _MULTIMEDIA_AUDIOSTREAM_H
28 #define _MULTIMEDIA_AUDIOSTREAM_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <Audio.h>
33 #include <AudioHdr.h>
34 #include <stdlib.h>
35 #include <AudioDebug.h>
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 // This is the abstract base class for all audio data sources/sinks.
42 // It is invalid to create an object of type AudioStream.
44 class AudioStream : public Audio {
45 private:
46 AudioHdr hdr; // data encoding info
47 Double length; // length of data, in secs
49 protected:
51 Boolean hdrset() const; // TRUE if header valid
53 // Set header (always)
54 AudioError updateheader(
55 const AudioHdr& h); // header to copy
57 // Set data length
58 void setlength(
59 Double len); // new length, in secs
61 virtual Boolean opened() const = 0; // TRUE if stream 'open'
63 public:
64 AudioStream(const char *path = ""); // Constructor
66 // Set header
67 virtual AudioError SetHeader(
68 const AudioHdr& h); // header to copy
70 // Set data length
71 virtual void SetLength(
72 Double len); // new length, in secs
74 // XXX - is this needed? do we need time->sample frames?
75 virtual size_t GetByteCount() const; // Get length, in bytes
77 // class Audio methods specialized here
78 virtual AudioHdr GetHeader(); // Get header
80 virtual Double GetLength() const; // Get length, in secs
82 // Make sure endian of the data matches the current processor.
83 AudioError coerceEndian(unsigned char *buf, size_t len,
84 AudioEndian en);
86 virtual Boolean isEndianSensitive() const;
87 AudioEndian localByteOrder() const
89 return (hdr.localByteOrder());
93 #include <AudioStream_inline.h>
95 #ifdef __cplusplus
97 #endif
99 #endif /* !_MULTIMEDIA_AUDIOSTREAM_H */