Bladeren bron

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 jaren geleden
bovenliggende
commit
6441d014e1

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

@@ -25,7 +25,10 @@
 #include "io/stream.h"
 #include "console/console.h"
 #include "memory/frameAllocator.h"
+
+#ifndef TORQUE_OS_IOS
 #include "vorbis/vorbisfile.h"
+#endif
 
 #ifndef _MMATH_H_
 #include "math/mMath.h"
@@ -97,6 +100,7 @@ struct WAVChunkHdr
 
 #define CHUNKSIZE 4096
 
+#ifndef TORQUE_OS_IOS
 // Ogg Vorbis
 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);
 	return stream->getPosition();
 }
+#endif
 
 
 //--------------------------------------
@@ -275,6 +280,7 @@ ALuint AudioBuffer::getALBuffer()
            malBuffer = bufferID;
        }
 #endif
+#ifndef TORQUE_OS_IOS
 		else if (len > 3 && !dStricmp(mFilename + len - 4, ".ogg"))
 		{
 #  ifdef LOG_SOUND_LOADS
@@ -282,6 +288,7 @@ ALuint AudioBuffer::getALBuffer()
 #  endif
 		   readSuccess = readOgg(obj);
 	   }
+#endif
 
       if(readSuccess)
          return(malBuffer);
@@ -432,6 +439,7 @@ bool AudioBuffer::readWAV(ResourceObject *obj)
    return false;
 }
 
+#ifndef TORQUE_OS_IOS
 // 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
 bool AudioBuffer::readOgg(ResourceObject *obj)
@@ -533,4 +541,5 @@ long AudioBuffer::oggRead(OggVorbis_File* vf, char *buffer, int length, int bige
 	}
 
 	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 readWAV(ResourceObject *obj);
 
+#ifndef TORQUE_OS_IOS
    bool readOgg(ResourceObject *obj);
    long oggRead(struct OggVorbis_File* vf, char *buffer, int length, int bigendianp, int *bitstream);
+#endif
 
 public:
    AudioBuffer(StringTableEntry filename);

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

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

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

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