wavedata.c revision 88447a05f537aabe9a1bc3d5313f22581ec992a7
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright (C) 4Front Technologies 1996-2008.
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Purpose: Test sounds for osstest
*
* Nodoc:
*/
#include <string.h>
#include "wavedata.h"
static int
le_int(const unsigned char *p, int l)
{
int i, val;
val = 0;
for (i = l - 1; i >= 0; i--) {
}
return (val);
}
int
uncompress_wave(short *outbuf)
{
#define WAVE_FORMAT_ADPCM 0x0002
typedef struct {
}
768, 614, 512, 409, 307, 230, 230, 230
};
unsigned char buf[4096];
int channels = 1;
int p = 12, outp = 0;
int nBlockAlign = 2048;
int nib;
int ppp;
/* filelen = le_int(&hdr[4], 4); */
/* fmt = le_int(&hdr[p + 8], 2); */
/* speed = le_int(&hdr[p + 12], 4); */
/* bytes_per_sample = le_int(&hdr[p + 20], 2); */
x = p + 30;
for (i = 0; i < wNumCoeff; i++) {
x += 2;
x += 2;
}
}
p += n + 8;
}
p += 8;
/*
* Playback procedure
*/
#define OUT_SAMPLE(s) { \
if (s > 32767) \
s = 32767; \
else if (s < -32768) \
s = -32768; \
n += 2; \
}
#define GETNIBBLE \
((nib == 0) ? \
outp = 0;
ppp = p;
while (dataleft > nBlockAlign) {
int x = 0;
ppp += nBlockAlign;
dataleft -= nBlockAlign;
nib = 0;
n = 0;
for (i = 0; i < channels; i++) {
x++;
}
for (i = 0; i < channels; i++) {
x += 2;
}
for (i = 0; i < channels; i++) {
x += 2;
OUT_SAMPLE(samp1[i]);
}
for (i = 0; i < channels; i++) {
x += 2;
OUT_SAMPLE(samp2[i]);
}
for (i = 0; i < channels; i++) {
+ (samp2[i] *
/* Convert to signed */
if (i_delta & 0x08)
i_delta -= 0x10;
if (delta[i] < 16)
delta[i] = 16;
}
}
}
return (outp * 2);
}