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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-09 00:08:19 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-06-09 00:08:19 +0400
commitc8b4cf92067ffeb625aa39003baf5d8f7c3f0025 (patch)
treec6c50dbc3d90a65fca6c1ca56a93e4a57cf7e154 /intern
parente93db433a086a3e739c0f4026cd500f0b595b0f1 (diff)
parentd76a6f5231c015c35123d22e1f5c3ffcdfbf9bbd (diff)
2.50:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19820:HEAD Notes: * Game and sequencer RNA, and sequencer header are now out of date a bit after changes in trunk. * I didn't know how to port these bugfixes, most likely they are not needed anymore. * Fix "duplicate strip" always increase the user count for ipo. * IPO pinning on sequencer strips was lost during Undo.
Diffstat (limited to 'intern')
-rw-r--r--intern/CMakeLists.txt16
-rw-r--r--intern/SoundSystem/fmod/Makefile43
-rw-r--r--intern/SoundSystem/fmod/SND_FmodDevice.cpp574
-rw-r--r--intern/SoundSystem/fmod/SND_FmodDevice.h103
-rw-r--r--intern/SoundSystem/openal/SND_OpenALDevice.cpp290
-rw-r--r--intern/SoundSystem/sdl/SND_SDLCDDevice.cpp2
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp24
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h8
-rw-r--r--intern/guardedalloc/intern/mmap_win.c1
9 files changed, 219 insertions, 842 deletions
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 1c0d795448c..697d0b6b575 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -24,10 +24,20 @@
#
# ***** END GPL LICENSE BLOCK *****
-SUBDIRS(SoundSystem string ghost guardedalloc moto container memutil decimation iksolver boolop opennl)
+ADD_SUBDIRECTORY(SoundSystem)
+ADD_SUBDIRECTORY(string)
+ADD_SUBDIRECTORY(ghost)
+ADD_SUBDIRECTORY(guardedalloc)
+ADD_SUBDIRECTORY(moto)
+ADD_SUBDIRECTORY(container)
+ADD_SUBDIRECTORY(memutil)
+ADD_SUBDIRECTORY(decimation)
+ADD_SUBDIRECTORY(iksolver)
+ADD_SUBDIRECTORY(boolop)
+ADD_SUBDIRECTORY(opennl)
IF(WITH_ELBEEM)
- SUBDIRS(elbeem)
+ ADD_SUBDIRECTORY(elbeem)
ENDIF(WITH_ELBEEM)
-SUBDIRS(bsp)
+ADD_SUBDIRECTORY(bsp)
diff --git a/intern/SoundSystem/fmod/Makefile b/intern/SoundSystem/fmod/Makefile
deleted file mode 100644
index 47bc0348fe2..00000000000
--- a/intern/SoundSystem/fmod/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# $Id$
-#
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
-# All rights reserved.
-#
-# The Original Code is: all of this file.
-#
-# Contributor(s): none yet.
-#
-# ***** END GPL LICENSE BLOCK *****
-#
-#
-
-LIBNAME = FmodSoundSystem
-DIR = $(OCGDIR)/intern/$(LIBNAME)
-
-include nan_compile.mk
-
-CCFLAGS += $(LEVEL_1_CPP_WARNINGS)
-
-CPPFLAGS += -I$(NAN_FMOD)/include
-CPPFLAGS += -I$(NAN_STRING)/include
-CPPFLAGS += -I$(NAN_MOTO)/include
-CPPFLAGS += -I../intern
-CPPFLAGS += -I..
-CPPFLAGS += -I.
diff --git a/intern/SoundSystem/fmod/SND_FmodDevice.cpp b/intern/SoundSystem/fmod/SND_FmodDevice.cpp
deleted file mode 100644
index 3ba0802a5b0..00000000000
--- a/intern/SoundSystem/fmod/SND_FmodDevice.cpp
+++ /dev/null
@@ -1,574 +0,0 @@
-/*
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- * SND_FmodDevice derived from SND_IAudioDevice
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef WIN32
-#pragma warning (disable:4786) // get rid of stupid stl-visual compiler debug warning
-#endif //WIN32
-
-#include "SND_FmodDevice.h"
-#include "SoundDefines.h"
-#include "SND_Utils.h"
-
-SND_FmodDevice::SND_FmodDevice()
-{
- /* Removed the functionality for checking if noaudio was provided on */
- /* the commandline. */
- m_dspunit = NULL;
-
- m_audio = true;
-
- // let's check if we can get fmod to initialize...
- if (m_audio)
- {
- signed char MinHardwareChannels = FSOUND_SetMinHardwareChannels(NUM_FMOD_MIN_HW_CHANNELS);
- signed char MaxHardwareChannels = FSOUND_SetMaxHardwareChannels(NUM_FMOD_MAX_HW_CHANNELS);
-
- if (FSOUND_Init(MIXRATE, NUM_SOURCES, 0))
- {
- m_max_channels = FSOUND_GetMaxChannels();
- m_num_hardware_channels = FSOUND_GetNumHardwareChannels();
- m_num_software_channels = NUM_SOURCES;
-
- // let's get us a wavecache
- m_wavecache = new SND_WaveCache();
-
- int i;
- for (i = 0; i < NUM_BUFFERS; i++)
- m_buffers[i] = NULL;
-
- for (i = 0; i < NUM_SOURCES; i++)
- {
- m_sources[i] = NULL;
- m_frequencies[i] = 0;
- m_channels[i] = 0;
- }
- }
- else
- {
- m_audio = false;
- }
- }
-
-#ifdef ONTKEVER
- int numdrivers = FSOUND_GetNumDrivers();
- int output = FSOUND_GetOutput();
- int oputputrate = FSOUND_GetOutputRate();
- int mixer = FSOUND_GetMixer();
-
- printf("maxchannels is: %d\n", m_max_channels);
- printf("num hw channels is: %d\n", m_num_hardware_channels);
- printf("num sw channels is: %d\n", m_num_software_channels);
- printf("numdrivers is: %d\n", numdrivers);
- printf("output is: %d\n", output);
- printf("oputputrate is: %d\n", oputputrate);
- printf("mixer is: %d\n", mixer);
-#endif
-}
-
-
-
-SND_FmodDevice::~SND_FmodDevice()
-{
- // let's see if we used the cd. if not, just leave it alone
- SND_CDObject* pCD = SND_CDObject::Instance();
-
- if (pCD)
- {
- this->StopCD();
- SND_CDObject::DisposeSystem();
- }
-
- StopUsingDSP();
-
- FSOUND_Close();
-}
-
-
-
-void SND_FmodDevice::UseCD() const
-{
- // only fmod has CD support, so only create it here
- SND_CDObject::CreateSystem();
-}
-
-
-
-void SND_FmodDevice::MakeCurrent() const
-{
- // empty
-}
-
-
-
-SND_WaveSlot* SND_FmodDevice::LoadSample(const STR_String& name,
- void* memlocation,
- int size)
-{
- SND_WaveSlot* waveslot = NULL;
- STR_String samplename = name;
-
- if (m_audio)
- {
- /* first check if the sample is supported */
- if (SND_IsSampleValid(name, memlocation))
- {
- /* create the waveslot */
- waveslot = m_wavecache->GetWaveSlot(samplename);
-
- if (waveslot)
- {
- int buffer = waveslot->GetBuffer();
-
- /* load the sample from memory? */
- if (size && memlocation)
- {
- m_buffers[buffer] = FSOUND_Sample_Load(buffer, (char*)memlocation, FSOUND_LOADMEMORY, size);
-
- /* if the loading succeeded, fill the waveslot with info */
- if (m_buffers[buffer])
- {
- int sampleformat = SND_GetSampleFormat(memlocation);
- int numberofchannels = SND_GetNumberOfChannels(memlocation);
- int samplerate = SND_GetSampleRate(memlocation);
- int bitrate = SND_GetBitRate(memlocation);
- int numberofsamples = SND_GetNumberOfSamples(memlocation, size);
-
- waveslot->SetFileSize(size);
- waveslot->SetData(memlocation);
- waveslot->SetSampleFormat(sampleformat);
- waveslot->SetNumberOfChannels(numberofchannels);
- waveslot->SetSampleRate(samplerate);
- waveslot->SetBitRate(bitrate);
- waveslot->SetNumberOfSamples(numberofsamples);
- }
- }
- /* or from file? */
- else
- {
- m_buffers[buffer] = FSOUND_Sample_Load(buffer, samplename.Ptr(), FSOUND_LOOP_NORMAL, NULL);
- }
-
-#ifdef ONTKEVER
- int error = FSOUND_GetError();
- printf("sample load: errornumber is: %d\n", error);
-#endif
-
- /* if the loading succeeded, mark the waveslot */
- if (m_buffers[buffer])
- {
- waveslot->SetLoaded(true);
- }
- /* or when it failed, free the waveslot */
- else
- {
- m_wavecache->RemoveSample(waveslot->GetSampleName(), waveslot->GetBuffer());
- waveslot = NULL;
- }
- }
- }
- }
-
- return waveslot;
-}
-
-
-
-
-// listener's and general stuff //////////////////////////////////////////////////////
-
-
-
-/* sets the global dopplervelocity */
-void SND_FmodDevice::SetDopplerVelocity(MT_Scalar dopplervelocity) const
-{
- /* not supported by fmod */
- FSOUND_3D_Listener_SetDopplerFactor(dopplervelocity);
-}
-
-
-
-/* sets the global dopplerfactor */
-void SND_FmodDevice::SetDopplerFactor(MT_Scalar dopplerfactor) const
-{
- FSOUND_3D_Listener_SetDopplerFactor(dopplerfactor);
-}
-
-
-
-/* sets the global rolloff factor */
-void SND_FmodDevice::SetListenerRollOffFactor(MT_Scalar rollofffactor) const
-{
- // not implemented in openal
-}
-
-
-
-void SND_FmodDevice::NextFrame() const
-{
- FSOUND_3D_Update();
-}
-
-
-
-// set the gain for the listener
-void SND_FmodDevice::SetListenerGain(float gain) const
-{
- int fmod_gain = (int)(gain * 255);
- FSOUND_SetSFXMasterVolume(fmod_gain);
-}
-
-
-
-void SND_FmodDevice::InitListener()
-{
- // initialize the listener with these values that won't change
- // (as long as we can have only one listener)
- // now we can superimpose all listeners on each other (for they
- // have the same settings)
- float lispos[3] = {0,0,0};
- float lisvel[3] = {0,0,0};
-
- FSOUND_3D_Listener_SetAttributes(lispos, lisvel, 0, -1, 0, 0, 0, 1);
-}
-
-
-
-// source playstate stuff ////////////////////////////////////////////////////////////
-
-
-
-// check if the sound's still playing
-int SND_FmodDevice::GetPlayState(int id)
-{
- int result = SND_STOPPED;
-
- // klopt niet, fixen
- signed char isplaying = FSOUND_IsPlaying(id);
-
- if (isplaying)
- {
- result = SND_PLAYING;
- }
-
-/* hi reevan, just swap // of these 2 lines */
-// return result;
- return 0;
-}
-
-
-
-/* sets the buffer */
-void SND_FmodDevice::SetObjectBuffer(int id, unsigned int buffer)
-{
- m_sources[id] = m_buffers[buffer];
-}
-
-
-
-// make the source play
-void SND_FmodDevice::PlayObject(int id)
-{
- m_channels[id] = FSOUND_PlaySound(FSOUND_FREE, m_sources[id]);
- m_frequencies[id] = FSOUND_GetFrequency(m_channels[id]);
-// printf("fmod: play \n");
-}
-
-
-
-// make the source stop
-void SND_FmodDevice::StopObject(int id) const
-{
- FSOUND_StopSound(m_channels[id]);
-// printf("fmod: stop \n");
-}
-
-
-
-// stop all sources
-void SND_FmodDevice::StopAllObjects()
-{
- FSOUND_StopSound(FSOUND_ALL);
-}
-
-
-
-// pause the source
-void SND_FmodDevice::PauseObject(int id) const
-{
- FSOUND_StopSound(m_channels[id]);
-}
-
-
-
-// source properties stuff ////////////////////////////////////////////////////////////
-
-
-
-// give openal the object's pitch
-void SND_FmodDevice::SetObjectPitch(int id, MT_Scalar pitch) const
-{
- pitch = pitch * m_frequencies[id];
- char result = FSOUND_SetFrequency(m_channels[id], (int)pitch);
-}
-
-
-
-// give openal the object's gain
-void SND_FmodDevice::SetObjectGain(int id, MT_Scalar gain) const
-{
- int vol = (int)(gain * 255);
- FSOUND_SetVolume(m_channels[id], vol);
-}
-
-
-
-// give openal the object's looping
-void SND_FmodDevice::SetObjectLoop(int id, unsigned int loopmode) const
-{
-// printf("loopmode: %d\n", loopmode);
- switch (loopmode)
- {
- case SND_LOOP_OFF:
- {
-#ifndef __APPLE__
- char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_OFF);
-#else
- char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_OFF);
-#endif
-// char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_OFF);
- break;
- }
- case SND_LOOP_NORMAL:
- {
-#ifndef __APPLE__
- char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_NORMAL);
-#else
- char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_NORMAL);
-#endif
-// char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_NORMAL);
- break;
- }
- case SND_LOOP_BIDIRECTIONAL:
- {
-#ifndef __APPLE__
- char result = FSOUND_Sample_SetLoopMode(m_sources[id], FSOUND_LOOP_BIDI);
-#else
- char result = FSOUND_SetLoopMode(m_sources[id], FSOUND_LOOP_BIDI);
-#endif
-// char result = FSOUND_SetLoopMode(m_channels[id], FSOUND_LOOP_NORMAL);
- break;
- }
- default:
- break;
- }
-}
-
-
-
-void SND_FmodDevice::SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const
-{
- FSOUND_Sample_SetLoopPoints(m_sources[id], loopstart, loopend);
-}
-
-
-
-void SND_FmodDevice::SetObjectMinGain(int id, MT_Scalar mingain) const
-{
- /* not supported by fmod */
-}
-
-
-
-void SND_FmodDevice::SetObjectMaxGain(int id, MT_Scalar maxgain) const
-{
- /* not supported by fmod */
-}
-
-
-
-void SND_FmodDevice::SetObjectRollOffFactor(int id, MT_Scalar rollofffactor) const
-{
- /* not supported by fmod */
-}
-
-
-
-void SND_FmodDevice::SetObjectReferenceDistance(int id, MT_Scalar referencedistance) const
-{
- /* not supported by fmod */
-}
-
-
-
-// give openal the object's position
-void SND_FmodDevice::ObjectIs2D(int id) const
-{
- float obpos[3] = {0,0,0};
- float obvel[3] = {0,0,0};
-
- FSOUND_3D_SetAttributes(m_channels[id], obpos, obvel);
-}
-
-
-
-void SND_FmodDevice::SetObjectTransform(int id,
- const MT_Vector3& position,
- const MT_Vector3& velocity,
- const MT_Matrix3x3& orientation,
- const MT_Vector3& lisposition,
- const MT_Scalar& rollofffactor) const
-{
- float obpos[3];
- float obvel[3];
-
- obpos[0] = (float)position[0] * (float)rollofffactor; //x (l/r)
- obpos[1] = (float)position[1] * (float)rollofffactor;
- obpos[2] = (float)position[2] * (float)rollofffactor;
-
- velocity.getValue(obvel);
- FSOUND_3D_SetAttributes(m_channels[id], obpos, obvel);
-}
-
-
-
-// cd support stuff ////////////////////////////////////////////////////////////
-
-
-void SND_FmodDevice::PlayCD(int track) const
-{
-#ifndef __APPLE__
- signed char result = FSOUND_CD_Play(track);
-#else
- signed char result = FSOUND_CD_Play(0, track);
-#endif
-
-#ifdef ONTKEVER
- printf("SND_FmodDevice::PlayCD(): track=%d, result=%d\n", track, (int)result);
-#endif
-}
-
-
-
-void SND_FmodDevice::PauseCD(bool pause) const
-{
-#ifndef __APPLE__
- signed char result = FSOUND_CD_SetPaused(pause);
-#else
- signed char result = FSOUND_CD_SetPaused(0, pause);
-#endif
-
-#ifdef ONTKEVER
- printf("SND_FmodDevice::PauseCD(): pause=%d, result=%d\n", pause, (int)result);
-#endif
-}
-
-
-
-void SND_FmodDevice::StopCD() const
-{
- SND_CDObject* pCD = SND_CDObject::Instance();
-
- if (pCD)
- {
- if (pCD->GetUsed())
- {
-#ifndef __APPLE__
- signed char result = FSOUND_CD_Stop();
-#else
- signed char result = FSOUND_CD_Stop(0);
-#endif
-
-#ifdef ONTKEVER
- printf("SND_FmodDevice::StopCD(): result=%d\n", (int)result);
-#endif
- }
- }
-}
-
-
-
-void SND_FmodDevice::SetCDPlaymode(int playmode) const
-{
-#ifndef __APPLE__
- FSOUND_CD_SetPlayMode(playmode);
-#else
- FSOUND_CD_SetPlayMode(0, playmode);
-#endif
-
-#ifdef ONTKEVER
- printf("SND_FmodDevice::SetCDPlaymode(): playmode=%d,\n", playmode);
-#endif
-}
-
-
-
-void SND_FmodDevice::SetCDGain(MT_Scalar gain) const
-{
- int volume = gain * 255;
-#ifndef __APPLE__
- signed char result = FSOUND_CD_SetVolume(volume);
-#else
- signed char result = FSOUND_CD_SetVolume(0, volume);
-#endif
-
-#ifdef ONTKEVER
- printf("SND_FmodDevice::SetCDGain(): gain=%f, volume=%d, result=%d\n", gain, volume, (int)result);
-#endif
-}
-
-
-
-void SND_FmodDevice::StartUsingDSP()
-{
- m_dspunit = FSOUND_DSP_GetFFTUnit();
-
- FSOUND_DSP_SetActive(m_dspunit, true);
-}
-
-
-
-float* SND_FmodDevice::GetSpectrum()
-{
- m_spectrum = FSOUND_DSP_GetSpectrum();
-
- return m_spectrum;
-}
-
-
-
-void SND_FmodDevice::StopUsingDSP()
-{
- if (m_dspunit)
- FSOUND_DSP_SetActive(m_dspunit, false);
-}
diff --git a/intern/SoundSystem/fmod/SND_FmodDevice.h b/intern/SoundSystem/fmod/SND_FmodDevice.h
deleted file mode 100644
index 294ee4e3a72..00000000000
--- a/intern/SoundSystem/fmod/SND_FmodDevice.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/**
- * $Id$
- *
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-#ifndef SND_FMODDEVICE
-#define SND_FMODDEVICE
-
-#include "fmod.h"
-#include "SND_AudioDevice.h"
-#include "SoundDefines.h"
-
-class SND_FmodDevice : public SND_AudioDevice
-{
-public:
- SND_FmodDevice();
- ~SND_FmodDevice();
-
- SND_WaveSlot* LoadSample(const STR_String& samplename,
- void* memlocation,
- int size);
-
- void InitListener();
- void SetListenerGain(float gain) const;
- void SetDopplerVelocity(MT_Scalar dopplervelocity) const;
- void SetDopplerFactor(MT_Scalar dopplerfactor) const;
- void SetListenerRollOffFactor(MT_Scalar rollofffactor) const;
-
- void MakeCurrent() const;
- void NextFrame() const;
- void UseCD() const;
-
- void SetObjectBuffer(int id, unsigned int buffer);
- int GetPlayState(int id);
- void PlayObject(int id);
- void StopObject(int id) const;
- void StopAllObjects();
- void PauseObject(int id) const;
-
- void SetObjectLoop(int id, unsigned int loopmode) const;
- void SetObjectLoopPoints(int id, unsigned int loopstart, unsigned int loopend) const;
- void SetObjectPitch(int id, MT_Scalar pitch) const;
- void SetObjectGain(int id, MT_Scalar gain) const;
- void SetObjectMinGain(int id, MT_Scalar mingain) const;
- void SetObjectMaxGain(int id, MT_Scalar maxgain) const;
- void SetObjectRollOffFactor(int id, MT_Scalar rolloff) const;
- void SetObjectReferenceDistance(int id, MT_Scalar distance) const;
-
- void SetObjectTransform(int id,
- const MT_Vector3& position,
- const MT_Vector3& velocity,
- const MT_Matrix3x3& orientation,
- const MT_Vector3& lisposition,
- const MT_Scalar& rollofffactor) const;
- void ObjectIs2D(int id) const;
-
- void PlayCD(int track) const;
- void PauseCD(bool pause) const;
- void StopCD() const;
- void SetCDPlaymode(int playmode) const;
- void SetCDGain(MT_Scalar gain) const;
-
- void StartUsingDSP();
- float* GetSpectrum();
- void StopUsingDSP();
-
-private:
- FSOUND_SAMPLE* m_buffers[NUM_BUFFERS];
- FSOUND_SAMPLE* m_sources[NUM_SOURCES];
- FSOUND_DSPUNIT* m_dspunit;
- int m_frequencies[NUM_SOURCES];
- int m_max_channels;
- int m_num_hardware_channels;
- int m_num_software_channels;
- int m_channels[NUM_SOURCES];
- float* m_spectrum;
-};
-
-#endif //SND_FMODDEVICE
-
diff --git a/intern/SoundSystem/openal/SND_OpenALDevice.cpp b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
index 3649cf6de5a..424a05246ac 100644
--- a/intern/SoundSystem/openal/SND_OpenALDevice.cpp
+++ b/intern/SoundSystem/openal/SND_OpenALDevice.cpp
@@ -43,11 +43,9 @@
#ifdef APPLE_FRAMEWORK_FIX
#include <al.h>
#include <alc.h>
-#include <alut.h>
#else
#include <AL/al.h>
#include <AL/alc.h>
-#include <AL/alut.h>
#endif
#include <stdio.h>
@@ -61,13 +59,12 @@
#include <signal.h>
-/* untill openal gets unified we need this hack for non-windows systems */
-#if !defined(WIN32) && !defined(ALC_MAJOR_VERSION)
+/*************************** ALUT replacement *****************************/
-#include <malloc.h>
+/* instead of relying on alut, we just implement our own
+ * WAV loading functions, hopefully more reliable */
-ALvoid alutLoadWAVMemory(ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop);
-ALvoid alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq);
+#include <stdlib.h>
typedef struct /* WAV File-header */
{
@@ -120,93 +117,189 @@ typedef struct /* WAV Chunk-header */
ALuint Size;
} WAVChunkHdr_Struct;
-ALvoid alutLoadWAVMemory(ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop)
+static void *SND_loadFileIntoMemory(const char *filename, int *len_r)
+{
+ FILE *fp= fopen(filename, "rb");
+ void *data;
+
+ if (!fp) {
+ *len_r= -1;
+ return NULL;
+ }
+
+ fseek(fp, 0L, SEEK_END);
+ *len_r= ftell(fp);
+ fseek(fp, 0L, SEEK_SET);
+
+ data= malloc(*len_r);
+ if (!data) {
+ *len_r= -1;
+ return NULL;
+ }
+
+ if (fread(data, *len_r, 1, fp)!=1) {
+ *len_r= -1;
+ free(data);
+ return NULL;
+ }
+
+ return data;
+}
+
+#define TEST_SWITCH_INT(a) if(big_endian) { \
+ char s_i, *p_i; \
+ p_i= (char *)&(a); \
+ s_i=p_i[0]; p_i[0]=p_i[3]; p_i[3]=s_i; \
+ s_i=p_i[1]; p_i[1]=p_i[2]; p_i[2]=s_i; }
+
+#define TEST_SWITCH_SHORT(a) if(big_endian) { \
+ char s_i, *p_i; \
+ p_i= (char *)&(a); \
+ s_i=p_i[0]; p_i[0]=p_i[1]; p_i[1]=s_i; }
+
+static int stream_read(void *out, ALbyte **stream, ALsizei size, ALsizei *memsize)
+{
+ if(size <= *memsize) {
+ memcpy(out, *stream, size);
+ return 1;
+ }
+ else {
+ memset(out, 0, size);
+ return 0;
+ }
+}
+
+static int stream_skip(ALbyte **stream, ALsizei size, ALsizei *memsize)
+{
+ if(size <= *memsize) {
+ *stream += size;
+ *memsize -= size;
+ return 1;
+ }
+ else
+ return 0;
+}
+
+ALvoid SND_alutLoadWAVMemory(ALbyte *memory,ALsizei memsize,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop)
{
WAVChunkHdr_Struct ChunkHdr;
WAVFmtExHdr_Struct FmtExHdr;
WAVFileHdr_Struct FileHdr;
WAVSmplHdr_Struct SmplHdr;
WAVFmtHdr_Struct FmtHdr;
- ALbyte *Stream;
+ ALbyte *Stream= memory;
+ int test_endian= 1;
+ int big_endian= !((char*)&test_endian)[0];
*format=AL_FORMAT_MONO16;
*data=NULL;
*size=0;
*freq=22050;
*loop=AL_FALSE;
- if (memory)
+
+ if(!Stream)
+ return;
+
+ stream_read(&FileHdr,&Stream,sizeof(WAVFileHdr_Struct),&memsize);
+ stream_skip(&Stream,sizeof(WAVFileHdr_Struct),&memsize);
+
+ TEST_SWITCH_INT(FileHdr.Size);
+ FileHdr.Size=((FileHdr.Size+1)&~1)-4;
+
+ while((FileHdr.Size!=0) && stream_read(&ChunkHdr,&Stream,sizeof(WAVChunkHdr_Struct),&memsize))
{
- Stream=memory;
- if (Stream)
+ TEST_SWITCH_INT(ChunkHdr.Size);
+ stream_skip(&Stream,sizeof(WAVChunkHdr_Struct),&memsize);
+
+ if (!memcmp(ChunkHdr.Id,"fmt ",4))
{
- memcpy(&FileHdr,Stream,sizeof(WAVFileHdr_Struct));
- Stream+=sizeof(WAVFileHdr_Struct);
- FileHdr.Size=((FileHdr.Size+1)&~1)-4;
- while ((FileHdr.Size!=0)&&(memcpy(&ChunkHdr,Stream,sizeof(WAVChunkHdr_Struct))))
+ stream_read(&FmtHdr,&Stream,sizeof(WAVFmtHdr_Struct),&memsize);
+
+ TEST_SWITCH_SHORT(FmtHdr.Format);
+ TEST_SWITCH_SHORT(FmtHdr.Channels);
+ TEST_SWITCH_INT(FmtHdr.SamplesPerSec);
+ TEST_SWITCH_INT(FmtHdr.BytesPerSec);
+ TEST_SWITCH_SHORT(FmtHdr.BlockAlign);
+ TEST_SWITCH_SHORT(FmtHdr.BitsPerSample);
+
+ if (FmtHdr.Format==0x0001)
{
- Stream+=sizeof(WAVChunkHdr_Struct);
- if (!memcmp(ChunkHdr.Id,"fmt ",4))
- {
- memcpy(&FmtHdr,Stream,sizeof(WAVFmtHdr_Struct));
- if (FmtHdr.Format==0x0001)
- {
- *format=(FmtHdr.Channels==1?
- (FmtHdr.BitsPerSample==8?AL_FORMAT_MONO8:AL_FORMAT_MONO16):
- (FmtHdr.BitsPerSample==8?AL_FORMAT_STEREO8:AL_FORMAT_STEREO16));
- *freq=FmtHdr.SamplesPerSec;
- Stream+=ChunkHdr.Size;
- }
- else
- {
- memcpy(&FmtExHdr,Stream,sizeof(WAVFmtExHdr_Struct));
- Stream+=ChunkHdr.Size;
- }
- }
- else if (!memcmp(ChunkHdr.Id,"data",4))
+ *format=(FmtHdr.Channels==1?
+ (FmtHdr.BitsPerSample==8?AL_FORMAT_MONO8:AL_FORMAT_MONO16):
+ (FmtHdr.BitsPerSample==8?AL_FORMAT_STEREO8:AL_FORMAT_STEREO16));
+ *freq=FmtHdr.SamplesPerSec;
+ }
+ else
+ {
+ stream_read(&FmtExHdr,&Stream,sizeof(WAVFmtExHdr_Struct),&memsize);
+ TEST_SWITCH_SHORT(FmtExHdr.Size);
+ TEST_SWITCH_SHORT(FmtExHdr.SamplesPerBlock);
+ }
+ }
+ else if (!memcmp(ChunkHdr.Id,"data",4))
+ {
+ if (FmtHdr.Format==0x0001)
+ {
+ if((ALsizei)ChunkHdr.Size <= memsize)
{
- if (FmtHdr.Format==0x0001)
- {
- *size=ChunkHdr.Size;
- *data=malloc(ChunkHdr.Size+31);
- if (*data) memcpy(*data,Stream,ChunkHdr.Size);
+ *size=ChunkHdr.Size;
+ *data=malloc(ChunkHdr.Size+31);
+
+ if (*data) {
+ stream_read(*data,&Stream,ChunkHdr.Size,&memsize);
memset(((char *)*data)+ChunkHdr.Size,0,31);
- Stream+=ChunkHdr.Size;
- }
- else if (FmtHdr.Format==0x0011)
- {
- //IMA ADPCM
- }
- else if (FmtHdr.Format==0x0055)
- {
- //MP3 WAVE
+
+ if(FmtHdr.BitsPerSample == 16 && big_endian) {
+ int a, len= *size/2;
+ short *samples= (short*)*data;
+
+ for(a=0; a<len; a++) {
+ TEST_SWITCH_SHORT(samples[a])
+ }
+ }
}
}
- else if (!memcmp(ChunkHdr.Id,"smpl",4))
- {
- memcpy(&SmplHdr,Stream,sizeof(WAVSmplHdr_Struct));
- *loop = (SmplHdr.Loops ? AL_TRUE : AL_FALSE);
- Stream+=ChunkHdr.Size;
- }
- else Stream+=ChunkHdr.Size;
- Stream+=ChunkHdr.Size&1;
- FileHdr.Size-=(((ChunkHdr.Size+1)&~1)+8);
+ }
+ else if (FmtHdr.Format==0x0011)
+ {
+ //IMA ADPCM
+ }
+ else if (FmtHdr.Format==0x0055)
+ {
+ //MP3 WAVE
}
}
+ else if (!memcmp(ChunkHdr.Id,"smpl",4))
+ {
+ stream_read(&SmplHdr,&Stream,sizeof(WAVSmplHdr_Struct),&memsize);
+
+ TEST_SWITCH_INT(SmplHdr.Manufacturer);
+ TEST_SWITCH_INT(SmplHdr.Product);
+ TEST_SWITCH_INT(SmplHdr.SamplePeriod);
+ TEST_SWITCH_INT(SmplHdr.Note);
+ TEST_SWITCH_INT(SmplHdr.FineTune);
+ TEST_SWITCH_INT(SmplHdr.SMPTEFormat);
+ TEST_SWITCH_INT(SmplHdr.SMPTEOffest);
+ TEST_SWITCH_INT(SmplHdr.Loops);
+ TEST_SWITCH_INT(SmplHdr.SamplerData);
+
+ *loop = (SmplHdr.Loops ? AL_TRUE : AL_FALSE);
+ }
+
+ if(!stream_skip(&Stream, ChunkHdr.Size + (ChunkHdr.Size&1), &memsize))
+ break;
+
+ FileHdr.Size-=(((ChunkHdr.Size+1)&~1)+8);
}
}
-ALvoid alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq)
+ALvoid SND_alutUnloadWAV(ALenum format,ALvoid *data,ALsizei size,ALsizei freq)
{
if (data)
free(data);
}
-#endif /* WIN32 */
-
-#ifdef __APPLE__
-#define OUDE_OPENAL 1
-#endif
-
+/************************ Device Implementation ****************************/
SND_OpenALDevice::SND_OpenALDevice()
: SND_AudioDevice(),
@@ -223,10 +316,6 @@ SND_OpenALDevice::SND_OpenALDevice()
// let's check if we can get openal to initialize...
if (m_audio)
{
-#ifdef OUDE_OPENAL
- m_audio = true; // openal_2.12
- alutInit(NULL, NULL); // openal_2.12
-#else
m_audio = false;
ALCdevice *dev = alcOpenDevice(NULL);
@@ -236,7 +325,6 @@ SND_OpenALDevice::SND_OpenALDevice()
if (m_context) {
#ifdef AL_VERSION_1_1
alcMakeContextCurrent((ALCcontext*)m_context);
- alutInitWithoutContext(NULL, NULL); /* in this case we dont want alut to initialize the context, see above */
#else
alcMakeContextCurrent(m_context);
#endif
@@ -259,7 +347,6 @@ SND_OpenALDevice::SND_OpenALDevice()
}
}
-#endif
}
// then try to generate some buffers
@@ -283,7 +370,7 @@ SND_OpenALDevice::SND_OpenALDevice()
// next: the sources
if (m_audio)
{
-#ifdef OUDE_OPENAL
+#ifdef __APPLE__
ALenum alc_error = ALC_NO_ERROR; // openal_2.12
#elif defined(_WIN32)
// alcGetError has no arguments on windows
@@ -375,20 +462,11 @@ SND_OpenALDevice::~SND_OpenALDevice()
if (m_cdrom)
delete m_cdrom;
#endif
-#ifdef OUDE_OPENAL
- if (m_audio)
- alutExit();
-#else
if (m_device)
alcCloseDevice((ALCdevice*) m_device);
-#ifdef AL_VERSION_1_1
- alutExit();
-#endif
-#endif
}
-
SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
void* memlocation,
int size)
@@ -406,23 +484,22 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
{
if (waveslot)
{
+ bool freemem = false;
int buffer = waveslot->GetBuffer();
void* data = NULL;
-#ifndef __APPLE__
char loop = 'a';
-#endif
int sampleformat, bitrate, numberofchannels;
ALenum al_error = alGetError();
-
-#ifdef OUDE_OPENAL
- ALsizei samplerate, numberofsamples; // openal_2.12
-#else
- int samplerate, numberofsamples; // openal_2.14+
-#endif
+ ALsizei samplerate, numberofsamples; // openal_2.14+
/* Give them some safe defaults just incase */
bitrate = numberofchannels = 0;
+ if (!(size && memlocation)) {
+ memlocation = SND_loadFileIntoMemory(samplename.Ptr(), &size);
+ freemem = true;
+ }
+
/* load the sample from memory? */
if (size && memlocation)
{
@@ -437,33 +514,14 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
bitrate = SND_GetBitRate(memlocation);
/* load the sample into openal */
-#if defined(OUDE_OPENAL) || defined (__APPLE__)
- alutLoadWAVMemory((char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate); // openal_2.12
-#else
-#ifdef AL_VERSION_1_1
- float frequency = 0.0f;
- data = alutLoadMemoryFromFileImage(memlocation, size, &sampleformat, &numberofsamples, &frequency);
- samplerate = (int)frequency;
-#else
- alutLoadWAVMemory((signed char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate, &loop);// openal_2.14+
-
-#endif
-#endif
- /* put it in the buffer */
- alBufferData(m_buffers[buffer], sampleformat, data, numberofsamples, samplerate);
- }
- /* or from file? */
- else
- {
-#ifdef __APPLE__
- alutLoadWAVFile((ALbyte *)samplename.Ptr(), &sampleformat, &data, &numberofsamples, &samplerate);
-#else
- alutLoadWAVFile((ALbyte *)samplename.Ptr(), &sampleformat, &data, &numberofsamples, &samplerate, &loop);
-#endif
+ SND_alutLoadWAVMemory((ALbyte*)memlocation, size, &sampleformat, &data, &numberofsamples, &samplerate, &loop);
/* put it in the buffer */
alBufferData(m_buffers[buffer], sampleformat, data, numberofsamples, samplerate);
}
+ if(freemem)
+ free(memlocation);
+
/* fill the waveslot with info */
al_error = alGetError();
if (al_error == AL_NO_ERROR && m_buffers[buffer])
@@ -486,11 +544,7 @@ SND_WaveSlot* SND_OpenALDevice::LoadSample(const STR_String& name,
}
/* and free the original stuff (copy was made in openal) */
-#if defined(OUDE_OPENAL) || defined (__APPLE__) || !defined(AL_VERSION_1_1)
- alutUnloadWAV(sampleformat, data, numberofsamples, samplerate);
-#else
- free(data);
-#endif
+ SND_alutUnloadWAV(sampleformat, data, numberofsamples, samplerate);
}
}
else
@@ -594,7 +648,7 @@ int SND_OpenALDevice::GetPlayState(int id)
#ifdef __APPLE__
alGetSourcei(m_sources[id], AL_SOURCE_STATE, &alstate);
#else
- alGetSourceiv(m_sources[id], AL_SOURCE_STATE, &alstate);
+ alGetSourceiv(m_sources[id], AL_SOURCE_STATE, &alstate);
#endif
switch(alstate)
diff --git a/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp b/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp
index b1bac964c61..5054c39e8a1 100644
--- a/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp
+++ b/intern/SoundSystem/sdl/SND_SDLCDDevice.cpp
@@ -43,6 +43,8 @@
#ifndef DISABLE_SDL
#include <SDL.h>
+#else
+#include <stdio.h>
#endif
SND_SDLCDDevice::SND_SDLCDDevice() :
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index 1043d0938b4..fb1b96fcbc7 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -34,7 +34,6 @@
* @date May 7, 2001
*/
-
#include <Carbon/Carbon.h>
#include <ApplicationServices/ApplicationServices.h>
#include "GHOST_SystemCarbon.h"
@@ -430,6 +429,29 @@ GHOST_IWindow* GHOST_SystemCarbon::createWindow(
return window;
}
+GHOST_TSuccess GHOST_SystemCarbon::beginFullScreen(const GHOST_DisplaySetting& setting, GHOST_IWindow** window, const bool stereoVisual)
+{
+ GHOST_TSuccess success = GHOST_kFailure;
+
+ // need yo make this Carbon all on 10.5 for fullscreen to work correctly
+ CGCaptureAllDisplays();
+
+ success = GHOST_System::beginFullScreen( setting, window, stereoVisual);
+
+ if( success != GHOST_kSuccess ) {
+ // fullscreen failed for other reasons, release
+ CGReleaseAllDisplays();
+ }
+
+ return success;
+}
+
+GHOST_TSuccess GHOST_SystemCarbon::endFullScreen(void)
+{
+ CGReleaseAllDisplays();
+ return GHOST_System::endFullScreen();
+}
+
/* this is an old style low level event queue.
As we want to handle our own timers, this is ok.
the full screen hack should be removed */
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index 62d45ee769d..5b3b786a5ac 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -118,6 +118,14 @@ public:
const GHOST_TEmbedderWindowID parentWindow = 0
);
+ virtual GHOST_TSuccess beginFullScreen(
+ const GHOST_DisplaySetting& setting,
+ GHOST_IWindow** window,
+ const bool stereoVisual
+ );
+
+ virtual GHOST_TSuccess endFullScreen( void );
+
/***************************************************************************************
** Event management functionality
***************************************************************************************/
diff --git a/intern/guardedalloc/intern/mmap_win.c b/intern/guardedalloc/intern/mmap_win.c
index 5c59640200f..979e77ebbed 100644
--- a/intern/guardedalloc/intern/mmap_win.c
+++ b/intern/guardedalloc/intern/mmap_win.c
@@ -162,6 +162,7 @@ intptr_t munmap(void *ptr, intptr_t size)
CloseHandle( mm->maphandle );
CloseHandle( mm->fhandle);
mmap_remlink(mmapbase, mm);
+ free(mm);
return 0;
}