xref: /titanic_41/usr/src/cmd/audio/utilities/AudioCopy.cc (revision 159d09a20817016f09b3ea28d1bdada4a336bb91)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 #include <stdlib.h>
30 #include <errno.h>
31 #include <Audio.h>
32 #include <AudioBuffer.h>
33 #include <AudioLib.h>
34 
35 // Generic Audio functions
36 
37 
38 // Data format translation occurs transparently
39 AudioError
40 AudioCopy(
41 	Audio*		from,		// input source
42 	Audio*		to)		// output sink
43 {
44 	Double		frompos = 0.;
45 	Double		topos   = 0.;
46 	Double		limit   = AUDIO_UNKNOWN_TIME;
47 
48 	return (AudioCopy(from, to, frompos, topos, limit));
49 }
50 
51 // Copy a data stream
52 // Data format translation occurs transparently
53 AudioError
54 AudioCopy(
55 	Audio*		from,		// input source
56 	Audio*		to,		// output sink
57 	Double&		frompos,	// input position (updated)
58 	Double&		topos,		// output position (updated)
59 	Double&		limit)		// amount to copy (updated)
60 {
61 	return (from->Copy(to, frompos, topos, limit));
62 }
63 
64 // Copy one segment of a data stream
65 // Data format translation occurs transparently
66 AudioError
67 AudioAsyncCopy(
68 	Audio*		from,		// input source
69 	Audio*		to,		// output sink
70 	Double&		frompos,	// input position (updated)
71 	Double&		topos,		// output position (updated)
72 	Double&		limit)		// amount to copy (updated)
73 {
74 	return (from->AsyncCopy(to, frompos, topos, limit));
75 }
76