1
0
mirror of synced 2024-11-28 03:20:48 +01:00

Refactor libsegaapi

This commit is contained in:
Bobby Dilley 2022-07-28 18:54:00 +01:00
parent a3eefa45ed
commit 2dab9f406f
5 changed files with 538 additions and 679 deletions

View File

@ -1,11 +0,0 @@
LD=gcc #clang
CC=gcc
CFLAGS=-m32 -O0 -g
LDFLAGS=$(CFLAGS)
libsegaapi.so: segaapi.o
$(LD) $(LDFLAGS) segaapi.o -L/usr/lib/i386-linux-gnu -lalut -fPIC -shared -o libsegaapi.so
clean:
rm -f test libsegaapi.so
force:

View File

@ -8,26 +8,24 @@
https://web.archive.org/web/20070218003259/http://www.devmaster.net/articles.php?catID=6 https://web.archive.org/web/20070218003259/http://www.devmaster.net/articles.php?catID=6
*/ */
#include <stdio.h> #define TSF_IMPLEMENTATION
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <unistd.h>
#include <AL/al.h> #include <AL/al.h>
#include <AL/alc.h> #include <AL/alc.h>
#include <AL/alext.h> #include <AL/alext.h>
#include <AL/alut.h> #include <AL/alut.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "segadef.h"
#include "segaerr.h"
#include "segaeax.h"
#include "segaapi.h" #include "segaapi.h"
#include "segadef.h"
#define TSF_IMPLEMENTATION #include "segaeax.h"
#include "tsf.h" #include "tsf.h"
//#define DEBUG_SAMPLE //#define DEBUG_SAMPLE
#define DEBUG_OUTPUT #define DEBUG_OUTPUT
//#define DUMP_WAV //#define DUMP_WAV
@ -45,7 +43,7 @@
} \ } \
} }
SEGASTATUS g_LastStatus = SEGA_SUCCESS; int g_LastStatus = SEGA_SUCCESS;
// outrun2 will complain if these aren't present // outrun2 will complain if these aren't present
const GUID EAX_NULL_GUID; const GUID EAX_NULL_GUID;
@ -453,7 +451,7 @@ static void resetBuffer(segaapiContext_t *context)
updateBufferData(context, -1, -1); updateBufferData(context, -1, -1);
} }
SEGASTATUS SEGAAPI_Play(CTHANDLE hHandle) int SEGAAPI_Play(void* hHandle)
{ {
dbgPrint("SEGAAPI_Play() 0x%x", hHandle); dbgPrint("SEGAAPI_Play() 0x%x", hHandle);
segaapiContext_t *context = hHandle; segaapiContext_t *context = hHandle;
@ -481,7 +479,7 @@ SEGASTATUS SEGAAPI_Play(CTHANDLE hHandle)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
SEGASTATUS SEGAAPI_Pause(CTHANDLE hHandle) int SEGAAPI_Pause(void* hHandle)
{ {
dbgPrint("SEGAAPI_Pause() 0x%x", hHandle); dbgPrint("SEGAAPI_Pause() 0x%x", hHandle);
segaapiContext_t *context = hHandle; segaapiContext_t *context = hHandle;
@ -491,7 +489,7 @@ SEGASTATUS SEGAAPI_Pause(CTHANDLE hHandle)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
SEGASTATUS SEGAAPI_Stop(CTHANDLE hHandle) int SEGAAPI_Stop(void* hHandle)
{ {
dbgPrint("SEGAAPI_Stop() 0x%x", hHandle); dbgPrint("SEGAAPI_Stop() 0x%x", hHandle);
segaapiContext_t *context = hHandle; segaapiContext_t *context = hHandle;
@ -501,7 +499,7 @@ SEGASTATUS SEGAAPI_Stop(CTHANDLE hHandle)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
SEGASTATUS SEGAAPI_PlayWithSetup(CTHANDLE hHandle) int SEGAAPI_PlayWithSetup(void* hHandle)
{ {
dbgPrint("SEGAAPI_PlayWithSetup() 0x%x", hHandle); dbgPrint("SEGAAPI_PlayWithSetup() 0x%x", hHandle);
segaapiContext_t *context = hHandle; segaapiContext_t *context = hHandle;
@ -513,7 +511,7 @@ SEGASTATUS SEGAAPI_PlayWithSetup(CTHANDLE hHandle)
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
PlaybackStatus SEGAAPI_GetPlaybackStatus(CTHANDLE hHandle) PlaybackStatus SEGAAPI_GetPlaybackStatus(void* hHandle)
{ {
ALint state; ALint state;
@ -539,19 +537,19 @@ PlaybackStatus SEGAAPI_GetPlaybackStatus(CTHANDLE hHandle)
return PLAYBACK_STATUS_INVALID; return PLAYBACK_STATUS_INVALID;
} }
SEGASTATUS SEGAAPI_SetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat) int SEGAAPI_SetFormat(void* hHandle, HAWOSEFORMAT *pFormat)
{ {
dbgPrint("SEGAAPI_SetFormat() 0x%x", hHandle); dbgPrint("SEGAAPI_SetFormat() 0x%x", hHandle);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_GetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat) int SEGAAPI_GetFormat(void* hHandle, HAWOSEFORMAT *pFormat)
{ {
dbgPrint("SEGAAPI_GetFormat() 0x%x", hHandle); dbgPrint("SEGAAPI_GetFormat() 0x%x", hHandle);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_SetSampleRate(CTHANDLE hHandle, CTDWORD dwSampleRate) int SEGAAPI_SetSampleRate(void* hHandle, unsigned int dwSampleRate)
{ {
dbgPrint("SEGAAPI_SetSampleRate() 0x%x 0x%x", hHandle, dwSampleRate); dbgPrint("SEGAAPI_SetSampleRate() 0x%x 0x%x", hHandle, dwSampleRate);
if (hHandle == NULL) if (hHandle == NULL)
@ -564,25 +562,25 @@ SEGASTATUS SEGAAPI_SetSampleRate(CTHANDLE hHandle, CTDWORD dwSampleRate)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTDWORD SEGAAPI_GetSampleRate(CTHANDLE hHandle) unsigned int SEGAAPI_GetSampleRate(void* hHandle)
{ {
dbgPrint("SEGAAPI_GetSampleRate() 0x%x", hHandle); dbgPrint("SEGAAPI_GetSampleRate() 0x%x", hHandle);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_SetPriority(CTHANDLE hHandle, CTDWORD dwPriority) int SEGAAPI_SetPriority(void* hHandle, unsigned int dwPriority)
{ {
dbgPrint("SEGAAPI_SetPriority() 0x%x 0x%x", hHandle, dwPriority); dbgPrint("SEGAAPI_SetPriority() 0x%x 0x%x", hHandle, dwPriority);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
CTDWORD SEGAAPI_GetPriority(CTHANDLE hHandle) unsigned int SEGAAPI_GetPriority(void* hHandle)
{ {
dbgPrint("SEGAAPI_GetPriority() 0x%x", hHandle); dbgPrint("SEGAAPI_GetPriority() 0x%x", hHandle);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_SetUserData(CTHANDLE hHandle, CTHANDLE hUserData) int SEGAAPI_SetUserData(void* hHandle, void* hUserData)
{ {
dbgPrint("SEGAAPI_SetUserData() 0x%x 0x%x", hHandle, hUserData); dbgPrint("SEGAAPI_SetUserData() 0x%x 0x%x", hHandle, hUserData);
if (hHandle == NULL) if (hHandle == NULL)
@ -596,7 +594,7 @@ SEGASTATUS SEGAAPI_SetUserData(CTHANDLE hHandle, CTHANDLE hUserData)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTHANDLE SEGAAPI_GetUserData(CTHANDLE hHandle) void* SEGAAPI_GetUserData(void* hHandle)
{ {
dbgPrint("SEGAAPI_GetPriority() 0x%x", hHandle); dbgPrint("SEGAAPI_GetPriority() 0x%x", hHandle);
if (hHandle == NULL) if (hHandle == NULL)
@ -605,43 +603,43 @@ CTHANDLE SEGAAPI_GetUserData(CTHANDLE hHandle)
return context->userData; return context->userData;
} }
SEGASTATUS SEGAAPI_SetSendRouting(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend, HAROUTING dwDest) int SEGAAPI_SetSendRouting(void* hHandle, unsigned int dwChannel, unsigned int dwSend, HAROUTING dwDest)
{ {
dbgPrint("SEGAAPI_SetSendRouting() 0x%x 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend, dwDest); dbgPrint("SEGAAPI_SetSendRouting() 0x%x 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend, dwDest);
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
HAROUTING SEGAAPI_GetSendRouting(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend) HAROUTING SEGAAPI_GetSendRouting(void* hHandle, unsigned int dwChannel, unsigned int dwSend)
{ {
dbgPrint("SEGAAPI_GetSendRouting() 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend); dbgPrint("SEGAAPI_GetSendRouting() 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend);
return HA_UNUSED_PORT; return HA_UNUSED_PORT;
} }
SEGASTATUS SEGAAPI_SetSendLevel(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend, CTDWORD dwLevel) int SEGAAPI_SetSendLevel(void* hHandle, unsigned int dwChannel, unsigned int dwSend, unsigned int dwLevel)
{ {
dbgPrint("SEGAAPI_SetSendLevel() 0x%x 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend, dwLevel); dbgPrint("SEGAAPI_SetSendLevel() 0x%x 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend, dwLevel);
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTDWORD SEGAAPI_GetSendLevel(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend) unsigned int SEGAAPI_GetSendLevel(void* hHandle, unsigned int dwChannel, unsigned int dwSend)
{ {
dbgPrint("SEGAAPI_GetSendLevel() 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend); dbgPrint("SEGAAPI_GetSendLevel() 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend);
return 0; return 0;
} }
SEGASTATUS SEGAAPI_SetChannelVolume(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwVolume) int SEGAAPI_SetChannelVolume(void* hHandle, unsigned int dwChannel, unsigned int dwVolume)
{ {
dbgPrint("SEGAAPI_SetChannelVolume() 0x%x 0x%x 0x%x", hHandle, dwChannel, dwVolume); dbgPrint("SEGAAPI_SetChannelVolume() 0x%x 0x%x 0x%x", hHandle, dwChannel, dwVolume);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
CTDWORD SEGAAPI_GetChannelVolume(CTHANDLE hHandle, CTDWORD dwChannel) unsigned int SEGAAPI_GetChannelVolume(void* hHandle, unsigned int dwChannel)
{ {
dbgPrint("SEGAAPI_GetChannelVolume() 0x%x 0x%x", hHandle, dwChannel); dbgPrint("SEGAAPI_GetChannelVolume() 0x%x 0x%x", hHandle, dwChannel);
return 0; return 0;
} }
SEGASTATUS SEGAAPI_SetPlaybackPosition(CTHANDLE hHandle, CTDWORD dwPlaybackPos) int SEGAAPI_SetPlaybackPosition(void* hHandle, unsigned int dwPlaybackPos)
{ {
dbgPrint("SEGAAPI_SetPlaybackPosition() 0x%x 0x%x", hHandle, dwPlaybackPos); dbgPrint("SEGAAPI_SetPlaybackPosition() 0x%x 0x%x", hHandle, dwPlaybackPos);
segaapiContext_t *context = hHandle; segaapiContext_t *context = hHandle;
@ -649,7 +647,7 @@ SEGASTATUS SEGAAPI_SetPlaybackPosition(CTHANDLE hHandle, CTDWORD dwPlaybackPos)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTDWORD SEGAAPI_GetPlaybackPosition(CTHANDLE hHandle) unsigned int SEGAAPI_GetPlaybackPosition(void* hHandle)
{ {
ALint position; ALint position;
dbgPrint("SEGAAPI_GetPlaybackPosition() 0x%x", hHandle); dbgPrint("SEGAAPI_GetPlaybackPosition() 0x%x", hHandle);
@ -658,25 +656,25 @@ CTDWORD SEGAAPI_GetPlaybackPosition(CTHANDLE hHandle)
return position; return position;
} }
SEGASTATUS SEGAAPI_SetNotificationFrequency(CTHANDLE hHandle, CTDWORD dwFrameCount) int SEGAAPI_SetNotificationFrequency(void* hHandle, unsigned int dwFrameCount)
{ {
dbgPrint("SEGAAPI_SetNotificationFrequency() 0x%x 0x%x", hHandle, dwFrameCount); dbgPrint("SEGAAPI_SetNotificationFrequency() 0x%x 0x%x", hHandle, dwFrameCount);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_SetNotificationPoint(CTHANDLE hHandle, CTDWORD dwBufferOffset) int SEGAAPI_SetNotificationPoint(void* hHandle, unsigned int dwBufferOffset)
{ {
dbgPrint("SEGAAPI_SetNotificationPoint() 0x%x 0x%x", hHandle, dwBufferOffset); dbgPrint("SEGAAPI_SetNotificationPoint() 0x%x 0x%x", hHandle, dwBufferOffset);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_ClearNotificationPoint(CTHANDLE hHandle, CTDWORD dwBufferOffset) int SEGAAPI_ClearNotificationPoint(void* hHandle, unsigned int dwBufferOffset)
{ {
dbgPrint("SEGAAPI_ClearNotificationPoint() 0x%x 0x%x", hHandle, dwBufferOffset); dbgPrint("SEGAAPI_ClearNotificationPoint() 0x%x 0x%x", hHandle, dwBufferOffset);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_SetStartLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset) int SEGAAPI_SetStartLoopOffset(void* hHandle, unsigned int dwOffset)
{ {
dbgPrint("SEGAAPI_SetStartLoopOffset() 0x%x 0x%x", hHandle, dwOffset); dbgPrint("SEGAAPI_SetStartLoopOffset() 0x%x 0x%x", hHandle, dwOffset);
if (hHandle == NULL) if (hHandle == NULL)
@ -689,13 +687,13 @@ SEGASTATUS SEGAAPI_SetStartLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTDWORD SEGAAPI_GetStartLoopOffset(CTHANDLE hHandle) unsigned int SEGAAPI_GetStartLoopOffset(void* hHandle)
{ {
dbgPrint("SEGAAPI_GetStartLoopOffset() 0x%x", hHandle); dbgPrint("SEGAAPI_GetStartLoopOffset() 0x%x", hHandle);
return 0; return 0;
} }
SEGASTATUS SEGAAPI_SetEndLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset) int SEGAAPI_SetEndLoopOffset(void* hHandle, unsigned int dwOffset)
{ {
dbgPrint("SEGAAPI_SetEndLoopOffset() 0x%x 0x%x", hHandle, dwOffset); dbgPrint("SEGAAPI_SetEndLoopOffset() 0x%x 0x%x", hHandle, dwOffset);
if (hHandle == NULL) if (hHandle == NULL)
@ -708,25 +706,25 @@ SEGASTATUS SEGAAPI_SetEndLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTDWORD SEGAAPI_GetEndLoopOffset(CTHANDLE hHandle) unsigned int SEGAAPI_GetEndLoopOffset(void* hHandle)
{ {
dbgPrint("SEGAAPI_GetEndLoopOffset() 0x%x", hHandle); dbgPrint("SEGAAPI_GetEndLoopOffset() 0x%x", hHandle);
return 0; return 0;
} }
SEGASTATUS SEGAAPI_SetEndOffset(CTHANDLE hHandle, CTDWORD dwOffset) int SEGAAPI_SetEndOffset(void* hHandle, unsigned int dwOffset)
{ {
dbgPrint("SEGAAPI_SetEndOffset() 0x%x 0x%x", hHandle, dwOffset); dbgPrint("SEGAAPI_SetEndOffset() 0x%x 0x%x", hHandle, dwOffset);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
CTDWORD SEGAAPI_GetEndOffset(CTHANDLE hHandle) unsigned int SEGAAPI_GetEndOffset(void* hHandle)
{ {
dbgPrint("SEGAAPI_GetEndOffset() 0x%x", hHandle); dbgPrint("SEGAAPI_GetEndOffset() 0x%x", hHandle);
return 0; return 0;
} }
SEGASTATUS SEGAAPI_SetLoopState(CTHANDLE hHandle, CTBOOL bDoContinuousLooping) int SEGAAPI_SetLoopState(void* hHandle, int bDoContinuousLooping)
{ {
dbgPrint("SEGAAPI_SetLoopState() 0x%x 0x%x", hHandle, bDoContinuousLooping); dbgPrint("SEGAAPI_SetLoopState() 0x%x 0x%x", hHandle, bDoContinuousLooping);
segaapiContext_t *context = hHandle; segaapiContext_t *context = hHandle;
@ -735,13 +733,13 @@ SEGASTATUS SEGAAPI_SetLoopState(CTHANDLE hHandle, CTBOOL bDoContinuousLooping)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTBOOL SEGAAPI_GetLoopState(CTHANDLE hHandle) int SEGAAPI_GetLoopState(void* hHandle)
{ {
dbgPrint("SEGAAPI_GetLoopState() 0x%x", hHandle); dbgPrint("SEGAAPI_GetLoopState() 0x%x", hHandle);
return 0; return 0;
} }
SEGASTATUS SEGAAPI_UpdateBuffer(CTHANDLE hHandle, CTDWORD dwStartOffset, CTDWORD dwLength) int SEGAAPI_UpdateBuffer(void* hHandle, unsigned int dwStartOffset, unsigned int dwLength)
{ {
dbgPrint("SEGAAPI_UpdateBuffer() 0x%x 0x%x 0x%x", hHandle, dwStartOffset, dwLength); dbgPrint("SEGAAPI_UpdateBuffer() 0x%x 0x%x 0x%x", hHandle, dwStartOffset, dwLength);
if (hHandle == NULL) if (hHandle == NULL)
@ -754,7 +752,7 @@ SEGASTATUS SEGAAPI_UpdateBuffer(CTHANDLE hHandle, CTDWORD dwStartOffset, CTDWORD
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
SEGASTATUS SEGAAPI_SetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param, CTLONG lPARWValue) int SEGAAPI_SetSynthParam(void* hHandle, HASYNTHPARAMSEXT param, int lPARWValue)
{ {
float volume; float volume;
float semiTones; float semiTones;
@ -888,13 +886,13 @@ SEGASTATUS SEGAAPI_SetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param, CTLON
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
CTLONG SEGAAPI_GetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param) int SEGAAPI_GetSynthParam(void* hHandle, HASYNTHPARAMSEXT param)
{ {
dbgPrint("SEGAAPI_GetSynthParam() 0x%x 0x%x", hHandle, param); dbgPrint("SEGAAPI_GetSynthParam() 0x%x 0x%x", hHandle, param);
return 0; return 0;
} }
SEGASTATUS SEGAAPI_SetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams, SynthParamSet *pSynthParams) int SEGAAPI_SetSynthParamMultiple(void* hHandle, unsigned int dwNumParams, SynthParamSet *pSynthParams)
{ {
dbgPrint("SEGAAPI_SetSynthParamMultiple() 0x%x 0x%x 0x%x", hHandle, dwNumParams, pSynthParams); dbgPrint("SEGAAPI_SetSynthParamMultiple() 0x%x 0x%x 0x%x", hHandle, dwNumParams, pSynthParams);
segaapiContext_t *context = hHandle; segaapiContext_t *context = hHandle;
@ -909,19 +907,19 @@ SEGASTATUS SEGAAPI_SetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams,
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_GetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams, SynthParamSet *pSynthParams) int SEGAAPI_GetSynthParamMultiple(void* hHandle, unsigned int dwNumParams, SynthParamSet *pSynthParams)
{ {
dbgPrint("SEGAAPI_GetSynthParamMultiple() 0x%x 0x%x 0x%x", hHandle, dwNumParams, pSynthParams); dbgPrint("SEGAAPI_GetSynthParamMultiple() 0x%x 0x%x 0x%x", hHandle, dwNumParams, pSynthParams);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_SetReleaseState(CTHANDLE hHandle, CTBOOL bSet) int SEGAAPI_SetReleaseState(void* hHandle, int bSet)
{ {
dbgPrint("SEGAAPI_SetReleaseState() 0x%x 0x%x", hHandle, bSet); dbgPrint("SEGAAPI_SetReleaseState() 0x%x 0x%x", hHandle, bSet);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLBACK pCallback, CTDWORD dwFlags, CTHANDLE *phHandle) int SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLBACK pCallback, unsigned int dwFlags, void* *phHandle)
{ {
dbgPrint("SEGAAPI_CreateBuffer() 0x%x 0x%x 0x%x 0x%x", pConfig, pCallback, dwFlags, phHandle); dbgPrint("SEGAAPI_CreateBuffer() 0x%x 0x%x 0x%x 0x%x", pConfig, pCallback, dwFlags, phHandle);
if ((phHandle == NULL) || (pConfig == NULL)) if ((phHandle == NULL) || (pConfig == NULL))
@ -1027,7 +1025,7 @@ SEGASTATUS SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLB
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
SEGASTATUS SEGAAPI_DestroyBuffer(CTHANDLE hHandle) int SEGAAPI_DestroyBuffer(void* hHandle)
{ {
dbgPrint("SEGAAPI_DestroyBuffer() 0x%x", hHandle); dbgPrint("SEGAAPI_DestroyBuffer() 0x%x", hHandle);
if (hHandle == NULL) if (hHandle == NULL)
@ -1036,31 +1034,31 @@ SEGASTATUS SEGAAPI_DestroyBuffer(CTHANDLE hHandle)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTBOOL SEGAAPI_SetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize) int SEGAAPI_SetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize)
{ {
dbgPrint("SEGAAPI_SetGlobalEAXProperty() 0x%x 0x%x 0x%x 0x%x", guid, ulProperty, pData, ulDataSize); dbgPrint("SEGAAPI_SetGlobalEAXProperty() 0x%x 0x%x 0x%x 0x%x", guid, ulProperty, pData, ulDataSize);
return 0; return 0;
} }
CTBOOL SEGAAPI_GetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize) int SEGAAPI_GetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize)
{ {
dbgPrint("SEGAAPI_GetGlobalEAXProperty() 0x%x 0x%x 0x%x 0x%x", guid, ulProperty, pData, ulDataSize); dbgPrint("SEGAAPI_GetGlobalEAXProperty() 0x%x 0x%x 0x%x 0x%x", guid, ulProperty, pData, ulDataSize);
return 0; return 0;
} }
SEGASTATUS SEGAAPI_SetSPDIFOutChannelStatus(CTDWORD dwChannelStatus, CTDWORD dwExtChannelStatus) int SEGAAPI_SetSPDIFOutChannelStatus(unsigned int dwChannelStatus, unsigned int dwExtChannelStatus)
{ {
dbgPrint("SEGAAPI_SetSPDIFOutChannelStatus() 0x%x 0x%x", dwChannelStatus, dwExtChannelStatus); dbgPrint("SEGAAPI_SetSPDIFOutChannelStatus() 0x%x 0x%x", dwChannelStatus, dwExtChannelStatus);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_GetSPDIFOutChannelStatus(CTDWORD *pdwChannelStatus, CTDWORD *pdwExtChannelStatus) int SEGAAPI_GetSPDIFOutChannelStatus(unsigned int *pdwChannelStatus, unsigned int *pdwExtChannelStatus)
{ {
dbgPrint("SEGAAPI_GetSPDIFOutChannelStatus() 0x%x 0x%x", pdwChannelStatus, pdwExtChannelStatus); dbgPrint("SEGAAPI_GetSPDIFOutChannelStatus() 0x%x 0x%x", pdwChannelStatus, pdwExtChannelStatus);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
SEGASTATUS SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate) int SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate)
{ {
dbgPrint("SEGAAPI_SetSPDIFOutSampleRate() 0x%x", dwSamplingRate); dbgPrint("SEGAAPI_SetSPDIFOutSampleRate() 0x%x", dwSamplingRate);
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
@ -1072,7 +1070,7 @@ HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void)
return HASPDIFOUT_48KHZ; return HASPDIFOUT_48KHZ;
} }
SEGASTATUS SEGAAPI_SetSPDIFOutChannelRouting(CTDWORD dwChannel, HAROUTING dwSource) int SEGAAPI_SetSPDIFOutChannelRouting(unsigned int dwChannel, HAROUTING dwSource)
{ {
switch (dwChannel) switch (dwChannel)
{ {
@ -1089,13 +1087,13 @@ SEGASTATUS SEGAAPI_SetSPDIFOutChannelRouting(CTDWORD dwChannel, HAROUTING dwSour
return SEGAERR_UNSUPPORTED; return SEGAERR_UNSUPPORTED;
} }
HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(CTDWORD dwChannel) HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(unsigned int dwChannel)
{ {
dbgPrint("SEGAAPI_GetSPDIFOutChannelRouting() 0x%x", dwChannel); dbgPrint("SEGAAPI_GetSPDIFOutChannelRouting() 0x%x", dwChannel);
return HA_UNUSED_PORT; return HA_UNUSED_PORT;
} }
SEGASTATUS SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, CTDWORD dwVolume) int SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, unsigned int dwVolume)
{ {
// float v = (dwVolume >> 16) & 0xffff; // float v = (dwVolume >> 16) & 0xffff;
dbgPrint("SEGAAPI_SetIOVolume() 0x%x 0x%x", dwPhysIO, dwVolume); dbgPrint("SEGAAPI_SetIOVolume() 0x%x 0x%x", dwPhysIO, dwVolume);
@ -1103,31 +1101,31 @@ SEGASTATUS SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, CTDWORD dwVolume)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
CTDWORD SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO) unsigned int SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO)
{ {
dbgPrint("SEGAAPI_GetIOVolume() 0x%x", dwPhysIO); dbgPrint("SEGAAPI_GetIOVolume() 0x%x", dwPhysIO);
return 0xffffffff; return 0xffffffff;
} }
void SEGAAPI_SetLastStatus(SEGASTATUS LastStatus) void SEGAAPI_SetLastStatus(int LastStatus)
{ {
dbgPrint("SEGAAPI_SetLastStatus() 0x%x", LastStatus); dbgPrint("SEGAAPI_SetLastStatus() 0x%x", LastStatus);
return; return;
} }
SEGASTATUS SEGAAPI_GetLastStatus(void) int SEGAAPI_GetLastStatus(void)
{ {
dbgPrint("SEGAAPI_GetLastStatus()"); dbgPrint("SEGAAPI_GetLastStatus()");
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
SEGASTATUS SEGAAPI_Reset(void) int SEGAAPI_Reset(void)
{ {
dbgPrint("SEGAAPI_Reset()"); dbgPrint("SEGAAPI_Reset()");
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
SEGASTATUS SEGAAPI_Init(void) int SEGAAPI_Init(void)
{ {
dbgPrint("SEGAAPI_Init()"); dbgPrint("SEGAAPI_Init()");
@ -1166,7 +1164,7 @@ SEGASTATUS SEGAAPI_Init(void)
return SEGA_SUCCESS; return SEGA_SUCCESS;
} }
SEGASTATUS SEGAAPI_Exit(void) int SEGAAPI_Exit(void)
{ {
dbgPrint("SEGAAPI_Exit()"); dbgPrint("SEGAAPI_Exit()");
alutExit(); alutExit();

View File

@ -60,7 +60,7 @@
* Updated SEGAAPI_SetReleaseState() document. * Updated SEGAAPI_SetReleaseState() document.
* *
* 1.02 * 1.02
* Added SEGAAPI_SetSynthParamMultiple(0 and SEGAAPI_GetSynthParamMultiple(). * Added SEGAAPI_SetSynthParamMultiple(0 and SEGAAPI_GetSynthParamMultiple().
* Updated SEGAAPI_CreateBuffer() for user-mode buffer support. * Updated SEGAAPI_CreateBuffer() for user-mode buffer support.
* *
**************************************************************************** ****************************************************************************
@ -75,12 +75,22 @@
// INCLUDES // INCLUDES
#include "segadef.h" #include "segadef.h"
#include "segaerr.h"
#define SEGARESULT_FAILURE(_x) ((1 << 31) | 0xA000 | (_x))
#ifdef __cplusplus #define SEGA_SUCCESS 0L
extern "C" { #define SEGAERR_FAIL SEGARESULT_FAILURE(0)
#endif #define SEGAERR_BAD_POINTER SEGARESULT_FAILURE(3)
#define SEGAERR_UNSUPPORTED SEGARESULT_FAILURE(5)
#define SEGAERR_BAD_PARAM SEGARESULT_FAILURE(9)
#define SEGAERR_INVALID_CHANNEL SEGARESULT_FAILURE(10)
#define SEGAERR_INVALID_SEND SEGARESULT_FAILURE(11)
#define SEGAERR_PLAYING SEGARESULT_FAILURE(12)
#define SEGAERR_NO_RESOURCES SEGARESULT_FAILURE(13)
#define SEGAERR_BAD_CONFIG SEGARESULT_FAILURE(14)
#define SEGAERR_BAD_HANDLE SEGARESULT_FAILURE(18)
#define SEGAERR_BAD_SAMPLERATE SEGARESULT_FAILURE(28)
#define SEGAERR_OUT_OF_MEMORY SEGARESULT_FAILURE(31)
#define SEGAERR_INIT_FAILED SEGARESULT_FAILURE(39)
/** /**
* The following defines SEGA custom EAX40 properties. * The following defines SEGA custom EAX40 properties.
@ -88,7 +98,7 @@ extern "C" {
// {A7FEEC3F-2BFD-4a40-891F-7423E38BAC1F} // {A7FEEC3F-2BFD-4a40-891F-7423E38BAC1F}
DEFINE_GUID(EAXPROPERTYID_EAX40_SEGA_Custom, DEFINE_GUID(EAXPROPERTYID_EAX40_SEGA_Custom,
0xa7feec3f, 0x2bfd, 0x4a40, 0x89, 0x1f, 0x74, 0x23, 0xe3, 0x8b, 0xac, 0x1f); 0xa7feec3f, 0x2bfd, 0x4a40, 0x89, 0x1f, 0x74, 0x23, 0xe3, 0x8b, 0xac, 0x1f);
// SEGA custom EAX40 properties // SEGA custom EAX40 properties
/* /*
@ -96,7 +106,7 @@ DEFINE_GUID(EAXPROPERTYID_EAX40_SEGA_Custom,
* FXSlot2 and FXSlot3 when non-reverb is loaded to these slots. * FXSlot2 and FXSlot3 when non-reverb is loaded to these slots.
* *
* EAXSEGA_STEREO_RETURN * EAXSEGA_STEREO_RETURN
* ulDataSize = CTDWORD * ulDataSize = unsigned int
* value = 0 denotes route to front L/R (default) * value = 0 denotes route to front L/R (default)
* value = 1 denotes route to Rear L/R * value = 1 denotes route to Rear L/R
*/ */
@ -110,82 +120,79 @@ typedef enum
* The following defines all of the messages wave output clients * The following defines all of the messages wave output clients
* can receive as part of their callback routines. * can receive as part of their callback routines.
*/ */
typedef enum { typedef enum
{
HAWOS_RESOURCE_STOLEN = 0, HAWOS_RESOURCE_STOLEN = 0,
HAWOS_NOTIFY = 2 HAWOS_NOTIFY = 2
} HAWOSMESSAGETYPE; } HAWOSMESSAGETYPE;
/* /*
* The Playback status. * The Playback status.
*/ */
typedef enum { typedef enum
PLAYBACK_STATUS_STOP, /* The voice is stopped */ {
PLAYBACK_STATUS_ACTIVE, /* The voice is playing */ PLAYBACK_STATUS_STOP, /* The voice is stopped */
PLAYBACK_STATUS_PAUSE, /* The voice is paused */ PLAYBACK_STATUS_ACTIVE, /* The voice is playing */
PLAYBACK_STATUS_INVALID = -1 /* Invalid state */ PLAYBACK_STATUS_PAUSE, /* The voice is paused */
PLAYBACK_STATUS_INVALID = -1 /* Invalid state */
} PlaybackStatus; } PlaybackStatus;
/* /*
* dwFlags use in CreateBuffer. * dwFlags use in CreateBuffer.
*/ */
#define HABUF_SYNTH_BUFFER 0x00000001 // indiate to create a synth buffer #define HABUF_SYNTH_BUFFER 0x00000001 // indiate to create a synth buffer
#define HABUF_ALLOC_USER_MEM 0x00000002 // indiate that caller allocate memory #define HABUF_ALLOC_USER_MEM 0x00000002 // indiate that caller allocate memory
#define HABUF_USE_MAPPED_MEM 0x00000003 // indiate that caller allocate memory #define HABUF_USE_MAPPED_MEM 0x00000003 // indiate that caller allocate memory
/* /*
* The HAWOSEFORMAT structure is used to change the format of an output client. * The HAWOSEFORMAT structure is used to change the format of an output client.
*/ */
#ifndef __HAWAVE_H #ifndef __HAWAVE_H
#define HASF_UNSIGNED_8PCM 0x0004 /* Unsigned (offset 128) 8-bit PCM */ #define HASF_UNSIGNED_8PCM 0x0004 /* Unsigned (offset 128) 8-bit PCM */
#define HASF_SIGNED_16PCM 0x0020 /* Signed 16-bit PCM */ #define HASF_SIGNED_16PCM 0x0020 /* Signed 16-bit PCM */
#endif #endif
typedef struct { typedef struct
CTDWORD dwSampleRate; /* The sample rate the client desires (in Hz) */ {
CTDWORD dwSampleFormat; /* The sample format the client will use */ unsigned int dwSampleRate; /* The sample rate the client desires (in Hz) */
CTDWORD byNumChans; /* The number of samples in the sample unsigned int dwSampleFormat; /* The sample format the client will use */
* frame (1 = mono, 2 = stereo). */ unsigned int byNumChans; /* The number of samples in the sample
* frame (1 = mono, 2 = stereo). */
} HAWOSEFORMAT; } HAWOSEFORMAT;
/* /*
* HAWOSEMAPDATA contains * HAWOSEMAPDATA contains
*/ */
typedef struct { typedef struct
CTDWORD dwSize; /* Supply by caller. Size (in bytes) of the valid sample data */ {
CTDWORD dwOffset; /* Return by driver. Offset of buffer where the the first valid sample should be written to */ unsigned int dwSize; /* Supply by caller. Size (in bytes) of the valid sample data */
CTHANDLE hBufferHdr; /* Return by driver. Memory address that user-space application can access. */ unsigned int dwOffset; /* Return by driver. Offset of buffer where the the first valid sample should be written to */
void *hBufferHdr; /* Return by driver. Memory address that user-space application can access. */
} HAWOSEMAPDATA; } HAWOSEMAPDATA;
/* /*
* The HAWOSEBUFFERCONFIG structure is used to describe how an input or * The HAWOSEBUFFERCONFIG structure is used to describe how an input or
* output buffer client wishes to configure the device when it opens it. * output buffer client wishes to configure the device when it opens it.
*/ */
typedef struct { typedef struct
CTDWORD dwPriority; /* The priority with which the voices {
* should be allocated. This is used unsigned int dwPriority; /* The priority with which the voices
* when voices need to be ripped off. */ * should be allocated. This is used
CTDWORD dwSampleRate; /* The sample rate the voice desires */ * when voices need to be ripped off. */
CTDWORD dwSampleFormat; /* The sample format the voice will use */ unsigned int dwSampleRate; /* The sample rate the voice desires */
CTDWORD byNumChans; /* The number of samples in the sample unsigned int dwSampleFormat; /* The sample format the voice will use */
* frame. (1 = mono, 2 = stereo). */ unsigned int byNumChans; /* The number of samples in the sample
CTDWORD dwReserved; /* Reserved field */ * frame. (1 = mono, 2 = stereo). */
CTHANDLE hUserData; /* User data */ unsigned int dwReserved; /* Reserved field */
HAWOSEMAPDATA mapData; /* The sample memory mapping for the buffer. */ void *hUserData; /* User data */
HAWOSEMAPDATA mapData; /* The sample memory mapping for the buffer. */
} HAWOSEBUFFERCONFIG; } HAWOSEBUFFERCONFIG;
/** /**
* Default values * Default values
*/ */
#define HAWOSEVOL_MAX 0xFFFFFFFF /* Maximum volume; no attenuation */ #define HAWOSEVOL_MAX 0xFFFFFFFF /* Maximum volume; no attenuation */
/** /**
* Since Tina has up to 64- voices, voice priorities typically ranging * Since Tina has up to 64- voices, voice priorities typically ranging
@ -195,9 +202,8 @@ typedef struct {
* Set voice priority to HAWOSEP_MAXIMUM if a voice must never get ripped * Set voice priority to HAWOSEP_MAXIMUM if a voice must never get ripped
* off under any circumstances. * off under any circumstances.
*/ */
#define HAWOSEP_MINIMUM 0 #define HAWOSEP_MINIMUM 0
#define HAWOSEP_MAXIMUM 0xFFFFFFFF #define HAWOSEP_MAXIMUM 0xFFFFFFFF
/** @brief Routing List /** @brief Routing List
* *
@ -206,59 +212,58 @@ typedef struct {
*/ */
#define HAWOSE_UNUSED_SEND 0xFFFF0001 #define HAWOSE_UNUSED_SEND 0xFFFF0001
typedef enum HAROUTING
typedef enum HAROUTING{ {
HA_UNUSED_PORT=HAWOSE_UNUSED_SEND, HA_UNUSED_PORT = HAWOSE_UNUSED_SEND,
// Dry multi-channel outputs // Dry multi-channel outputs
HA_FRONT_LEFT_PORT =0, HA_FRONT_LEFT_PORT = 0,
HA_FRONT_RIGHT_PORT=1, HA_FRONT_RIGHT_PORT = 1,
HA_FRONT_CENTER_PORT=2, HA_FRONT_CENTER_PORT = 2,
HA_LFE_PORT=3, HA_LFE_PORT = 3,
HA_REAR_LEFT_PORT=4, HA_REAR_LEFT_PORT = 4,
HA_REAR_RIGHT_PORT=5, HA_REAR_RIGHT_PORT = 5,
// effect outputs // effect outputs
HA_FXSLOT0_PORT=10, HA_FXSLOT0_PORT = 10,
HA_FXSLOT1_PORT=11, HA_FXSLOT1_PORT = 11,
HA_FXSLOT2_PORT=12, HA_FXSLOT2_PORT = 12,
HA_FXSLOT3_PORT=13 HA_FXSLOT3_PORT = 13
} HAROUTING; } HAROUTING;
/** /**
* The following defines SPDIF-Out sampling rate. * The following defines SPDIF-Out sampling rate.
*/ */
typedef enum { typedef enum
HASPDIFOUT_44_1KHZ=0, {
HASPDIFOUT_44_1KHZ = 0,
HASPDIFOUT_48KHZ, HASPDIFOUT_48KHZ,
HASPDIFOUT_96KHZ HASPDIFOUT_96KHZ
} HASPDIFOUTRATE; } HASPDIFOUTRATE;
/** /**
* The following defines inputs and outputs of SEGA sound board. * The following defines inputs and outputs of SEGA sound board.
*/ */
typedef enum HAPHYSICALIO { typedef enum HAPHYSICALIO
{
// analog outputs // analog outputs
HA_OUT_FRONT_LEFT =0, HA_OUT_FRONT_LEFT = 0,
HA_OUT_FRONT_RIGHT=1, HA_OUT_FRONT_RIGHT = 1,
HA_OUT_FRONT_CENTER=2, HA_OUT_FRONT_CENTER = 2,
HA_OUT_LFE_PORT=3, HA_OUT_LFE_PORT = 3,
HA_OUT_REAR_LEFT=4, HA_OUT_REAR_LEFT = 4,
HA_OUT_REAR_RIGHT=5, HA_OUT_REAR_RIGHT = 5,
// optical Outputs // optical Outputs
HA_OUT_OPTICAL_LEFT=10, HA_OUT_OPTICAL_LEFT = 10,
HA_OUT_OPTICAL_RIGHT=11, HA_OUT_OPTICAL_RIGHT = 11,
// Line In // Line In
HA_IN_LINEIN_LEFT=20, HA_IN_LINEIN_LEFT = 20,
HA_IN_LINEIN_RIGHT=21 HA_IN_LINEIN_RIGHT = 21
}HAPHYSICALIO ;
} HAPHYSICALIO;
/** @brief Synth parameters enumeration list /** @brief Synth parameters enumeration list
* *
@ -268,45 +273,46 @@ typedef enum HAPHYSICALIO {
* Refers to DLS spec or SoundFont spec for details of these Parameters, * Refers to DLS spec or SoundFont spec for details of these Parameters,
* their units and their ranges. * their units and their ranges.
*/ */
typedef enum HASYNTHPARAMSEXT { typedef enum HASYNTHPARAMSEXT
HAVP_ATTENUATION, ///< 0, 0x00, initialAttenuation {
HAVP_PITCH, ///< 1, 0x01, fineTune + coarseTune * 100 HAVP_ATTENUATION, ///< 0, 0x00, initialAttenuation
HAVP_FILTER_CUTOFF, ///< 2, 0x02, initialFilterFc HAVP_PITCH, ///< 1, 0x01, fineTune + coarseTune * 100
HAVP_FILTER_Q, ///< 3, 0x03, initialFilterQ HAVP_FILTER_CUTOFF, ///< 2, 0x02, initialFilterFc
HAVP_DELAY_VOL_ENV, ///< 4, 0x04, delayVolEnv HAVP_FILTER_Q, ///< 3, 0x03, initialFilterQ
HAVP_ATTACK_VOL_ENV, ///< 5, 0x05, attackVolEnv HAVP_DELAY_VOL_ENV, ///< 4, 0x04, delayVolEnv
HAVP_HOLD_VOL_ENV, ///< 6, 0x06, holdVolEnv HAVP_ATTACK_VOL_ENV, ///< 5, 0x05, attackVolEnv
HAVP_DECAY_VOL_ENV, ///< 7, 0x07, decayVolEnv HAVP_HOLD_VOL_ENV, ///< 6, 0x06, holdVolEnv
HAVP_SUSTAIN_VOL_ENV, ///< 8, 0x08, sustainVolEnv HAVP_DECAY_VOL_ENV, ///< 7, 0x07, decayVolEnv
HAVP_RELEASE_VOL_ENV, ///< 9, 0x09, releaseVolEnv HAVP_SUSTAIN_VOL_ENV, ///< 8, 0x08, sustainVolEnv
HAVP_DELAY_MOD_ENV, ///< 10, 0x0A, delayModEnv HAVP_RELEASE_VOL_ENV, ///< 9, 0x09, releaseVolEnv
HAVP_ATTACK_MOD_ENV, ///< 11, 0x0B, attackModEnv HAVP_DELAY_MOD_ENV, ///< 10, 0x0A, delayModEnv
HAVP_HOLD_MOD_ENV, ///< 12, 0x0C, holdModEnv HAVP_ATTACK_MOD_ENV, ///< 11, 0x0B, attackModEnv
HAVP_DECAY_MOD_ENV, ///< 13, 0x0D, decayModEnv HAVP_HOLD_MOD_ENV, ///< 12, 0x0C, holdModEnv
HAVP_SUSTAIN_MOD_ENV, ///< 14, 0x0E, sustainModEnv HAVP_DECAY_MOD_ENV, ///< 13, 0x0D, decayModEnv
HAVP_RELEASE_MOD_ENV, ///< 15, 0x0F, releaseModEnv HAVP_SUSTAIN_MOD_ENV, ///< 14, 0x0E, sustainModEnv
HAVP_DELAY_MOD_LFO, ///< 16, 0x10, delayModLFO HAVP_RELEASE_MOD_ENV, ///< 15, 0x0F, releaseModEnv
HAVP_FREQ_MOD_LFO, ///< 17, 0x11, freqModLFO HAVP_DELAY_MOD_LFO, ///< 16, 0x10, delayModLFO
HAVP_DELAY_VIB_LFO, ///< 18, 0x12, delayVibLFO HAVP_FREQ_MOD_LFO, ///< 17, 0x11, freqModLFO
HAVP_FREQ_VIB_LFO, ///< 19, 0x13, freqVibLFO HAVP_DELAY_VIB_LFO, ///< 18, 0x12, delayVibLFO
HAVP_MOD_LFO_TO_PITCH, ///< 20, 0x14, modLfoToPitch HAVP_FREQ_VIB_LFO, ///< 19, 0x13, freqVibLFO
HAVP_VIB_LFO_TO_PITCH, ///< 21, 0x15, vibLfoToPitch HAVP_MOD_LFO_TO_PITCH, ///< 20, 0x14, modLfoToPitch
HAVP_MOD_LFO_TO_FILTER_CUTOFF, ///< 22, 0x16, modLfoToFilterFc HAVP_VIB_LFO_TO_PITCH, ///< 21, 0x15, vibLfoToPitch
HAVP_MOD_LFO_TO_ATTENUATION, ///< 23, 0x17, modLfoToVolume HAVP_MOD_LFO_TO_FILTER_CUTOFF, ///< 22, 0x16, modLfoToFilterFc
HAVP_MOD_ENV_TO_PITCH, ///< 24, 0x18, modEnvToPitch HAVP_MOD_LFO_TO_ATTENUATION, ///< 23, 0x17, modLfoToVolume
HAVP_MOD_ENV_TO_FILTER_CUTOFF ///< 25, 0x19, modEnvToFilterFc HAVP_MOD_ENV_TO_PITCH, ///< 24, 0x18, modEnvToPitch
HAVP_MOD_ENV_TO_FILTER_CUTOFF ///< 25, 0x19, modEnvToFilterFc
} HASYNTHPARAMSEXT; } HASYNTHPARAMSEXT;
#ifndef __SYNTHPARAMSET_ #ifndef __SYNTHPARAMSET_
# define __SYNTHPARAMSET_ #define __SYNTHPARAMSET_
typedef struct SynthParamSetExt { typedef struct SynthParamSetExt
{
HASYNTHPARAMSEXT param; HASYNTHPARAMSEXT param;
CTLONG lPARWValue; int lPARWValue;
} SynthParamSet; } SynthParamSet;
#endif #endif
/* /*
How this SYNTH PARAMS EXT maps to Sega API requests: How this SYNTH PARAMS EXT maps to Sega API requests:
@ -339,8 +345,6 @@ How this SYNTH PARAMS EXT maps to Sega API requests:
*/ */
/* /*
* Interfaces expose. These interfaces will be exposed in user mode. * Interfaces expose. These interfaces will be exposed in user mode.
* *
@ -352,7 +356,6 @@ How this SYNTH PARAMS EXT maps to Sega API requests:
* *
*/ */
/*********************************************************** /***********************************************************
* @section * @section
* API for playback operation controls. * API for playback operation controls.
@ -374,8 +377,7 @@ How this SYNTH PARAMS EXT maps to Sega API requests:
* Returns SEGA_SUCCESS if playback can start. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if playback can start. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_Play(CTHANDLE hHandle); int SEGAAPI_Play(void *hHandle);
/** /**
* Halts playback and freezes the current counter at its last * Halts playback and freezes the current counter at its last
@ -390,8 +392,7 @@ SEGASTATUS SEGAAPI_Play(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if playback was successfully paused. * Returns SEGA_SUCCESS if playback was successfully paused.
* Otherwise, returns an appropriate error code. * Otherwise, returns an appropriate error code.
*/ */
SEGASTATUS SEGAAPI_Pause(CTHANDLE hHandle); int SEGAAPI_Pause(void *hHandle);
/** /**
* Stops playback and resets the sample counter. * Stops playback and resets the sample counter.
@ -407,9 +408,9 @@ SEGASTATUS SEGAAPI_Pause(CTHANDLE hHandle);
* Otherwise, returns an appropriate error code. * Otherwise, returns an appropriate error code.
* *
*/ */
SEGASTATUS SEGAAPI_Stop(CTHANDLE hHandle); int SEGAAPI_Stop(void *hHandle);
SEGASTATUS SEGAAPI_PlayWithSetup(CTHANDLE hHandle); int SEGAAPI_PlayWithSetup(void *hHandle);
/** /**
* Returns a current playback status of a buffer. * Returns a current playback status of a buffer.
@ -423,10 +424,7 @@ SEGASTATUS SEGAAPI_PlayWithSetup(CTHANDLE hHandle);
* One of the playback status defined in the PlaybackStatus enumration type. * One of the playback status defined in the PlaybackStatus enumration type.
* If the returned status is PLAYBACK_STATUS_INVALID, use GetLastStatus() to check the error code. * If the returned status is PLAYBACK_STATUS_INVALID, use GetLastStatus() to check the error code.
*/ */
PlaybackStatus SEGAAPI_GetPlaybackStatus(CTHANDLE hHandle); PlaybackStatus SEGAAPI_GetPlaybackStatus(void *hHandle);
/*********************************************************** /***********************************************************
* @section * @section
@ -461,8 +459,7 @@ PlaybackStatus SEGAAPI_GetPlaybackStatus(CTHANDLE hHandle);
* @retval SEGAERR_BAD_CONFIG if something in the given configuration is * @retval SEGAERR_BAD_CONFIG if something in the given configuration is
* invalid. * invalid.
*/ */
SEGASTATUS SEGAAPI_SetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat); int SEGAAPI_SetFormat(void *hHandle, HAWOSEFORMAT *pFormat);
/** /**
* Returns the current format of the buffer. * Returns the current format of the buffer.
@ -479,8 +476,7 @@ SEGASTATUS SEGAAPI_SetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_GetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat); int SEGAAPI_GetFormat(void *hHandle, HAWOSEFORMAT *pFormat);
/** /**
* Changes the playback sample rate for the current client to the * Changes the playback sample rate for the current client to the
@ -500,8 +496,7 @@ SEGASTATUS SEGAAPI_GetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetSampleRate(CTHANDLE hHandle, CTDWORD dwSampleRate); int SEGAAPI_SetSampleRate(void *hHandle, unsigned int dwSampleRate);
/** /**
* Returns the current sample rate. * Returns the current sample rate.
@ -515,9 +510,7 @@ SEGASTATUS SEGAAPI_SetSampleRate(CTHANDLE hHandle, CTDWORD dwSampleRate);
* Returns the current sample rate. * Returns the current sample rate.
* If the returned value is 0, use GetLastStatus() to check the error code. * If the returned value is 0, use GetLastStatus() to check the error code.
*/ */
CTDWORD SEGAAPI_GetSampleRate(CTHANDLE hHandle); unsigned int SEGAAPI_GetSampleRate(void *hHandle);
/*********************************************************** /***********************************************************
* @section * @section
@ -525,7 +518,7 @@ CTDWORD SEGAAPI_GetSampleRate(CTHANDLE hHandle);
* *
*/ */
/** /**
* Changes the buffer's priority to the specified value. * Changes the buffer's priority to the specified value.
* *
* If all the voices are set to HAWOSEP_MAXIMUM (0xFFFFFFFF) priority, * If all the voices are set to HAWOSEP_MAXIMUM (0xFFFFFFFF) priority,
@ -543,8 +536,7 @@ CTDWORD SEGAAPI_GetSampleRate(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetPriority(CTHANDLE hHandle, CTDWORD dwPriority); int SEGAAPI_SetPriority(void *hHandle, unsigned int dwPriority);
/** /**
* Returns the buffer's current priority. * Returns the buffer's current priority.
@ -558,8 +550,7 @@ SEGASTATUS SEGAAPI_SetPriority(CTHANDLE hHandle, CTDWORD dwPriority);
* Returns the buffer's current priority. * Returns the buffer's current priority.
* Note that returned value is also set to 0 if error invoked this function. * Note that returned value is also set to 0 if error invoked this function.
*/ */
CTDWORD SEGAAPI_GetPriority(CTHANDLE hHandle); unsigned int SEGAAPI_GetPriority(void *hHandle);
/*********************************************************** /***********************************************************
* @section * @section
@ -587,8 +578,7 @@ CTDWORD SEGAAPI_GetPriority(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetUserData(CTHANDLE hHandle, CTHANDLE hUserData); int SEGAAPI_SetUserData(void *hHandle, void *hUserData);
/** /**
* Returns the last user-defined data set by the caller. * Returns the last user-defined data set by the caller.
@ -602,8 +592,7 @@ SEGASTATUS SEGAAPI_SetUserData(CTHANDLE hHandle, CTHANDLE hUserData);
* Returns the user-defined data. * Returns the user-defined data.
* Note that returned value is set to 0 if error invoked this function. * Note that returned value is set to 0 if error invoked this function.
*/ */
CTHANDLE SEGAAPI_GetUserData(CTHANDLE hHandle); void *SEGAAPI_GetUserData(void *hHandle);
/*********************************************************** /***********************************************************
* @section * @section
@ -647,7 +636,7 @@ CTHANDLE SEGAAPI_GetUserData(CTHANDLE hHandle);
* @retval SEGAERR_INVALID_CHANNEL if the specified channel isn't in use. * @retval SEGAERR_INVALID_CHANNEL if the specified channel isn't in use.
* @retval SEGAERR_INVALID_SEND if the specified send isn't supported. * @retval SEGAERR_INVALID_SEND if the specified send isn't supported.
*/ */
SEGASTATUS SEGAAPI_SetSendRouting(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend, int SEGAAPI_SetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend,
HAROUTING dwDest); HAROUTING dwDest);
/** /**
@ -668,7 +657,7 @@ SEGASTATUS SEGAAPI_SetSendRouting(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD d
* Returns the current destination. * Returns the current destination.
* Note that returned value is set to HA_UNUSED_PORT if error invoked this function. * Note that returned value is set to HA_UNUSED_PORT if error invoked this function.
*/ */
HAROUTING SEGAAPI_GetSendRouting(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend); HAROUTING SEGAAPI_GetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend);
/** /**
* Sets the output level of a particular send on a channel to the specified * Sets the output level of a particular send on a channel to the specified
@ -700,8 +689,8 @@ HAROUTING SEGAAPI_GetSendRouting(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dw
* @retval SEGAERR_INVALID_CHANNEL if the specified channel isn't valid. * @retval SEGAERR_INVALID_CHANNEL if the specified channel isn't valid.
* @retval SEGAERR_INVALID_SEND if the specified send isn't valid. * @retval SEGAERR_INVALID_SEND if the specified send isn't valid.
*/ */
SEGASTATUS SEGAAPI_SetSendLevel(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend, int SEGAAPI_SetSendLevel(void *hHandle, unsigned int dwChannel, unsigned int dwSend,
CTDWORD dwLevel); unsigned int dwLevel);
/** /**
* Returns the output level of a particular send on a channel. * Returns the output level of a particular send on a channel.
@ -721,9 +710,7 @@ SEGASTATUS SEGAAPI_SetSendLevel(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwS
* Returns the current send level. * Returns the current send level.
* Note that returned value is set to 0 if error invoked this function. * Note that returned value is set to 0 if error invoked this function.
*/ */
CTDWORD SEGAAPI_GetSendLevel(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend); unsigned int SEGAAPI_GetSendLevel(void *hHandle, unsigned int dwChannel, unsigned int dwSend);
/*********************************************************** /***********************************************************
* @section * @section
@ -758,7 +745,7 @@ CTDWORD SEGAAPI_GetSendLevel(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwSend
* @retval SEGAERR_UNSUPPORTED if the device can't change volume. * @retval SEGAERR_UNSUPPORTED if the device can't change volume.
* @retval SEGAERR_INVALID_CHANNEL if the given send isn't valid. * @retval SEGAERR_INVALID_CHANNEL if the given send isn't valid.
*/ */
SEGASTATUS SEGAAPI_SetChannelVolume(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD dwVolume); int SEGAAPI_SetChannelVolume(void *hHandle, unsigned int dwChannel, unsigned int dwVolume);
/** /**
* Returns the current volume level for the requested channel. * Returns the current volume level for the requested channel.
@ -775,9 +762,7 @@ SEGASTATUS SEGAAPI_SetChannelVolume(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD
* Returns the current volume. * Returns the current volume.
* Note that returned value is set to 0 if error invoked this function. * Note that returned value is set to 0 if error invoked this function.
*/ */
CTDWORD SEGAAPI_GetChannelVolume(CTHANDLE hHandle, CTDWORD dwChannel); unsigned int SEGAAPI_GetChannelVolume(void *hHandle, unsigned int dwChannel);
/*********************************************************** /***********************************************************
* @section * API for playback position controls. * @section * API for playback position controls.
@ -802,8 +787,7 @@ CTDWORD SEGAAPI_GetChannelVolume(CTHANDLE hHandle, CTDWORD dwChannel);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetPlaybackPosition(CTHANDLE hHandle, CTDWORD dwPlaybackPos); int SEGAAPI_SetPlaybackPosition(void *hHandle, unsigned int dwPlaybackPos);
/** /**
* Returns the position in the buffer (IN BYTES) where the * Returns the position in the buffer (IN BYTES) where the
@ -818,8 +802,7 @@ SEGASTATUS SEGAAPI_SetPlaybackPosition(CTHANDLE hHandle, CTDWORD dwPlaybackPos);
* Returns the current playback position. * Returns the current playback position.
* Note that returned value is set to 0 if error invoked this function. * Note that returned value is set to 0 if error invoked this function.
*/ */
CTDWORD SEGAAPI_GetPlaybackPosition(CTHANDLE hHandle); unsigned int SEGAAPI_GetPlaybackPosition(void *hHandle);
/*********************************************************** /***********************************************************
* @section * @section
@ -853,7 +836,7 @@ CTDWORD SEGAAPI_GetPlaybackPosition(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetNotificationFrequency(CTHANDLE hHandle, CTDWORD dwFrameCount); int SEGAAPI_SetNotificationFrequency(void *hHandle, unsigned int dwFrameCount);
/** /**
* This function can be used to set a notification point in the ring * This function can be used to set a notification point in the ring
@ -877,7 +860,7 @@ SEGASTATUS SEGAAPI_SetNotificationFrequency(CTHANDLE hHandle, CTDWORD dwFrameCou
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetNotificationPoint(CTHANDLE hHandle, CTDWORD dwBufferOffset); int SEGAAPI_SetNotificationPoint(void *hHandle, unsigned int dwBufferOffset);
/** /**
* Removes a previously set notification point. * Removes a previously set notification point.
@ -895,8 +878,7 @@ SEGASTATUS SEGAAPI_SetNotificationPoint(CTHANDLE hHandle, CTDWORD dwBufferOffset
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_ClearNotificationPoint(CTHANDLE hHandle, CTDWORD dwBufferOffset); int SEGAAPI_ClearNotificationPoint(void *hHandle, unsigned int dwBufferOffset);
/** /**
* Sets the start loop offset. The start loop offset controls where * Sets the start loop offset. The start loop offset controls where
@ -923,8 +905,7 @@ SEGASTATUS SEGAAPI_ClearNotificationPoint(CTHANDLE hHandle, CTDWORD dwBufferOffs
* Returns SEGA_SUCCESS if the loop offset is changed successful. * Returns SEGA_SUCCESS if the loop offset is changed successful.
* Otherwise, returns an appropriate error code. * Otherwise, returns an appropriate error code.
*/ */
SEGASTATUS SEGAAPI_SetStartLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset); int SEGAAPI_SetStartLoopOffset(void *hHandle, unsigned int dwOffset);
/** /**
* Returns the current start loop offest. * Returns the current start loop offest.
@ -938,8 +919,7 @@ SEGASTATUS SEGAAPI_SetStartLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset);
* Returns the current start loop offset. * Returns the current start loop offset.
* Note that returned value is set to 0 if error invoked this function. * Note that returned value is set to 0 if error invoked this function.
*/ */
CTDWORD SEGAAPI_GetStartLoopOffset(CTHANDLE hHandle); unsigned int SEGAAPI_GetStartLoopOffset(void *hHandle);
/** /**
* Sets the End Loop Offset position. When the play pointer crosses * Sets the End Loop Offset position. When the play pointer crosses
@ -965,8 +945,7 @@ CTDWORD SEGAAPI_GetStartLoopOffset(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetEndLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset); int SEGAAPI_SetEndLoopOffset(void *hHandle, unsigned int dwOffset);
/** /**
* Returns the current end loop offest. * Returns the current end loop offest.
@ -980,8 +959,7 @@ SEGASTATUS SEGAAPI_SetEndLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset);
* Returns the current end loop offest. * Returns the current end loop offest.
* Note that returned value is set to 0 if error invoked this function. * Note that returned value is set to 0 if error invoked this function.
*/ */
CTDWORD SEGAAPI_GetEndLoopOffset(CTHANDLE hHandle); unsigned int SEGAAPI_GetEndLoopOffset(void *hHandle);
/** /**
* Sets the End Offset position. When the play pointer crosses * Sets the End Offset position. When the play pointer crosses
@ -1009,7 +987,7 @@ CTDWORD SEGAAPI_GetEndLoopOffset(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetEndOffset(CTHANDLE hHandle, CTDWORD dwOffset); int SEGAAPI_SetEndOffset(void *hHandle, unsigned int dwOffset);
/** /**
* Returns the current end offest. * Returns the current end offest.
@ -1023,7 +1001,7 @@ SEGASTATUS SEGAAPI_SetEndOffset(CTHANDLE hHandle, CTDWORD dwOffset);
* Returns the current end offest. * Returns the current end offest.
* Note that returned value is set to 0 if error invoked this function. * Note that returned value is set to 0 if error invoked this function.
*/ */
CTDWORD SEGAAPI_GetEndOffset(CTHANDLE hHandle); unsigned int SEGAAPI_GetEndOffset(void *hHandle);
/** /**
* Allows the user to control whether the voice loops back to the * Allows the user to control whether the voice loops back to the
@ -1049,7 +1027,7 @@ CTDWORD SEGAAPI_GetEndOffset(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetLoopState(CTHANDLE hHandle, CTBOOL bDoContinuousLooping); int SEGAAPI_SetLoopState(void *hHandle, int bDoContinuousLooping);
/** /**
* Returns the current loop status. * Returns the current loop status.
@ -1063,8 +1041,7 @@ SEGASTATUS SEGAAPI_SetLoopState(CTHANDLE hHandle, CTBOOL bDoContinuousLooping);
* Returns TRUE if it is in loop state. Otherwise, returns FALSE. * Returns TRUE if it is in loop state. Otherwise, returns FALSE.
* Note that returned value is set to FALSE if error invoked this function. * Note that returned value is set to FALSE if error invoked this function.
*/ */
CTBOOL SEGAAPI_GetLoopState(CTHANDLE hHandle); int SEGAAPI_GetLoopState(void *hHandle);
/** /**
* Advises the driver code that some portion of the buffer * Advises the driver code that some portion of the buffer
@ -1096,8 +1073,7 @@ CTBOOL SEGAAPI_GetLoopState(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_UpdateBuffer(CTHANDLE hHandle, CTDWORD dwStartOffset, CTDWORD dwLength); int SEGAAPI_UpdateBuffer(void *hHandle, unsigned int dwStartOffset, unsigned int dwLength);
/*********************************************************** /***********************************************************
* @section * @section
@ -1125,8 +1101,7 @@ SEGASTATUS SEGAAPI_UpdateBuffer(CTHANDLE hHandle, CTDWORD dwStartOffset, CTDWORD
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param, CTLONG lPARWValue); int SEGAAPI_SetSynthParam(void *hHandle, HASYNTHPARAMSEXT param, int lPARWValue);
/** /**
* Returns the most recent call to SetSynthParam() in PARW units. This is the cache value * Returns the most recent call to SetSynthParam() in PARW units. This is the cache value
@ -1147,8 +1122,7 @@ SEGASTATUS SEGAAPI_SetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param, CTLON
* The returned value in PARW units. * The returned value in PARW units.
* Note that returned value is set to -1 if error invoked this function. * Note that returned value is set to -1 if error invoked this function.
*/ */
CTLONG SEGAAPI_GetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param); int SEGAAPI_GetSynthParam(void *hHandle, HASYNTHPARAMSEXT param);
/** /**
* Sets and stores an array of synthesizer parameters, in Perceptually-Additive Real-World (PARW) units. * Sets and stores an array of synthesizer parameters, in Perceptually-Additive Real-World (PARW) units.
@ -1170,8 +1144,7 @@ CTLONG SEGAAPI_GetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams, SynthParamSet *pSynthParams); int SEGAAPI_SetSynthParamMultiple(void *hHandle, unsigned int dwNumParams, SynthParamSet *pSynthParams);
/** /**
* Retrieves an array of synthesizer parameters, in Perceptually-Additive Real-World (PARW) units. * Retrieves an array of synthesizer parameters, in Perceptually-Additive Real-World (PARW) units.
@ -1193,8 +1166,7 @@ SEGASTATUS SEGAAPI_SetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams,
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_GetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams, SynthParamSet *pSynthParams); int SEGAAPI_GetSynthParamMultiple(void *hHandle, unsigned int dwNumParams, SynthParamSet *pSynthParams);
/** /**
* Set the voice into the release phase of the volume envelope engines when set to TRUE. * Set the voice into the release phase of the volume envelope engines when set to TRUE.
@ -1212,9 +1184,7 @@ SEGASTATUS SEGAAPI_GetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams,
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetReleaseState(CTHANDLE hHandle, CTBOOL bSet); int SEGAAPI_SetReleaseState(void *hHandle, int bSet);
/*********************************************************** /***********************************************************
* @section * @section
@ -1243,9 +1213,8 @@ SEGASTATUS SEGAAPI_SetReleaseState(CTHANDLE hHandle, CTBOOL bSet);
* @param HAWOSMESSAGETYPE message * @param HAWOSMESSAGETYPE message
* The callback message. * The callback message.
*/ */
typedef void (*HAWOSEGABUFFERCALLBACK)(CTHANDLE hHandle, typedef void (*HAWOSEGABUFFERCALLBACK)(void *hHandle,
HAWOSMESSAGETYPE message); HAWOSMESSAGETYPE message);
/*********************************************************** /***********************************************************
* @section * @section
@ -1335,11 +1304,10 @@ typedef void (*HAWOSEGABUFFERCALLBACK)(CTHANDLE hHandle,
* the device. Generally, increasing the client's priority * the device. Generally, increasing the client's priority
* will allow a subsequent creation request to succeed. * will allow a subsequent creation request to succeed.
*/ */
SEGASTATUS SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG * pConfig, int SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig,
HAWOSEGABUFFERCALLBACK pCallback, HAWOSEGABUFFERCALLBACK pCallback,
CTDWORD dwFlags, unsigned int dwFlags,
CTHANDLE *phHandle); void **phHandle);
/** /**
* Destroys the buffer previously created with CreateBuffer(). * Destroys the buffer previously created with CreateBuffer().
@ -1357,11 +1325,7 @@ SEGASTATUS SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG * pConfig,
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_DestroyBuffer(CTHANDLE hHandle); int SEGAAPI_DestroyBuffer(void *hHandle);
/*********************************************************** /***********************************************************
* @section * @section
@ -1399,7 +1363,7 @@ SEGASTATUS SEGAAPI_DestroyBuffer(CTHANDLE hHandle);
* @return * @return
* Returns TRUE if successful. Otherwise, returns FALSE. * Returns TRUE if successful. Otherwise, returns FALSE.
*/ */
CTBOOL SEGAAPI_SetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize); int SEGAAPI_SetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize);
/** /**
* Gets global EAX property. * Gets global EAX property.
@ -1422,8 +1386,7 @@ CTBOOL SEGAAPI_SetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *
* @return * @return
* Returns TRUE if successful. Otherwise, returns FALSE. * Returns TRUE if successful. Otherwise, returns FALSE.
*/ */
CTBOOL SEGAAPI_GetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize); int SEGAAPI_GetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize);
/*********************************************************** /***********************************************************
* @section * @section
@ -1445,9 +1408,9 @@ CTBOOL SEGAAPI_GetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetSPDIFOutChannelStatus( int SEGAAPI_SetSPDIFOutChannelStatus(
CTDWORD dwChannelStatus, unsigned int dwChannelStatus,
CTDWORD dwExtChannelStatus); unsigned int dwExtChannelStatus);
/** /**
* Gets SPDIF Out channel status. * Gets SPDIF Out channel status.
@ -1462,10 +1425,9 @@ SEGASTATUS SEGAAPI_SetSPDIFOutChannelStatus(
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_GetSPDIFOutChannelStatus( int SEGAAPI_GetSPDIFOutChannelStatus(
CTDWORD *pdwChannelStatus, unsigned int *pdwChannelStatus,
CTDWORD *pdwExtChannelStatus); unsigned int *pdwExtChannelStatus);
/** /**
* Sets the SPDIF Out sampling rate. This function also updates the * Sets the SPDIF Out sampling rate. This function also updates the
@ -1479,7 +1441,7 @@ SEGASTATUS SEGAAPI_GetSPDIFOutChannelStatus(
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate); int SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate);
/** /**
* Gets SPDIF Out sampling rate * Gets SPDIF Out sampling rate
@ -1490,7 +1452,6 @@ SEGASTATUS SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate);
*/ */
HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void); HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void);
/** /**
* Sets SPDIF Out channel routing. * Sets SPDIF Out channel routing.
* *
@ -1511,11 +1472,11 @@ HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetSPDIFOutChannelRouting( int SEGAAPI_SetSPDIFOutChannelRouting(
CTDWORD dwChannel, unsigned int dwChannel,
HAROUTING dwSource); HAROUTING dwSource);
/** /**
* Gets SPDIF Out channel routing * Gets SPDIF Out channel routing
* *
* @param dwChannel * @param dwChannel
@ -1524,13 +1485,11 @@ SEGASTATUS SEGAAPI_SetSPDIFOutChannelRouting(
* *
* @return * @return
* The source to which the channel is received signal from. * The source to which the channel is received signal from.
* Note that returned value is set to HA_UNUSED_PORT if error invoked this function. * Note that returned value is set to HA_UNUSED_PORT if error invoked this function.
* *
* See HAROUTING for the details of the source enumeration list. * See HAROUTING for the details of the source enumeration list.
*/ */
HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(CTDWORD dwChannel); HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(unsigned int dwChannel);
/*********************************************************** /***********************************************************
* @section * @section
@ -1553,7 +1512,7 @@ HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(CTDWORD dwChannel);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate * Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code. * error code.
*/ */
SEGASTATUS SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, CTDWORD dwVolume); int SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, unsigned int dwVolume);
/** /**
* Returns the current volume level for the requested physical IO. * Returns the current volume level for the requested physical IO.
@ -1565,7 +1524,7 @@ SEGASTATUS SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, CTDWORD dwVolume);
* The current volume. * The current volume.
* Note that returned value is set to 0xffffffff if error invoked this function. * Note that returned value is set to 0xffffffff if error invoked this function.
*/ */
CTDWORD SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO); unsigned int SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO);
/** /**
* Sets the last status code manually. * Sets the last status code manually.
@ -1579,8 +1538,7 @@ CTDWORD SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO);
* @return * @return
* None. * None.
*/ */
void SEGAAPI_SetLastStatus(SEGASTATUS LastStatus); void SEGAAPI_SetLastStatus(int LastStatus);
/** /**
* Returns the last status code for the function that just invoked. * Returns the last status code for the function that just invoked.
@ -1588,14 +1546,13 @@ void SEGAAPI_SetLastStatus(SEGASTATUS LastStatus);
* Therefore, The last status code should be checked immediately after a function * Therefore, The last status code should be checked immediately after a function
* is invoked. * is invoked.
* *
* For functions that return SEGASTATUS, caller can check the return code * For functions that return int, caller can check the return code
* immediately without needing to call GetLastStatus function. * immediately without needing to call GetLastStatus function.
* *
* @return * @return
* The SEGASTATUS code. * The int code.
*/ */
SEGASTATUS SEGAAPI_GetLastStatus(void); int SEGAAPI_GetLastStatus(void);
/** /**
* Resets the driver to its default states. * Resets the driver to its default states.
@ -1609,10 +1566,9 @@ SEGASTATUS SEGAAPI_GetLastStatus(void);
* *
* *
* @return * @return
* The SEGASTATUS code. * The int code.
*/ */
SEGASTATUS SEGAAPI_Reset(void); int SEGAAPI_Reset(void);
/** /**
* Initializes the SEGAAPI Library. * Initializes the SEGAAPI Library.
@ -1621,10 +1577,9 @@ SEGASTATUS SEGAAPI_Reset(void);
* *
* *
* @return * @return
* The SEGASTATUS code. * The int code.
*/ */
SEGASTATUS SEGAAPI_Init(void); int SEGAAPI_Init(void);
/** /**
* Exits from the SEGAAPI Library. * Exits from the SEGAAPI Library.
@ -1634,14 +1589,8 @@ SEGASTATUS SEGAAPI_Init(void);
* *
* *
* @return * @return
* The SEGASTATUS code. * The int code.
*/ */
SEGASTATUS SEGAAPI_Exit(void); int SEGAAPI_Exit(void);
#ifdef __cplusplus
}
#endif
#endif /* __SEGAAPI_H */
#endif /* __SEGAAPI_H */

View File

@ -3,56 +3,22 @@
#ifndef __SEGAAPITYPES_H #ifndef __SEGAAPITYPES_H
#define __SEGAAPITYPES_H #define __SEGAAPITYPES_H
/* Define basic COM types */
/* 8 bit signed value */
typedef char CTCHAR, *PCTCHAR, **PPCTCHAR;
/* 8 bit unsigned value */
typedef unsigned char CTBYTE, *PCTBYTE, **PPCTBYTE;
typedef unsigned char CTUCHAR, *PCTUCHAR, **PPCTUCHAR;
/* 16 bit signed value */
typedef short CTSHORT, *PCTSHORT, **PPCTSHORT;
/* 16 bit unsigned value */
typedef unsigned short CTWORD, *PCTWORD, **PPCTWORD;
typedef unsigned short CTUSHORT, *PCTUSHORT, **PPCTUSHORT;
/* 32 bit signed value */
typedef int CTLONG, *PCTLONG, **PPCTLONG;
/* 32 bit unsigned value */
typedef unsigned int CTDWORD, *PCTDWORD, **PPCTDWORD;
typedef unsigned long CTULONG, *PCTULONG, **PPCTULONG;
typedef int CTBOOL, *PCTBOOL, **PPCTBOOL;
typedef void * CTHANDLE;
/* Define basic COM types */
#ifndef GUID_DEFINED #ifndef GUID_DEFINED
#define GUID_DEFINED #define GUID_DEFINED
typedef struct _GUID typedef struct _GUID
{ {
unsigned long Data1; unsigned long Data1;
unsigned short Data2; unsigned short Data2;
unsigned short Data3; unsigned short Data3;
unsigned char Data4[8]; unsigned char Data4[8];
} GUID; } GUID;
#endif // GUID_DEFINED #endif // GUID_DEFINED
#ifndef DEFINE_GUID #ifndef DEFINE_GUID
#ifndef INITGUID #define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) extern const GUID name
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID /*FAR*/ name
#else
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \
extern const GUID name = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } }
#endif // INITGUID
#endif // DEFINE_GUID #endif // DEFINE_GUID
#endif /* __SEGAAPITYPES_H */ #endif /* __SEGAAPITYPES_H */
#endif /* __CTDEF_H */ #endif /* __CTDEF_H */

View File

@ -1,43 +0,0 @@
/****************************************************************************
* Copyright (C) 2004 Creative Technology Ltd. All rights reserved.
*
****************************************************************************
* File: sapidef.h
*
* This file contains the return codes definition for segaapi.
*
****************************************************************************
*/
#ifndef __SEGAAPIERROR_H
#define __SEGAAPIERROR_H
typedef int SEGASTATUS;
#define SEGA_SUCCEEDED(_x) ((SEGASTATUS) (_x) >= 0)
#define SEGA_FAILED(_x) ((SEGASTATUS) (_x) < 0)
#define SEGARESULT_SUCCESS(_x) (_x)
#define SEGARESULT_FAILURE(_x) ((1 << 31) | 0xA000 | (_x))
#define SEGA_SUCCESS 0L
#define SEGAERR_FAIL SEGARESULT_FAILURE(0)
#define SEGAERR_BAD_POINTER SEGARESULT_FAILURE(3)
#define SEGAERR_UNSUPPORTED SEGARESULT_FAILURE(5)
#define SEGAERR_BAD_PARAM SEGARESULT_FAILURE(9)
#define SEGAERR_INVALID_CHANNEL SEGARESULT_FAILURE(10)
#define SEGAERR_INVALID_SEND SEGARESULT_FAILURE(11)
#define SEGAERR_PLAYING SEGARESULT_FAILURE(12)
#define SEGAERR_NO_RESOURCES SEGARESULT_FAILURE(13)
#define SEGAERR_BAD_CONFIG SEGARESULT_FAILURE(14)
#define SEGAERR_BAD_HANDLE SEGARESULT_FAILURE(18)
#define SEGAERR_BAD_SAMPLERATE SEGARESULT_FAILURE(28)
#define SEGAERR_OUT_OF_MEMORY SEGARESULT_FAILURE(31)
#define SEGAERR_INIT_FAILED SEGARESULT_FAILURE(39)
#endif /* __SEGAAPIERROR_H */