summaryrefslogtreecommitdiffstats
path: root/src/audio/oal/stream.cpp
diff options
context:
space:
mode:
authorerorcun <erayorcunus@gmail.com>2020-10-13 12:18:49 +0200
committerGitHub <noreply@github.com>2020-10-13 12:18:49 +0200
commit971b7cba654454a15a58fce3e2fb4c67391b43f3 (patch)
treeb198627410bb10c381297ac8b7e6230cf36819ef /src/audio/oal/stream.cpp
parentFix typo in fire.cpp (diff)
parentUpdate sampman_miles.cpp (diff)
downloadre3-971b7cba654454a15a58fce3e2fb4c67391b43f3.tar
re3-971b7cba654454a15a58fce3e2fb4c67391b43f3.tar.gz
re3-971b7cba654454a15a58fce3e2fb4c67391b43f3.tar.bz2
re3-971b7cba654454a15a58fce3e2fb4c67391b43f3.tar.lz
re3-971b7cba654454a15a58fce3e2fb4c67391b43f3.tar.xz
re3-971b7cba654454a15a58fce3e2fb4c67391b43f3.tar.zst
re3-971b7cba654454a15a58fce3e2fb4c67391b43f3.zip
Diffstat (limited to 'src/audio/oal/stream.cpp')
-rw-r--r--src/audio/oal/stream.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index 2f392264..58b5dc02 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -377,8 +377,8 @@ CStream::CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUF
#endif
else
m_pSoundFile = nil;
- ASSERT(m_pSoundFile != nil);
- if (m_pSoundFile && m_pSoundFile->IsOpened() )
+
+ if ( IsOpened() )
{
m_pBuffer = malloc(m_pSoundFile->GetBufferSize());
ASSERT(m_pBuffer!=nil);
@@ -425,14 +425,14 @@ bool CStream::HasSource()
bool CStream::IsOpened()
{
- return m_pSoundFile->IsOpened();
+ return m_pSoundFile && m_pSoundFile->IsOpened();
}
bool CStream::IsPlaying()
{
if ( !HasSource() || !IsOpened() ) return false;
- if ( m_pSoundFile->IsOpened() && !m_bPaused )
+ if ( !m_bPaused )
{
ALint sourceState;
alGetSourcei(m_alSource, AL_SOURCE_STATE, &sourceState);
@@ -500,7 +500,7 @@ void CStream::SetPan(uint8 nPan)
void CStream::SetPosMS(uint32 nPos)
{
- if ( !m_pSoundFile->IsOpened() ) return;
+ if ( !IsOpened() ) return;
m_pSoundFile->Seek(nPos);
ClearBuffers();
}
@@ -508,7 +508,7 @@ void CStream::SetPosMS(uint32 nPos)
uint32 CStream::GetPosMS()
{
if ( !HasSource() ) return 0;
- if ( !m_pSoundFile->IsOpened() ) return 0;
+ if ( !IsOpened() ) return 0;
ALint offset;
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
@@ -521,7 +521,7 @@ uint32 CStream::GetPosMS()
uint32 CStream::GetLengthMS()
{
- if ( !m_pSoundFile->IsOpened() ) return 0;
+ if ( !IsOpened() ) return 0;
return m_pSoundFile->GetLength();
}
@@ -529,7 +529,7 @@ bool CStream::FillBuffer(ALuint alBuffer)
{
if ( !HasSource() )
return false;
- if ( !m_pSoundFile->IsOpened() )
+ if ( !IsOpened() )
return false;
if ( !(alBuffer != AL_NONE && alIsBuffer(alBuffer)) )
return false;
@@ -571,7 +571,7 @@ void CStream::ClearBuffers()
bool CStream::Setup()
{
- if ( m_pSoundFile->IsOpened() )
+ if ( IsOpened() )
{
m_pSoundFile->Seek(0);
alSourcei(m_alSource, AL_SOURCE_RELATIVE, AL_TRUE);