diff --git a/VERSION b/VERSION index bda8fbe..5bc1cc4 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.2.6 +2.2.7 diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 5c74e0a..f43fb19 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 7df95f1..7201171 100644 Binary files a/images/start.png and b/images/start.png differ diff --git a/media-layer/core/src/audio/api.cpp b/media-layer/core/src/audio/api.cpp index 1aceb04..44fe4fd 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 9b4468c..ba898f9 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); }