From 637f1c11321994185445af2db742bf17a9b191a9 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Tue, 12 Oct 2021 16:01:07 -0400 Subject: [PATCH] 2.2.7 --- VERSION | 2 +- docs/CHANGELOG.md | 4 + images/start.png | Bin 31456 -> 31460 bytes media-layer/core/src/audio/api.cpp | 148 +++++++++++++++-------------- mods/src/server/server.cpp | 1 - 5 files changed, 82 insertions(+), 73 deletions(-) diff --git a/VERSION b/VERSION index bda8fbec1..5bc1cc43d 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.6 +2.2.7 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5c74e0ac0..f43fb192e 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +**2.2.7** +* Fix Crash When OpenAL Is Unavailable +* Fix Command Input In Server + **2.2.5** * Fix Bug In Texture Scaling Code diff --git a/images/start.png b/images/start.png index 7df95f121c7267069d6dce26b3bebceb881a91b4..7201171320d188cdba2a0d91fe15e42877d2444e 100644 GIT binary patch delta 1408 zcmZva`#aMM0LE44^wbE=4x#3_hLn)SoOmjlnWbEg`#~98JTC(C3mV+$uT&CDvyWyb0B>*@0syzl#Y|5@4bab?HzaRe|@xgE#wQI^DK zv4FJ=Fatvtf^^6{Ejls*Q ztJ1VL_3mUyZ;h1Qc+}E6D1&>OR<*%+60;OwnDb=8bW2pCn5KgMWOv6SU z6V7tTDlj@YX9q@Bzsy(|e`+~6(1A0p&rtF9>f{LRm=cCylb1m5Cj7ncM|o7u-Y%1d z@|Hm^D1YY^?4s6ayj7WH#D3BIqV2IV+8u22>K-wPe*fUDwk_>Fl3z!M;$DIo%txhy z5H+pAZWIT8nvD`*(m!4n;!8|mudKDax%7yKhHn|; zObgMv^8%WF&Lw_C>WeqMCMAXh@n(%)wIwDjyKzpB3_WK&C;&z=nkvQdU&!1x21z^@ zz4QkeJ6S+8aVuZ0O^lrn^~w`p_nTVeQcwyW*I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Xt zw!dejw7*n0*LJW8Pm<`Fd0e-v(?5&2+Fz%C7IC$|l#NYd6Fwx>K@YW(vheAo&rUB# z52KRGaa+w`DY2Q{*{1z%!r{s@szo0guIC@At#nfRSJQ4f{d2U*j3BpGs#KC&|#C7~j?Qiot;u_Ma|6Yu?-(Oz;gm0JaA5Ln2Tayt}6Mtcr zLZXD}VI)#`iIknpH9W~Cq({oY7MG+m-MMnj@Mbe%t__=VY(8t9&F8CgJ+9)~cZoCs zcP+CC*>Yu*Rc|QS)Tb6cFPlt~HpjfpI(imaX+m=;%cadZN6KDklburH8ai8R$01QY z;|LcK5fKp)Q9{_^A|fIpA|gtNb$>{ql)Yp}r#btFl#N8J$hdZMIr}?|%U!dqNTlp5 zayf2UTwJrYNXyy&{+6A}skQc(LSHVv_+tOHlpW4>Qe&HmW%X^@gp*0@NTGvqm9OuM z&Zhn2nhe?|Y)NMmie{4uP&aMjxX5*MQrN01*W+Ibk<#~9|BT`~|43ZhO-euBTr*qR zOnfYn!p~gm;~J{!+Wr#Pc9z(j|MfPp2@#Y+BIC+JDP_5oCOdX5Uq2p__$|=Y>+i3G z*FWLQ+5Y~PjZ1g#ebs7vlTlX}f9SX)rmi;qVMphF;~QK<)5FV(ca z>pt2{P^*WH=^=$u``aA<`e$TQj!hVqYx_&vwP}Bwu*oFOKh?CG&G*GdI5o$-{$A<) zV^bfS<5oZC=v>b~QoHG-bB?Z>^S{mUub=;`IoIh~0j2DJNt{bvC(G99pAmn5J+l){ z^$&k;L+o|<|Lxu3vs`C+81R)P3#q-g$dW002ovPDHLkV1o2?%FX}) diff --git a/media-layer/core/src/audio/api.cpp b/media-layer/core/src/audio/api.cpp index 1aceb04a9..44fe4fdf2 100644 --- a/media-layer/core/src/audio/api.cpp +++ b/media-layer/core/src/audio/api.cpp @@ -25,90 +25,96 @@ static std::vector &get_sources() { // Update Listener void media_audio_update(float volume, float x, float y, float z, float yaw) { - // Update Listener Volume - alListenerf(AL_GAIN, volume); - AL_ERROR_CHECK(); + // Check + if (_media_audio_is_loaded()) { + // Update Listener Volume + alListenerf(AL_GAIN, volume); + AL_ERROR_CHECK(); - // Update Listener Position - alListener3f(AL_POSITION, x, y, z); - AL_ERROR_CHECK(); + // Update Listener Position + alListener3f(AL_POSITION, x, y, z); + AL_ERROR_CHECK(); - // Update Listener Orientation - float radian_yaw = yaw * (M_PI / 180); - ALfloat orientation[] = {-sinf(radian_yaw), 0.0f, cosf(radian_yaw), 0.0f, 1.0f, 0.0f}; - alListenerfv(AL_ORIENTATION, orientation); - AL_ERROR_CHECK(); + // Update Listener Orientation + float radian_yaw = yaw * (M_PI / 180); + ALfloat orientation[] = {-sinf(radian_yaw), 0.0f, cosf(radian_yaw), 0.0f, 1.0f, 0.0f}; + alListenerfv(AL_ORIENTATION, orientation); + AL_ERROR_CHECK(); - // Clear Finished Sources - std::vector::iterator it = get_sources().begin(); - while (it != get_sources().end()) { - ALuint source = *it; - bool remove = false; - // Check - if (source && alIsSource(source)) { - // Is Valid Source - ALint source_state; - alGetSourcei(source, AL_SOURCE_STATE, &source_state); - AL_ERROR_CHECK(); - if (source_state != AL_PLAYING) { - // Finished Playing - remove = true; - alDeleteSources(1, &source); + // Clear Finished Sources + std::vector::iterator it = get_sources().begin(); + while (it != get_sources().end()) { + ALuint source = *it; + bool remove = false; + // Check + if (source && alIsSource(source)) { + // Is Valid Source + ALint source_state; + alGetSourcei(source, AL_SOURCE_STATE, &source_state); AL_ERROR_CHECK(); + if (source_state != AL_PLAYING) { + // Finished Playing + remove = true; + alDeleteSources(1, &source); + AL_ERROR_CHECK(); + } + } else { + // Not A Source + remove = true; + } + // Remove If Needed + if (remove) { + it = get_sources().erase(it); + } else { + ++it; } - } else { - // Not A Source - remove = true; - } - // Remove If Needed - if (remove) { - it = get_sources().erase(it); - } else { - ++it; } } } void media_audio_play(const char *source, const char *name, float x, float y, float z, float pitch, float volume, int is_ui) { - // Load Sound - ALuint buffer = _media_audio_get_buffer(source, name); - if (volume > 0.0f && buffer) { - // Create Source - ALuint al_source; - alGenSources(1, &al_source); - AL_ERROR_CHECK(); + // Check + if (_media_audio_is_loaded()) { + // Load Sound + ALuint buffer = _media_audio_get_buffer(source, name); + if (volume > 0.0f && buffer) { + // Create Source + ALuint al_source; + alGenSources(1, &al_source); + AL_ERROR_CHECK(); - // Set Properties - alSourcef(al_source, AL_PITCH, pitch); - AL_ERROR_CHECK(); - alSourcef(al_source, AL_GAIN, volume); - AL_ERROR_CHECK(); - alSource3f(al_source, AL_POSITION, x, y, z); - AL_ERROR_CHECK(); - alSource3f(al_source, AL_VELOCITY, 0, 0, 0); - AL_ERROR_CHECK(); - alSourcei(al_source, AL_LOOPING, AL_FALSE); - AL_ERROR_CHECK(); - alSourcei(al_source, AL_SOURCE_RELATIVE, is_ui ? AL_TRUE : AL_FALSE); - AL_ERROR_CHECK(); + // Set Properties + alSourcef(al_source, AL_PITCH, pitch); + AL_ERROR_CHECK(); + alSourcef(al_source, AL_GAIN, volume); + AL_ERROR_CHECK(); + alSource3f(al_source, AL_POSITION, x, y, z); + AL_ERROR_CHECK(); + alSource3f(al_source, AL_VELOCITY, 0, 0, 0); + AL_ERROR_CHECK(); + alSourcei(al_source, AL_LOOPING, AL_FALSE); + AL_ERROR_CHECK(); + alSourcei(al_source, AL_SOURCE_RELATIVE, is_ui ? AL_TRUE : AL_FALSE); + AL_ERROR_CHECK(); - // Set Attenuation - alSourcei(al_source, AL_DISTANCE_MODEL, AL_LINEAR_DISTANCE); - AL_ERROR_CHECK(); - alSourcef(al_source, AL_MAX_DISTANCE, 16.0f); - AL_ERROR_CHECK(); - alSourcef(al_source, AL_ROLLOFF_FACTOR, 1.0f); - AL_ERROR_CHECK(); - alSourcef(al_source, AL_REFERENCE_DISTANCE, 0.0f); - AL_ERROR_CHECK(); + // Set Attenuation + alSourcei(al_source, AL_DISTANCE_MODEL, AL_LINEAR_DISTANCE); + AL_ERROR_CHECK(); + alSourcef(al_source, AL_MAX_DISTANCE, 16.0f); + AL_ERROR_CHECK(); + alSourcef(al_source, AL_ROLLOFF_FACTOR, 1.0f); + AL_ERROR_CHECK(); + alSourcef(al_source, AL_REFERENCE_DISTANCE, 0.0f); + AL_ERROR_CHECK(); - // Set Buffer - alSourcei(al_source, AL_BUFFER, buffer); - AL_ERROR_CHECK(); + // Set Buffer + alSourcei(al_source, AL_BUFFER, buffer); + AL_ERROR_CHECK(); - // Play - alSourcePlay(al_source); - AL_ERROR_CHECK(); - get_sources().push_back(al_source); + // Play + alSourcePlay(al_source); + AL_ERROR_CHECK(); + get_sources().push_back(al_source); + } } } diff --git a/mods/src/server/server.cpp b/mods/src/server/server.cpp index 9b4468c67..ba898f956 100644 --- a/mods/src/server/server.cpp +++ b/mods/src/server/server.cpp @@ -292,7 +292,6 @@ static void *read_stdin_thread(__attribute__((unused)) void *data) { stdin_buffer = strdup(""); } stdin_buffer_complete = true; - break; } else { string_append((char **) &stdin_buffer, "%c", (char) x); }