0N/A/*
2362N/A * Copyright (c) 2002, 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#ifndef DIRECT_AUDIO_INCLUDED
0N/A#define DIRECT_AUDIO_INCLUDED
0N/A
0N/A// includes for types
0N/A#include "SoundDefs.h"
0N/A
0N/A// for memset
0N/A#include <string.h>
0N/A
0N/A#include "Utilities.h"
0N/A
0N/A// the following defines should match the ones in AbstractMixer.java
0N/A#define DAUDIO_PCM 0
0N/A#define DAUDIO_ULAW 1
0N/A#define DAUDIO_ALAW 2
0N/A
0N/A#define DAUDIO_STRING_LENGTH 200
0N/A
0N/Atypedef struct tag_DirectAudioDeviceDescription {
0N/A // optional deviceID (complementary to deviceIndex)
0N/A INT32 deviceID;
0N/A INT32 maxSimulLines;
0N/A char name[DAUDIO_STRING_LENGTH+1];
0N/A char vendor[DAUDIO_STRING_LENGTH+1];
0N/A char description[DAUDIO_STRING_LENGTH+1];
0N/A char version[DAUDIO_STRING_LENGTH+1];
0N/A} DirectAudioDeviceDescription;
0N/A
0N/A
0N/A// method definitions
0N/A
0N/A#if (USE_DAUDIO == TRUE)
0N/A
0N/A// callback from GetFormats, implemented in DirectAudioDevice.c
0N/Avoid DAUDIO_AddAudioFormat(void* creator, int significantBits, int frameSizeInBytes,
0N/A int channels, float sampleRate,
0N/A int encoding, int isSigned,
0N/A int bigEndian);
0N/A
0N/A
0N/A// the following methods need to be implemented by the platform dependent code
0N/A
0N/A/* returns the number of mixer devices */
0N/AINT32 DAUDIO_GetDirectAudioDeviceCount();
0N/A
0N/A/* returns TRUE on success, FALSE otherwise */
0N/AINT32 DAUDIO_GetDirectAudioDeviceDescription(INT32 mixerIndex,
0N/A DirectAudioDeviceDescription* description);
0N/A
0N/A// SourceDataLine and TargetDataLine
0N/A
0N/Avoid DAUDIO_GetFormats(INT32 mixerIndex, INT32 deviceID, int isSource, void* creator);
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/Aint DAUDIO_Start(void* id, int isSource);
0N/Aint DAUDIO_Stop(void* id, int isSource);
0N/Avoid DAUDIO_Close(void* id, int isSource);
0N/Aint DAUDIO_Write(void* id, char* data, int byteSize); // returns -1 on error
0N/Aint DAUDIO_Read(void* id, char* data, int byteSize); // returns -1 on error
0N/A
0N/Aint DAUDIO_GetBufferSize(void* id, int isSource);
0N/Aint DAUDIO_StillDraining(void* id, int isSource);
0N/Aint DAUDIO_Flush(void* id, int isSource);
0N/A/* in bytes */
0N/Aint DAUDIO_GetAvailable(void* id, int isSource);
0N/AINT64 DAUDIO_GetBytePosition(void* id, int isSource, INT64 javaBytePos);
0N/Avoid DAUDIO_SetBytePosition(void* id, int isSource, INT64 javaBytePos);
0N/A
0N/Aint DAUDIO_RequiresServicing(void* id, int isSource);
0N/Avoid DAUDIO_Service(void* id, int isSource);
0N/A
0N/A#endif // USE_DAUDIO
0N/A
0N/A#endif // DIRECT_AUDIO_INCLUDED