Index: /trunk/openjdk/jdk/make/javax/sound/FILES_c.gmk
===================================================================
--- /trunk/openjdk/jdk/make/javax/sound/FILES_c.gmk	(revision 254)
+++ /trunk/openjdk/jdk/make/javax/sound/FILES_c.gmk	(revision 255)
@@ -41,4 +41,10 @@
 	PLATFORM_API_WinOS_Ports.c
 
+FILES_os2 = \
+	PLATFORM_API_WinOS_MidiIn.c \
+	PLATFORM_API_WinOS_MidiOut.c \
+	PLATFORM_API_WinOS_Util.c \
+	PLATFORM_API_WinOS_Ports.c
+	
 FILES_export = \
 	com/sun/media/sound/Platform.java
Index: /trunk/openjdk/jdk/make/javax/sound/Makefile
===================================================================
--- /trunk/openjdk/jdk/make/javax/sound/Makefile	(revision 254)
+++ /trunk/openjdk/jdk/make/javax/sound/Makefile	(revision 255)
@@ -100,4 +100,20 @@
   #MXSPP_ADD = $(PLATFORM)-$(ARCH)/
 endif # PLATFORM win32
+
+ifeq ($(PLATFORM), os2)
+  CPPFLAGS += 	-DUSE_PLATFORM_MIDI_OUT=TRUE \
+		-DUSE_PLATFORM_MIDI_IN=TRUE \
+		-DUSE_PORTS=TRUE
+  LDLIBS += -lwinmm.lib
+
+  # Odin32 always provides MIDI and ports
+  INCLUDE_MIDI  = TRUE
+  INCLUDE_PORTS = TRUE
+
+  # DirectSound handles directaudio (both i586 and amd64)
+  SUBDIRS += jsoundds
+  EXTRA_SOUND_JNI_LIBS += jsoundds
+  #MXSPP_ADD = $(PLATFORM)-$(ARCH)/
+endif # PLATFORM os2
 
 ifeq ($(PLATFORM), linux)
Index: /trunk/openjdk/jdk/make/javax/sound/jsoundds/Makefile
===================================================================
--- /trunk/openjdk/jdk/make/javax/sound/jsoundds/Makefile	(revision 254)
+++ /trunk/openjdk/jdk/make/javax/sound/jsoundds/Makefile	(revision 255)
@@ -53,4 +53,10 @@
 # Extra cc/linker flags.
 #
+ifeq ($(PLATFORM), os2)
+LDLIBS += -ldsound.lib -lwinmm.lib -luser32.lib
+CPPFLAGS += \
+	-DUSE_DAUDIO=TRUE \
+	-I$(SHARE_SRC)/native/com/sun/media/sound
+else
 LDLIBS += dsound.lib winmm.lib user32.lib
 CPPFLAGS += \
@@ -58,4 +64,5 @@
 	-I$(SHARE_SRC)/native/com/sun/media/sound \
 	-I$(DXSDK_INCLUDE_PATH)
+endif
 
 #
Index: /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp	(revision 254)
+++ /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp	(revision 255)
@@ -90,5 +90,9 @@
 }
 
+#ifdef __WIN32OS2__
+static GUID CLSID_DAUDIO_Zero = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
+#else
 static GUID CLSID_DAUDIO_Zero = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+#endif
 
 BOOL isEqualGUID(LPGUID lpGuid1, LPGUID lpGuid2) {
@@ -199,4 +203,5 @@
             }
         }
+#ifndef __WIN32OS2__
         oldCount = rs.currMixerIndex;
         rs.isSource = FALSE;
@@ -212,4 +217,5 @@
             }
         }
+#endif
         g_mixerCount = rs.currMixerIndex;
 
@@ -255,6 +261,8 @@
         strncpy(desc->description, "DirectSound Playback", DAUDIO_STRING_LENGTH);
     } else {
+#ifndef __WIN32OS2__
         DirectSoundCaptureEnumerate((LPDSENUMCALLBACK) DS_GetDescEnum, desc);
         strncpy(desc->description, "DirectSound Capture", DAUDIO_STRING_LENGTH);
+#endif
     }
 
@@ -480,8 +488,10 @@
         if (data.line2Start->isSource) {
             data.startResult =
-                data.line2Start->playBuffer->Play(0, 0, DSCBSTART_LOOPING);
+                data.line2Start->playBuffer->Play(0, 0, DSBPLAY_LOOPING);
         } else {
+#ifndef __WIN32OS2__
             data.startResult =
                 data.line2Start->captureBuffer->Start(DSCBSTART_LOOPING);
+#endif
         }
         ::SetEvent(data.startedEvent);
@@ -545,6 +555,8 @@
             g_audioDeviceCache[deviceID].dev = (void*) devPlay;
         } else {
+#ifndef __WIN32OS2__
             res = DirectSoundCaptureCreate(lpGuid, &devCapture, NULL);
             g_audioDeviceCache[deviceID].dev = (void*) devCapture;
+#endif
         }
         g_audioDeviceCache[deviceID].refCount = 0;
@@ -584,5 +596,7 @@
                 DEV_PLAY(deviceID)->Release();
             } else {
+#ifndef __WIN32OS2__
                 DEV_CAPTURE(deviceID)->Release();
+#endif
             }
             g_audioDeviceCache[deviceID].dev = NULL;
@@ -611,5 +625,9 @@
 
 #if !defined(DEFINE_WAVEFORMATEX_GUID)
+#ifdef __WIN32OS2__
+#define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x), 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
+#else
 #define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
+#endif
 #endif
 #ifndef STATIC_KSDATAFORMAT_SUBTYPE_PCM
