mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-27 03:24:15 +01:00
Fix Audio
This commit is contained in:
parent
ea4007a13c
commit
1a0b71bd47
@ -155,13 +155,13 @@ public:
|
|||||||
void Seek(uint32 milliseconds)
|
void Seek(uint32 milliseconds)
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return;
|
if ( !IsOpened() ) return;
|
||||||
mpg123_seek(m_pMH, ms2samples(milliseconds)*GetSampleSize(), SEEK_SET);
|
mpg123_seek(m_pMH, ms2samples(milliseconds), SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Tell()
|
uint32 Tell()
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return 0;
|
if ( !IsOpened() ) return 0;
|
||||||
return samples2ms(mpg123_tell(m_pMH)/GetSampleSize());
|
return samples2ms(mpg123_tell(m_pMH));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Decode(void *buffer)
|
uint32 Decode(void *buffer)
|
||||||
@ -247,13 +247,13 @@ public:
|
|||||||
void Seek(uint32 milliseconds)
|
void Seek(uint32 milliseconds)
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return;
|
if ( !IsOpened() ) return;
|
||||||
op_pcm_seek(m_FileH, ms2samples(milliseconds) * GetSampleSize());
|
op_pcm_seek(m_FileH, ms2samples(milliseconds) / GetChannels());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Tell()
|
uint32 Tell()
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return 0;
|
if ( !IsOpened() ) return 0;
|
||||||
return samples2ms(op_pcm_tell(m_FileH)/GetSampleSize());
|
return samples2ms(op_pcm_tell(m_FileH) * GetChannels());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Decode(void *buffer)
|
uint32 Decode(void *buffer)
|
||||||
@ -461,8 +461,8 @@ uint32 CStream::GetPosMS()
|
|||||||
alGetSourcei(m_alSource, AL_BYTE_OFFSET, &offset);
|
alGetSourcei(m_alSource, AL_BYTE_OFFSET, &offset);
|
||||||
|
|
||||||
return m_pSoundFile->Tell()
|
return m_pSoundFile->Tell()
|
||||||
- m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS-1))
|
- m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS-1)) / m_pSoundFile->GetChannels()
|
||||||
+ m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize());
|
+ m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize()) / m_pSoundFile->GetChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 CStream::GetLengthMS()
|
uint32 CStream::GetLengthMS()
|
||||||
|
@ -24,12 +24,12 @@ public:
|
|||||||
|
|
||||||
uint32 ms2samples(uint32 ms)
|
uint32 ms2samples(uint32 ms)
|
||||||
{
|
{
|
||||||
return float(ms) / 1000.0f * float(GetChannels()) * float(GetSampleRate());
|
return float(ms) / 1000.0f * float(GetSampleRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 samples2ms(uint32 sm)
|
uint32 samples2ms(uint32 sm)
|
||||||
{
|
{
|
||||||
return float(sm) * 1000.0f / float(GetChannels()) / float(GetSampleRate());
|
return float(sm) * 1000.0f / float(GetSampleRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetBufferSamples()
|
uint32 GetBufferSamples()
|
||||||
|
Loading…
Reference in New Issue
Block a user