Path: blob/master/src/java.desktop/share/native/libjsound/Ports.h
41149 views
/*1* Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#ifndef PORTS_INCLUDED26#define PORTS_INCLUDED272829#include "SoundDefs.h"30// for memset31#include <string.h>32#include "Configure.h" // put flags for debug msgs etc. here33#include "Utilities.h"34#include <com_sun_media_sound_PortMixer.h>353637/* *********************** PORT TYPES (for all platforms) ******************************* */3839#define PORT_SRC_UNKNOWN (com_sun_media_sound_PortMixer_SRC_UNKNOWN)40#define PORT_SRC_MICROPHONE (com_sun_media_sound_PortMixer_SRC_MICROPHONE)41#define PORT_SRC_LINE_IN (com_sun_media_sound_PortMixer_SRC_LINE_IN)42#define PORT_SRC_COMPACT_DISC (com_sun_media_sound_PortMixer_SRC_COMPACT_DISC)43#define PORT_SRC_MASK (com_sun_media_sound_PortMixer_SRC_MASK)44#define PORT_DST_UNKNOWN (com_sun_media_sound_PortMixer_DST_UNKNOWN)45#define PORT_DST_SPEAKER (com_sun_media_sound_PortMixer_DST_SPEAKER)46#define PORT_DST_HEADPHONE (com_sun_media_sound_PortMixer_DST_HEADPHONE)47#define PORT_DST_LINE_OUT (com_sun_media_sound_PortMixer_DST_LINE_OUT)48#define PORT_DST_MASK (com_sun_media_sound_PortMixer_DST_MASK)4950#define PORT_STRING_LENGTH 2005152typedef struct tag_PortMixerDescription {53char name[PORT_STRING_LENGTH];54char vendor[PORT_STRING_LENGTH];55char description[PORT_STRING_LENGTH];56char version[PORT_STRING_LENGTH];57} PortMixerDescription;585960// for BooleanControl.Type61#define CONTROL_TYPE_MUTE ((char*) 1)62#define CONTROL_TYPE_SELECT ((char*) 2)6364// for FloatControl.Type65#define CONTROL_TYPE_BALANCE ((char*) 1)66#define CONTROL_TYPE_MASTER_GAIN ((char*) 2)67#define CONTROL_TYPE_PAN ((char*) 3)68#define CONTROL_TYPE_VOLUME ((char*) 4)69#define CONTROL_TYPE_MAX 47071// method definitions7273/* controlID: unique ID for this control74* type: string that is used to construct the BooleanControl.Type, or CONTROL_TYPE_MUTE75* creator: pointer to the creator struct provided by PORT_GetControls76* returns an opaque pointer to the created control77*/78typedef void* (*PORT_NewBooleanControlPtr)(void* creator, void* controlID, char* type);7980/* type: string that is used to construct the CompoundControl.Type81* controls: an array of opaque controls returned by the CreateXXXControlPtr functions82* controlCount: number of elements in controls83* creator: pointer to the creator struct provided by PORT_GetControls84* returns an opaque pointer to the created control85*/86typedef void* (*PORT_NewCompoundControlPtr)(void* creator, char* type, void** controls, int controlCount);8788/* controlID: unique ID for this control89* type: string that is used to construct the FloatControl.Type, or one of90* CONTROL_TYPE_BALANCE, CONTROL_TYPE_MASTER_GAIN, CONTROL_TYPE_PAN, CONTROL_TYPE_VOLUME91* creator: pointer to the creator struct provided by PORT_GetControls92* returns an opaque pointer to the created control93*/94typedef void* (*PORT_NewFloatControlPtr)(void* creator, void* controlID, char* type,95float min, float max, float precision, const char* units);9697/* control: The control to add to current port98* creator: pointer to the creator struct provided by PORT_GetControls99* returns TRUE or FALSE100*/101typedef int (*PORT_AddControlPtr)(void* creator, void* control);102103// struct for dynamically instantiating the controls from platform dependent code104// without creating a dependency from the platform code to JNI105106typedef struct tag_PortControlCreator {107PORT_NewBooleanControlPtr newBooleanControl;108PORT_NewCompoundControlPtr newCompoundControl;109PORT_NewFloatControlPtr newFloatControl;110PORT_AddControlPtr addControl;111} PortControlCreator;112113#if (USE_PORTS == TRUE)114115// the following methods need to be implemented by the platform dependent code116INT32 PORT_GetPortMixerCount();117INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description);118void* PORT_Open(INT32 mixerIndex);119void PORT_Close(void* id);120121INT32 PORT_GetPortCount(void* id);122INT32 PORT_GetPortType(void* id, INT32 portIndex);123INT32 PORT_GetPortName(void* id, INT32 portIndex, char* name, INT32 len);124void PORT_GetControls(void* id, INT32 portIndex, PortControlCreator* creator);125float PORT_GetFloatValue(void* controlID);126INT32 PORT_GetIntValue(void* controlIDV);127void PORT_SetFloatValue(void* controlID, float value);128void PORT_SetIntValue(void* controlIDV, INT32 value);129130#endif // USE_PORTS131132#endif // PORTS_INCLUDED133134135