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 PORTS_INCLUDED
0N/A#define PORTS_INCLUDED
0N/A
0N/A
0N/A#include "SoundDefs.h"
0N/A// for memset
0N/A#include <string.h>
0N/A#include "Configure.h" // put flags for debug msgs etc. here
0N/A#include "Utilities.h"
0N/A#include <com_sun_media_sound_PortMixer.h>
0N/A
0N/A
0N/A/* *********************** PORT TYPES (for all platforms) ******************************* */
0N/A
0N/A#define PORT_SRC_UNKNOWN (com_sun_media_sound_PortMixer_SRC_UNKNOWN)
0N/A#define PORT_SRC_MICROPHONE (com_sun_media_sound_PortMixer_SRC_MICROPHONE)
0N/A#define PORT_SRC_LINE_IN (com_sun_media_sound_PortMixer_SRC_LINE_IN)
0N/A#define PORT_SRC_COMPACT_DISC (com_sun_media_sound_PortMixer_SRC_COMPACT_DISC)
0N/A#define PORT_SRC_MASK (com_sun_media_sound_PortMixer_SRC_MASK)
0N/A#define PORT_DST_UNKNOWN (com_sun_media_sound_PortMixer_DST_UNKNOWN)
0N/A#define PORT_DST_SPEAKER (com_sun_media_sound_PortMixer_DST_SPEAKER)
0N/A#define PORT_DST_HEADPHONE (com_sun_media_sound_PortMixer_DST_HEADPHONE)
0N/A#define PORT_DST_LINE_OUT (com_sun_media_sound_PortMixer_DST_LINE_OUT)
0N/A#define PORT_DST_MASK (com_sun_media_sound_PortMixer_DST_MASK)
0N/A
0N/A#define PORT_STRING_LENGTH 200
0N/A
0N/Atypedef struct tag_PortMixerDescription {
0N/A char name[PORT_STRING_LENGTH];
0N/A char vendor[PORT_STRING_LENGTH];
0N/A char description[PORT_STRING_LENGTH];
0N/A char version[PORT_STRING_LENGTH];
0N/A} PortMixerDescription;
0N/A
0N/A
0N/A// for BooleanControl.Type
0N/A#define CONTROL_TYPE_MUTE ((char*) 1)
0N/A#define CONTROL_TYPE_SELECT ((char*) 2)
0N/A
0N/A// for FloatControl.Type
0N/A#define CONTROL_TYPE_BALANCE ((char*) 1)
0N/A#define CONTROL_TYPE_MASTER_GAIN ((char*) 2)
0N/A#define CONTROL_TYPE_PAN ((char*) 3)
0N/A#define CONTROL_TYPE_VOLUME ((char*) 4)
0N/A#define CONTROL_TYPE_MAX 4
0N/A
0N/A// method definitions
0N/A
0N/A/* controlID: unique ID for this control
0N/A * type: string that is used to construct the BooleanControl.Type, or CONTROL_TYPE_MUTE
0N/A * creator: pointer to the creator struct provided by PORT_GetControls
0N/A * returns an opaque pointer to the created control
0N/A */
0N/Atypedef void* (*PORT_NewBooleanControlPtr)(void* creator, void* controlID, char* type);
0N/A
0N/A/* type: string that is used to construct the CompoundControl.Type
0N/A * controls: an array of opaque controls returned by the CreateXXXControlPtr functions
0N/A * controlCount: number of elements in controls
0N/A * creator: pointer to the creator struct provided by PORT_GetControls
0N/A * returns an opaque pointer to the created control
0N/A */
0N/Atypedef void* (*PORT_NewCompoundControlPtr)(void* creator, char* type, void** controls, int controlCount);
0N/A
0N/A/* controlID: unique ID for this control
0N/A * type: string that is used to construct the FloatControl.Type, or one of
0N/A * CONTROL_TYPE_BALANCE, CONTROL_TYPE_MASTER_GAIN, CONTROL_TYPE_PAN, CONTROL_TYPE_VOLUME
0N/A * creator: pointer to the creator struct provided by PORT_GetControls
0N/A * returns an opaque pointer to the created control
0N/A */
0N/Atypedef void* (*PORT_NewFloatControlPtr)(void* creator, void* controlID, char* type,
0N/A float min, float max, float precision, char* units);
0N/A
0N/A/* control: The control to add to current port
0N/A * creator: pointer to the creator struct provided by PORT_GetControls
0N/A * returns TRUE or FALSE
0N/A */
0N/Atypedef int (*PORT_AddControlPtr)(void* creator, void* control);
0N/A
0N/A// struct for dynamically instantiating the controls from platform dependent code
0N/A// without creating a dependency from the platform code to JNI
0N/A
0N/Atypedef struct tag_PortControlCreator {
0N/A PORT_NewBooleanControlPtr newBooleanControl;
0N/A PORT_NewCompoundControlPtr newCompoundControl;
0N/A PORT_NewFloatControlPtr newFloatControl;
0N/A PORT_AddControlPtr addControl;
0N/A} PortControlCreator;
0N/A
0N/A#if (USE_PORTS == TRUE)
0N/A
0N/A// the following methods need to be implemented by the platform dependent code
0N/AINT32 PORT_GetPortMixerCount();
0N/AINT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description);
0N/Avoid* PORT_Open(INT32 mixerIndex);
0N/Avoid PORT_Close(void* id);
0N/A
0N/AINT32 PORT_GetPortCount(void* id);
0N/AINT32 PORT_GetPortType(void* id, INT32 portIndex);
0N/AINT32 PORT_GetPortName(void* id, INT32 portIndex, char* name, INT32 len);
0N/Avoid PORT_GetControls(void* id, INT32 portIndex, PortControlCreator* creator);
0N/Afloat PORT_GetFloatValue(void* controlID);
0N/AINT32 PORT_GetIntValue(void* controlIDV);
0N/Avoid PORT_SetFloatValue(void* controlID, float value);
0N/Avoid PORT_SetIntValue(void* controlIDV, INT32 value);
0N/A
0N/A#endif // USE_PORTS
0N/A
0N/A#endif // PORTS_INCLUDED