jdk/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_DirectSound.cpp
changeset 47191 8c95ea7056b7
parent 41566 f52207d194bf
equal deleted inserted replaced
47190:8aff50fc76a5 47191:8c95ea7056b7
    50  #include "DirectAudio.h"
    50  #include "DirectAudio.h"
    51 #ifdef __cplusplus
    51 #ifdef __cplusplus
    52 }
    52 }
    53 #endif
    53 #endif
    54 
    54 
       
    55 /* include to prevent charset problem */
       
    56 #include "PLATFORM_API_WinOS_Charset_Util.h"
       
    57 
    55 #ifdef USE_DEBUG_SILENCING
    58 #ifdef USE_DEBUG_SILENCING
    56 #define DEBUG_SILENCING0(p) TRACE0(p)
    59 #define DEBUG_SILENCING0(p) TRACE0(p)
    57 #define DEBUG_SILENCING1(p1,p2) TRACE1(p1,p2)
    60 #define DEBUG_SILENCING1(p1,p2) TRACE1(p1,p2)
    58 #define DEBUG_SILENCING2(p1,p2,p3) TRACE2(p1,p2,p3)
    61 #define DEBUG_SILENCING2(p1,p2,p3) TRACE2(p1,p2,p3)
    59 #else
    62 #else
   225     /*TRACE1("DirectSound: %d installed devices\n", g_mixerCount);*/
   228     /*TRACE1("DirectSound: %d installed devices\n", g_mixerCount);*/
   226     return g_mixerCount;
   229     return g_mixerCount;
   227 }
   230 }
   228 
   231 
   229 BOOL CALLBACK DS_GetDescEnum(LPGUID lpGuid,
   232 BOOL CALLBACK DS_GetDescEnum(LPGUID lpGuid,
   230                              LPCSTR lpstrDescription,
   233                              LPCWSTR lpstrDescription,
   231                              LPCSTR lpstrModule,
   234                              LPCWSTR lpstrModule,
   232                              DirectAudioDeviceDescription* desc) {
   235                              DirectAudioDeviceDescription* desc) {
   233 
   236 
   234     INT32 cacheIndex = findCacheItemByGUID(lpGuid, g_audioDeviceCache[desc->deviceID].isSource);
   237     INT32 cacheIndex = findCacheItemByGUID(lpGuid, g_audioDeviceCache[desc->deviceID].isSource);
   235     if (cacheIndex == desc->deviceID) {
   238     if (cacheIndex == desc->deviceID) {
   236         strncpy(desc->name, lpstrDescription, DAUDIO_STRING_LENGTH);
   239         UnicodeToUTF8AndCopy(desc->name, lpstrDescription, DAUDIO_STRING_LENGTH);
   237         //strncpy(desc->description, lpstrModule, DAUDIO_STRING_LENGTH);
   240         //strncpy(desc->description, lpstrModule, DAUDIO_STRING_LENGTH);
   238         desc->maxSimulLines = -1;
   241         desc->maxSimulLines = -1;
   239         /* do not continue enumeration */
   242         /* do not continue enumeration */
   240         return FALSE;
   243         return FALSE;
   241     }
   244     }
   255         DS_unlockCache();
   258         DS_unlockCache();
   256         return FALSE;
   259         return FALSE;
   257     }
   260     }
   258     desc->maxSimulLines = 0;
   261     desc->maxSimulLines = 0;
   259     if (g_audioDeviceCache[desc->deviceID].isSource) {
   262     if (g_audioDeviceCache[desc->deviceID].isSource) {
   260         DirectSoundEnumerate((LPDSENUMCALLBACK) DS_GetDescEnum, desc);
   263         DirectSoundEnumerateW((LPDSENUMCALLBACKW) DS_GetDescEnum, desc);
   261         strncpy(desc->description, "DirectSound Playback", DAUDIO_STRING_LENGTH);
   264         strncpy(desc->description, "DirectSound Playback", DAUDIO_STRING_LENGTH);
   262     } else {
   265     } else {
   263         DirectSoundCaptureEnumerate((LPDSENUMCALLBACK) DS_GetDescEnum, desc);
   266         DirectSoundCaptureEnumerateW((LPDSENUMCALLBACKW) DS_GetDescEnum, desc);
   264         strncpy(desc->description, "DirectSound Capture", DAUDIO_STRING_LENGTH);
   267         strncpy(desc->description, "DirectSound Capture", DAUDIO_STRING_LENGTH);
   265     }
   268     }
   266 
   269 
   267     /*desc->vendor;
   270     /*desc->vendor;
   268     desc->version;*/
   271     desc->version;*/