1
0
mirror of synced 2024-11-27 22:50:47 +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
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#include <unistd.h>
#define TSF_IMPLEMENTATION
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alext.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"
#define TSF_IMPLEMENTATION
#include "segadef.h"
#include "segaeax.h"
#include "tsf.h"
//#define DEBUG_SAMPLE
#define DEBUG_OUTPUT
//#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
const GUID EAX_NULL_GUID;
@ -453,7 +451,7 @@ static void resetBuffer(segaapiContext_t *context)
updateBufferData(context, -1, -1);
}
SEGASTATUS SEGAAPI_Play(CTHANDLE hHandle)
int SEGAAPI_Play(void* hHandle)
{
dbgPrint("SEGAAPI_Play() 0x%x", hHandle);
segaapiContext_t *context = hHandle;
@ -481,7 +479,7 @@ SEGASTATUS SEGAAPI_Play(CTHANDLE hHandle)
return SEGA_SUCCESS;
}
SEGASTATUS SEGAAPI_Pause(CTHANDLE hHandle)
int SEGAAPI_Pause(void* hHandle)
{
dbgPrint("SEGAAPI_Pause() 0x%x", hHandle);
segaapiContext_t *context = hHandle;
@ -491,7 +489,7 @@ SEGASTATUS SEGAAPI_Pause(CTHANDLE hHandle)
return SEGA_SUCCESS;
}
SEGASTATUS SEGAAPI_Stop(CTHANDLE hHandle)
int SEGAAPI_Stop(void* hHandle)
{
dbgPrint("SEGAAPI_Stop() 0x%x", hHandle);
segaapiContext_t *context = hHandle;
@ -501,7 +499,7 @@ SEGASTATUS SEGAAPI_Stop(CTHANDLE hHandle)
return SEGA_SUCCESS;
}
SEGASTATUS SEGAAPI_PlayWithSetup(CTHANDLE hHandle)
int SEGAAPI_PlayWithSetup(void* hHandle)
{
dbgPrint("SEGAAPI_PlayWithSetup() 0x%x", hHandle);
segaapiContext_t *context = hHandle;
@ -513,7 +511,7 @@ SEGASTATUS SEGAAPI_PlayWithSetup(CTHANDLE hHandle)
return SEGAERR_UNSUPPORTED;
}
PlaybackStatus SEGAAPI_GetPlaybackStatus(CTHANDLE hHandle)
PlaybackStatus SEGAAPI_GetPlaybackStatus(void* hHandle)
{
ALint state;
@ -539,19 +537,19 @@ PlaybackStatus SEGAAPI_GetPlaybackStatus(CTHANDLE hHandle)
return PLAYBACK_STATUS_INVALID;
}
SEGASTATUS SEGAAPI_SetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat)
int SEGAAPI_SetFormat(void* hHandle, HAWOSEFORMAT *pFormat)
{
dbgPrint("SEGAAPI_SetFormat() 0x%x", hHandle);
return SEGAERR_UNSUPPORTED;
}
SEGASTATUS SEGAAPI_GetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat)
int SEGAAPI_GetFormat(void* hHandle, HAWOSEFORMAT *pFormat)
{
dbgPrint("SEGAAPI_GetFormat() 0x%x", hHandle);
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);
if (hHandle == NULL)
@ -564,25 +562,25 @@ SEGASTATUS SEGAAPI_SetSampleRate(CTHANDLE hHandle, CTDWORD dwSampleRate)
return SEGA_SUCCESS;
}
CTDWORD SEGAAPI_GetSampleRate(CTHANDLE hHandle)
unsigned int SEGAAPI_GetSampleRate(void* hHandle)
{
dbgPrint("SEGAAPI_GetSampleRate() 0x%x", hHandle);
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);
return SEGAERR_UNSUPPORTED;
}
CTDWORD SEGAAPI_GetPriority(CTHANDLE hHandle)
unsigned int SEGAAPI_GetPriority(void* hHandle)
{
dbgPrint("SEGAAPI_GetPriority() 0x%x", hHandle);
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);
if (hHandle == NULL)
@ -596,7 +594,7 @@ SEGASTATUS SEGAAPI_SetUserData(CTHANDLE hHandle, CTHANDLE hUserData)
return SEGA_SUCCESS;
}
CTHANDLE SEGAAPI_GetUserData(CTHANDLE hHandle)
void* SEGAAPI_GetUserData(void* hHandle)
{
dbgPrint("SEGAAPI_GetPriority() 0x%x", hHandle);
if (hHandle == NULL)
@ -605,43 +603,43 @@ CTHANDLE SEGAAPI_GetUserData(CTHANDLE hHandle)
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);
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);
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);
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);
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);
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);
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);
segaapiContext_t *context = hHandle;
@ -649,7 +647,7 @@ SEGASTATUS SEGAAPI_SetPlaybackPosition(CTHANDLE hHandle, CTDWORD dwPlaybackPos)
return SEGA_SUCCESS;
}
CTDWORD SEGAAPI_GetPlaybackPosition(CTHANDLE hHandle)
unsigned int SEGAAPI_GetPlaybackPosition(void* hHandle)
{
ALint position;
dbgPrint("SEGAAPI_GetPlaybackPosition() 0x%x", hHandle);
@ -658,25 +656,25 @@ CTDWORD SEGAAPI_GetPlaybackPosition(CTHANDLE hHandle)
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);
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);
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);
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);
if (hHandle == NULL)
@ -689,13 +687,13 @@ SEGASTATUS SEGAAPI_SetStartLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset)
return SEGA_SUCCESS;
}
CTDWORD SEGAAPI_GetStartLoopOffset(CTHANDLE hHandle)
unsigned int SEGAAPI_GetStartLoopOffset(void* hHandle)
{
dbgPrint("SEGAAPI_GetStartLoopOffset() 0x%x", hHandle);
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);
if (hHandle == NULL)
@ -708,25 +706,25 @@ SEGASTATUS SEGAAPI_SetEndLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset)
return SEGA_SUCCESS;
}
CTDWORD SEGAAPI_GetEndLoopOffset(CTHANDLE hHandle)
unsigned int SEGAAPI_GetEndLoopOffset(void* hHandle)
{
dbgPrint("SEGAAPI_GetEndLoopOffset() 0x%x", hHandle);
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);
return SEGAERR_UNSUPPORTED;
}
CTDWORD SEGAAPI_GetEndOffset(CTHANDLE hHandle)
unsigned int SEGAAPI_GetEndOffset(void* hHandle)
{
dbgPrint("SEGAAPI_GetEndOffset() 0x%x", hHandle);
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);
segaapiContext_t *context = hHandle;
@ -735,13 +733,13 @@ SEGASTATUS SEGAAPI_SetLoopState(CTHANDLE hHandle, CTBOOL bDoContinuousLooping)
return SEGA_SUCCESS;
}
CTBOOL SEGAAPI_GetLoopState(CTHANDLE hHandle)
int SEGAAPI_GetLoopState(void* hHandle)
{
dbgPrint("SEGAAPI_GetLoopState() 0x%x", hHandle);
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);
if (hHandle == NULL)
@ -754,7 +752,7 @@ SEGASTATUS SEGAAPI_UpdateBuffer(CTHANDLE hHandle, CTDWORD dwStartOffset, CTDWORD
return SEGA_SUCCESS;
}
SEGASTATUS SEGAAPI_SetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param, CTLONG lPARWValue)
int SEGAAPI_SetSynthParam(void* hHandle, HASYNTHPARAMSEXT param, int lPARWValue)
{
float volume;
float semiTones;
@ -888,13 +886,13 @@ SEGASTATUS SEGAAPI_SetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param, CTLON
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);
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);
segaapiContext_t *context = hHandle;
@ -909,19 +907,19 @@ SEGASTATUS SEGAAPI_SetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams,
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);
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);
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);
if ((phHandle == NULL) || (pConfig == NULL))
@ -1027,7 +1025,7 @@ SEGASTATUS SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLB
return SEGA_SUCCESS;
}
SEGASTATUS SEGAAPI_DestroyBuffer(CTHANDLE hHandle)
int SEGAAPI_DestroyBuffer(void* hHandle)
{
dbgPrint("SEGAAPI_DestroyBuffer() 0x%x", hHandle);
if (hHandle == NULL)
@ -1036,31 +1034,31 @@ SEGASTATUS SEGAAPI_DestroyBuffer(CTHANDLE hHandle)
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);
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);
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);
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);
return SEGAERR_UNSUPPORTED;
}
SEGASTATUS SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate)
int SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate)
{
dbgPrint("SEGAAPI_SetSPDIFOutSampleRate() 0x%x", dwSamplingRate);
return SEGAERR_UNSUPPORTED;
@ -1072,7 +1070,7 @@ HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void)
return HASPDIFOUT_48KHZ;
}
SEGASTATUS SEGAAPI_SetSPDIFOutChannelRouting(CTDWORD dwChannel, HAROUTING dwSource)
int SEGAAPI_SetSPDIFOutChannelRouting(unsigned int dwChannel, HAROUTING dwSource)
{
switch (dwChannel)
{
@ -1089,13 +1087,13 @@ SEGASTATUS SEGAAPI_SetSPDIFOutChannelRouting(CTDWORD dwChannel, HAROUTING dwSour
return SEGAERR_UNSUPPORTED;
}
HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(CTDWORD dwChannel)
HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(unsigned int dwChannel)
{
dbgPrint("SEGAAPI_GetSPDIFOutChannelRouting() 0x%x", dwChannel);
return HA_UNUSED_PORT;
}
SEGASTATUS SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, CTDWORD dwVolume)
int SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, unsigned int dwVolume)
{
// float v = (dwVolume >> 16) & 0xffff;
dbgPrint("SEGAAPI_SetIOVolume() 0x%x 0x%x", dwPhysIO, dwVolume);
@ -1103,31 +1101,31 @@ SEGASTATUS SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, CTDWORD dwVolume)
return SEGA_SUCCESS;
}
CTDWORD SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO)
unsigned int SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO)
{
dbgPrint("SEGAAPI_GetIOVolume() 0x%x", dwPhysIO);
return 0xffffffff;
}
void SEGAAPI_SetLastStatus(SEGASTATUS LastStatus)
void SEGAAPI_SetLastStatus(int LastStatus)
{
dbgPrint("SEGAAPI_SetLastStatus() 0x%x", LastStatus);
return;
}
SEGASTATUS SEGAAPI_GetLastStatus(void)
int SEGAAPI_GetLastStatus(void)
{
dbgPrint("SEGAAPI_GetLastStatus()");
return SEGA_SUCCESS;
}
SEGASTATUS SEGAAPI_Reset(void)
int SEGAAPI_Reset(void)
{
dbgPrint("SEGAAPI_Reset()");
return SEGA_SUCCESS;
}
SEGASTATUS SEGAAPI_Init(void)
int SEGAAPI_Init(void)
{
dbgPrint("SEGAAPI_Init()");
@ -1166,7 +1164,7 @@ SEGASTATUS SEGAAPI_Init(void)
return SEGA_SUCCESS;
}
SEGASTATUS SEGAAPI_Exit(void)
int SEGAAPI_Exit(void)
{
dbgPrint("SEGAAPI_Exit()");
alutExit();

View File

@ -60,7 +60,7 @@
* Updated SEGAAPI_SetReleaseState() document.
*
* 1.02
* Added SEGAAPI_SetSynthParamMultiple(0 and SEGAAPI_GetSynthParamMultiple().
* Added SEGAAPI_SetSynthParamMultiple(0 and SEGAAPI_GetSynthParamMultiple().
* Updated SEGAAPI_CreateBuffer() for user-mode buffer support.
*
****************************************************************************
@ -75,12 +75,22 @@
// INCLUDES
#include "segadef.h"
#include "segaerr.h"
#ifdef __cplusplus
extern "C" {
#endif
#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)
/**
* The following defines SEGA custom EAX40 properties.
@ -88,7 +98,7 @@ extern "C" {
// {A7FEEC3F-2BFD-4a40-891F-7423E38BAC1F}
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
/*
@ -96,7 +106,7 @@ DEFINE_GUID(EAXPROPERTYID_EAX40_SEGA_Custom,
* FXSlot2 and FXSlot3 when non-reverb is loaded to these slots.
*
* EAXSEGA_STEREO_RETURN
* ulDataSize = CTDWORD
* ulDataSize = unsigned int
* value = 0 denotes route to front L/R (default)
* value = 1 denotes route to Rear L/R
*/
@ -110,23 +120,23 @@ typedef enum
* The following defines all of the messages wave output clients
* can receive as part of their callback routines.
*/
typedef enum {
typedef enum
{
HAWOS_RESOURCE_STOLEN = 0,
HAWOS_NOTIFY = 2
} HAWOSMESSAGETYPE;
/*
* The Playback status.
*/
typedef enum {
typedef enum
{
PLAYBACK_STATUS_STOP, /* The voice is stopped */
PLAYBACK_STATUS_ACTIVE, /* The voice is playing */
PLAYBACK_STATUS_PAUSE, /* The voice is paused */
PLAYBACK_STATUS_INVALID = -1 /* Invalid state */
} PlaybackStatus;
/*
* dwFlags use in CreateBuffer.
*/
@ -143,50 +153,47 @@ typedef enum {
#define HASF_SIGNED_16PCM 0x0020 /* Signed 16-bit PCM */
#endif
typedef struct {
CTDWORD dwSampleRate; /* The sample rate the client desires (in Hz) */
CTDWORD dwSampleFormat; /* The sample format the client will use */
CTDWORD byNumChans; /* The number of samples in the sample
typedef struct
{
unsigned int dwSampleRate; /* The sample rate the client desires (in Hz) */
unsigned int dwSampleFormat; /* The sample format the client will use */
unsigned int byNumChans; /* The number of samples in the sample
* frame (1 = mono, 2 = stereo). */
} HAWOSEFORMAT;
/*
* HAWOSEMAPDATA contains
*/
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 */
CTHANDLE hBufferHdr; /* Return by driver. Memory address that user-space application can access. */
typedef struct
{
unsigned int dwSize; /* Supply by caller. Size (in bytes) of the valid sample data */
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;
/*
* The HAWOSEBUFFERCONFIG structure is used to describe how an input or
* output buffer client wishes to configure the device when it opens it.
*/
typedef struct {
CTDWORD dwPriority; /* The priority with which the voices
typedef struct
{
unsigned int dwPriority; /* The priority with which the voices
* should be allocated. This is used
* when voices need to be ripped off. */
CTDWORD dwSampleRate; /* The sample rate the voice desires */
CTDWORD dwSampleFormat; /* The sample format the voice will use */
CTDWORD byNumChans; /* The number of samples in the sample
unsigned int dwSampleRate; /* The sample rate the voice desires */
unsigned int dwSampleFormat; /* The sample format the voice will use */
unsigned int byNumChans; /* The number of samples in the sample
* frame. (1 = mono, 2 = stereo). */
CTDWORD dwReserved; /* Reserved field */
CTHANDLE hUserData; /* User data */
unsigned int dwReserved; /* Reserved field */
void *hUserData; /* User data */
HAWOSEMAPDATA mapData; /* The sample memory mapping for the buffer. */
} HAWOSEBUFFERCONFIG;
/**
* Default values
*/
#define HAWOSEVOL_MAX 0xFFFFFFFF /* Maximum volume; no attenuation */
/**
* Since Tina has up to 64- voices, voice priorities typically ranging
* from 0 to 63, where 0 is lower priority (more likely to get ripped off)
@ -198,7 +205,6 @@ typedef struct {
#define HAWOSEP_MINIMUM 0
#define HAWOSEP_MAXIMUM 0xFFFFFFFF
/** @brief Routing List
*
* voice sends routing to speakers or effects ports.
@ -206,59 +212,58 @@ typedef struct {
*/
#define HAWOSE_UNUSED_SEND 0xFFFF0001
typedef enum HAROUTING{
HA_UNUSED_PORT=HAWOSE_UNUSED_SEND,
typedef enum HAROUTING
{
HA_UNUSED_PORT = HAWOSE_UNUSED_SEND,
// Dry multi-channel outputs
HA_FRONT_LEFT_PORT =0,
HA_FRONT_RIGHT_PORT=1,
HA_FRONT_CENTER_PORT=2,
HA_LFE_PORT=3,
HA_REAR_LEFT_PORT=4,
HA_REAR_RIGHT_PORT=5,
HA_FRONT_LEFT_PORT = 0,
HA_FRONT_RIGHT_PORT = 1,
HA_FRONT_CENTER_PORT = 2,
HA_LFE_PORT = 3,
HA_REAR_LEFT_PORT = 4,
HA_REAR_RIGHT_PORT = 5,
// effect outputs
HA_FXSLOT0_PORT=10,
HA_FXSLOT1_PORT=11,
HA_FXSLOT2_PORT=12,
HA_FXSLOT3_PORT=13
HA_FXSLOT0_PORT = 10,
HA_FXSLOT1_PORT = 11,
HA_FXSLOT2_PORT = 12,
HA_FXSLOT3_PORT = 13
} HAROUTING;
/**
* The following defines SPDIF-Out sampling rate.
*/
typedef enum {
HASPDIFOUT_44_1KHZ=0,
typedef enum
{
HASPDIFOUT_44_1KHZ = 0,
HASPDIFOUT_48KHZ,
HASPDIFOUT_96KHZ
} HASPDIFOUTRATE;
/**
* The following defines inputs and outputs of SEGA sound board.
*/
typedef enum HAPHYSICALIO {
typedef enum HAPHYSICALIO
{
// analog outputs
HA_OUT_FRONT_LEFT =0,
HA_OUT_FRONT_RIGHT=1,
HA_OUT_FRONT_CENTER=2,
HA_OUT_LFE_PORT=3,
HA_OUT_REAR_LEFT=4,
HA_OUT_REAR_RIGHT=5,
HA_OUT_FRONT_LEFT = 0,
HA_OUT_FRONT_RIGHT = 1,
HA_OUT_FRONT_CENTER = 2,
HA_OUT_LFE_PORT = 3,
HA_OUT_REAR_LEFT = 4,
HA_OUT_REAR_RIGHT = 5,
// optical Outputs
HA_OUT_OPTICAL_LEFT=10,
HA_OUT_OPTICAL_RIGHT=11,
HA_OUT_OPTICAL_LEFT = 10,
HA_OUT_OPTICAL_RIGHT = 11,
// Line In
HA_IN_LINEIN_LEFT=20,
HA_IN_LINEIN_RIGHT=21
}HAPHYSICALIO ;
HA_IN_LINEIN_LEFT = 20,
HA_IN_LINEIN_RIGHT = 21
} HAPHYSICALIO;
/** @brief Synth parameters enumeration list
*
@ -268,7 +273,8 @@ typedef enum HAPHYSICALIO {
* Refers to DLS spec or SoundFont spec for details of these Parameters,
* their units and their ranges.
*/
typedef enum HASYNTHPARAMSEXT {
typedef enum HASYNTHPARAMSEXT
{
HAVP_ATTENUATION, ///< 0, 0x00, initialAttenuation
HAVP_PITCH, ///< 1, 0x01, fineTune + coarseTune * 100
HAVP_FILTER_CUTOFF, ///< 2, 0x02, initialFilterFc
@ -299,14 +305,14 @@ typedef enum HASYNTHPARAMSEXT {
} HASYNTHPARAMSEXT;
#ifndef __SYNTHPARAMSET_
# define __SYNTHPARAMSET_
typedef struct SynthParamSetExt {
#define __SYNTHPARAMSET_
typedef struct SynthParamSetExt
{
HASYNTHPARAMSEXT param;
CTLONG lPARWValue;
int lPARWValue;
} SynthParamSet;
#endif
/*
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.
*
@ -352,7 +356,6 @@ How this SYNTH PARAMS EXT maps to Sega API requests:
*
*/
/***********************************************************
* @section
* 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
* error code.
*/
SEGASTATUS SEGAAPI_Play(CTHANDLE hHandle);
int SEGAAPI_Play(void *hHandle);
/**
* 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.
* Otherwise, returns an appropriate error code.
*/
SEGASTATUS SEGAAPI_Pause(CTHANDLE hHandle);
int SEGAAPI_Pause(void *hHandle);
/**
* Stops playback and resets the sample counter.
@ -407,9 +408,9 @@ SEGASTATUS SEGAAPI_Pause(CTHANDLE hHandle);
* 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.
@ -423,10 +424,7 @@ SEGASTATUS SEGAAPI_PlayWithSetup(CTHANDLE hHandle);
* 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.
*/
PlaybackStatus SEGAAPI_GetPlaybackStatus(CTHANDLE hHandle);
PlaybackStatus SEGAAPI_GetPlaybackStatus(void *hHandle);
/***********************************************************
* @section
@ -461,8 +459,7 @@ PlaybackStatus SEGAAPI_GetPlaybackStatus(CTHANDLE hHandle);
* @retval SEGAERR_BAD_CONFIG if something in the given configuration is
* invalid.
*/
SEGASTATUS SEGAAPI_SetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat);
int SEGAAPI_SetFormat(void *hHandle, HAWOSEFORMAT *pFormat);
/**
* 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
* 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
@ -500,8 +496,7 @@ SEGASTATUS SEGAAPI_GetFormat(CTHANDLE hHandle, HAWOSEFORMAT *pFormat);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_SetSampleRate(CTHANDLE hHandle, CTDWORD dwSampleRate);
int SEGAAPI_SetSampleRate(void *hHandle, unsigned int dwSampleRate);
/**
* Returns the current sample rate.
@ -515,9 +510,7 @@ SEGASTATUS SEGAAPI_SetSampleRate(CTHANDLE hHandle, CTDWORD dwSampleRate);
* Returns the current sample rate.
* 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
@ -525,7 +518,7 @@ CTDWORD SEGAAPI_GetSampleRate(CTHANDLE hHandle);
*
*/
/**
/**
* Changes the buffer's priority to the specified value.
*
* 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
* error code.
*/
SEGASTATUS SEGAAPI_SetPriority(CTHANDLE hHandle, CTDWORD dwPriority);
int SEGAAPI_SetPriority(void *hHandle, unsigned int dwPriority);
/**
* Returns the buffer's current priority.
@ -558,8 +550,7 @@ SEGASTATUS SEGAAPI_SetPriority(CTHANDLE hHandle, CTDWORD dwPriority);
* Returns the buffer's current priority.
* 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
@ -587,8 +578,7 @@ CTDWORD SEGAAPI_GetPriority(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* 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.
@ -602,8 +592,7 @@ SEGASTATUS SEGAAPI_SetUserData(CTHANDLE hHandle, CTHANDLE hUserData);
* Returns the user-defined data.
* Note that returned value is set to 0 if error invoked this function.
*/
CTHANDLE SEGAAPI_GetUserData(CTHANDLE hHandle);
void *SEGAAPI_GetUserData(void *hHandle);
/***********************************************************
* @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_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);
/**
@ -668,7 +657,7 @@ SEGASTATUS SEGAAPI_SetSendRouting(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD d
* Returns the current destination.
* 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
@ -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_SEND if the specified send isn't valid.
*/
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);
/**
* 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.
* 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
@ -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_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.
@ -775,9 +762,7 @@ SEGASTATUS SEGAAPI_SetChannelVolume(CTHANDLE hHandle, CTDWORD dwChannel, CTDWORD
* Returns the current volume.
* 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.
@ -802,8 +787,7 @@ CTDWORD SEGAAPI_GetChannelVolume(CTHANDLE hHandle, CTDWORD dwChannel);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* 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
@ -818,8 +802,7 @@ SEGASTATUS SEGAAPI_SetPlaybackPosition(CTHANDLE hHandle, CTDWORD dwPlaybackPos);
* Returns the current playback position.
* 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
@ -853,7 +836,7 @@ CTDWORD SEGAAPI_GetPlaybackPosition(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* 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
@ -877,7 +860,7 @@ SEGASTATUS SEGAAPI_SetNotificationFrequency(CTHANDLE hHandle, CTDWORD dwFrameCou
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_SetNotificationPoint(CTHANDLE hHandle, CTDWORD dwBufferOffset);
int SEGAAPI_SetNotificationPoint(void *hHandle, unsigned int dwBufferOffset);
/**
* 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
* 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
@ -923,8 +905,7 @@ SEGASTATUS SEGAAPI_ClearNotificationPoint(CTHANDLE hHandle, CTDWORD dwBufferOffs
* Returns SEGA_SUCCESS if the loop offset is changed successful.
* 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.
@ -938,8 +919,7 @@ SEGASTATUS SEGAAPI_SetStartLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset);
* Returns the current start loop offset.
* 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
@ -965,8 +945,7 @@ CTDWORD SEGAAPI_GetStartLoopOffset(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_SetEndLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset);
int SEGAAPI_SetEndLoopOffset(void *hHandle, unsigned int dwOffset);
/**
* Returns the current end loop offest.
@ -980,8 +959,7 @@ SEGASTATUS SEGAAPI_SetEndLoopOffset(CTHANDLE hHandle, CTDWORD dwOffset);
* Returns the current end loop offest.
* 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
@ -1009,7 +987,7 @@ CTDWORD SEGAAPI_GetEndLoopOffset(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_SetEndOffset(CTHANDLE hHandle, CTDWORD dwOffset);
int SEGAAPI_SetEndOffset(void *hHandle, unsigned int dwOffset);
/**
* Returns the current end offest.
@ -1023,7 +1001,7 @@ SEGASTATUS SEGAAPI_SetEndOffset(CTHANDLE hHandle, CTDWORD dwOffset);
* Returns the current end offest.
* 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
@ -1049,7 +1027,7 @@ CTDWORD SEGAAPI_GetEndOffset(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_SetLoopState(CTHANDLE hHandle, CTBOOL bDoContinuousLooping);
int SEGAAPI_SetLoopState(void *hHandle, int bDoContinuousLooping);
/**
* 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.
* 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
@ -1096,8 +1073,7 @@ CTBOOL SEGAAPI_GetLoopState(CTHANDLE hHandle);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_UpdateBuffer(CTHANDLE hHandle, CTDWORD dwStartOffset, CTDWORD dwLength);
int SEGAAPI_UpdateBuffer(void *hHandle, unsigned int dwStartOffset, unsigned int dwLength);
/***********************************************************
* @section
@ -1125,8 +1101,7 @@ SEGASTATUS SEGAAPI_UpdateBuffer(CTHANDLE hHandle, CTDWORD dwStartOffset, CTDWORD
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* 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
@ -1147,8 +1122,7 @@ SEGASTATUS SEGAAPI_SetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param, CTLON
* The returned value in PARW units.
* 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.
@ -1170,8 +1144,7 @@ CTLONG SEGAAPI_GetSynthParam(CTHANDLE hHandle, HASYNTHPARAMSEXT param);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* 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.
@ -1193,8 +1166,7 @@ SEGASTATUS SEGAAPI_SetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams,
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* 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.
@ -1212,9 +1184,7 @@ SEGASTATUS SEGAAPI_GetSynthParamMultiple(CTHANDLE hHandle, CTDWORD dwNumParams,
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_SetReleaseState(CTHANDLE hHandle, CTBOOL bSet);
int SEGAAPI_SetReleaseState(void *hHandle, int bSet);
/***********************************************************
* @section
@ -1243,10 +1213,9 @@ SEGASTATUS SEGAAPI_SetReleaseState(CTHANDLE hHandle, CTBOOL bSet);
* @param HAWOSMESSAGETYPE message
* The callback message.
*/
typedef void (*HAWOSEGABUFFERCALLBACK)(CTHANDLE hHandle,
typedef void (*HAWOSEGABUFFERCALLBACK)(void *hHandle,
HAWOSMESSAGETYPE message);
/***********************************************************
* @section
* API to create playback buffers (voices).
@ -1335,11 +1304,10 @@ typedef void (*HAWOSEGABUFFERCALLBACK)(CTHANDLE hHandle,
* the device. Generally, increasing the client's priority
* will allow a subsequent creation request to succeed.
*/
SEGASTATUS SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG * pConfig,
int SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig,
HAWOSEGABUFFERCALLBACK pCallback,
CTDWORD dwFlags,
CTHANDLE *phHandle);
unsigned int dwFlags,
void **phHandle);
/**
* 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
* error code.
*/
SEGASTATUS SEGAAPI_DestroyBuffer(CTHANDLE hHandle);
int SEGAAPI_DestroyBuffer(void *hHandle);
/***********************************************************
* @section
@ -1399,7 +1363,7 @@ SEGASTATUS SEGAAPI_DestroyBuffer(CTHANDLE hHandle);
* @return
* 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.
@ -1422,8 +1386,7 @@ CTBOOL SEGAAPI_SetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *
* @return
* 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
@ -1445,9 +1408,9 @@ CTBOOL SEGAAPI_GetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_SetSPDIFOutChannelStatus(
CTDWORD dwChannelStatus,
CTDWORD dwExtChannelStatus);
int SEGAAPI_SetSPDIFOutChannelStatus(
unsigned int dwChannelStatus,
unsigned int dwExtChannelStatus);
/**
* Gets SPDIF Out channel status.
@ -1462,10 +1425,9 @@ SEGASTATUS SEGAAPI_SetSPDIFOutChannelStatus(
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_GetSPDIFOutChannelStatus(
CTDWORD *pdwChannelStatus,
CTDWORD *pdwExtChannelStatus);
int SEGAAPI_GetSPDIFOutChannelStatus(
unsigned int *pdwChannelStatus,
unsigned int *pdwExtChannelStatus);
/**
* 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
* error code.
*/
SEGASTATUS SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate);
int SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate);
/**
* Gets SPDIF Out sampling rate
@ -1490,7 +1452,6 @@ SEGASTATUS SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate);
*/
HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void);
/**
* Sets SPDIF Out channel routing.
*
@ -1511,11 +1472,11 @@ HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* error code.
*/
SEGASTATUS SEGAAPI_SetSPDIFOutChannelRouting(
CTDWORD dwChannel,
int SEGAAPI_SetSPDIFOutChannelRouting(
unsigned int dwChannel,
HAROUTING dwSource);
/**
/**
* Gets SPDIF Out channel routing
*
* @param dwChannel
@ -1528,9 +1489,7 @@ SEGASTATUS SEGAAPI_SetSPDIFOutChannelRouting(
*
* See HAROUTING for the details of the source enumeration list.
*/
HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(CTDWORD dwChannel);
HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(unsigned int dwChannel);
/***********************************************************
* @section
@ -1553,7 +1512,7 @@ HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(CTDWORD dwChannel);
* Returns SEGA_SUCCESS if successful. Otherwise, returns an appropriate
* 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.
@ -1565,7 +1524,7 @@ SEGASTATUS SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, CTDWORD dwVolume);
* The current volume.
* 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.
@ -1579,8 +1538,7 @@ CTDWORD SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO);
* @return
* None.
*/
void SEGAAPI_SetLastStatus(SEGASTATUS LastStatus);
void SEGAAPI_SetLastStatus(int LastStatus);
/**
* 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
* 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.
*
* @return
* The SEGASTATUS code.
* The int code.
*/
SEGASTATUS SEGAAPI_GetLastStatus(void);
int SEGAAPI_GetLastStatus(void);
/**
* Resets the driver to its default states.
@ -1609,10 +1566,9 @@ SEGASTATUS SEGAAPI_GetLastStatus(void);
*
*
* @return
* The SEGASTATUS code.
* The int code.
*/
SEGASTATUS SEGAAPI_Reset(void);
int SEGAAPI_Reset(void);
/**
* Initializes the SEGAAPI Library.
@ -1621,10 +1577,9 @@ SEGASTATUS SEGAAPI_Reset(void);
*
*
* @return
* The SEGASTATUS code.
* The int code.
*/
SEGASTATUS SEGAAPI_Init(void);
int SEGAAPI_Init(void);
/**
* Exits from the SEGAAPI Library.
@ -1634,14 +1589,8 @@ SEGASTATUS SEGAAPI_Init(void);
*
*
* @return
* The SEGASTATUS code.
* The int code.
*/
SEGASTATUS SEGAAPI_Exit(void);
#ifdef __cplusplus
}
#endif
int SEGAAPI_Exit(void);
#endif /* __SEGAAPI_H */

View File

@ -3,56 +3,22 @@
#ifndef __SEGAAPITYPES_H
#define __SEGAAPITYPES_H
/* 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 */
/* Define basic COM types */
#ifndef GUID_DEFINED
#define GUID_DEFINED
typedef struct _GUID
{
#define GUID_DEFINED
typedef struct _GUID
{
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[8];
} GUID;
} GUID;
#endif // GUID_DEFINED
#ifndef DEFINE_GUID
#ifndef INITGUID
#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
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) extern const GUID name
#endif // DEFINE_GUID
#endif /* __SEGAAPITYPES_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 */