forked from mirror/openmw-tes3mp
Tested if exchanging sf_read with sf_readf in libsndfile help OpenMW crash (it did not)
This commit is contained in:
parent
cd4ed4e6bf
commit
27bef84091
3 changed files with 4 additions and 5 deletions
|
@ -19,10 +19,8 @@ void SndFileSource::getInfo(int32_t *_rate, int32_t *_channels, int32_t *_bits)
|
||||||
|
|
||||||
size_t SndFileSource::readSamples(void *data, size_t length)
|
size_t SndFileSource::readSamples(void *data, size_t length)
|
||||||
{
|
{
|
||||||
// Read frames. We count channels as part of the frame, even though
|
// readf_* reads entire frames, including channels
|
||||||
// libsndfile does not. This is because the library still requires
|
return sf_readf_short((SNDFILE*)handle, (short*)data, length);
|
||||||
// the number of frames read to be a multiple of channels.
|
|
||||||
return channels*sf_read_short((SNDFILE*)handle, (short*)data, length*channels);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SndFileSource::SndFileSource(const std::string &file)
|
SndFileSource::SndFileSource(const std::string &file)
|
||||||
|
|
|
@ -102,7 +102,7 @@ Mpg123Source::Mpg123Source(const std::string &file)
|
||||||
err = mpg123_getformat(mhh, &rate, &channels, &encoding);
|
err = mpg123_getformat(mhh, &rate, &channels, &encoding);
|
||||||
checkError(err, mh);
|
checkError(err, mh);
|
||||||
if(encoding != MPG123_ENC_SIGNED_16)
|
if(encoding != MPG123_ENC_SIGNED_16)
|
||||||
fail("Bad encoding");
|
fail("Unsupported encoding in " + file);
|
||||||
|
|
||||||
// This is the only bit size we support.
|
// This is the only bit size we support.
|
||||||
bits = 16;
|
bits = 16;
|
||||||
|
|
|
@ -29,6 +29,7 @@ void play(const char* name, bool stream=false)
|
||||||
else
|
else
|
||||||
snd = mg.load(name);
|
snd = mg.load(name);
|
||||||
|
|
||||||
|
snd->setStreaming(true);
|
||||||
snd->play();
|
snd->play();
|
||||||
|
|
||||||
while(snd->isPlaying())
|
while(snd->isPlaying())
|
||||||
|
|
Loading…
Reference in a new issue