mega28
06-08-2013 09:40:17
OgreOggSound crashes with the following error when attempting to load a wave file
This is due to the difference in sizes of "long int" between 32 and 64-bit linux at least.
The bug disappeared for my case after changing the wave structures in OgreOggISound.h
To the following:
This of course needs a better fix but it did the trick for me.
A related post: viewtopic.php?f=19&t=14791
*****************************************
*** --- Initialising OgreOggSound --- ***
*** --- OgreOggSound v1.22 --- ***
*****************************************
*** --- OpenAL version 1.1
*** --- AVAILABLE DEVICES --- ***
*** --- OpenAL Soft
*** --- Choosing: OpenAL Soft (Default device)
*** --- OpenAL Device successfully created
*** --- OpenAL Context successfully created
*** --- SUPPORTED FORMATS
*** --- AL_FORMAT_MONO16 -- Monophonic Sound
*** --- AL_FORMAT_STEREO16 -- Stereo Sound
*** --- AL_FORMAT_QUAD16 -- 4 Channel Sound
*** --- AL_FORMAT_51CHN16 -- 5.1 Surround Sound
*** --- AL_FORMAT_61CHN16 -- 6.1 Surround Sound
*** --- AL_FORMAT_71CHN16 -- 7.1 Surround Sound
*** --- Created 100 sources for simultaneous sounds
*** --- Using BOOST threads for streaming
*****************************************
*** --- OgreOggSound Initialised --- ***
*****************************************
*** Initializing OIS ***
terminate called after throwing an instance of 'Ogre::InternalErrorException'
what(): OGRE EXCEPTION(7:InternalErrorException): Not a valid WAVE file! in OgreOggStaticWavSound::_openImpl() at /home/mega/Elbatriq/OgreOggSound-1.23/src/OgreOggStaticWavSound.cpp (line 165)
This is due to the difference in sizes of "long int" between 32 and 64-bit linux at least.
The bug disappeared for my case after changing the wave structures in OgreOggISound.h
//! CHUNK header information
// Chunk section within a wav file ('data'/'fact'/'cue' etc..)
typedef struct
{
char chunkID[4]; // 'data' or 'fact'
long int length;
} ChunkHeader;
//! WAVEFORMATEX header information
/** Structure defining a WAVE sounds format.
*/
typedef struct
{
char mRIFF[4]; // 'RIFF'
unsigned long int mLength;
char mWAVE[4]; // 'WAVE'
char mFMT[4]; // 'fmt '
unsigned int mHeaderSize; // varies...
unsigned short int mFormatTag;
unsigned short int mChannels; // 1,2 for stereo data is (l,r) pairs
unsigned long int mSamplesPerSec;
unsigned long int mAvgBytesPerSec;
unsigned short int mBlockAlign;
unsigned short int mBitsPerSample;
} WaveHeader;
//! WAVEFORMATEXTENSIBLE sound information
/** Structure defining a WAVE sounds format.
*/
typedef struct
{
WaveHeader* mFormat;
unsigned short mSamples;
unsigned long int mChannelMask;
char mSubFormat[16];
} WavFormatData;
To the following:
//! CHUNK header information
// Chunk section within a wav file ('data'/'fact'/'cue' etc..)
typedef struct
{
char chunkID[4]; // 'data' or 'fact'
int length;
} ChunkHeader;
//! WAVEFORMATEX header information
/** Structure defining a WAVE sounds format.
*/
typedef struct
{
char mRIFF[4]; // 'RIFF'
unsigned int mLength;
char mWAVE[4]; // 'WAVE'
char mFMT[4]; // 'fmt '
unsigned int mHeaderSize; // varies...
unsigned short int mFormatTag;
unsigned short int mChannels; // 1,2 for stereo data is (l,r) pairs
unsigned int mSamplesPerSec;
unsigned int mAvgBytesPerSec;
unsigned short int mBlockAlign;
unsigned short int mBitsPerSample;
} WaveHeader;
//! WAVEFORMATEXTENSIBLE sound information
/** Structure defining a WAVE sounds format.
*/
typedef struct
{
WaveHeader* mFormat;
unsigned short mSamples;
unsigned int mChannelMask;
char mSubFormat[16];
} WavFormatData;
This of course needs a better fix but it did the trick for me.
A related post: viewtopic.php?f=19&t=14791