0N/A/*
2362N/A * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/A#define USE_ERROR
0N/A#define USE_TRACE
0N/A
0N/A#include "PLATFORM_API_SolarisOS_Utils.h"
0N/A#include "DirectAudio.h"
0N/A
0N/A#if USE_DAUDIO == TRUE
0N/A
0N/A
0N/A// The default buffer time
0N/A#define DEFAULT_PERIOD_TIME_MILLIS 50
0N/A
0N/A///// implemented functions of DirectAudio.h
0N/A
0N/AINT32 DAUDIO_GetDirectAudioDeviceCount() {
0N/A return (INT32) getAudioDeviceCount();
0N/A}
0N/A
0N/A
0N/AINT32 DAUDIO_GetDirectAudioDeviceDescription(INT32 mixerIndex,
0N/A DirectAudioDeviceDescription* description) {
0N/A AudioDeviceDescription desc;
0N/A
0N/A if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, TRUE)) {
0N/A description->maxSimulLines = desc.maxSimulLines;
0N/A strncpy(description->name, desc.name, DAUDIO_STRING_LENGTH-1);
0N/A description->name[DAUDIO_STRING_LENGTH-1] = 0;
0N/A strncpy(description->vendor, desc.vendor, DAUDIO_STRING_LENGTH-1);
0N/A description->vendor[DAUDIO_STRING_LENGTH-1] = 0;
0N/A strncpy(description->version, desc.version, DAUDIO_STRING_LENGTH-1);
0N/A description->version[DAUDIO_STRING_LENGTH-1] = 0;
0N/A /*strncpy(description->description, desc.description, DAUDIO_STRING_LENGTH-1);*/
0N/A strncpy(description->description, "Solaris Mixer", DAUDIO_STRING_LENGTH-1);
0N/A description->description[DAUDIO_STRING_LENGTH-1] = 0;
0N/A return TRUE;
0N/A }
0N/A return FALSE;
0N/A
0N/A}
0N/A
0N/A#define MAX_SAMPLE_RATES 20
0N/A
0N/Avoid DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* creator) {
0N/A int fd = -1;
0N/A AudioDeviceDescription desc;
0N/A am_sample_rates_t *sr;
0N/A /* hardcoded bits and channels */
0N/A int bits[] = {8, 16};
0N/A int bitsCount = 2;
0N/A int channels[] = {1, 2};
0N/A int channelsCount = 2;
0N/A /* for querying sample rates */
0N/A int err;
0N/A int ch, b, s;
0N/A
0N/A TRACE2("DAUDIO_GetFormats, mixer %d, isSource=%d\n", mixerIndex, isSource);
0N/A if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, FALSE)) {
0N/A fd = open(desc.pathctl, O_RDONLY);
0N/A }
0N/A if (fd < 0) {
0N/A ERROR1("Couldn't open audio device ctl for device %d!\n", mixerIndex);
0N/A return;
0N/A }
0N/A
0N/A /* get sample rates */
0N/A sr = (am_sample_rates_t*) malloc(AUDIO_MIXER_SAMP_RATES_STRUCT_SIZE(MAX_SAMPLE_RATES));
0N/A if (sr == NULL) {
0N/A ERROR1("DAUDIO_GetFormats: out of memory for mixer %d\n", (int) mixerIndex);
0N/A close(fd);
0N/A return;
0N/A }
0N/A
0N/A sr->num_samp_rates = MAX_SAMPLE_RATES;
0N/A sr->type = isSource?AUDIO_PLAY:AUDIO_RECORD;
0N/A sr->samp_rates[0] = -2;
0N/A err = ioctl(fd, AUDIO_MIXER_GET_SAMPLE_RATES, sr);
0N/A if (err < 0) {
0N/A ERROR1(" DAUDIO_GetFormats: AUDIO_MIXER_GET_SAMPLE_RATES failed for mixer %d!\n",
0N/A (int)mixerIndex);
0N/A ERROR2(" -> num_sample_rates=%d sample_rates[0] = %d\n",
0N/A (int) sr->num_samp_rates,
0N/A (int) sr->samp_rates[0]);
0N/A /* Some Solaris 8 drivers fail for get sample rates!
0N/A * Do as if we support all sample rates
0N/A */
0N/A sr->flags = MIXER_SR_LIMITS;
0N/A }
0N/A if ((sr->flags & MIXER_SR_LIMITS)
0N/A || (sr->num_samp_rates > MAX_SAMPLE_RATES)) {
0N/A#ifdef USE_TRACE
0N/A if ((sr->flags & MIXER_SR_LIMITS)) {
0N/A TRACE1(" DAUDIO_GetFormats: floating sample rate allowed by mixer %d\n",
0N/A (int)mixerIndex);
0N/A }
0N/A if (sr->num_samp_rates > MAX_SAMPLE_RATES) {
0N/A TRACE2(" DAUDIO_GetFormats: more than %d formats. Use -1 for sample rates mixer %d\n",
0N/A MAX_SAMPLE_RATES, (int)mixerIndex);
0N/A }
0N/A#endif
0N/A /*
0N/A * Fake it to have only one sample rate: -1
0N/A */
0N/A sr->num_samp_rates = 1;
0N/A sr->samp_rates[0] = -1;
0N/A }
0N/A close(fd);
0N/A
0N/A for (ch = 0; ch < channelsCount; ch++) {
0N/A for (b = 0; b < bitsCount; b++) {
0N/A for (s = 0; s < sr->num_samp_rates; s++) {
0N/A DAUDIO_AddAudioFormat(creator,
0N/A bits[b], /* significant bits */
0N/A 0, /* frameSize: let it be calculated */
0N/A channels[ch],
0N/A (float) ((int) sr->samp_rates[s]),
0N/A DAUDIO_PCM, /* encoding - let's only do PCM */
0N/A (bits[b] > 8)?TRUE:TRUE, /* isSigned */
0N/A#ifdef _LITTLE_ENDIAN
0N/A FALSE /* little endian */
0N/A#else
0N/A (bits[b] > 8)?TRUE:FALSE /* big endian */
0N/A#endif
0N/A );
0N/A }
0N/A }
0N/A }
0N/A free(sr);
0N/A}
0N/A
0N/A
0N/Atypedef struct {
0N/A int fd;
0N/A audio_info_t info;
0N/A int bufferSizeInBytes;
0N/A int frameSize; /* storage size in Bytes */
0N/A /* how many bytes were written or read */
0N/A INT32 transferedBytes;
0N/A /* if transferedBytes exceed 32-bit boundary,
0N/A * it will be reset and positionOffset will receive
0N/A * the offset
0N/A */
0N/A INT64 positionOffset;
0N/A} SolPcmInfo;
0N/A
0N/A
0N/Avoid* DAUDIO_Open(INT32 mixerIndex, INT32 deviceID, int isSource,
0N/A int encoding, float sampleRate, int sampleSizeInBits,
0N/A int frameSize, int channels,
0N/A int isSigned, int isBigEndian, int bufferSizeInBytes) {
0N/A int err = 0;
0N/A int openMode;
0N/A AudioDeviceDescription desc;
0N/A SolPcmInfo* info;
0N/A
0N/A TRACE0("> DAUDIO_Open\n");
0N/A if (encoding != DAUDIO_PCM) {
0N/A ERROR1(" DAUDIO_Open: invalid encoding %d\n", (int) encoding);
0N/A return NULL;
0N/A }
0N/A
0N/A info = (SolPcmInfo*) malloc(sizeof(SolPcmInfo));
0N/A if (!info) {
0N/A ERROR0("Out of memory\n");
0N/A return NULL;
0N/A }
0N/A memset(info, 0, sizeof(SolPcmInfo));
0N/A info->frameSize = frameSize;
0N/A info->fd = -1;
0N/A
0N/A if (isSource) {
0N/A openMode = O_WRONLY;
0N/A } else {
0N/A openMode = O_RDONLY;
0N/A }
0N/A
0N/A#ifndef __linux__
0N/A /* blackdown does not use NONBLOCK */
0N/A openMode |= O_NONBLOCK;
0N/A#endif
0N/A
0N/A if (getAudioDeviceDescriptionByIndex(mixerIndex, &desc, FALSE)) {
0N/A info->fd = open(desc.path, openMode);
0N/A }
0N/A if (info->fd < 0) {
0N/A ERROR1("Couldn't open audio device for mixer %d!\n", mixerIndex);
0N/A free(info);
0N/A return NULL;
0N/A }
0N/A /* set to multiple open */
0N/A if (ioctl(info->fd, AUDIO_MIXER_MULTIPLE_OPEN, NULL) >= 0) {
0N/A TRACE1("DAUDIO_Open: %s set to multiple open\n", desc.path);
0N/A } else {
0N/A ERROR1("DAUDIO_Open: ioctl AUDIO_MIXER_MULTIPLE_OPEN failed on %s!\n", desc.path);
0N/A }
0N/A
0N/A AUDIO_INITINFO(&(info->info));
0N/A /* need AUDIO_GETINFO ioctl to get this to work on solaris x86 */
0N/A err = ioctl(info->fd, AUDIO_GETINFO, &(info->info));
0N/A
0N/A /* not valid to call AUDIO_SETINFO ioctl with all the fields from AUDIO_GETINFO. */
0N/A AUDIO_INITINFO(&(info->info));
0N/A
0N/A if (isSource) {
0N/A info->info.play.sample_rate = sampleRate;
0N/A info->info.play.precision = sampleSizeInBits;
0N/A info->info.play.channels = channels;
0N/A info->info.play.encoding = AUDIO_ENCODING_LINEAR;
0N/A info->info.play.buffer_size = bufferSizeInBytes;
0N/A info->info.play.pause = 1;
0N/A } else {
0N/A info->info.record.sample_rate = sampleRate;
0N/A info->info.record.precision = sampleSizeInBits;
0N/A info->info.record.channels = channels;
0N/A info->info.record.encoding = AUDIO_ENCODING_LINEAR;
0N/A info->info.record.buffer_size = bufferSizeInBytes;
0N/A info->info.record.pause = 1;
0N/A }
0N/A err = ioctl(info->fd, AUDIO_SETINFO, &(info->info));
0N/A if (err < 0) {
0N/A ERROR0("DAUDIO_Open: could not set info!\n");
0N/A DAUDIO_Close((void*) info, isSource);
0N/A return NULL;
0N/A }
0N/A DAUDIO_Flush((void*) info, isSource);
0N/A
0N/A err = ioctl(info->fd, AUDIO_GETINFO, &(info->info));
0N/A if (err >= 0) {
0N/A if (isSource) {
0N/A info->bufferSizeInBytes = info->info.play.buffer_size;
0N/A } else {
0N/A info->bufferSizeInBytes = info->info.record.buffer_size;
0N/A }
0N/A TRACE2("DAUDIO: buffersize in bytes: requested=%d, got %d\n",
0N/A (int) bufferSizeInBytes,
0N/A (int) info->bufferSizeInBytes);
0N/A } else {
0N/A ERROR0("DAUDIO_Open: cannot get info!\n");
0N/A DAUDIO_Close((void*) info, isSource);
0N/A return NULL;
0N/A }
0N/A TRACE0("< DAUDIO_Open: Opened device successfully.\n");
0N/A return (void*) info;
0N/A}
0N/A
0N/A
0N/Aint DAUDIO_Start(void* id, int isSource) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A int err, modified;
0N/A audio_info_t audioInfo;
0N/A
0N/A TRACE0("> DAUDIO_Start\n");
0N/A
0N/A AUDIO_INITINFO(&audioInfo);
0N/A err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
0N/A if (err >= 0) {
0N/A // unpause
0N/A modified = FALSE;
0N/A if (isSource && audioInfo.play.pause) {
0N/A audioInfo.play.pause = 0;
0N/A modified = TRUE;
0N/A }
0N/A if (!isSource && audioInfo.record.pause) {
0N/A audioInfo.record.pause = 0;
0N/A modified = TRUE;
0N/A }
0N/A if (modified) {
0N/A err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo);
0N/A }
0N/A }
0N/A
0N/A TRACE1("< DAUDIO_Start %s\n", (err>=0)?"success":"error");
0N/A return (err >= 0)?TRUE:FALSE;
0N/A}
0N/A
0N/Aint DAUDIO_Stop(void* id, int isSource) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A int err, modified;
0N/A audio_info_t audioInfo;
0N/A
0N/A TRACE0("> DAUDIO_Stop\n");
0N/A
0N/A AUDIO_INITINFO(&audioInfo);
0N/A err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
0N/A if (err >= 0) {
0N/A // pause
0N/A modified = FALSE;
0N/A if (isSource && !audioInfo.play.pause) {
0N/A audioInfo.play.pause = 1;
0N/A modified = TRUE;
0N/A }
0N/A if (!isSource && !audioInfo.record.pause) {
0N/A audioInfo.record.pause = 1;
0N/A modified = TRUE;
0N/A }
0N/A if (modified) {
0N/A err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo);
0N/A }
0N/A }
0N/A
0N/A TRACE1("< DAUDIO_Stop %s\n", (err>=0)?"success":"error");
0N/A return (err >= 0)?TRUE:FALSE;
0N/A}
0N/A
0N/Avoid DAUDIO_Close(void* id, int isSource) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A
0N/A TRACE0("DAUDIO_Close\n");
0N/A if (info != NULL) {
0N/A if (info->fd >= 0) {
0N/A DAUDIO_Flush(id, isSource);
0N/A close(info->fd);
0N/A }
0N/A free(info);
0N/A }
0N/A}
0N/A
0N/A#ifndef USE_TRACE
0N/A/* close to 2^31 */
0N/A#define POSITION_MAX 2000000000
0N/A#else
0N/A/* for testing */
0N/A#define POSITION_MAX 1000000
0N/A#endif
0N/A
0N/Avoid resetErrorFlagAndAdjustPosition(SolPcmInfo* info, int isSource, int count) {
0N/A audio_info_t audioInfo;
0N/A audio_prinfo_t* prinfo;
0N/A int err;
0N/A int offset = -1;
0N/A int underrun = FALSE;
0N/A int devBytes = 0;
0N/A
0N/A if (count > 0) {
0N/A info->transferedBytes += count;
0N/A
0N/A if (isSource) {
0N/A prinfo = &(audioInfo.play);
0N/A } else {
0N/A prinfo = &(audioInfo.record);
0N/A }
0N/A AUDIO_INITINFO(&audioInfo);
0N/A err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
0N/A if (err >= 0) {
0N/A underrun = prinfo->error;
0N/A devBytes = prinfo->samples * info->frameSize;
0N/A }
0N/A AUDIO_INITINFO(&audioInfo);
0N/A if (underrun) {
0N/A /* if an underrun occured, reset */
0N/A ERROR1("DAUDIO_Write/Read: Underrun/overflow: adjusting positionOffset by %d:\n",
0N/A (devBytes - info->transferedBytes));
0N/A ERROR1(" devBytes from %d to 0, ", devBytes);
0N/A ERROR2(" positionOffset from %d to %d ",
0N/A (int) info->positionOffset,
0N/A (int) (info->positionOffset + info->transferedBytes));
0N/A ERROR1(" transferedBytes from %d to 0\n",
0N/A (int) info->transferedBytes);
0N/A prinfo->samples = 0;
0N/A info->positionOffset += info->transferedBytes;
0N/A info->transferedBytes = 0;
0N/A }
0N/A else if (info->transferedBytes > POSITION_MAX) {
0N/A /* we will reset transferedBytes and
0N/A * the samples field in prinfo
0N/A */
0N/A offset = devBytes;
0N/A prinfo->samples = 0;
0N/A }
0N/A /* reset error flag */
0N/A prinfo->error = 0;
0N/A
0N/A err = ioctl(info->fd, AUDIO_SETINFO, &audioInfo);
0N/A if (err >= 0) {
0N/A if (offset > 0) {
0N/A /* upon exit of AUDIO_SETINFO, the samples parameter
0N/A * was set to the previous value. This is our
0N/A * offset.
0N/A */
0N/A TRACE1("Adjust samplePos: offset=%d, ", (int) offset);
0N/A TRACE2("transferedBytes=%d -> %d, ",
0N/A (int) info->transferedBytes,
0N/A (int) (info->transferedBytes - offset));
0N/A TRACE2("positionOffset=%d -> %d\n",
0N/A (int) (info->positionOffset),
0N/A (int) (((int) info->positionOffset) + offset));
0N/A info->transferedBytes -= offset;
0N/A info->positionOffset += offset;
0N/A }
0N/A } else {
0N/A ERROR0("DAUDIO: resetErrorFlagAndAdjustPosition ioctl failed!\n");
0N/A }
0N/A }
0N/A}
0N/A
0N/A// returns -1 on error
0N/Aint DAUDIO_Write(void* id, char* data, int byteSize) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A int ret = -1;
0N/A
0N/A TRACE1("> DAUDIO_Write %d bytes\n", byteSize);
0N/A if (info!=NULL) {
0N/A ret = write(info->fd, data, byteSize);
0N/A resetErrorFlagAndAdjustPosition(info, TRUE, ret);
0N/A /* sets ret to -1 if buffer full, no error! */
0N/A if (ret < 0) {
0N/A ret = 0;
0N/A }
0N/A }
0N/A TRACE1("< DAUDIO_Write: returning %d bytes.\n", ret);
0N/A return ret;
0N/A}
0N/A
0N/A// returns -1 on error
0N/Aint DAUDIO_Read(void* id, char* data, int byteSize) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A int ret = -1;
0N/A
0N/A TRACE1("> DAUDIO_Read %d bytes\n", byteSize);
0N/A if (info != NULL) {
0N/A ret = read(info->fd, data, byteSize);
0N/A resetErrorFlagAndAdjustPosition(info, TRUE, ret);
0N/A /* sets ret to -1 if buffer full, no error! */
0N/A if (ret < 0) {
0N/A ret = 0;
0N/A }
0N/A }
0N/A TRACE1("< DAUDIO_Read: returning %d bytes.\n", ret);
0N/A return ret;
0N/A}
0N/A
0N/A
0N/Aint DAUDIO_GetBufferSize(void* id, int isSource) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A if (info) {
0N/A return info->bufferSizeInBytes;
0N/A }
0N/A return 0;
0N/A}
0N/A
0N/Aint DAUDIO_StillDraining(void* id, int isSource) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A audio_info_t audioInfo;
0N/A audio_prinfo_t* prinfo;
0N/A int ret = FALSE;
0N/A
0N/A if (info!=NULL) {
0N/A if (isSource) {
0N/A prinfo = &(audioInfo.play);
0N/A } else {
0N/A prinfo = &(audioInfo.record);
0N/A }
0N/A /* check error flag */
0N/A AUDIO_INITINFO(&audioInfo);
0N/A ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
0N/A ret = (prinfo->error != 0)?FALSE:TRUE;
0N/A }
0N/A return ret;
0N/A}
0N/A
0N/A
0N/Aint getDevicePosition(SolPcmInfo* info, int isSource) {
0N/A audio_info_t audioInfo;
0N/A audio_prinfo_t* prinfo;
0N/A int err;
0N/A
0N/A if (isSource) {
0N/A prinfo = &(audioInfo.play);
0N/A } else {
0N/A prinfo = &(audioInfo.record);
0N/A }
0N/A AUDIO_INITINFO(&audioInfo);
0N/A err = ioctl(info->fd, AUDIO_GETINFO, &audioInfo);
0N/A if (err >= 0) {
0N/A /*TRACE2("---> device paused: %d eof=%d\n",
0N/A prinfo->pause, prinfo->eof);
0N/A */
0N/A return (int) (prinfo->samples * info->frameSize);
0N/A }
0N/A ERROR0("DAUDIO: getDevicePosition: ioctl failed!\n");
0N/A return -1;
0N/A}
0N/A
0N/Aint DAUDIO_Flush(void* id, int isSource) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A int err = -1;
0N/A int pos;
0N/A
0N/A TRACE0("DAUDIO_Flush\n");
0N/A if (info) {
0N/A if (isSource) {
0N/A err = ioctl(info->fd, I_FLUSH, FLUSHW);
0N/A } else {
0N/A err = ioctl(info->fd, I_FLUSH, FLUSHR);
0N/A }
0N/A if (err >= 0) {
0N/A /* resets the transferedBytes parameter to
0N/A * the current samples count of the device
0N/A */
0N/A pos = getDevicePosition(info, isSource);
0N/A if (pos >= 0) {
0N/A info->transferedBytes = pos;
0N/A }
0N/A }
0N/A }
0N/A if (err < 0) {
0N/A ERROR0("ERROR in DAUDIO_Flush\n");
0N/A }
0N/A return (err < 0)?FALSE:TRUE;
0N/A}
0N/A
0N/Aint DAUDIO_GetAvailable(void* id, int isSource) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A int ret = 0;
0N/A int pos;
0N/A
0N/A if (info) {
0N/A /* unfortunately, the STREAMS architecture
0N/A * seems to not have a method for querying
0N/A * the available bytes to read/write!
0N/A * estimate it...
0N/A */
0N/A pos = getDevicePosition(info, isSource);
0N/A if (pos >= 0) {
0N/A if (isSource) {
0N/A /* we usually have written more bytes
0N/A * to the queue than the device position should be
0N/A */
0N/A ret = (info->bufferSizeInBytes) - (info->transferedBytes - pos);
0N/A } else {
0N/A /* for record, the device stream should
0N/A * be usually ahead of our read actions
0N/A */
0N/A ret = pos - info->transferedBytes;
0N/A }
0N/A if (ret > info->bufferSizeInBytes) {
0N/A ERROR2("DAUDIO_GetAvailable: available=%d, too big at bufferSize=%d!\n",
0N/A (int) ret, (int) info->bufferSizeInBytes);
0N/A ERROR2(" devicePos=%d, transferedBytes=%d\n",
0N/A (int) pos, (int) info->transferedBytes);
0N/A ret = info->bufferSizeInBytes;
0N/A }
0N/A else if (ret < 0) {
0N/A ERROR1("DAUDIO_GetAvailable: available=%d, in theory not possible!\n",
0N/A (int) ret);
0N/A ERROR2(" devicePos=%d, transferedBytes=%d\n",
0N/A (int) pos, (int) info->transferedBytes);
0N/A ret = 0;
0N/A }
0N/A }
0N/A }
0N/A
0N/A TRACE1("DAUDIO_GetAvailable returns %d bytes\n", ret);
0N/A return ret;
0N/A}
0N/A
0N/AINT64 DAUDIO_GetBytePosition(void* id, int isSource, INT64 javaBytePos) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A int ret;
0N/A int pos;
0N/A INT64 result = javaBytePos;
0N/A
0N/A if (info) {
0N/A pos = getDevicePosition(info, isSource);
0N/A if (pos >= 0) {
0N/A result = info->positionOffset + pos;
0N/A }
0N/A }
0N/A
0N/A //printf("getbyteposition: javaBytePos=%d , return=%d\n", (int) javaBytePos, (int) result);
0N/A return result;
0N/A}
0N/A
0N/A
0N/Avoid DAUDIO_SetBytePosition(void* id, int isSource, INT64 javaBytePos) {
0N/A SolPcmInfo* info = (SolPcmInfo*) id;
0N/A int ret;
0N/A int pos;
0N/A
0N/A if (info) {
0N/A pos = getDevicePosition(info, isSource);
0N/A if (pos >= 0) {
0N/A info->positionOffset = javaBytePos - pos;
0N/A }
0N/A }
0N/A}
0N/A
0N/Aint DAUDIO_RequiresServicing(void* id, int isSource) {
0N/A // never need servicing on Solaris
0N/A return FALSE;
0N/A}
0N/A
0N/Avoid DAUDIO_Service(void* id, int isSource) {
0N/A // never need servicing on Solaris
0N/A}
0N/A
0N/A
0N/A#endif // USE_DAUDIO