comparison usr/src/cmd/audio/utilities/AudioError.cc @ 0:c9caec207d52 b86

Initial porting based on b86
author Koji Uno <koji.uno@sun.com>
date Tue, 02 Jun 2009 18:56:50 +0900
parents
children 1a15d5aaf794
comparison
equal deleted inserted replaced
-1:000000000000 0:c9caec207d52
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) 1993-2001 by Sun Microsystems, Inc.
24 * All rights reserved.
25 */
26
27 #pragma ident "@(#)AudioError.cc 1.2 05/06/08 SMI"
28
29 #include <string.h>
30 #include <AudioError.h>
31
32
33 // class Audio methods
34
35 // Convert error code to string
36 char *AudioError::
37 msg()
38 {
39 if (code == AUDIO_NOERROR)
40 return (char *)("");
41 if (code == AUDIO_UNIXERROR) {
42 if (sys == 0) {
43 sys = errno;
44 }
45 if (sys >= 0) {
46 return (strerror(sys));
47 } else {
48 return (_MGET_("Unknown UNIX error"));
49 }
50 }
51
52 // XXX - these must jive with what's in audio_errno.h
53 switch (code) {
54 case 0: /* AUDIO_SUCCESS = 0 */
55 return (_MGET_("Audio operation successful"));
56 case 1: /* AUDIO_ERR_BADHDR = 1 */
57 return (_MGET_("Invalid audio header"));
58 case 2: /* AUDIO_ERR_BADFILEHDR = 2 */
59 return (_MGET_("Invalid audio file header"));
60 case 3: /* AUDIO_ERR_BADARG = 3 */
61 return (_MGET_("Invalid argument or value"));
62 case 4: /* AUDIO_ERR_NOEFFECT = 4 */
63 return (_MGET_("Audio operation not performed"));
64 case 5: /* AUDIO_ERR_ENCODING = 5 */
65 return (_MGET_("Unknown audio encoding format"));
66 case 6: /* AUDIO_ERR_INTERRUPTED = 6 */
67 return (_MGET_("Audio operation interrupted"));
68 case 7: /* AUDIO_EOF = 7 */
69 return (_MGET_("Audio end-of-file"));
70 case 8: /* AUDIO_ERR_HDRINVAL = 8 */
71 return (_MGET_("Unsupported audio data format"));
72 case 9: /* AUDIO_ERR_PRECISION = 9 */
73 return (_MGET_("Unsupported audio data precision"));
74 case 10: /* AUDIO_ERR_NOTDEVICE = 10 */
75 return (_MGET_("Not an audio device"));
76 case 11: /* AUDIO_ERR_DEVICEBUSY = 11 */
77 return (_MGET_("Audio device is busy"));
78 case 12: /* AUDIO_ERR_BADFRAME = 12 */
79 return (_MGET_("Partial sample frame"));
80 case 13: /* AUDIO_ERR_FORMATLOCK = 13 */
81 return (_MGET_("Audio format cannot be changed"));
82 case 14: /* AUDIO_ERR_DEVOVERFLOW = 14 */
83 return (_MGET_("Audio device overrun"));
84 default:
85 return (_MGET_("Unknown audio error"));
86 }
87 }