mirror of
https://github.com/celisej567/mcpe.git
synced 2026-01-05 18:10:09 +03:00
* Fix bad names in the PCM sound header. Audio now works well :)
This commit is contained in:
@@ -105,12 +105,6 @@ void SoundSystemWindows::playAt(const SoundDesc& sound, float x, float y, float
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (sound.m_pHeader->m_id == 1) //for some reason if the id is 1 you need to pitch the sound down
|
||||
{
|
||||
pitch /= 2.f;
|
||||
}
|
||||
|
||||
HRESULT result;
|
||||
IDirectSoundBuffer* tempBuffer;
|
||||
unsigned char* bufferPtr;
|
||||
@@ -123,8 +117,8 @@ void SoundSystemWindows::playAt(const SoundDesc& sound, float x, float y, float
|
||||
WAVEFORMATEX waveFormat;
|
||||
waveFormat.wFormatTag = WAVE_FORMAT_PCM;
|
||||
waveFormat.nSamplesPerSec = DWORD(float(sound.m_pHeader->m_sample_rate) * pitch);
|
||||
waveFormat.wBitsPerSample = 16;
|
||||
waveFormat.nChannels = sound.m_header.m_channels;
|
||||
waveFormat.wBitsPerSample = 8 * sound.m_pHeader->m_bytes_per_sample;
|
||||
waveFormat.nChannels = sound.m_pHeader->m_channels;
|
||||
waveFormat.nBlockAlign = (waveFormat.wBitsPerSample / 8) * waveFormat.nChannels;
|
||||
waveFormat.nAvgBytesPerSec = waveFormat.nSamplesPerSec * waveFormat.nBlockAlign;
|
||||
waveFormat.cbSize = 0;
|
||||
@@ -185,7 +179,6 @@ void SoundSystemWindows::playAt(const SoundDesc& sound, float x, float y, float
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
(*soundbuffer)->Play(0, 0, 0);
|
||||
m_buffers.push_back(soundbuffer);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
struct PCMSoundHeader
|
||||
{
|
||||
int m_id;
|
||||
int m_channels;
|
||||
int m_bytes_per_sample;
|
||||
int m_sample_rate;
|
||||
int m_length;
|
||||
};
|
||||
@@ -31,6 +31,6 @@ struct SoundDesc
|
||||
m_pHeader = &header;
|
||||
m_header = header;
|
||||
m_pData = data;
|
||||
field_4 = header.m_id * header.m_length * header.m_channels;
|
||||
field_4 = header.m_channels * header.m_length * header.m_bytes_per_sample;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user