Clean up segaapi
This commit is contained in:
parent
17bb64eadc
commit
84aefa6238
@ -16,30 +16,30 @@
|
||||
|
||||
//#define DEBUG_OUTPUT
|
||||
|
||||
const GUID EAX_NULL_GUID;
|
||||
const GUID EAX_FREQUENCYSHIFTER_EFFECT;
|
||||
const GUID EAX_ECHO_EFFECT;
|
||||
const GUID EAX_REVERB_EFFECT;
|
||||
const GUID EAX_EQUALIZER_EFFECT;
|
||||
const GUID EAX_DISTORTION_EFFECT;
|
||||
const GUID EAX_AGCCOMPRESSOR_EFFECT;
|
||||
const GUID EAX_PITCHSHIFTER_EFFECT;
|
||||
const GUID EAX_FLANGER_EFFECT;
|
||||
const GUID EAX_VOCALMORPHER_EFFECT;
|
||||
const GUID EAX_AUTOWAH_EFFECT;
|
||||
const GUID EAX_RINGMODULATOR_EFFECT;
|
||||
const GUID EAX_CHORUS_EFFECT;
|
||||
const GUID NULL_GUID;
|
||||
const GUID FREQUENCYSHIFTER_EFFECT;
|
||||
const GUID ECHO_EFFECT;
|
||||
const GUID REVERB_EFFECT;
|
||||
const GUID EQUALIZER_EFFECT;
|
||||
const GUID DISTORTION_EFFECT;
|
||||
const GUID AGCCOMPRESSOR_EFFECT;
|
||||
const GUID PITCHSHIFTER_EFFECT;
|
||||
const GUID FLANGER_EFFECT;
|
||||
const GUID VOCALMORPHER_EFFECT;
|
||||
const GUID AUTOWAH_EFFECT;
|
||||
const GUID RINGMODULATOR_EFFECT;
|
||||
const GUID CHORUS_EFFECT;
|
||||
|
||||
const GUID EAXPROPERTYID_EAX40_FXSlot0;
|
||||
const GUID EAXPROPERTYID_EAX40_FXSlot1;
|
||||
const GUID EAXPROPERTYID_EAX40_FXSlot2;
|
||||
const GUID EAXPROPERTYID_EAX40_FXSlot3;
|
||||
const GUID PROPERTYID_EAX40_FXSlot0;
|
||||
const GUID PROPERTYID_EAX40_FXSlot1;
|
||||
const GUID PROPERTYID_EAX40_FXSlot2;
|
||||
const GUID PROPERTYID_EAX40_FXSlot3;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
// SEGA API Parts
|
||||
void *userData;
|
||||
HAWOSEGABUFFERCALLBACK callback;
|
||||
BufferCallback callback;
|
||||
bool synthesizer;
|
||||
bool loop;
|
||||
unsigned int channels;
|
||||
@ -138,7 +138,7 @@ ALsizei FramesToBytes(ALsizei size, ALenum channels, ALenum type)
|
||||
|
||||
static unsigned int bufferSampleSize(SEGAContext *context)
|
||||
{
|
||||
return context->channels * ((context->sampleFormat == HASF_SIGNED_16PCM) ? 2 : 1);
|
||||
return context->channels * ((context->sampleFormat == SIGNED_16PCM) ? 2 : 1);
|
||||
}
|
||||
|
||||
static void updateBufferLoop(SEGAContext *context)
|
||||
@ -167,7 +167,7 @@ static void updateBufferData(SEGAContext *context, unsigned int offset, size_t l
|
||||
|
||||
switch (context->sampleFormat)
|
||||
{
|
||||
case HASF_UNSIGNED_8PCM: /* Unsigned (offset 128) 8-bit PCM */
|
||||
case UNSIGNED_8PCM: /* Unsigned (offset 128) 8-bit PCM */
|
||||
alType = AL_BYTE_SOFT;
|
||||
switch (context->channels)
|
||||
{
|
||||
@ -183,7 +183,7 @@ static void updateBufferData(SEGAContext *context, unsigned int offset, size_t l
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case HASF_SIGNED_16PCM: /* Signed 16-bit PCM */
|
||||
case SIGNED_16PCM: /* Signed 16-bit PCM */
|
||||
alType = AL_SHORT_SOFT;
|
||||
switch (context->channels)
|
||||
{
|
||||
@ -281,7 +281,7 @@ int SEGAAPI_Play(void *hHandle)
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
if (context == NULL)
|
||||
return SEGAERR_BAD_PARAM;
|
||||
return SEGA_ERROR_BAD_PARAM;
|
||||
|
||||
// alSourcei(context->alSource, AL_LOOPING, context->loop ? AL_TRUE : AL_FALSE);
|
||||
alSourcei(context->alSource, AL_LOOPING, AL_FALSE);
|
||||
@ -295,7 +295,7 @@ int SEGAAPI_Pause(void *hHandle)
|
||||
dbgPrint("SEGAAPI_Pause() 0x%x", hHandle);
|
||||
SEGAContext *context = hHandle;
|
||||
if (context == NULL)
|
||||
return SEGAERR_BAD_PARAM;
|
||||
return SEGA_ERROR_BAD_PARAM;
|
||||
alSourcePause(context->alSource);
|
||||
return SEGA_SUCCESS;
|
||||
}
|
||||
@ -306,7 +306,7 @@ int SEGAAPI_Stop(void *hHandle)
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
if (context == NULL)
|
||||
return SEGAERR_BAD_PARAM;
|
||||
return SEGA_ERROR_BAD_PARAM;
|
||||
|
||||
alSourceStop(context->alSource);
|
||||
|
||||
@ -318,23 +318,24 @@ int SEGAAPI_PlayWithSetup(void *hHandle)
|
||||
dbgPrint("SEGAAPI_PlayWithSetup() 0x%x", hHandle);
|
||||
SEGAContext *context = hHandle;
|
||||
if (context == NULL)
|
||||
return SEGAERR_BAD_PARAM;
|
||||
return SEGA_ERROR_BAD_PARAM;
|
||||
alSourcei(context->alSource, AL_LOOPING, context->loop ? AL_TRUE : AL_FALSE);
|
||||
alSourcei(context->alSource, AL_BUFFER, context->alBuffer);
|
||||
alSourcePlay(context->alSource);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
PlaybackStatus SEGAAPI_GetPlaybackStatus(void *hHandle)
|
||||
{
|
||||
ALint state;
|
||||
|
||||
dbgPrint("SEGAAPI_GetPlaybackStatus() 0x%x", hHandle);
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
if (context == NULL)
|
||||
return PLAYBACK_STATUS_INVALID;
|
||||
|
||||
ALint state;
|
||||
alGetSourcei(context->alSource, AL_SOURCE_STATE, &state);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case AL_PLAYING:
|
||||
@ -351,16 +352,16 @@ PlaybackStatus SEGAAPI_GetPlaybackStatus(void *hHandle)
|
||||
return PLAYBACK_STATUS_INVALID;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetFormat(void *hHandle, HAWOSEFORMAT *pFormat)
|
||||
int SEGAAPI_SetFormat(void *hHandle, OutputFormat *pFormat)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetFormat() 0x%x", hHandle);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_GetFormat(void *hHandle, HAWOSEFORMAT *pFormat)
|
||||
int SEGAAPI_GetFormat(void *hHandle, OutputFormat *pFormat)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetFormat() 0x%x", hHandle);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetSampleRate(void *hHandle, unsigned int dwSampleRate)
|
||||
@ -368,7 +369,7 @@ int SEGAAPI_SetSampleRate(void *hHandle, unsigned int dwSampleRate)
|
||||
dbgPrint("SEGAAPI_SetSampleRate() 0x%x 0x%x", hHandle, dwSampleRate);
|
||||
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
context->sampleRate = dwSampleRate;
|
||||
@ -380,7 +381,7 @@ unsigned int SEGAAPI_GetSampleRate(void *hHandle)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetSampleRate() 0x%x", hHandle);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
return context->sampleRate;
|
||||
@ -389,20 +390,20 @@ unsigned int SEGAAPI_GetSampleRate(void *hHandle)
|
||||
int SEGAAPI_SetPriority(void *hHandle, unsigned int dwPriority)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetPriority() 0x%x 0x%x", hHandle, dwPriority);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
unsigned int SEGAAPI_GetPriority(void *hHandle)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetPriority() 0x%x", hHandle);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetUserData(void *hHandle, void *hUserData)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetUserData() 0x%x 0x%x", hHandle, hUserData);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
context->userData = hUserData;
|
||||
@ -419,16 +420,16 @@ void *SEGAAPI_GetUserData(void *hHandle)
|
||||
return context->userData;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend, HAROUTING dwDest)
|
||||
int SEGAAPI_SetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend, Routing dwDest)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetSendRouting() 0x%x 0x%x 0x%x 0x%x", hHandle, dwChannel, dwSend, dwDest);
|
||||
return SEGA_SUCCESS;
|
||||
}
|
||||
|
||||
HAROUTING SEGAAPI_GetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend)
|
||||
Routing 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;
|
||||
return UNUSED_PORT;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetSendLevel(void *hHandle, unsigned int dwChannel, unsigned int dwSend, unsigned int dwLevel)
|
||||
@ -446,7 +447,7 @@ unsigned int SEGAAPI_GetSendLevel(void *hHandle, unsigned int dwChannel, unsigne
|
||||
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;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
unsigned int SEGAAPI_GetChannelVolume(void *hHandle, unsigned int dwChannel)
|
||||
@ -459,7 +460,7 @@ int SEGAAPI_SetPlaybackPosition(void *hHandle, unsigned int dwPlaybackPos)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetPlaybackPosition() 0x%x 0x%x", hHandle, dwPlaybackPos);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
alSourcei(context->alSource, AL_BYTE_OFFSET, dwPlaybackPos);
|
||||
@ -472,7 +473,7 @@ unsigned int SEGAAPI_GetPlaybackPosition(void *hHandle)
|
||||
dbgPrint("SEGAAPI_GetPlaybackPosition() 0x%x", hHandle);
|
||||
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
@ -485,26 +486,26 @@ unsigned int SEGAAPI_GetPlaybackPosition(void *hHandle)
|
||||
int SEGAAPI_SetNotificationFrequency(void *hHandle, unsigned int dwFrameCount)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetNotificationFrequency() 0x%x 0x%x", hHandle, dwFrameCount);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetNotificationPoint(void *hHandle, unsigned int dwBufferOffset)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetNotificationPoint() 0x%x 0x%x", hHandle, dwBufferOffset);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_ClearNotificationPoint(void *hHandle, unsigned int dwBufferOffset)
|
||||
{
|
||||
dbgPrint("SEGAAPI_ClearNotificationPoint() 0x%x 0x%x", hHandle, dwBufferOffset);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetStartLoopOffset(void *hHandle, unsigned int dwOffset)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetStartLoopOffset() 0x%x 0x%x", hHandle, dwOffset);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
@ -518,7 +519,7 @@ unsigned int SEGAAPI_GetStartLoopOffset(void *hHandle)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetStartLoopOffset() 0x%x", hHandle);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
@ -529,7 +530,7 @@ int SEGAAPI_SetEndLoopOffset(void *hHandle, unsigned int dwOffset)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetEndLoopOffset() 0x%x 0x%x", hHandle, dwOffset);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
context->endLoop = dwOffset;
|
||||
@ -542,7 +543,7 @@ unsigned int SEGAAPI_GetEndLoopOffset(void *hHandle)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetEndLoopOffset() 0x%x", hHandle);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
@ -553,7 +554,7 @@ int SEGAAPI_SetEndOffset(void *hHandle, unsigned int dwOffset)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetEndOffset() 0x%x 0x%x", hHandle, dwOffset);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
context->endOffset = dwOffset;
|
||||
@ -565,7 +566,7 @@ unsigned int SEGAAPI_GetEndOffset(void *hHandle)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetEndOffset() 0x%x", hHandle);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
@ -576,7 +577,7 @@ int SEGAAPI_SetLoopState(void *hHandle, int loop)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetLoopState() 0x%x 0x%x", hHandle, loop);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
context->loop = loop;
|
||||
@ -588,7 +589,7 @@ int SEGAAPI_GetLoopState(void *hHandle)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetLoopState() 0x%x", hHandle);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
@ -599,25 +600,25 @@ int SEGAAPI_UpdateBuffer(void *hHandle, unsigned int dwStartOffset, unsigned int
|
||||
{
|
||||
dbgPrint("SEGAAPI_UpdateBuffer() 0x%x 0x%x 0x%x", hHandle, dwStartOffset, dwLength);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
updateBufferData(context, dwStartOffset, dwLength);
|
||||
return SEGA_SUCCESS;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetSynthParam(void *hHandle, HASYNTHPARAMSEXT param, int lPARWValue)
|
||||
int SEGAAPI_SetSynthParam(void *hHandle, SynthParams param, int lPARWValue)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetSynthParam() 0x%x 0x%x 0x%x", hHandle, param, lPARWValue);
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
if (context == NULL)
|
||||
return SEGAERR_BAD_PARAM;
|
||||
return SEGA_ERROR_BAD_PARAM;
|
||||
|
||||
switch (param)
|
||||
{
|
||||
case HAVP_ATTENUATION:
|
||||
case ATTENUATION:
|
||||
{
|
||||
float volume = tsf_decibelsToGain(0.0f - lPARWValue / 10.0f);
|
||||
alListenerf(AL_GAIN, volume);
|
||||
@ -626,7 +627,7 @@ int SEGAAPI_SetSynthParam(void *hHandle, HASYNTHPARAMSEXT param, int lPARWValue)
|
||||
}
|
||||
break;
|
||||
|
||||
case HAVP_PITCH:
|
||||
case PITCH:
|
||||
{
|
||||
float semiTones = lPARWValue / 100.0f;
|
||||
// freqRatio = XAudio2SemitonesToFrequencyRatio(semiTones);
|
||||
@ -645,7 +646,7 @@ int SEGAAPI_SetSynthParam(void *hHandle, HASYNTHPARAMSEXT param, int lPARWValue)
|
||||
return SEGA_SUCCESS;
|
||||
}
|
||||
|
||||
int SEGAAPI_GetSynthParam(void *hHandle, HASYNTHPARAMSEXT param)
|
||||
int SEGAAPI_GetSynthParam(void *hHandle, SynthParams param)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetSynthParam() 0x%x 0x%x", hHandle, param);
|
||||
return 0;
|
||||
@ -657,7 +658,7 @@ int SEGAAPI_SetSynthParamMultiple(void *hHandle, unsigned int dwNumParams, Synth
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
if (context == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
for (int i = 0; i < dwNumParams; i++)
|
||||
{
|
||||
@ -670,14 +671,14 @@ int SEGAAPI_SetSynthParamMultiple(void *hHandle, unsigned int dwNumParams, Synth
|
||||
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;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetReleaseState(void *hHandle, int enterReleasePhase)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetReleaseState() 0x%x 0x%x", hHandle, enterReleasePhase);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_HANDLE;
|
||||
return SEGA_ERROR_BAD_HANDLE;
|
||||
|
||||
SEGAContext *context = hHandle;
|
||||
|
||||
@ -690,26 +691,26 @@ int SEGAAPI_SetReleaseState(void *hHandle, int enterReleasePhase)
|
||||
return SEGA_SUCCESS;
|
||||
}
|
||||
|
||||
int SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLBACK pCallback, unsigned int dwFlags, void **phHandle)
|
||||
int SEGAAPI_CreateBuffer(BufferConfig *pConfig, BufferCallback 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))
|
||||
{
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGAERR_BAD_POINTER");
|
||||
return SEGAERR_BAD_POINTER;
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGA_ERROR_BAD_POINTER");
|
||||
return SEGA_ERROR_BAD_POINTER;
|
||||
}
|
||||
|
||||
SEGAContext *context = malloc(sizeof(SEGAContext));
|
||||
if (context == NULL)
|
||||
{
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGAERR_OUT_OF_MEMORY");
|
||||
return SEGAERR_OUT_OF_MEMORY;
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGA_ERROR_OUT_OF_MEMORY");
|
||||
return SEGA_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// dbgPrint("SEGAAPI_CreateBuffer() allocated %i bytes",sizeof(SEGAContext));
|
||||
context->playing = false;
|
||||
context->callback = pCallback;
|
||||
context->synthesizer = dwFlags & HABUF_SYNTH_BUFFER;
|
||||
context->synthesizer = dwFlags & SYNTH_BUFFER;
|
||||
context->sampleRate = pConfig->dwSampleRate;
|
||||
context->sampleFormat = pConfig->dwSampleFormat;
|
||||
context->channels = pConfig->byNumChans;
|
||||
@ -720,20 +721,20 @@ int SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLBACK pCa
|
||||
// can't have all 3 types at once - sanity check
|
||||
if ((dwFlags & 0x06) == 0x06)
|
||||
{
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGAERR_BAD_PARAM");
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGA_ERROR_BAD_PARAM");
|
||||
free(context);
|
||||
return SEGAERR_BAD_PARAM;
|
||||
return SEGA_ERROR_BAD_PARAM;
|
||||
}
|
||||
|
||||
// indiate that caller allocate memory
|
||||
if (dwFlags & HABUF_ALLOC_USER_MEM)
|
||||
// The caller allocates the buffer memory
|
||||
if (dwFlags & ALLOC_USER_MEM)
|
||||
{
|
||||
context->data = pConfig->mapData.hBufferHdr;
|
||||
dbgPrint("SEGAAPI_CreateBuffer() user memory 0x%x", context->data);
|
||||
}
|
||||
|
||||
// reuse memory
|
||||
else if (dwFlags & HABUF_USE_MAPPED_MEM)
|
||||
// We should reuse mapped memory for the buffer
|
||||
else if (dwFlags & USE_MAPPED_MEM)
|
||||
{
|
||||
context->data = pConfig->mapData.hBufferHdr;
|
||||
if (context->data == NULL)
|
||||
@ -742,22 +743,23 @@ int SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLBACK pCa
|
||||
context->data = malloc(context->size);
|
||||
if (context->data == NULL)
|
||||
{
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGAERR_OUT_OF_MEMORY");
|
||||
return SEGAERR_OUT_OF_MEMORY;
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGA_ERROR_OUT_OF_MEMORY");
|
||||
return SEGA_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
dbgPrint("SEGAAPI_CreateBuffer() bad pointer, allocated %i data bytes", context->size);
|
||||
}
|
||||
else
|
||||
dbgPrint("SEGAAPI_CreateBuffer() reusing memory 0x%x", context->data);
|
||||
}
|
||||
// Allocate new buffer (caller will fill it later)
|
||||
|
||||
// We should allocate new buffer which the caller will fill
|
||||
else
|
||||
{
|
||||
context->data = malloc(context->size);
|
||||
if (context->data == NULL)
|
||||
{
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGAERR_OUT_OF_MEMORY");
|
||||
return SEGAERR_OUT_OF_MEMORY;
|
||||
dbgPrint("SEGAAPI_CreateBuffer() SEGA_ERROR_OUT_OF_MEMORY");
|
||||
return SEGA_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
dbgPrint("SEGAAPI_CreateBuffer() allocated %i data bytes", context->size);
|
||||
}
|
||||
@ -785,13 +787,13 @@ int SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLBACK pCa
|
||||
return SEGA_SUCCESS;
|
||||
}
|
||||
|
||||
int SEGAAPI_DestroyBuffer(void *hHandle)
|
||||
int SEGAAPI_DestroyBuffer(void *buffer)
|
||||
{
|
||||
dbgPrint("SEGAAPI_DestroyBuffer() 0x%x", hHandle);
|
||||
if (hHandle == NULL)
|
||||
return SEGAERR_BAD_PARAM;
|
||||
dbgPrint("SEGAAPI_DestroyBuffer() 0x%x", buffer);
|
||||
if (buffer == NULL)
|
||||
return SEGA_ERROR_BAD_PARAM;
|
||||
|
||||
free(hHandle);
|
||||
free(buffer);
|
||||
|
||||
return SEGA_SUCCESS;
|
||||
}
|
||||
@ -805,57 +807,57 @@ int SEGAAPI_SetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pDa
|
||||
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 SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetSPDIFOutChannelStatus(unsigned int dwChannelStatus, unsigned int dwExtChannelStatus)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetSPDIFOutChannelStatus() 0x%x 0x%x", dwChannelStatus, dwExtChannelStatus);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_GetSPDIFOutChannelStatus(unsigned int *pdwChannelStatus, unsigned int *pdwExtChannelStatus)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetSPDIFOutChannelStatus() 0x%x 0x%x", pdwChannelStatus, pdwExtChannelStatus);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate)
|
||||
int SEGAAPI_SetSPDIFOutSampleRate(SPDIFOutputSampleRate dwSamplingRate)
|
||||
{
|
||||
dbgPrint("SEGAAPI_SetSPDIFOutSampleRate() 0x%x", dwSamplingRate);
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void)
|
||||
SPDIFOutputSampleRate SEGAAPI_GetSPDIFOutSampleRate(void)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetSPDIFOutSampleRate()");
|
||||
return HASPDIFOUT_48KHZ;
|
||||
return SPDIFOUT_48KHZ;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetSPDIFOutChannelRouting(unsigned int dwChannel, HAROUTING dwSource)
|
||||
int SEGAAPI_SetSPDIFOutChannelRouting(unsigned int dwChannel, Routing dwSource)
|
||||
{
|
||||
switch (dwChannel)
|
||||
{
|
||||
case 0: // left
|
||||
case OUT_FRONT_LEFT:
|
||||
dbgPrint("SEGAAPI_SetSPDIFOutChannelRouting() dwChannel = LEFT; dwSource = 0x%x", dwSource);
|
||||
break;
|
||||
case 1: // right
|
||||
case OUT_FRONT_RIGHT:
|
||||
dbgPrint("SEGAAPI_SetSPDIFOutChannelRouting() dwChannel = RIGHT; dwSource = 0x%x", dwSource);
|
||||
break;
|
||||
default:
|
||||
dbgPrint("SEGAAPI_SetSPDIFOutChannelRouting() dwChannel = UNKNOWN; dwSource = 0x%x", dwSource);
|
||||
break;
|
||||
}
|
||||
return SEGAERR_UNSUPPORTED;
|
||||
return SEGA_ERROR_UNSUPPORTED;
|
||||
}
|
||||
|
||||
HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(unsigned int dwChannel)
|
||||
Routing SEGAAPI_GetSPDIFOutChannelRouting(unsigned int dwChannel)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetSPDIFOutChannelRouting() 0x%x", dwChannel);
|
||||
return HA_UNUSED_PORT;
|
||||
return UNUSED_PORT;
|
||||
}
|
||||
|
||||
int SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, unsigned int dwVolume)
|
||||
int SEGAAPI_SetIOVolume(SoundBoardIO dwPhysIO, unsigned int dwVolume)
|
||||
{
|
||||
// float v = (dwVolume >> 16) & 0xffff;
|
||||
dbgPrint("SEGAAPI_SetIOVolume() 0x%x 0x%x", dwPhysIO, dwVolume);
|
||||
@ -863,7 +865,7 @@ int SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, unsigned int dwVolume)
|
||||
return SEGA_SUCCESS;
|
||||
}
|
||||
|
||||
unsigned int SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO)
|
||||
unsigned int SEGAAPI_GetIOVolume(SoundBoardIO dwPhysIO)
|
||||
{
|
||||
dbgPrint("SEGAAPI_GetIOVolume() 0x%x", dwPhysIO);
|
||||
return 0xffffffff;
|
||||
@ -894,7 +896,7 @@ int SEGAAPI_Init(void)
|
||||
if (alutInit(NULL, NULL) == AL_FALSE)
|
||||
{
|
||||
dbgPrint("SEGAAPI_Init() alutInit() failed!");
|
||||
return SEGAERR_FAIL;
|
||||
return SEGA_ERROR_FAIL;
|
||||
}
|
||||
|
||||
return SEGA_SUCCESS;
|
||||
|
@ -1,8 +1,7 @@
|
||||
#ifndef __SEGAAPI_H
|
||||
#define __SEGAAPI_H
|
||||
|
||||
#ifndef GUID_DEFINED
|
||||
#define GUID_DEFINED
|
||||
/* GUID Definitions */
|
||||
typedef struct _GUID
|
||||
{
|
||||
unsigned long Data1;
|
||||
@ -10,281 +9,172 @@ typedef struct _GUID
|
||||
unsigned short Data3;
|
||||
unsigned char Data4[8];
|
||||
} GUID;
|
||||
#endif // GUID_DEFINED
|
||||
|
||||
#ifndef DEFINE_GUID
|
||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) extern const GUID name
|
||||
#endif // DEFINE_GUID
|
||||
#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) extern const GUID name
|
||||
|
||||
#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)
|
||||
|
||||
// {A7FEEC3F-2BFD-4a40-891F-7423E38BAC1F}
|
||||
DEFINE_GUID(EAXPROPERTYID_EAX40_SEGA_Custom, 0xa7feec3f, 0x2bfd, 0x4a40, 0x89, 0x1f, 0x74, 0x23, 0xe3, 0x8b, 0xac, 0x1f);
|
||||
|
||||
typedef enum
|
||||
{
|
||||
EAXSEGA_STEREO_RETURN_FX2 = 0,
|
||||
EAXSEGA_STEREO_RETURN_FX3 = 1
|
||||
} EAXSEGA_PROPERTY;
|
||||
/* Return values */
|
||||
#define SEGARESULT_FAILURE(_x) ((1 << 31) | 0xA000 | (_x))
|
||||
#define SEGA_SUCCESS 0L
|
||||
#define SEGA_ERROR_FAIL SEGARESULT_FAILURE(0)
|
||||
#define SEGA_ERROR_BAD_POINTER SEGARESULT_FAILURE(3)
|
||||
#define SEGA_ERROR_UNSUPPORTED SEGARESULT_FAILURE(5)
|
||||
#define SEGA_ERROR_BAD_PARAM SEGARESULT_FAILURE(9)
|
||||
#define SEGA_ERROR_INVALID_CHANNEL SEGARESULT_FAILURE(10)
|
||||
#define SEGA_ERROR_INVALID_SEND SEGARESULT_FAILURE(11)
|
||||
#define SEGA_ERROR_PLAYING SEGARESULT_FAILURE(12)
|
||||
#define SEGA_ERROR_NO_RESOURCES SEGARESULT_FAILURE(13)
|
||||
#define SEGA_ERROR_BAD_CONFIG SEGARESULT_FAILURE(14)
|
||||
#define SEGA_ERROR_BAD_HANDLE SEGARESULT_FAILURE(18)
|
||||
#define SEGA_ERROR_BAD_SAMPLERATE SEGARESULT_FAILURE(28)
|
||||
#define SEGA_ERROR_OUT_OF_MEMORY SEGARESULT_FAILURE(31)
|
||||
#define SEGA_ERROR_INIT_FAILED SEGARESULT_FAILURE(39)
|
||||
|
||||
/**
|
||||
* The following defines all of the messages wave output clients
|
||||
* can receive as part of their callback routines.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
HAWOS_RESOURCE_STOLEN = 0,
|
||||
HAWOS_NOTIFY = 2
|
||||
} HAWOSMESSAGETYPE;
|
||||
/* Values used in various functions */
|
||||
#define SYNTH_BUFFER 0x00000001
|
||||
#define ALLOC_USER_MEM 0x00000002
|
||||
#define USE_MAPPED_MEM 0x00000003
|
||||
#define UNSIGNED_8PCM 0x0004
|
||||
#define SIGNED_16PCM 0x0020
|
||||
#define VOL_MAX 0xFFFFFFFF
|
||||
#define P_MINIMUM 0
|
||||
#define P_MAXIMUM 0xFFFFFFFF
|
||||
#define UNUSED_SEND 0xFFFF0001
|
||||
|
||||
/*
|
||||
* The Playback status.
|
||||
*/
|
||||
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 */
|
||||
STEREO_RETURN_FX2 = 0,
|
||||
STEREO_RETURN_FX3 = 1
|
||||
} SegaProperty;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RESOURCE_STOLEN = 0,
|
||||
NOTIFY = 2
|
||||
} CallbackMessage;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
PLAYBACK_STATUS_STOP,
|
||||
PLAYBACK_STATUS_ACTIVE,
|
||||
PLAYBACK_STATUS_PAUSE,
|
||||
PLAYBACK_STATUS_INVALID = -1
|
||||
} PlaybackStatus;
|
||||
|
||||
/*
|
||||
* dwFlags use in CreateBuffer.
|
||||
*/
|
||||
#define HABUF_SYNTH_BUFFER 0x00000001 // indiate to create a synth buffer
|
||||
#define HABUF_ALLOC_USER_MEM 0x00000002 // 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.
|
||||
*/
|
||||
|
||||
#ifndef __HAWAVE_H
|
||||
#define HASF_UNSIGNED_8PCM 0x0004 /* Unsigned (offset 128) 8-bit PCM */
|
||||
#define HASF_SIGNED_16PCM 0x0020 /* Signed 16-bit PCM */
|
||||
#endif
|
||||
typedef struct
|
||||
{
|
||||
unsigned int dwSampleRate;
|
||||
unsigned int dwSampleFormat;
|
||||
unsigned int byNumChans;
|
||||
} OutputFormat;
|
||||
|
||||
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;
|
||||
unsigned int dwSize;
|
||||
unsigned int dwOffset;
|
||||
void *hBufferHdr;
|
||||
} MapData;
|
||||
|
||||
/*
|
||||
* HAWOSEMAPDATA contains
|
||||
*/
|
||||
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;
|
||||
unsigned int dwPriority;
|
||||
unsigned int dwSampleRate;
|
||||
unsigned int dwSampleFormat;
|
||||
unsigned int byNumChans;
|
||||
unsigned int dwReserved;
|
||||
void *hUserData;
|
||||
MapData mapData;
|
||||
} BufferConfig;
|
||||
|
||||
/*
|
||||
* 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
|
||||
typedef enum Routing
|
||||
{
|
||||
unsigned int dwPriority; /* The priority with which the voices
|
||||
* should be allocated. This is used
|
||||
* when voices need to be ripped off. */
|
||||
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). */
|
||||
unsigned int dwReserved; /* Reserved field */
|
||||
void *hUserData; /* User data */
|
||||
HAWOSEMAPDATA mapData; /* The sample memory mapping for the buffer. */
|
||||
} HAWOSEBUFFERCONFIG;
|
||||
UNUSED_PORT = UNUSED_SEND,
|
||||
FRONT_LEFT_PORT = 0,
|
||||
FRONT_RIGHT_PORT = 1,
|
||||
FRONT_CENTER_PORT = 2,
|
||||
LFE_PORT = 3,
|
||||
REAR_LEFT_PORT = 4,
|
||||
REAR_RIGHT_PORT = 5,
|
||||
FXSLOT0_PORT = 10,
|
||||
FXSLOT1_PORT = 11,
|
||||
FXSLOT2_PORT = 12,
|
||||
FXSLOT3_PORT = 13
|
||||
} Routing;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
* than 63.
|
||||
*
|
||||
* Set voice priority to HAWOSEP_MAXIMUM if a voice must never get ripped
|
||||
* off under any circumstances.
|
||||
*/
|
||||
#define HAWOSEP_MINIMUM 0
|
||||
#define HAWOSEP_MAXIMUM 0xFFFFFFFF
|
||||
|
||||
/** @brief Routing List
|
||||
*
|
||||
* voice sends routing to speakers or effects ports.
|
||||
*
|
||||
*/
|
||||
#define HAWOSE_UNUSED_SEND 0xFFFF0001
|
||||
|
||||
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,
|
||||
|
||||
// effect outputs
|
||||
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,
|
||||
HASPDIFOUT_48KHZ,
|
||||
HASPDIFOUT_96KHZ
|
||||
} HASPDIFOUTRATE;
|
||||
SPDIFOUT_44_1KHZ = 0,
|
||||
SPDIFOUT_48KHZ,
|
||||
SPDIFOUT_96KHZ
|
||||
} SPDIFOutputSampleRate;
|
||||
|
||||
/**
|
||||
* The following defines inputs and outputs of SEGA sound board.
|
||||
*/
|
||||
typedef enum HAPHYSICALIO
|
||||
typedef enum SoundBoardIO
|
||||
{
|
||||
// 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,
|
||||
OUT_FRONT_LEFT = 0,
|
||||
OUT_FRONT_RIGHT = 1,
|
||||
OUT_FRONT_CENTER = 2,
|
||||
OUT_LFE_PORT = 3,
|
||||
OUT_REAR_LEFT = 4,
|
||||
OUT_REAR_RIGHT = 5,
|
||||
OUT_OPTICAL_LEFT = 10,
|
||||
OUT_OPTICAL_RIGHT = 11,
|
||||
IN_LINEIN_LEFT = 20,
|
||||
IN_LINEIN_RIGHT = 21
|
||||
} SoundBoardIO;
|
||||
|
||||
// optical Outputs
|
||||
HA_OUT_OPTICAL_LEFT = 10,
|
||||
HA_OUT_OPTICAL_RIGHT = 11,
|
||||
|
||||
// Line In
|
||||
HA_IN_LINEIN_LEFT = 20,
|
||||
HA_IN_LINEIN_RIGHT = 21
|
||||
|
||||
} HAPHYSICALIO;
|
||||
|
||||
/** @brief Synth parameters enumeration list
|
||||
*
|
||||
* This table defines the most common (and hardware-supported)
|
||||
* control routings in Real World Unit.
|
||||
*
|
||||
* Refers to DLS spec or SoundFont spec for details of these Parameters,
|
||||
* their units and their ranges.
|
||||
*/
|
||||
typedef enum HASYNTHPARAMSEXT
|
||||
typedef enum SynthParams
|
||||
{
|
||||
HAVP_ATTENUATION, ///< 0, 0x00, initialAttenuation
|
||||
HAVP_PITCH, ///< 1, 0x01, fineTune + coarseTune * 100
|
||||
HAVP_FILTER_CUTOFF, ///< 2, 0x02, initialFilterFc
|
||||
HAVP_FILTER_Q, ///< 3, 0x03, initialFilterQ
|
||||
HAVP_DELAY_VOL_ENV, ///< 4, 0x04, delayVolEnv
|
||||
HAVP_ATTACK_VOL_ENV, ///< 5, 0x05, attackVolEnv
|
||||
HAVP_HOLD_VOL_ENV, ///< 6, 0x06, holdVolEnv
|
||||
HAVP_DECAY_VOL_ENV, ///< 7, 0x07, decayVolEnv
|
||||
HAVP_SUSTAIN_VOL_ENV, ///< 8, 0x08, sustainVolEnv
|
||||
HAVP_RELEASE_VOL_ENV, ///< 9, 0x09, releaseVolEnv
|
||||
HAVP_DELAY_MOD_ENV, ///< 10, 0x0A, delayModEnv
|
||||
HAVP_ATTACK_MOD_ENV, ///< 11, 0x0B, attackModEnv
|
||||
HAVP_HOLD_MOD_ENV, ///< 12, 0x0C, holdModEnv
|
||||
HAVP_DECAY_MOD_ENV, ///< 13, 0x0D, decayModEnv
|
||||
HAVP_SUSTAIN_MOD_ENV, ///< 14, 0x0E, sustainModEnv
|
||||
HAVP_RELEASE_MOD_ENV, ///< 15, 0x0F, releaseModEnv
|
||||
HAVP_DELAY_MOD_LFO, ///< 16, 0x10, delayModLFO
|
||||
HAVP_FREQ_MOD_LFO, ///< 17, 0x11, freqModLFO
|
||||
HAVP_DELAY_VIB_LFO, ///< 18, 0x12, delayVibLFO
|
||||
HAVP_FREQ_VIB_LFO, ///< 19, 0x13, freqVibLFO
|
||||
HAVP_MOD_LFO_TO_PITCH, ///< 20, 0x14, modLfoToPitch
|
||||
HAVP_VIB_LFO_TO_PITCH, ///< 21, 0x15, vibLfoToPitch
|
||||
HAVP_MOD_LFO_TO_FILTER_CUTOFF, ///< 22, 0x16, modLfoToFilterFc
|
||||
HAVP_MOD_LFO_TO_ATTENUATION, ///< 23, 0x17, modLfoToVolume
|
||||
HAVP_MOD_ENV_TO_PITCH, ///< 24, 0x18, modEnvToPitch
|
||||
HAVP_MOD_ENV_TO_FILTER_CUTOFF ///< 25, 0x19, modEnvToFilterFc
|
||||
ATTENUATION,
|
||||
PITCH,
|
||||
FILTER_CUTOFF,
|
||||
FILTER_Q,
|
||||
DELAY_VOL_ENV,
|
||||
ATTACK_VOL_ENV,
|
||||
HOLD_VOL_ENV,
|
||||
DECAY_VOL_ENV,
|
||||
SUSTAIN_VOL_ENV,
|
||||
RELEASE_VOL_ENV,
|
||||
DELAY_MOD_ENV,
|
||||
ATTACK_MOD_ENV,
|
||||
HOLD_MOD_ENV,
|
||||
DECAY_MOD_ENV,
|
||||
SUSTAIN_MOD_ENV,
|
||||
RELEASE_MOD_ENV,
|
||||
DELAY_MOD_LFO,
|
||||
FREQ_MOD_LFO,
|
||||
DELAY_VIB_LFO,
|
||||
FREQ_VIB_LFO,
|
||||
MOD_LFO_TO_PITCH,
|
||||
VIB_LFO_TO_PITCH,
|
||||
MOD_LFO_TO_FILTER_CUTOFF,
|
||||
MOD_LFO_TO_ATTENUATION,
|
||||
MOD_ENV_TO_PITCH,
|
||||
MOD_ENV_TO_FILTER_CUTOFF
|
||||
|
||||
} HASYNTHPARAMSEXT;
|
||||
} SynthParams;
|
||||
|
||||
#ifndef __SYNTHPARAMSET_
|
||||
#define __SYNTHPARAMSET_
|
||||
typedef struct SynthParamSetExt
|
||||
{
|
||||
HASYNTHPARAMSEXT param;
|
||||
SynthParams param;
|
||||
int lPARWValue;
|
||||
} SynthParamSet;
|
||||
#endif
|
||||
|
||||
/*
|
||||
How this SYNTH PARAMS EXT maps to Sega API requests:
|
||||
|
||||
HAVP_ATTENUATION, SetVolume()
|
||||
HAVP_PITCH, SetPitch()
|
||||
HAVP_FILTER_CUTOFF, SetFilter()
|
||||
HAVP_FILTER_Q, SetFilter()
|
||||
HAVP_DELAY_VOL_ENV, SetEG()
|
||||
HAVP_ATTACK_VOL_ENV, SetEG()
|
||||
HAVP_HOLD_VOL_ENV, SetEG()
|
||||
HAVP_DECAY_VOL_ENV, SetEG()
|
||||
HAVP_SUSTAIN_VOL_ENV, SetEG()
|
||||
HAVP_RELEASE_VOL_ENV, SetEG()
|
||||
HAVP_DELAY_MOD_ENV, SetEG()
|
||||
HAVP_ATTACK_MOD_ENV, SetEG()
|
||||
HAVP_HOLD_MOD_ENV, SetEG()
|
||||
HAVP_DECAY_MOD_ENV, SetEG()
|
||||
HAVP_SUSTAIN_MOD_ENV, SetEG()
|
||||
HAVP_RELEASE_MOD_ENV, SetEG()
|
||||
HAVP_DELAY_MOD_LFO, SetLFO()
|
||||
HAVP_FREQ_MOD_LFO, SetLFO()
|
||||
HAVP_DELAY_VIB_LFO, SetLFO()
|
||||
HAVP_FREQ_VIB_LFO, SetLFO()
|
||||
HAVP_MOD_LFO_TO_PITCH, SetLFO()
|
||||
HAVP_VIB_LFO_TO_PITCH, SetLFO()
|
||||
HAVP_MOD_LFO_TO_FILTER_CUTOFF, SetLFO()
|
||||
HAVP_MOD_LFO_TO_ATTENUATION, SetLFO()
|
||||
HAVP_MOD_ENV_TO_PITCH, SetEG()
|
||||
HAVP_MOD_ENV_TO_FILTER_CUTOFF, SetEG()
|
||||
|
||||
*/
|
||||
|
||||
int SEGAAPI_Play(void *hHandle);
|
||||
int SEGAAPI_Pause(void *hHandle);
|
||||
int SEGAAPI_Stop(void *hHandle);
|
||||
int SEGAAPI_PlayWithSetup(void *hHandle);
|
||||
PlaybackStatus SEGAAPI_GetPlaybackStatus(void *hHandle);
|
||||
int SEGAAPI_SetFormat(void *hHandle, HAWOSEFORMAT *pFormat);
|
||||
int SEGAAPI_GetFormat(void *hHandle, HAWOSEFORMAT *pFormat);
|
||||
int SEGAAPI_SetFormat(void *hHandle, OutputFormat *pFormat);
|
||||
int SEGAAPI_GetFormat(void *hHandle, OutputFormat *pFormat);
|
||||
int SEGAAPI_SetSampleRate(void *hHandle, unsigned int dwSampleRate);
|
||||
unsigned int SEGAAPI_GetSampleRate(void *hHandle);
|
||||
int SEGAAPI_SetPriority(void *hHandle, unsigned int dwPriority);
|
||||
unsigned int SEGAAPI_GetPriority(void *hHandle);
|
||||
int SEGAAPI_SetUserData(void *hHandle, void *hUserData);
|
||||
void *SEGAAPI_GetUserData(void *hHandle);
|
||||
int SEGAAPI_SetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend, HAROUTING dwDest);
|
||||
HAROUTING SEGAAPI_GetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend);
|
||||
int SEGAAPI_SetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend, Routing dwDest);
|
||||
Routing SEGAAPI_GetSendRouting(void *hHandle, unsigned int dwChannel, unsigned int dwSend);
|
||||
int SEGAAPI_SetSendLevel(void *hHandle, unsigned int dwChannel, unsigned int dwSend, unsigned int dwLevel);
|
||||
unsigned int SEGAAPI_GetSendLevel(void *hHandle, unsigned int dwChannel, unsigned int dwSend);
|
||||
int SEGAAPI_SetChannelVolume(void *hHandle, unsigned int dwChannel, unsigned int dwVolume);
|
||||
@ -303,24 +193,24 @@ unsigned int SEGAAPI_GetEndOffset(void *hHandle);
|
||||
int SEGAAPI_SetLoopState(void *hHandle, int bDoContinuousLooping);
|
||||
int SEGAAPI_GetLoopState(void *hHandle);
|
||||
int SEGAAPI_UpdateBuffer(void *hHandle, unsigned int dwStartOffset, unsigned int dwLength);
|
||||
int SEGAAPI_SetSynthParam(void *hHandle, HASYNTHPARAMSEXT param, int lPARWValue);
|
||||
int SEGAAPI_GetSynthParam(void *hHandle, HASYNTHPARAMSEXT param);
|
||||
int SEGAAPI_SetSynthParam(void *hHandle, SynthParams param, int lPARWValue);
|
||||
int SEGAAPI_GetSynthParam(void *hHandle, SynthParams param);
|
||||
int SEGAAPI_SetSynthParamMultiple(void *hHandle, unsigned int dwNumParams, SynthParamSet *pSynthParams);
|
||||
int SEGAAPI_GetSynthParamMultiple(void *hHandle, unsigned int dwNumParams, SynthParamSet *pSynthParams);
|
||||
int SEGAAPI_SetReleaseState(void *hHandle, int bSet);
|
||||
typedef void (*HAWOSEGABUFFERCALLBACK)(void *hHandle, HAWOSMESSAGETYPE message);
|
||||
int SEGAAPI_CreateBuffer(HAWOSEBUFFERCONFIG *pConfig, HAWOSEGABUFFERCALLBACK pCallback, unsigned int dwFlags, void **phHandle);
|
||||
typedef void (*BufferCallback)(void *hHandle, CallbackMessage message);
|
||||
int SEGAAPI_CreateBuffer(BufferConfig *pConfig, BufferCallback pCallback, unsigned int dwFlags, void **phHandle);
|
||||
int SEGAAPI_DestroyBuffer(void *hHandle);
|
||||
int SEGAAPI_SetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize);
|
||||
int SEGAAPI_GetGlobalEAXProperty(GUID *guid, unsigned long ulProperty, void *pData, unsigned long ulDataSize);
|
||||
int SEGAAPI_SetSPDIFOutChannelStatus(unsigned int dwChannelStatus, unsigned int dwExtChannelStatus);
|
||||
int SEGAAPI_GetSPDIFOutChannelStatus(unsigned int *pdwChannelStatus, unsigned int *pdwExtChannelStatus);
|
||||
int SEGAAPI_SetSPDIFOutSampleRate(HASPDIFOUTRATE dwSamplingRate);
|
||||
HASPDIFOUTRATE SEGAAPI_GetSPDIFOutSampleRate(void);
|
||||
int SEGAAPI_SetSPDIFOutChannelRouting( unsigned int dwChannel, HAROUTING dwSource);
|
||||
HAROUTING SEGAAPI_GetSPDIFOutChannelRouting(unsigned int dwChannel);
|
||||
int SEGAAPI_SetIOVolume(HAPHYSICALIO dwPhysIO, unsigned int dwVolume);
|
||||
unsigned int SEGAAPI_GetIOVolume(HAPHYSICALIO dwPhysIO);
|
||||
int SEGAAPI_SetSPDIFOutSampleRate(SPDIFOutputSampleRate dwSamplingRate);
|
||||
SPDIFOutputSampleRate SEGAAPI_GetSPDIFOutSampleRate(void);
|
||||
int SEGAAPI_SetSPDIFOutChannelRouting(unsigned int dwChannel, Routing dwSource);
|
||||
Routing SEGAAPI_GetSPDIFOutChannelRouting(unsigned int dwChannel);
|
||||
int SEGAAPI_SetIOVolume(SoundBoardIO dwPhysIO, unsigned int dwVolume);
|
||||
unsigned int SEGAAPI_GetIOVolume(SoundBoardIO dwPhysIO);
|
||||
void SEGAAPI_SetLastStatus(int LastStatus);
|
||||
int SEGAAPI_GetLastStatus(void);
|
||||
int SEGAAPI_Reset(void);
|
||||
|
Loading…
Reference in New Issue
Block a user