Browse Source

Disables Ogg for iOS

This disables Ogg for iOS.  Unfortunately it means that for now ogg
files won’t work on iOS devices.  However, iOS will compile again.
Peter Robinson 9 years ago
parent
commit
6441d014e1

+ 10 - 1
engine/source/audio/audioBuffer.cc

@@ -25,7 +25,10 @@
 #include "io/stream.h"
 #include "io/stream.h"
 #include "console/console.h"
 #include "console/console.h"
 #include "memory/frameAllocator.h"
 #include "memory/frameAllocator.h"
+
+#ifndef TORQUE_OS_IOS
 #include "vorbis/vorbisfile.h"
 #include "vorbis/vorbisfile.h"
+#endif
 
 
 #ifndef _MMATH_H_
 #ifndef _MMATH_H_
 #include "math/mMath.h"
 #include "math/mMath.h"
@@ -97,6 +100,7 @@ struct WAVChunkHdr
 
 
 #define CHUNKSIZE 4096
 #define CHUNKSIZE 4096
 
 
+#ifndef TORQUE_OS_IOS
 // Ogg Vorbis
 // Ogg Vorbis
 static size_t _ov_read_func(void *ptr, size_t size, size_t nmemb, void *datasource)
 static size_t _ov_read_func(void *ptr, size_t size, size_t nmemb, void *datasource)
 {
 {
@@ -135,6 +139,7 @@ static long _ov_tell_func(void *datasource)
 	Stream *stream = reinterpret_cast<Stream*>(datasource);
 	Stream *stream = reinterpret_cast<Stream*>(datasource);
 	return stream->getPosition();
 	return stream->getPosition();
 }
 }
+#endif
 
 
 
 
 //--------------------------------------
 //--------------------------------------
@@ -275,6 +280,7 @@ ALuint AudioBuffer::getALBuffer()
            malBuffer = bufferID;
            malBuffer = bufferID;
        }
        }
 #endif
 #endif
+#ifndef TORQUE_OS_IOS
 		else if (len > 3 && !dStricmp(mFilename + len - 4, ".ogg"))
 		else if (len > 3 && !dStricmp(mFilename + len - 4, ".ogg"))
 		{
 		{
 #  ifdef LOG_SOUND_LOADS
 #  ifdef LOG_SOUND_LOADS
@@ -282,6 +288,7 @@ ALuint AudioBuffer::getALBuffer()
 #  endif
 #  endif
 		   readSuccess = readOgg(obj);
 		   readSuccess = readOgg(obj);
 	   }
 	   }
+#endif
 
 
       if(readSuccess)
       if(readSuccess)
          return(malBuffer);
          return(malBuffer);
@@ -432,6 +439,7 @@ bool AudioBuffer::readWAV(ResourceObject *obj)
    return false;
    return false;
 }
 }
 
 
+#ifndef TORQUE_OS_IOS
 // Read an Ogg Vorbis file from the given ResourceObject and initialize an alBuffer with it.
 // Read an Ogg Vorbis file from the given ResourceObject and initialize an alBuffer with it.
 // Pulled from: https://www.garagegames.com/community/forums/viewthread/136675
 // Pulled from: https://www.garagegames.com/community/forums/viewthread/136675
 bool AudioBuffer::readOgg(ResourceObject *obj)
 bool AudioBuffer::readOgg(ResourceObject *obj)
@@ -533,4 +541,5 @@ long AudioBuffer::oggRead(OggVorbis_File* vf, char *buffer, int length, int bige
 	}
 	}
 
 
 	return offset;
 	return offset;
-}
+}
+#endif

+ 2 - 0
engine/source/audio/audioBuffer.h

@@ -47,8 +47,10 @@ private:
    bool readRIFFchunk(Stream &s, const char *seekLabel, U32 *size);
    bool readRIFFchunk(Stream &s, const char *seekLabel, U32 *size);
    bool readWAV(ResourceObject *obj);
    bool readWAV(ResourceObject *obj);
 
 
+#ifndef TORQUE_OS_IOS
    bool readOgg(ResourceObject *obj);
    bool readOgg(ResourceObject *obj);
    long oggRead(struct OggVorbis_File* vf, char *buffer, int length, int bigendianp, int *bitstream);
    long oggRead(struct OggVorbis_File* vf, char *buffer, int length, int bigendianp, int *bitstream);
+#endif
 
 
 public:
 public:
    AudioBuffer(StringTableEntry filename);
    AudioBuffer(StringTableEntry filename);

+ 5 - 0
engine/source/audio/audioStreamSourceFactory.cc

@@ -30,7 +30,10 @@
 #include "audio/audioStreamSourceFactory.h"
 #include "audio/audioStreamSourceFactory.h"
 
 
 #include "audio/wavStreamSource.h"
 #include "audio/wavStreamSource.h"
+
+#ifndef TORQUE_OS_IOS
 #include "audio/vorbisStreamSource.h"
 #include "audio/vorbisStreamSource.h"
+#endif
 
 
 AudioStreamSource* AudioStreamSourceFactory::getNewInstance(const char *filename)
 AudioStreamSource* AudioStreamSourceFactory::getNewInstance(const char *filename)
 {
 {
@@ -38,8 +41,10 @@ AudioStreamSource* AudioStreamSourceFactory::getNewInstance(const char *filename
 	if(len > 3 && !dStricmp(filename + len - 4, ".wav"))
 	if(len > 3 && !dStricmp(filename + len - 4, ".wav"))
 		return new WavStreamSource(filename);
 		return new WavStreamSource(filename);
 	
 	
+#ifndef TORQUE_OS_IOS
 	if (len > 3 && !dStricmp(filename + len - 4, ".ogg"))
 	if (len > 3 && !dStricmp(filename + len - 4, ".ogg"))
 		return new VorbisStreamSource(filename);
 		return new VorbisStreamSource(filename);
+#endif
 
 
 	return NULL;
 	return NULL;
 }
 }

+ 2 - 1
engine/source/audio/vorbisStreamSource.h

@@ -12,9 +12,9 @@
 #include "audio/audioStreamSource.h"
 #include "audio/audioStreamSource.h"
 #endif
 #endif
 
 
+#ifndef TORQUE_OS_IOS
 #include "vorbis/vorbisfile.h"
 #include "vorbis/vorbisfile.h"
 
 
-
 class VorbisStreamSource: public AudioStreamSource
 class VorbisStreamSource: public AudioStreamSource
 {
 {
 	public:
 	public:
@@ -55,5 +55,6 @@ class VorbisStreamSource: public AudioStreamSource
 		void resetStream();
 		void resetStream();
       void setNewFile(const char * file);
       void setNewFile(const char * file);
 };
 };
+#endif
 
 
 #endif // _VORBISSTREAMSOURCE_H_
 #endif // _VORBISSTREAMSOURCE_H_