mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-22 22:53:52 +00:00
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)
|
||||
{
|
||||
// Read frames. We count channels as part of the frame, even though
|
||||
// libsndfile does not. This is because the library still requires
|
||||
// the number of frames read to be a multiple of channels.
|
||||
return channels*sf_read_short((SNDFILE*)handle, (short*)data, length*channels);
|
||||
// readf_* reads entire frames, including channels
|
||||
return sf_readf_short((SNDFILE*)handle, (short*)data, length);
|
||||
}
|
||||
|
||||
SndFileSource::SndFileSource(const std::string &file)
|
||||
|
|
|
@ -102,7 +102,7 @@ Mpg123Source::Mpg123Source(const std::string &file)
|
|||
err = mpg123_getformat(mhh, &rate, &channels, &encoding);
|
||||
checkError(err, mh);
|
||||
if(encoding != MPG123_ENC_SIGNED_16)
|
||||
fail("Bad encoding");
|
||||
fail("Unsupported encoding in " + file);
|
||||
|
||||
// This is the only bit size we support.
|
||||
bits = 16;
|
||||
|
|
|
@ -29,6 +29,7 @@ void play(const char* name, bool stream=false)
|
|||
else
|
||||
snd = mg.load(name);
|
||||
|
||||
snd->setStreaming(true);
|
||||
snd->play();
|
||||
|
||||
while(snd->isPlaying())
|
||||
|
|
Loading…
Reference in a new issue