Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorStefan Gartner <stefang@aon.at>2004-04-14 17:00:36 +0400
committerStefan Gartner <stefang@aon.at>2004-04-14 17:00:36 +0400
commit837da93f19376bd61a478b6cda11868415241703 (patch)
treedb72b3c76efa1862edf8f9f549a5bc9f9e66fa69 /intern
parent7dc152b01a6b77a840e916ecbf5fa34c3a6ab2a8 (diff)
enable openal support for os x and linux-powerpc
as there is a conflict between openal and sdl (when compiled with cdrom support), i had to disable support for cd playing using sdl on os x for the time being.
Diffstat (limited to 'intern')
-rw-r--r--intern/SoundSystem/Makefile10
-rw-r--r--intern/SoundSystem/SND_DependKludge.h14
-rw-r--r--intern/SoundSystem/intern/SND_Utils.cpp7
-rw-r--r--intern/SoundSystem/openal/SND_OpenALDevice.cpp32
-rw-r--r--intern/SoundSystem/openal/SND_OpenALDevice.h3
5 files changed, 41 insertions, 25 deletions
diff --git a/intern/SoundSystem/Makefile b/intern/SoundSystem/Makefile
index 9714e49da36..20e37c26a33 100644
--- a/intern/SoundSystem/Makefile
+++ b/intern/SoundSystem/Makefile
@@ -44,16 +44,14 @@ ifneq ($(NAN_NO_OPENAL),true)
DIRS += fmod
DIRS += openal sdl
endif
- #ifeq ($(OS),darwin)
- # DIRS += fmod
- #endif
+ ifeq ($(OS),darwin)
+ DIRS += openal
+ endif
ifeq ($(OS),freebsd)
DIRS += openal
endif
ifeq ($(OS),$(findstring $(OS), "linux"))
- ifeq ($(CPU),i386)
- DIRS += openal sdl
- endif
+ DIRS += openal sdl
endif
else
CPPFLAGS += -DNO_SOUND
diff --git a/intern/SoundSystem/SND_DependKludge.h b/intern/SoundSystem/SND_DependKludge.h
index d5d8dd27972..15db3da9cd2 100644
--- a/intern/SoundSystem/SND_DependKludge.h
+++ b/intern/SoundSystem/SND_DependKludge.h
@@ -38,18 +38,10 @@
#ifndef NO_SOUND
-# if defined (_WIN32) && !defined(FREE_WINDOWS)
-#define USE_OPENAL
-#elif defined (__linux__)
-# if defined (__i386__)
-# define USE_OPENAL
-# endif
-#elif defined (__FreeBSD__)
+#if defined (_WIN32) && !defined(FREE_WINDOWS)
+# define USE_OPENAL
+#elif defined (__linux__) || (__FreeBSD__) || defined(__APPLE__)
# define USE_OPENAL
-/*
-#elif defined (__APPLE__)
-# define USE_FMOD
-*/
#else
# ifdef USE_OPENAL
# undef USE_OPENAL
diff --git a/intern/SoundSystem/intern/SND_Utils.cpp b/intern/SoundSystem/intern/SND_Utils.cpp
index 1048e701611..a919ffad609 100644
--- a/intern/SoundSystem/intern/SND_Utils.cpp
+++ b/intern/SoundSystem/intern/SND_Utils.cpp
@@ -73,7 +73,7 @@ typedef enum
SND_endianLittle
} SND_TEndian;
-#ifdef __APPLE__
+#ifdef __BIG_ENDIAN__
const SND_TEndian SND_fEndian = SND_endianBig;
#else
const SND_TEndian SND_fEndian = SND_endianLittle;
@@ -339,6 +339,8 @@ unsigned int SND_GetHeaderSize(void* sample)
if (CheckSample(sample))
{
memcpy(&chunklength, ((char*)sample) + offset, 4);
+ /* This was endian unsafe. See top of the file for the define. */
+ if (SND_fEndian == SND_endianBig) SWITCH_INT(chunklength);
offset = offset + chunklength + 4;
memcpy(data, ((char*)sample) + offset, 4);
@@ -392,10 +394,11 @@ void SND_GetSampleInfo(signed char* sample, SND_WaveSlot* waveslot)
if (CheckSample(sample))
{
memcpy(&fileheader, sample, sizeof(WavFileHeader));
+ fileheader.size = SND_GetHeaderSize(sample);
sample += sizeof(WavFileHeader);
fileheader.size = ((fileheader.size+1) & ~1) - 4;
- while ((fileheader.size != 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader))))
+ while ((fileheader.size > 0) && (memcpy(&chunkheader, sample, sizeof(WavChunkHeader))))
{
sample += sizeof(WavChunkHeader);
if (!memcmp(chunkheader.id, "fmt ", 4))
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.cpp b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
index 6016b1b2355..199e791dd64 100644
--- a/intern/SoundSystem/openal/SND_OpenALDevice.cpp
+++ b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
@@ -40,7 +40,9 @@
#endif //WIN32
#include "SND_OpenALDevice.h"
+#ifndef __APPLE__
#include "SND_SDLCDDevice.h"
+#endif
#include "SoundDefines.h"
#include "SND_Utils.h"
@@ -276,8 +278,9 @@ SND_OpenALDevice::SND_OpenALDevice()
{
m_wavecache = new SND_WaveCache();
}
-
+#ifndef __APPLE__
m_cdrom = new SND_SDLCDDevice();
+#endif
}
void SND_OpenALDevice::UseCD(void) const
@@ -316,9 +319,10 @@ SND_OpenALDevice::~SND_OpenALDevice()
this->StopCD();
SND_CDObject::DisposeSystem();
}
-
+#ifndef __APPLE__
if (m_cdrom)
delete m_cdrom;
+#endif
}
@@ -366,7 +370,7 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
bitrate = SND_GetBitRate(memlocation);
/* load the sample into openal */
-#ifdef OUDE_OPENAL
+#if defined(OUDE_OPENAL) || defined (__APPLE__)
alutLoadWAVMemory((char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate); // openal_2.12
#else
alutLoadWAVMemory((signed char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate, &loop);// openal_2.14+
@@ -377,7 +381,9 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
/* or from file? */
else
{
-#ifdef WIN32
+#ifdef __APPLE__
+ alutLoadWAVFile((signed char*)samplename.Ptr(), &sampleformat, &data, &numberofsamples, &samplerate);
+#elif defined(WIN32)
alutLoadWAVFile((signed char*)samplename.Ptr(), &sampleformat, &data, &numberofsamples, &samplerate, &loop);
#else
alutLoadWAV((char*)samplename.Ptr(), &data,
@@ -456,7 +462,9 @@ void SND_OpenALDevice::SetListenerRollOffFactor(MT_Scalar rollofffactor) const
void SND_OpenALDevice::NextFrame() const
{
// CD
+#ifndef __APPLE__
m_cdrom->NextFrame();
+#endif
// not needed by openal
}
@@ -509,8 +517,12 @@ int SND_OpenALDevice::GetPlayState(int id)
int alstate = 0;
int result = 0;
+#ifdef __APPLE__
+ alGetSourcei(m_sources[id], AL_SOURCE_STATE, &alstate);
+#else
alGetSourceiv(m_sources[id], AL_SOURCE_STATE, &alstate);
-
+#endif
+
switch(alstate)
{
case AL_INITIAL:
@@ -690,31 +702,41 @@ void SND_OpenALDevice::SetObjectTransform(int id,
void SND_OpenALDevice::PlayCD(int track) const
{
+#ifndef __APPLE__
m_cdrom->PlayCD(track);
+#endif
}
void SND_OpenALDevice::PauseCD(bool pause) const
{
+#ifndef __APPLE__
m_cdrom->PauseCD(pause);
+#endif
}
void SND_OpenALDevice::StopCD() const
{
+#ifndef __APPLE__
SND_CDObject* pCD = SND_CDObject::Instance();
if (pCD && pCD->GetUsed())
{
m_cdrom->StopCD();
}
+#endif
}
void SND_OpenALDevice::SetCDPlaymode(int playmode) const
{
+#ifndef __APPLE__
m_cdrom->SetCDPlaymode(playmode);
+#endif
}
void SND_OpenALDevice::SetCDGain(MT_Scalar gain) const
{
+#ifndef __APPLE__
m_cdrom->SetCDGain(gain);
+#endif
}
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.h b/intern/SoundSystem/openal/SND_OpenALDevice.h
index f204d2d0371..4f20580c2f3 100644
--- a/intern/SoundSystem/openal/SND_OpenALDevice.h
+++ b/intern/SoundSystem/openal/SND_OpenALDevice.h
@@ -100,8 +100,9 @@ private:
unsigned int m_sources[NUM_SOURCES];
bool m_buffersinitialized;
bool m_sourcesinitialized;
-
+#ifndef __APPLE__
class SND_SDLCDDevice* m_cdrom;
+#endif
};
#endif //SND_OPENALDEVICE