dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / audio / include / AudioBuffer.h
blob1fa61e0b2624b9ba9f4f0bc8a8e9067bc4a4268d
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) 1992-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
27 #ifndef _MULTIMEDIA_AUDIOBUFFER_H
28 #define _MULTIMEDIA_AUDIOBUFFER_H
30 #pragma ident "%Z%%M% %I% %E% SMI"
32 #include <AudioStream.h>
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 // This is the class describing a mapped buffer of audio data.
39 // In addition to the standard Read and Write methods, the address
40 // of the buffer may be obtained and the data accessed directly.
42 class AudioBuffer : public AudioStream {
43 private:
44 Double buflen; // buffer size, in seconds
45 int zflag; // malloc'd with zmalloc?
46 protected:
47 size_t bufsize; // buffer size, in bytes
48 void* bufaddr; // buffer address
50 // class AudioStream methods specialized here
51 virtual Boolean opened() const; // TRUE, if open
52 virtual AudioError alloc(); // Allocate buffer
54 public:
55 // Constructor
56 AudioBuffer(
57 double len = 0., // buffer size, in seconds
58 const char *name = "(buffer)"); // name
59 ~AudioBuffer(); // Destructor
61 virtual void* GetAddress() const; // Get buffer address
62 virtual void* GetAddress(Double) const; // Get address at offset
63 virtual AudioError SetSize(Double len); // Change buffer size
64 virtual Double GetSize() const; // Get buffer size
65 virtual size_t GetByteCount() const; // Get size, in bytes
67 // class AudioStream methods specialized here
68 // Set header
69 virtual AudioError SetHeader(
70 const AudioHdr& h); // header to copy
72 // Set data length
73 virtual void SetLength(
74 Double len); // new length, in secs
76 // class Audio methods specialized here
78 // Read from position
79 virtual AudioError ReadData(
80 void* buf, // buffer to fill
81 size_t& len, // buffer length (updated)
82 Double& pos); // start position (updated)
84 // Write at position
85 virtual AudioError WriteData(
86 void* buf, // buffer to copy
87 size_t& len, // buffer length (updated)
88 Double& pos); // start position (updated)
90 // Append at position
91 virtual AudioError AppendData(
92 void* buf, // buffer to copy
93 size_t& len, // buffer length (updated)
94 Double& pos); // start position (updated)
96 // copy to another audio obj.
97 virtual AudioError AsyncCopy(
98 Audio* to, // dest audio object
99 Double& frompos,
100 Double& topos,
101 Double& limit);
103 virtual Boolean isBuffer() const { return (TRUE); }
106 #ifdef __cplusplus
108 #endif
110 #endif /* !_MULTIMEDIA_AUDIOBUFFER_H */