mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-27 05:32:45 +00:00
CRYO: More cleaning and renaming
This commit is contained in:
parent
df8f48b023
commit
1b34a02db7
@ -210,16 +210,16 @@ void CLHNM_WaitLoop(hnm_t *hnm) {
|
||||
time_drift = TimerTicks - next_frame_time;
|
||||
}
|
||||
|
||||
void CLHNM_SetupSound(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode) {
|
||||
void CLHNM_SetupSound(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode) {
|
||||
soundChannel = CLSoundChannel_New(mode);
|
||||
soundGroup = CLSoundGroup_New(numSounds, arg4, sampleSize, rate, mode);
|
||||
soundGroup = CLSoundGroup_New(numSounds, length, sampleSize, rate, mode);
|
||||
if (sampleSize == 16)
|
||||
CLSoundGroup_Reverse16All(soundGroup);
|
||||
}
|
||||
|
||||
void CLHNM_SetupSoundADPCM(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode) {
|
||||
void CLHNM_SetupSoundADPCM(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode) {
|
||||
soundChannel_adpcm = CLSoundChannel_New(mode);
|
||||
soundGroup_adpcm = CLSoundGroup_New(numSounds, arg4, sampleSize, rate, mode);
|
||||
soundGroup_adpcm = CLSoundGroup_New(numSounds, length, sampleSize, rate, mode);
|
||||
}
|
||||
|
||||
void CLHNM_CloseSound() {
|
||||
@ -568,7 +568,7 @@ bool CLHNM_NextElement(hnm_t *hnm) {
|
||||
if (!h6) {
|
||||
int sound_size = sz - 8;
|
||||
if (!use_adpcm) {
|
||||
CLSoundGroup_SetDatas(soundGroup, hnm->_dataPtr, sound_size - 2, 0);
|
||||
CLSoundGroup_SetDatas(soundGroup, hnm->_dataPtr, sound_size - 2, false);
|
||||
if (sound_started)
|
||||
CLSoundGroup_PlayNextSample(soundGroup, soundChannel);
|
||||
else
|
||||
@ -579,10 +579,10 @@ bool CLHNM_NextElement(hnm_t *hnm) {
|
||||
const int kDecompTableSize = 256 * sizeof(int16);
|
||||
CLHNM_LoadDecompTable((int16 *)hnm->_dataPtr);
|
||||
CLHNM_DecompADPCM(hnm->_dataPtr + kDecompTableSize, sound_buffer, sound_size - kDecompTableSize);
|
||||
CLSoundGroup_AssignDatas(soundGroup_adpcm, sound_buffer, (sound_size - kDecompTableSize) * 2, 0);
|
||||
CLSoundGroup_AssignDatas(soundGroup_adpcm, sound_buffer, (sound_size - kDecompTableSize) * 2, false);
|
||||
} else {
|
||||
CLHNM_DecompADPCM(hnm->_dataPtr, sound_buffer, sound_size);
|
||||
CLSoundGroup_AssignDatas(soundGroup_adpcm, sound_buffer, sound_size * 2, 0);
|
||||
CLSoundGroup_AssignDatas(soundGroup_adpcm, sound_buffer, sound_size * 2, false);
|
||||
}
|
||||
pending_sounds++;
|
||||
if (sound_started)
|
||||
|
@ -24,20 +24,17 @@
|
||||
|
||||
namespace Cryo {
|
||||
|
||||
soundgroup_t *CLSoundGroup_New(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode) {
|
||||
soundgroup_t *sg;
|
||||
int16 i;
|
||||
|
||||
sg = (soundgroup_t *)malloc(sizeof(*sg));
|
||||
soundgroup_t *CLSoundGroup_New(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode) {
|
||||
soundgroup_t *sg = (soundgroup_t *)malloc(sizeof(*sg));
|
||||
if (numSounds < kCryoMaxClSounds)
|
||||
sg->_numSounds = numSounds;
|
||||
else
|
||||
error("CLSoundGroup_New - numSounds >= kCryoMaxClSounds");
|
||||
|
||||
for (i = 0; i < sg->_numSounds; i++) {
|
||||
sound_t *sound = CLSoundRaw_New(arg4, rate, sampleSize, mode);
|
||||
for (int i = 0; i < sg->_numSounds; i++) {
|
||||
sound_t *sound = CLSoundRaw_New(length, rate, sampleSize, mode);
|
||||
sg->_sound[i] = sound;
|
||||
sound->ff_1A = arg4;
|
||||
sound->_maxLength = length;
|
||||
}
|
||||
sg->_soundIndex = 0;
|
||||
sg->_playIndex = 0;
|
||||
@ -47,15 +44,13 @@ soundgroup_t *CLSoundGroup_New(int16 numSounds, int16 arg4, int16 sampleSize, fl
|
||||
}
|
||||
|
||||
void CLSoundGroup_Free(soundgroup_t *sg) {
|
||||
int16 i;
|
||||
for (i = 0; i < sg->_numSounds; i++)
|
||||
for (int16 i = 0; i < sg->_numSounds; i++)
|
||||
CLSoundRaw_Free(sg->_sound[i]);
|
||||
free(sg);
|
||||
}
|
||||
|
||||
void CLSoundGroup_Reverse16All(soundgroup_t *sg) {
|
||||
int16 i;
|
||||
for (i = 0; i < sg->_numSounds; i++)
|
||||
for (int16 i = 0; i < sg->_numSounds; i++)
|
||||
sg->_sound[i]->_reversed = true;
|
||||
}
|
||||
|
||||
@ -66,12 +61,12 @@ void *CLSoundGroup_GetNextBuffer(soundgroup_t *sg) {
|
||||
return sound->sndHandle + sound->_headerLen;
|
||||
}
|
||||
|
||||
int16 CLSoundGroup_AssignDatas(soundgroup_t *sg, void *buffer, int length, int16 isSigned) {
|
||||
bool CLSoundGroup_AssignDatas(soundgroup_t *sg, void *buffer, int length, bool isSigned) {
|
||||
sound_t *sound = sg->_sound[sg->_soundIndex];
|
||||
if (sg->ff_106)
|
||||
while (sound->_locked) ;
|
||||
else if (sound->_locked)
|
||||
return 0;
|
||||
return false;
|
||||
sound->_buffer = (char *)buffer;
|
||||
CLSound_SetLength(sound, length);
|
||||
sound->_length = length;
|
||||
@ -84,19 +79,20 @@ int16 CLSoundGroup_AssignDatas(soundgroup_t *sg, void *buffer, int length, int16
|
||||
else
|
||||
sg->_soundIndex++;
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
int16 CLSoundGroup_SetDatas(soundgroup_t *sg, void *data, int length, int16 isSigned) {
|
||||
bool CLSoundGroup_SetDatas(soundgroup_t *sg, void *data, int length, bool isSigned) {
|
||||
void *buffer;
|
||||
sound_t *sound = sg->_sound[sg->_soundIndex];
|
||||
if (length >= sound->ff_1A) {
|
||||
if (length >= sound->_maxLength)
|
||||
error("CLSoundGroup_SetDatas - Unexpected length");
|
||||
}
|
||||
|
||||
if (sg->ff_106)
|
||||
while (sound->_locked) ;
|
||||
else if (sound->_locked)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
buffer = sound->sndHandle + sound->_headerLen;
|
||||
sound->_buffer = (char *)buffer;
|
||||
memcpy(buffer, data, length);
|
||||
@ -111,7 +107,7 @@ int16 CLSoundGroup_SetDatas(soundgroup_t *sg, void *data, int length, int16 isSi
|
||||
else
|
||||
sg->_soundIndex++;
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CLSoundGroup_PlayNextSample(soundgroup_t *sg, soundchannel_t *ch) {
|
||||
|
@ -24,12 +24,12 @@
|
||||
|
||||
namespace Cryo {
|
||||
|
||||
sound_t *CLSoundRaw_New(int16 arg1, float rate, int16 sampleSize, int16 mode) {
|
||||
sound_t *CLSoundRaw_New(int16 length, float rate, int16 sampleSize, int16 mode) {
|
||||
sound_t *sound;
|
||||
|
||||
sound = (sound_t *)malloc(sizeof(*sound));
|
||||
if (sound) {
|
||||
sound->ff_1A = arg1;
|
||||
sound->_maxLength = length;
|
||||
sound->_rate = rate;
|
||||
sound->_sampleSize = sampleSize;
|
||||
sound->_buffer = nullptr;
|
||||
|
@ -132,7 +132,7 @@ struct sound_t {
|
||||
|
||||
char *_buffer;
|
||||
int ff_16;
|
||||
int16 ff_1A;
|
||||
int16 _maxLength;
|
||||
float _rate;
|
||||
int16 _sampleSize;
|
||||
int _length;
|
||||
@ -177,15 +177,15 @@ extern volatile int32 TimerTicks;
|
||||
extern View ScreenView;
|
||||
|
||||
|
||||
soundgroup_t *CLSoundGroup_New(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode);
|
||||
soundgroup_t *CLSoundGroup_New(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode);
|
||||
void CLSoundGroup_Free(soundgroup_t *sg);
|
||||
void CLSoundGroup_Reverse16All(soundgroup_t *sg);
|
||||
void *CLSoundGroup_GetNextBuffer(soundgroup_t *sg);
|
||||
int16 CLSoundGroup_AssignDatas(soundgroup_t *sg, void *buffer, int length, int16 isSigned);
|
||||
int16 CLSoundGroup_SetDatas(soundgroup_t *sg, void *data, int length, int16 isSigned);
|
||||
bool CLSoundGroup_AssignDatas(soundgroup_t *sg, void *buffer, int length, bool isSigned);
|
||||
bool CLSoundGroup_SetDatas(soundgroup_t *sg, void *data, int length, bool isSigned);
|
||||
void CLSoundGroup_PlayNextSample(soundgroup_t *sg, soundchannel_t *ch);
|
||||
|
||||
sound_t *CLSoundRaw_New(int16 arg1, float rate, int16 sampleSize, int16 mode);
|
||||
sound_t *CLSoundRaw_New(int16 length, float rate, int16 sampleSize, int16 mode);
|
||||
void CLSoundRaw_Free(sound_t *sound);
|
||||
void CLSoundRaw_AssignBuffer(sound_t *sound, void *buffer, int bufferOffs, int length);
|
||||
|
||||
@ -259,8 +259,8 @@ void CLHNM_Init();
|
||||
void CLHNM_Done();
|
||||
void CLHNM_SetupTimer(float rate);
|
||||
void CLHNM_WaitLoop(hnm_t *hnm);
|
||||
void CLHNM_SetupSound(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode);
|
||||
void CLHNM_SetupSoundADPCM(int16 numSounds, int16 arg4, int16 sampleSize, float rate, int16 mode);
|
||||
void CLHNM_SetupSound(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode);
|
||||
void CLHNM_SetupSoundADPCM(int16 numSounds, int16 length, int16 sampleSize, float rate, int16 mode);
|
||||
void CLHNM_CloseSound();
|
||||
void CLHNM_SetForceZero2Black(bool forceblack);
|
||||
hnm_t *CLHNM_New(int preload_size);
|
||||
|
Loading…
x
Reference in New Issue
Block a user