16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-20 11:29:18 +02:00

Merge pull request #20 from xwizard

Fixes OpenAL crash and adds extra OpenAL error logging.
Gitignore entries for vscode
Removes unnecessary assert() and caps "sg" at 1.0
This commit is contained in:
Milek7
2022-07-15 19:20:51 +02:00
committed by GitHub
4 changed files with 5 additions and 4 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,5 @@
builds/
CMakeLists.txt.user
ci_shadervalidator/validateshaders
build/
.vscode/

View File

@@ -118,8 +118,7 @@ double PFVd( double PH, double PL, double const S, double LIM, double const DP )
LIM = LIM + 1;
PH = PH + 1.0; // wyzsze cisnienie absolutne
PL = PL + 1.0; // nizsze cisnienie absolutne
assert( PH != PL );
double sg = PL / PH; // bezwymiarowy stosunek cisnien
double sg = std::min( 1.0, PL / PH ); // bezwymiarowy stosunek cisnien
double FM = PH * 197.0 * S; // najwyzszy mozliwy przeplyw, wraz z kierunkiem
if ((PH - LIM) < 0.1)
FM = FM * (PH - LIM) / DP; // jesli jestesmy przy nastawieniu, to zawor sie przymyka

View File

@@ -69,7 +69,7 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
}
else {
id = null_resource;
ErrorLog("sound: failed to create AL buffer");
ErrorLog("sound: failed to create AL buffer: " + std::string(alGetString(alGetError())));
}
delete[] buf;

View File

@@ -17,7 +17,7 @@ openal_source::bind( sound_source *Controller, uint32_sequence Sounds, Iterator_
is_multipart = ( buffers.size() > 1 );
if( id != audio::null_resource ) {
if( id != audio::null_resource && !buffers.empty()) {
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );
::alSourceRewind( id );
// sound controller can potentially request playback to start from certain buffer point