Changeset 255


Ignore:
Timestamp:
Feb 9, 2011, 9:08:56 PM (15 years ago)
Author:
dmik
Message:

jdk/jsound: Adapted MIDI and DirectAudio code to OS/2 to make sound actually work (#67).

Location:
trunk/openjdk/jdk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/openjdk/jdk/make/javax/sound/FILES_c.gmk

    r2 r255  
    4141        PLATFORM_API_WinOS_Ports.c
    4242
     43FILES_os2 = \
     44        PLATFORM_API_WinOS_MidiIn.c \
     45        PLATFORM_API_WinOS_MidiOut.c \
     46        PLATFORM_API_WinOS_Util.c \
     47        PLATFORM_API_WinOS_Ports.c
     48       
    4349FILES_export = \
    4450        com/sun/media/sound/Platform.java
  • trunk/openjdk/jdk/make/javax/sound/Makefile

    r2 r255  
    100100  #MXSPP_ADD = $(PLATFORM)-$(ARCH)/
    101101endif # PLATFORM win32
     102
     103ifeq ($(PLATFORM), os2)
     104  CPPFLAGS +=   -DUSE_PLATFORM_MIDI_OUT=TRUE \
     105                -DUSE_PLATFORM_MIDI_IN=TRUE \
     106                -DUSE_PORTS=TRUE
     107  LDLIBS += -lwinmm.lib
     108
     109  # Odin32 always provides MIDI and ports
     110  INCLUDE_MIDI  = TRUE
     111  INCLUDE_PORTS = TRUE
     112
     113  # DirectSound handles directaudio (both i586 and amd64)
     114  SUBDIRS += jsoundds
     115  EXTRA_SOUND_JNI_LIBS += jsoundds
     116  #MXSPP_ADD = $(PLATFORM)-$(ARCH)/
     117endif # PLATFORM os2
    102118
    103119ifeq ($(PLATFORM), linux)
  • trunk/openjdk/jdk/make/javax/sound/jsoundds/Makefile

    r2 r255  
    5353# Extra cc/linker flags.
    5454#
     55ifeq ($(PLATFORM), os2)
     56LDLIBS += -ldsound.lib -lwinmm.lib -luser32.lib
     57CPPFLAGS += \
     58        -DUSE_DAUDIO=TRUE \
     59        -I$(SHARE_SRC)/native/com/sun/media/sound
     60else
    5561LDLIBS += dsound.lib winmm.lib user32.lib
    5662CPPFLAGS += \
     
    5864        -I$(SHARE_SRC)/native/com/sun/media/sound \
    5965        -I$(DXSDK_INCLUDE_PATH)
     66endif
    6067
    6168#
  • trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_DirectSound.cpp

    r254 r255  
    9090}
    9191
     92#ifdef __WIN32OS2__
     93static GUID CLSID_DAUDIO_Zero = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
     94#else
    9295static GUID CLSID_DAUDIO_Zero = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
     96#endif
    9397
    9498BOOL isEqualGUID(LPGUID lpGuid1, LPGUID lpGuid2) {
     
    199203            }
    200204        }
     205#ifndef __WIN32OS2__
    201206        oldCount = rs.currMixerIndex;
    202207        rs.isSource = FALSE;
     
    212217            }
    213218        }
     219#endif
    214220        g_mixerCount = rs.currMixerIndex;
    215221
     
    255261        strncpy(desc->description, "DirectSound Playback", DAUDIO_STRING_LENGTH);
    256262    } else {
     263#ifndef __WIN32OS2__
    257264        DirectSoundCaptureEnumerate((LPDSENUMCALLBACK) DS_GetDescEnum, desc);
    258265        strncpy(desc->description, "DirectSound Capture", DAUDIO_STRING_LENGTH);
     266#endif
    259267    }
    260268
     
    480488        if (data.line2Start->isSource) {
    481489            data.startResult =
    482                 data.line2Start->playBuffer->Play(0, 0, DSCBSTART_LOOPING);
     490                data.line2Start->playBuffer->Play(0, 0, DSBPLAY_LOOPING);
    483491        } else {
     492#ifndef __WIN32OS2__
    484493            data.startResult =
    485494                data.line2Start->captureBuffer->Start(DSCBSTART_LOOPING);
     495#endif
    486496        }
    487497        ::SetEvent(data.startedEvent);
     
    545555            g_audioDeviceCache[deviceID].dev = (void*) devPlay;
    546556        } else {
     557#ifndef __WIN32OS2__
    547558            res = DirectSoundCaptureCreate(lpGuid, &devCapture, NULL);
    548559            g_audioDeviceCache[deviceID].dev = (void*) devCapture;
     560#endif
    549561        }
    550562        g_audioDeviceCache[deviceID].refCount = 0;
     
    584596                DEV_PLAY(deviceID)->Release();
    585597            } else {
     598#ifndef __WIN32OS2__
    586599                DEV_CAPTURE(deviceID)->Release();
     600#endif
    587601            }
    588602            g_audioDeviceCache[deviceID].dev = NULL;
     
    611625
    612626#if !defined(DEFINE_WAVEFORMATEX_GUID)
     627#ifdef __WIN32OS2__
     628#define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x), 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 }
     629#else
    613630#define DEFINE_WAVEFORMATEX_GUID(x) (USHORT)(x), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
     631#endif
    614632#endif
    615633#ifndef STATIC_KSDATAFORMAT_SUBTYPE_PCM
     
    725743        }
    726744    } else {
     745#ifndef __WIN32OS2__
    727746        if (FAILED(info->captureBuffer->Lock(0,
    728747                                             info->dsBufferSizeInBytes,
     
    733752            return;
    734753        }
     754#endif
    735755    }
    736756    if (pb1!=NULL) {
     
    756776        DEBUG_SILENCING2("  silencedBytes=%d, my writePos=%d\n", (int)info->silencedBytes, (int)info->writePos);
    757777    } else {
     778#ifndef __WIN32OS2__
    758779        info->captureBuffer->Unlock( pb1, cb1, pb2, cb2 );
     780#endif
    759781    }
    760782    TRACE0("< DS_clearbuffer\n");
     
    768790                          int bufferSizeInBytes) {
    769791    DSBUFFERDESC dsbdesc;
     792#ifndef __WIN32OS2__
    770793    DSCBUFFERDESC dscbdesc;
     794#endif
    771795    HRESULT res;
    772796    WAVEFORMATEXTENSIBLE format;
     
    800824            (&dsbdesc, (LPDIRECTSOUNDBUFFER*) &buffer, NULL);
    801825    } else {
     826#ifndef __WIN32OS2__
    802827        memset(&dscbdesc, 0, sizeof(DSCBUFFERDESC));
    803828        dscbdesc.dwSize = sizeof(DSCBUFFERDESC);
     
    807832        res = DEV_CAPTURE(info->deviceID)->CreateCaptureBuffer
    808833            (&dscbdesc, (LPDIRECTSOUNDCAPTUREBUFFER*) &buffer, NULL);
     834#endif
    809835    }
    810836    if (FAILED(res)) {
     
    821847    }
    822848    if (info->captureBuffer != NULL) {
     849#ifndef __WIN32OS2__
    823850        info->captureBuffer->Release();
    824851        info->captureBuffer = NULL;
     852#endif
    825853    }
    826854}
     
    953981        }
    954982    } else {
     983#ifndef __WIN32OS2__
    955984        if (info->captureBuffer->GetStatus(&status) == DS_OK) {
    956985            if (status & DSCBSTATUS_LOOPING) {
     
    960989        }
    961990        res = DS_StartBufferHelper::StartBuffer(info);
     991#endif
    962992    }
    963993    if (FAILED(res)) {
     
    9781008        info->playBuffer->Stop();
    9791009    } else {
     1010#ifndef __WIN32OS2__
    9801011        info->captureBuffer->Stop();
     1012#endif
    9811013    }
    9821014
     
    10891121        }
    10901122    } else {
     1123#ifndef __WIN32OS2__
    10911124        if (FAILED(info->captureBuffer->GetCurrentPosition(playCursor, writeCursor))) {
    10921125            ERROR0("DS_GetAvailable: ERROR: Failed to get current position.\n");
     
    11261159            available = info->bufferSizeInBytes;
    11271160        }
     1161#endif
    11281162    }
    11291163    available = (available / info->frameSize) * info->frameSize;
     
    12381272    TRACE1("> DAUDIO_Read %d bytes\n", byteSize);
    12391273
     1274#ifndef __WIN32OS2__
    12401275    available = DS_GetAvailable(info, &captureCursor, &readCursor, &bufferSize, FALSE /* fromCaptureCursor? */);
    12411276    if (byteSize > available) byteSize = available;
     
    12801315        }
    12811316    }
     1317#else
     1318    byteSize = -1;
     1319#endif
    12821320
    12831321    TRACE1("< DAUDIO_Read: returning %d bytes.\n", byteSize);
     
    13161354        DS_clearBuffer(info, FALSE /* entire buffer */);
    13171355    } else {
     1356#ifndef __WIN32OS2__
    13181357        DWORD captureCursor, readCursor;
    13191358        /* set the read pointer to the current read position */
     
    13281367         */
    13291368        info->writePos = (int) readCursor;
     1369#endif
    13301370    }
    13311371    return TRUE;
  • trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_MidiOut.c

    r2 r255  
    2929#include "PLATFORM_API_WinOS_Util.h"
    3030
     31#ifdef __EMX__
     32#include <string.h>
     33#include <memory.h>
     34#endif
     35
    3136#if USE_PLATFORM_MIDI_OUT == TRUE
    3237
  • trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Ports.c

    r2 r255  
    7171#define PORT_CONTROL_TYPE_MIXER       6
    7272
    73 typedef struct tag_PortControlID {
     73struct tag_PortControlID {
    7474    PortInfo*           portInfo;
    7575    INT32               controlType;  // one of PORT_CONTROL_TYPE_XX
     
    8383        INT32                        muxIndex;
    8484    };
    85 } PortControlID;
     85};
    8686
    8787
  • trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Util.c

    r2 r255  
    2929
    3030#include "PLATFORM_API_WinOS_Util.h"
     31
     32#ifdef __EMX__
     33#include <string.h>
     34#include <memory.h>
     35#endif
    3136
    3237#if (USE_PLATFORM_MIDI_IN == TRUE) || (USE_PLATFORM_MIDI_OUT == TRUE)
  • trunk/openjdk/jdk/src/windows/native/com/sun/media/sound/PLATFORM_API_WinOS_Util.h

    r253 r255  
    3636/* for waveformat extensible */
    3737#include <mmreg.h>
     38#ifndef __WIN32OS2__
    3839#include <ks.h>
     40#endif
    3941
    4042#ifndef PLATFORM_API_WINOS_UTIL_INCLUDED
Note: See TracChangeset for help on using the changeset viewer.