@@ -725,4 +743,5 @@
         }
     } else {
+#ifndef __WIN32OS2__
         if (FAILED(info->captureBuffer->Lock(0,
                                              info->dsBufferSizeInBytes,
@@ -733,4 +752,5 @@
             return;
         }
+#endif
     }
     if (pb1!=NULL) {
@@ -756,5 +776,7 @@
         DEBUG_SILENCING2("  silencedBytes=%d, my writePos=%d\n", (int)info->silencedBytes, (int)info->writePos);
     } else {
+#ifndef __WIN32OS2__
         info->captureBuffer->Unlock( pb1, cb1, pb2, cb2 );
+#endif
     }
     TRACE0("< DS_clearbuffer\n");
@@ -768,5 +790,7 @@
                           int bufferSizeInBytes) {
     DSBUFFERDESC dsbdesc;
+#ifndef __WIN32OS2__
     DSCBUFFERDESC dscbdesc;
+#endif
     HRESULT res;
     WAVEFORMATEXTENSIBLE format;
@@ -800,4 +824,5 @@
             (&dsbdesc, (LPDIRECTSOUNDBUFFER*) &buffer, NULL);
     } else {
+#ifndef __WIN32OS2__
         memset(&dscbdesc, 0, sizeof(DSCBUFFERDESC));
         dscbdesc.dwSize = sizeof(DSCBUFFERDESC);
@@ -807,4 +832,5 @@
         res = DEV_CAPTURE(info->deviceID)->CreateCaptureBuffer
             (&dscbdesc, (LPDIRECTSOUNDCAPTUREBUFFER*) &buffer, NULL);
+#endif
     }
     if (FAILED(res)) {
@@ -821,6 +847,8 @@
     }
     if (info->captureBuffer != NULL) {
+#ifndef __WIN32OS2__
         info->captureBuffer->Release();
         info->captureBuffer = NULL;
+#endif
     }
 }
@@ -953,4 +981,5 @@
         }
     } else {
+#ifndef __WIN32OS2__
         if (info->captureBuffer->GetStatus(&status) == DS_OK) {
             if (status & DSCBSTATUS_LOOPING) {
@@ -960,4 +989,5 @@
         }
         res = DS_StartBufferHelper::StartBuffer(info);
+#endif
     }
     if (FAILED(res)) {
@@ -978,5 +1008,7 @@
         info->playBuffer->Stop();
     } else {
+#ifndef __WIN32OS2__
         info->captureBuffer->Stop();
+#endif
     }
 
@@ -1089,4 +1121,5 @@
         }
     } else {
+#ifndef __WIN32OS2__
         if (FAILED(info->captureBuffer->GetCurrentPosition(playCursor, writeCursor))) {
             ERROR0("DS_GetAvailable: ERROR: Failed to get current position.\n");
@@ -1126,4 +1159,5 @@
             available = info->bufferSizeInBytes;
         }
+#endif
     }
     available = (available / info->frameSize) * info->frameSize;
@@ -1238,4 +1272,5 @@
     TRACE1("> DAUDIO_Read %d bytes\n", byteSize);
 
+#ifndef __WIN32OS2__
     available = DS_GetAvailable(info, &captureCursor, &readCursor, &bufferSize, FALSE /* fromCaptureCursor? */);
     if (byteSize > available) byteSize = available;
@@ -1280,4 +1315,7 @@
         }
     }
+#else
+    byteSize = -1;
+#endif
 
     TRACE1("< DAUDIO_Read: returning %d bytes.\n", byteSize);
@@ -1316,4 +1354,5 @@
         DS_clearBuffer(info, FALSE /* entire buffer */);
     } else {
+#ifndef __WIN32OS2__
         DWORD captureCursor, readCursor;
         /* set the read pointer to the current read position */
@@ -1328,4 +1367,5 @@
          */
         info->writePos = (int) readCursor;
+#endif
     }
     return TRUE;
Index: /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_MidiOut.c
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_MidiOut.c	(revision 254)
+++ /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_MidiOut.c	(revision 255)
@@ -29,4 +29,9 @@
 #include "PLATFORM_API_WinOS_Util.h"
 
+#ifdef __EMX__
+#include <string.h>
+#include <memory.h>
+#endif
+
 #if USE_PLATFORM_MIDI_OUT == TRUE
 
Index: /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Ports.c
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Ports.c	(revision 254)
+++ /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Ports.c	(revision 255)
@@ -71,5 +71,5 @@
 #define PORT_CONTROL_TYPE_MIXER       6
 
-typedef struct tag_PortControlID {
+struct tag_PortControlID {
     PortInfo*           portInfo;
     INT32               controlType;  // one of PORT_CONTROL_TYPE_XX
@@ -83,5 +83,5 @@
         INT32                        muxIndex;
     };
-} PortControlID;
+};
 
 
Index: /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Util.c
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Util.c	(revision 254)
+++ /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Util.c	(revision 255)
@@ -29,4 +29,9 @@
 
 #include "PLATFORM_API_WinOS_Util.h"
+
+#ifdef __EMX__
+#include <string.h>
+#include <memory.h>
+#endif
 
 #if (USE_PLATFORM_MIDI_IN == TRUE) || (USE_PLATFORM_MIDI_OUT == TRUE)
Index: /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Util.h
===================================================================
--- /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Util.h	(revision 254)
+++ /trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Util.h	(revision 255)
@@ -36,5 +36,7 @@
 /* for waveformat extensible */
 #include <mmreg.h>
+#ifndef __WIN32OS2__
 #include <ks.h>
+#endif
 
 #ifndef PLATFORM_API_WINOS_UTIL_INCLUDED
