audio_input.c revision 028efd1c560953673904369fe3f2592de7103b8c
/*
* 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: Virtual mixing audio input routines
*
* This file contains the actual mixing and resampling engine for input.
*/
#include <sys/sysmacros.h>
#include "audio_impl.h"
void \
{ \
int ch = 0; \
\
do { /* for each channel */ \
int i; \
\
/* get value and adjust next channel offset */ \
\
i = fragfr; \
\
do { /* for each frame */ \
\
scaled /= AUDIO_VOL_SCALE; \
\
\
} while (--i); \
ch++; \
}
/*
* Produce a fragment's worth of data. This is called when the data in
* the conversion buffer is exhausted, and we need to refill it from the
* source buffer. We always consume data from the client in quantities of
* a fragment at a time (assuming that a fragment is available.)
*/
static void
{
unsigned nframes;
unsigned framesz;
/*
* Copy data. We deal properly with wraps. Done as a
* do...while to minimize the number of tests.
*/
do {
unsigned nf;
unsigned nb;
}
} while (count);
}
void
{
audio_client_t *c;
/* consume all fragments in the buffer */
/*
* Consider doing the SYNC outside of the lock.
*/
int space;
int count;
/* skip over streams paused or not running */
eng->e_suspended) {
continue;
}
/*
* Optionally convert fragment to requested sample
* format and rate.
*/
} else {
}
eng->e_stream_overruns++;
} else {
}
/* wake blocked threads (blocking reads, etc.) */
mutex_enter(&c->c_lock);
if (overrun) {
c->c_do_notify = B_TRUE;
}
c->c_do_input = B_TRUE;
cv_broadcast(&c->c_cv);
mutex_exit(&c->c_lock);
}
/*
* Update the tail pointer, and the data pointer.
*/
}
}
}