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