mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 14:51:40 +00:00
Better report the number of Smacker audio tracks
This commit is contained in:
parent
1a692f5c28
commit
3b6723e6f2
2 changed files with 16 additions and 5 deletions
|
@ -125,6 +125,7 @@ class SmackerDecoder
|
|||
void GetPalette(uint8_t *palette);
|
||||
void GetFrame(uint8_t *frame);
|
||||
|
||||
uint32_t GetNumAudioTracks();
|
||||
SmackerAudioInfo GetAudioTrackDetails(uint32_t trackIndex);
|
||||
uint32_t GetAudioData(uint32_t trackIndex, int16_t *audioBuffer);
|
||||
void DisableAudioTrack(uint32_t trackIndex);
|
||||
|
|
|
@ -94,10 +94,9 @@ void Smacker_Close(SmackerHandle &handle)
|
|||
handle.isValid = false;
|
||||
}
|
||||
|
||||
uint32_t Smacker_GetNumAudioTracks(SmackerHandle &)
|
||||
uint32_t Smacker_GetNumAudioTracks(SmackerHandle &handle)
|
||||
{
|
||||
// TODO: fixme
|
||||
return 1;
|
||||
return classInstances[handle.instanceIndex]->GetNumAudioTracks();
|
||||
}
|
||||
|
||||
SmackerAudioInfo Smacker_GetAudioTrackDetails(SmackerHandle &handle, uint32_t trackIndex)
|
||||
|
@ -398,8 +397,9 @@ bool SmackerDecoder::Open(const char *fileName)
|
|||
audioTracks[i].bufferSize = 0;
|
||||
audioTracks[i].bytesReadThisFrame = 0;
|
||||
|
||||
// FIXME: Only disable non-consecutive enabled tracks
|
||||
if (i > 0 /*&& !(audioTracks[i-1].flags & SMK_AUD_PRESENT)*/)
|
||||
// Disable non-consecutive enabled tracks. Not sure how to otherwise report
|
||||
// them properly for Smacker_GetNumAudioTracks.
|
||||
if (i > 0 && !(audioTracks[i-1].flags & SMK_AUD_PRESENT))
|
||||
audioTracks[i].flags &= ~SMK_AUD_PRESENT;
|
||||
|
||||
if (audioTracks[i].flags & 0xFFFFFF)
|
||||
|
@ -1184,6 +1184,16 @@ void SmackerDecoder::GotoFrame(uint32_t frameNum)
|
|||
GetNextFrame();
|
||||
}
|
||||
|
||||
uint32_t SmackerDecoder::GetNumAudioTracks()
|
||||
{
|
||||
for(uint32_t i = 0;i < kMaxAudioTracks;++i)
|
||||
{
|
||||
if (!(audioTracks[i].flags & SMK_AUD_PRESENT))
|
||||
return i;
|
||||
}
|
||||
return kMaxAudioTracks;
|
||||
}
|
||||
|
||||
SmackerAudioInfo SmackerDecoder::GetAudioTrackDetails(uint32_t trackIndex)
|
||||
{
|
||||
SmackerAudioInfo info;
|
||||
|
|
Loading…
Reference in a new issue