mirror of
https://gitea.sffempire.ru/Kolyah35/minecraft-pe-0.6.1.git
synced 2026-03-20 06:53:30 +00:00
Fixes and enhancements from my MCPE repository. (https://github.com/mschiller890/mcpe64)
This commit is contained in:
@@ -140,7 +140,7 @@ void SoundSystemAL::playAt( const SoundDesc& sound, float x, float y, float z, f
|
||||
{
|
||||
if (pitch < 0.01f) pitch = 1;
|
||||
|
||||
LOGI("playing sound '%s' with volume/pitch: %f, %f @ %f, %f, %f\n", sound.name.c_str(), volume, pitch, x, y, z);
|
||||
//LOGI("playing sound '%s' with volume/pitch: %f, %f @ %f, %f, %f\n", sound.name.c_str(), volume, pitch, x, y, z);
|
||||
|
||||
ALuint bufferID;
|
||||
if (!getBufferId(sound, &bufferID)) {
|
||||
@@ -151,7 +151,7 @@ void SoundSystemAL::playAt( const SoundDesc& sound, float x, float y, float z, f
|
||||
}
|
||||
errIdString = "Get buffer";
|
||||
checkError();
|
||||
LOGI("playing sound %d - '%s' with volume/pitch: %f, %f @ %f, %f, %f\n", bufferID, sound.name.c_str(), volume, pitch, x, y, z);
|
||||
//LOGI("playing sound %d - '%s' with volume/pitch: %f, %f @ %f, %f, %f\n", bufferID, sound.name.c_str(), volume, pitch, x, y, z);
|
||||
|
||||
int sourceIndex;
|
||||
errIdString = "Get free index";
|
||||
@@ -232,12 +232,12 @@ bool SoundSystemAL::getBufferId(const SoundDesc& sound, ALuint* buf) {
|
||||
: (sound.channels==2? AL_FORMAT_STEREO8 : AL_FORMAT_MONO8);
|
||||
|
||||
alBufferData(bufferID, format, sound.frames, sound.size, sound.frameRate);
|
||||
LOGI("Creating %d (%p) from sound: '%s'\n", bufferID, sound.frames, sound.name.c_str());
|
||||
//LOGI("Creating %d (%p) from sound: '%s'\n", bufferID, sound.frames, sound.name.c_str());
|
||||
errIdString = "Buffer data";
|
||||
LOGI("Creating buffer with data: %d (%d), %p, %d, %d\n", format, sound.byteWidth, sound.frames, sound.size, sound.frameRate);
|
||||
//LOGI("Creating buffer with data: %d (%d), %p, %d, %d\n", format, sound.byteWidth, sound.frames, sound.size, sound.frameRate);
|
||||
checkError();
|
||||
|
||||
LOGI("Sound ch: %d, fmt: %d, frames: %p, len: %f, fr: %d, sz: %d, numfr: %d\n", sound.channels, format, sound.frames, sound.length(), sound.frameRate, sound.size, sound.numFrames);
|
||||
//LOGI("Sound ch: %d, fmt: %d, frames: %p, len: %f, fr: %d, sz: %d, numfr: %d\n", sound.channels, format, sound.frames, sound.length(), sound.frameRate, sound.size, sound.numFrames);
|
||||
|
||||
|
||||
Buffer buffer;
|
||||
@@ -248,6 +248,10 @@ bool SoundSystemAL::getBufferId(const SoundDesc& sound, ALuint* buf) {
|
||||
_buffers.push_back(buffer);
|
||||
|
||||
// @huge @attn @note @fix: The original data is free'd
|
||||
// On PLATFORM_DESKTOP the PCM data lives in static arrays (not heap),
|
||||
// so calling delete[] on them causes a debug-heap __debugbreak crash.
|
||||
#if !defined(PLATFORM_DESKTOP)
|
||||
sound.destroy();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void SoundSystemSL::setListenerPos( float x, float y, float z )
|
||||
return;
|
||||
}
|
||||
|
||||
SLVec3D pos = {1000.0f * x, 1000.0f * y, 1000.0f * z};
|
||||
SLVec3D pos = {(SLint32)(1000.0f * x), (SLint32)(1000.0f * y), (SLint32)(1000.0f * z)};
|
||||
SLresult res = (*listener)->SetLocationCartesian(listener, &pos);
|
||||
checkErr(res);
|
||||
}
|
||||
@@ -115,10 +115,10 @@ void SoundSystemSL::playAt( const SoundDesc& sound, float x, float y, float z, f
|
||||
SLDataLocator_AndroidSimpleBufferQueue uri = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
|
||||
SLDataFormat_PCM mime = {
|
||||
SL_DATAFORMAT_PCM,
|
||||
sound.channels,
|
||||
sound.frameRate * 1000,
|
||||
sound.byteWidth << 3,
|
||||
sound.byteWidth << 3,
|
||||
(SLuint32)sound.channels,
|
||||
(SLuint32)(sound.frameRate * 1000),
|
||||
(SLuint32)(sound.byteWidth << 3),
|
||||
(SLuint32)(sound.byteWidth << 3),
|
||||
sound.channels==1? SL_SPEAKER_FRONT_CENTER :
|
||||
SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT,
|
||||
SL_BYTEORDER_LITTLEENDIAN
|
||||
|
||||
Reference in New Issue
Block a user