/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#define USE_ERROR
//#define USE_TRACE
#include "Ports.h"
#include "PLATFORM_API_SolarisOS_Utils.h"
// define the following to not use audio_prinfo_t.mod_ports
#define SOLARIS7_COMPATIBLE
// Solaris audio defines
};
"Speaker",
"Headphone",
"Line Out",
"AUX1 Out",
"AUX2 Out",
"SPDIF Out"
};
// defined in Ports.h
};
// Solaris audio defines
};
"Microphone In",
"Line In",
"Compact Disc In",
"AUX1 In",
"AUX2 In",
"SPDIF In",
"Internal Loopback"
};
// Ports.h defines
};
struct tag_PortControlID;
typedef struct tag_PortInfo {
// ports
int targetPortCount;
int sourcePortCount;
// indexes to sourcePorts/targetPorts
// contains first target ports, then source ports
// controls
} PortInfo;
typedef struct tag_PortControlID {
///// implemented functions of Ports.h
return (INT32) getAudioDeviceCount();
}
/*strncpy(description->description, desc.description, PORT_STRING_LENGTH-1);*/
return TRUE;
}
return FALSE;
}
TRACE0("PORT_Open\n");
}
if (fd < 0) {
return NULL;
}
}
if (!success) {
if (fd >= 0) {
}
PORT_Close((void*) info);
}
return info;
}
TRACE0("PORT_Close\n");
}
if (info->controlIDs) {
}
}
}
int ret = 0;
int i;
for (i = 0; i < ALL_TARGET_PORT_COUNT; i++) {
info->targetPortCount++;
}
#ifdef SOLARIS7_COMPATIBLE
#else
#endif
}
for (i = 0; i < ALL_SOURCE_PORT_COUNT; i++) {
info->sourcePortCount++;
}
#ifdef SOLARIS7_COMPATIBLE
#else
#endif
}
}
}
}
return ret;
}
}
} else {
}
}
return 0;
}
// pre-condition: portIndex must have been verified!
} else {
}
return ret;
}
char* n;
if (n) {
return TRUE;
}
}
return FALSE;
}
int controlIndex;
TRACE0(">createPortControl\n");
// fill the ControlID structure and add this control
return;
}
} else {
}
switch (type & PORT_CONTROL_TYPE_MASK) {
case PORT_CONTROL_TYPE_GAIN:
jsType = CONTROL_TYPE_VOLUME; break;
jsType = CONTROL_TYPE_BALANCE; break;
jsType = CONTROL_TYPE_VOLUME; break;
}
if (isBoolean) {
TRACE0(" PORT_CONTROL_TYPE_BOOLEAN\n");
}
else if (jsType == CONTROL_TYPE_BALANCE) {
TRACE0(" PORT_CONTROL_TYPE_BALANCE\n");
-1.0f, 1.0f, 2.0f / 65.0f, "");
} else {
TRACE0(" PORT_CONTROL_TYPE_FLOAT\n");
0.0f, 1.0f, 1.0f / 256.0f, "");
}
if (newControl) {
(*controlCount)++;
info->usedControlIDs++;
}
TRACE0("<createPortControl\n");
}
void addCompoundControl(PortInfo* info, PortControlCreator* creator, char* name, void** controlObjects, int* controlCount) {
void* compControl;
if (*controlCount) {
// create compound control and add it to the vector
if (compControl) {
}
*controlCount = 0;
}
TRACE0("<addCompoundControl\n");
}
void addAllControls(PortInfo* info, PortControlCreator* creator, void** controlObjects, int* controlCount) {
int i = 0;
TRACE0(">addAllControl\n");
// go through all controls and add them to the vector
for (i = 0; i < *controlCount; i++) {
}
*controlCount = 0;
TRACE0("<addAllControl\n");
}
int controlCount = 0;
TRACE4(">PORT_GetControls(id=%p, portIndex=%d). controlIDs=%p, maxControlCount=%d\n",
// if the memory isn't reserved for the control structures, allocate it
if (!info->controlIDs) {
int maxCount = 0;
TRACE0("getControl: allocate mem\n");
// get a maximum number of controls:
// each port has a select, balance, and volume control.
// then there is monitorGain and outputMuted
}
// add master mute control
controls, &controlCount);
#ifdef SOLARIS7_COMPATIBLE
#else
#endif
} else {
#ifdef SOLARIS7_COMPATIBLE
#else
#endif
}
// add a mixer strip with volume, ...
controls, &controlCount);
// ... balance, ...
controls, &controlCount);
// ... and select control (if not always on)...
if (selectable) {
controls, &controlCount);
}
// ... packaged in a compound control.
if (type == PORT_CONTROL_TYPE_PLAY) {
// add a single strip for source ports with monitor gain
controls, &controlCount);
// also in a compound control
}
}
TRACE0("< PORT_getControls\n");
}
} else {
}
default:
}
}
ERROR0("PORT_GetIntValue: Could not ioctl!\n");
return 0;
}
int setPort;
} else {
}
// first try to just add this port. if that fails, set ONLY to this port.
if (value) {
} else {
}
// didn't work. Either this line doesn't support to select several
// ports at once (e.g. record), or a real error
if (value) {
// set to ONLY this port (and disable any other currently selected ports)
}
} else {
// assume it's an error
}
}
break;
}
break;
default:
}
}
}
} else {
}
case PORT_CONTROL_TYPE_GAIN:
/ ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN));
/ ((float) (AUDIO_RIGHT_BALANCE - AUDIO_LEFT_BALANCE));
/ ((float) (AUDIO_MAX_GAIN - AUDIO_MIN_GAIN));
default:
}
}
ERROR0("PORT_GetFloatValue: Could not ioctl!\n");
return 0.0f;
}
} else {
}
case PORT_CONTROL_TYPE_GAIN:
break;
break;
break;
default:
return;
}
ERROR0("PORT_SetFloatValue: Could not ioctl!\n");
}
}
#endif // USE_PORTS