mirror of
https://github.com/SFML/SFML.git
synced 2024-11-28 22:31:09 +08:00
Added support for 32-bits samples in WAV files
This commit is contained in:
parent
ce16554763
commit
3ca6e0f346
@ -65,6 +65,17 @@ namespace
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool decode(sf::InputStream& stream, sf::Int32& value)
|
||||||
|
{
|
||||||
|
unsigned char bytes[sizeof(value)];
|
||||||
|
if (stream.read(bytes, sizeof(bytes)) != sizeof(bytes))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
value = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool decode(sf::InputStream& stream, sf::Uint32& value)
|
bool decode(sf::InputStream& stream, sf::Uint32& value)
|
||||||
{
|
{
|
||||||
unsigned char bytes[sizeof(value)];
|
unsigned char bytes[sizeof(value)];
|
||||||
@ -157,6 +168,16 @@ Uint64 SoundFileReaderWav::read(Int16* samples, Uint64 maxCount)
|
|||||||
return count;
|
return count;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
{
|
||||||
|
Int32 sample = 0;
|
||||||
|
if (decode(*m_stream, sample))
|
||||||
|
*samples++ = sample >> 16;
|
||||||
|
else
|
||||||
|
return count;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
Loading…
Reference in New Issue
Block a user