jdk/src/java.desktop/share/native/libjsound/Ports.h
author serb
Sat, 18 Jul 2015 15:12:08 +0300
changeset 32110 733062f75808
parent 25859 3317bb8137f4
permissions -rw-r--r--
8074831: Resolve disabled warnings for libjsound Reviewed-by: amenkov, azvegint
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#ifndef PORTS_INCLUDED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define PORTS_INCLUDED
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include "SoundDefs.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
// for memset
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include <string.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
#include "Configure.h"  // put flags for debug msgs etc. here
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "Utilities.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include <com_sun_media_sound_PortMixer.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/* *********************** PORT TYPES (for all platforms) ******************************* */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#define PORT_SRC_UNKNOWN      (com_sun_media_sound_PortMixer_SRC_UNKNOWN)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define PORT_SRC_MICROPHONE   (com_sun_media_sound_PortMixer_SRC_MICROPHONE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define PORT_SRC_LINE_IN      (com_sun_media_sound_PortMixer_SRC_LINE_IN)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define PORT_SRC_COMPACT_DISC (com_sun_media_sound_PortMixer_SRC_COMPACT_DISC)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#define PORT_SRC_MASK         (com_sun_media_sound_PortMixer_SRC_MASK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#define PORT_DST_UNKNOWN      (com_sun_media_sound_PortMixer_DST_UNKNOWN)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#define PORT_DST_SPEAKER      (com_sun_media_sound_PortMixer_DST_SPEAKER)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#define PORT_DST_HEADPHONE    (com_sun_media_sound_PortMixer_DST_HEADPHONE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define PORT_DST_LINE_OUT     (com_sun_media_sound_PortMixer_DST_LINE_OUT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define PORT_DST_MASK         (com_sun_media_sound_PortMixer_DST_MASK)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
#define PORT_STRING_LENGTH 200
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
typedef struct tag_PortMixerDescription {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    char name[PORT_STRING_LENGTH];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    char vendor[PORT_STRING_LENGTH];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    char description[PORT_STRING_LENGTH];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    char version[PORT_STRING_LENGTH];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
} PortMixerDescription;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
// for BooleanControl.Type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
#define CONTROL_TYPE_MUTE        ((char*) 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
#define CONTROL_TYPE_SELECT      ((char*) 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
// for FloatControl.Type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#define CONTROL_TYPE_BALANCE     ((char*) 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define CONTROL_TYPE_MASTER_GAIN ((char*) 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
#define CONTROL_TYPE_PAN         ((char*) 3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define CONTROL_TYPE_VOLUME      ((char*) 4)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#define CONTROL_TYPE_MAX         4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
// method definitions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
/* controlID: unique ID for this control
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * type: string that is used to construct the BooleanControl.Type, or CONTROL_TYPE_MUTE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * creator: pointer to the creator struct provided by PORT_GetControls
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * returns an opaque pointer to the created control
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
typedef void* (*PORT_NewBooleanControlPtr)(void* creator, void* controlID, char* type);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
/* type: string that is used to construct the CompoundControl.Type
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * controls: an array of opaque controls returned by the CreateXXXControlPtr functions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * controlCount: number of elements in controls
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * creator: pointer to the creator struct provided by PORT_GetControls
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * returns an opaque pointer to the created control
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
typedef void* (*PORT_NewCompoundControlPtr)(void* creator, char* type, void** controls, int controlCount);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
/* controlID: unique ID for this control
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * type: string that is used to construct the FloatControl.Type, or one of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *       CONTROL_TYPE_BALANCE, CONTROL_TYPE_MASTER_GAIN, CONTROL_TYPE_PAN, CONTROL_TYPE_VOLUME
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * creator: pointer to the creator struct provided by PORT_GetControls
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * returns an opaque pointer to the created control
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
typedef void* (*PORT_NewFloatControlPtr)(void* creator, void* controlID, char* type,
32110
733062f75808 8074831: Resolve disabled warnings for libjsound
serb
parents: 25859
diff changeset
    96
              float min, float max, float precision, const char* units);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
/* control: The control to add to current port
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * creator: pointer to the creator struct provided by PORT_GetControls
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * returns TRUE or FALSE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
typedef int (*PORT_AddControlPtr)(void* creator, void* control);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
// struct for dynamically instantiating the controls from platform dependent code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
// without creating a dependency from the platform code to JNI
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
typedef struct tag_PortControlCreator {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    PORT_NewBooleanControlPtr newBooleanControl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    PORT_NewCompoundControlPtr newCompoundControl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    PORT_NewFloatControlPtr newFloatControl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    PORT_AddControlPtr addControl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
} PortControlCreator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
#if (USE_PORTS == TRUE)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
// the following methods need to be implemented by the platform dependent code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
INT32 PORT_GetPortMixerCount();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
void* PORT_Open(INT32 mixerIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
void  PORT_Close(void* id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
INT32 PORT_GetPortCount(void* id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
INT32 PORT_GetPortType(void* id, INT32 portIndex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
INT32 PORT_GetPortName(void* id, INT32 portIndex, char* name, INT32 len);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
void  PORT_GetControls(void* id, INT32 portIndex, PortControlCreator* creator);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
float PORT_GetFloatValue(void* controlID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
INT32 PORT_GetIntValue(void* controlIDV);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
void  PORT_SetFloatValue(void* controlID, float value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
void  PORT_SetIntValue(void* controlIDV, INT32 value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
#endif // USE_PORTS
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
#endif // PORTS_INCLUDED