mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 19:20:46 +00:00
Fix function that some sadist formatted with 3 spaces
git-svn-id: https://svn.eduke32.com/eduke32@7280 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
06ac4f88b9
commit
ea94b36dec
1 changed files with 71 additions and 70 deletions
|
@ -362,96 +362,97 @@ priority.
|
||||||
|
|
||||||
int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
int32_t MV_PlayVorbis(char *ptr, uint32_t length, int32_t loopstart, int32_t loopend, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t priority, float volume, uint32_t callbackval)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(loopend);
|
UNREFERENCED_PARAMETER(loopend);
|
||||||
|
|
||||||
if (!MV_Installed)
|
if (!MV_Installed)
|
||||||
{
|
{
|
||||||
MV_SetErrorCode(MV_NotInstalled);
|
MV_SetErrorCode(MV_NotInstalled);
|
||||||
return MV_Error;
|
return MV_Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *vd = (vorbis_data *)calloc(1, sizeof(vorbis_data));
|
auto *vd = (vorbis_data *)calloc(1, sizeof(vorbis_data));
|
||||||
|
|
||||||
if (!vd)
|
if (!vd)
|
||||||
{
|
{
|
||||||
MV_SetErrorCode(MV_InvalidFile);
|
MV_SetErrorCode(MV_InvalidFile);
|
||||||
return MV_Error;
|
return MV_Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
vd->ptr = ptr;
|
vd->ptr = ptr;
|
||||||
vd->pos = 0;
|
vd->pos = 0;
|
||||||
vd->length = length;
|
vd->length = length;
|
||||||
vd->lastbitstream = -1;
|
|
||||||
|
|
||||||
int32_t status = ov_open_callbacks((void *)vd, &vd->vf, 0, 0, vorbis_callbacks);
|
vd->lastbitstream = -1;
|
||||||
|
|
||||||
if (status < 0)
|
int32_t status = ov_open_callbacks((void *)vd, &vd->vf, 0, 0, vorbis_callbacks);
|
||||||
{
|
|
||||||
free(vd);
|
|
||||||
MV_Printf("MV_PlayVorbis: err %d\n", status);
|
|
||||||
MV_SetErrorCode(MV_InvalidFile);
|
|
||||||
return MV_Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
vorbis_info *vi = ov_info(&vd->vf, 0);
|
if (status < 0)
|
||||||
|
{
|
||||||
|
free(vd);
|
||||||
|
MV_Printf("MV_PlayVorbis: err %d\n", status);
|
||||||
|
MV_SetErrorCode(MV_InvalidFile);
|
||||||
|
return MV_Error;
|
||||||
|
}
|
||||||
|
|
||||||
if (!vi)
|
vorbis_info *vi = ov_info(&vd->vf, 0);
|
||||||
{
|
|
||||||
ov_clear(&vd->vf);
|
|
||||||
free(vd);
|
|
||||||
MV_SetErrorCode(MV_InvalidFile);
|
|
||||||
return MV_Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (vi->channels != 1 && vi->channels != 2)
|
if (!vi)
|
||||||
{
|
{
|
||||||
ov_clear(&vd->vf);
|
ov_clear(&vd->vf);
|
||||||
free(vd);
|
free(vd);
|
||||||
MV_SetErrorCode(MV_InvalidFile);
|
MV_SetErrorCode(MV_InvalidFile);
|
||||||
return MV_Error;
|
return MV_Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Request a voice from the voice pool
|
if (vi->channels != 1 && vi->channels != 2)
|
||||||
VoiceNode *voice = MV_AllocVoice(priority);
|
{
|
||||||
|
ov_clear(&vd->vf);
|
||||||
|
free(vd);
|
||||||
|
MV_SetErrorCode(MV_InvalidFile);
|
||||||
|
return MV_Error;
|
||||||
|
}
|
||||||
|
|
||||||
if (voice == NULL)
|
// Request a voice from the voice pool
|
||||||
{
|
VoiceNode *voice = MV_AllocVoice(priority);
|
||||||
ov_clear(&vd->vf);
|
|
||||||
free(vd);
|
|
||||||
MV_SetErrorCode(MV_NoVoices);
|
|
||||||
return MV_Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
voice->wavetype = FMT_VORBIS;
|
if (voice == NULL)
|
||||||
voice->bits = 16;
|
{
|
||||||
voice->channels = vi->channels;
|
ov_clear(&vd->vf);
|
||||||
voice->rawdataptr = (void *) vd;
|
free(vd);
|
||||||
voice->GetSound = MV_GetNextVorbisBlock;
|
MV_SetErrorCode(MV_NoVoices);
|
||||||
voice->NextBlock = vd->block;
|
return MV_Error;
|
||||||
voice->LoopCount = 0;
|
}
|
||||||
voice->BlockLength = 0;
|
|
||||||
voice->length = 0;
|
|
||||||
voice->next = NULL;
|
|
||||||
voice->prev = NULL;
|
|
||||||
voice->priority = priority;
|
|
||||||
voice->callbackval = callbackval;
|
|
||||||
|
|
||||||
voice->LoopStart = 0;
|
voice->wavetype = FMT_VORBIS;
|
||||||
voice->LoopEnd = 0;
|
voice->bits = 16;
|
||||||
voice->LoopSize = (loopstart >= 0 ? 1 : 0);
|
voice->channels = vi->channels;
|
||||||
|
voice->rawdataptr = (void *)vd;
|
||||||
|
voice->GetSound = MV_GetNextVorbisBlock;
|
||||||
|
voice->NextBlock = vd->block;
|
||||||
|
voice->LoopCount = 0;
|
||||||
|
voice->BlockLength = 0;
|
||||||
|
voice->length = 0;
|
||||||
|
voice->next = NULL;
|
||||||
|
voice->prev = NULL;
|
||||||
|
voice->priority = priority;
|
||||||
|
voice->callbackval = callbackval;
|
||||||
|
|
||||||
|
voice->LoopStart = 0;
|
||||||
|
voice->LoopEnd = 0;
|
||||||
|
voice->LoopSize = (loopstart >= 0 ? 1 : 0);
|
||||||
|
|
||||||
// load loop tags from metadata
|
// load loop tags from metadata
|
||||||
MV_GetVorbisCommentLoops(voice, ov_comment(&vd->vf, 0));
|
MV_GetVorbisCommentLoops(voice, ov_comment(&vd->vf, 0));
|
||||||
|
|
||||||
voice->Paused = FALSE;
|
voice->Paused = FALSE;
|
||||||
|
|
||||||
MV_SetVoicePitch(voice, vi->rate, pitchoffset);
|
MV_SetVoicePitch(voice, vi->rate, pitchoffset);
|
||||||
MV_SetVoiceMixMode( voice );
|
MV_SetVoiceMixMode(voice);
|
||||||
|
|
||||||
MV_SetVoiceVolume( voice, vol, left, right, volume );
|
MV_SetVoiceVolume(voice, vol, left, right, volume);
|
||||||
MV_PlayVoice( voice );
|
MV_PlayVoice(voice);
|
||||||
|
|
||||||
return voice->handle;
|
return voice->handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MV_ReleaseVorbisVoice( VoiceNode * voice )
|
void MV_ReleaseVorbisVoice( VoiceNode * voice )
|
||||||
|
|
Loading…
Reference in a new issue