mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 15:09:19 +02:00
tweak hack for specialized loadtype models, and fix for loading sounds from floating point files
This commit is contained in:
@@ -3998,8 +3998,9 @@ void TDynamicObject::LoadMMediaFile( std::string BaseDir, std::string TypeName,
|
|||||||
// Ra: tu wczytywanie modelu ładunku jest w porządku
|
// Ra: tu wczytywanie modelu ładunku jest w porządku
|
||||||
if( false == asLoadName.empty() ) {
|
if( false == asLoadName.empty() ) {
|
||||||
// try first specialized version of the load model, vehiclename_loadname
|
// try first specialized version of the load model, vehiclename_loadname
|
||||||
auto const specializedloadfilename { BaseDir + TypeName + "_" + MoverParameters->LoadType + ".t3d" };
|
auto const specializedloadfilename { BaseDir + TypeName + "_" + MoverParameters->LoadType };
|
||||||
if( true == FileExists( specializedloadfilename ) ) {
|
if( ( true == FileExists( specializedloadfilename + ".e3d" ) )
|
||||||
|
|| ( true == FileExists( specializedloadfilename + ".t3d" ) ) ) {
|
||||||
mdLoad = TModelsManager::GetModel( specializedloadfilename, true );
|
mdLoad = TModelsManager::GetModel( specializedloadfilename, true );
|
||||||
}
|
}
|
||||||
if( mdLoad == nullptr ) {
|
if( mdLoad == nullptr ) {
|
||||||
|
|||||||
@@ -30,9 +30,12 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
|
|||||||
std::replace(file.begin(), file.end(), '\\', '/');
|
std::replace(file.begin(), file.end(), '\\', '/');
|
||||||
|
|
||||||
SNDFILE *sf = sf_open(file.c_str(), SFM_READ, &si);
|
SNDFILE *sf = sf_open(file.c_str(), SFM_READ, &si);
|
||||||
|
|
||||||
if (sf == nullptr)
|
if (sf == nullptr)
|
||||||
throw std::runtime_error("sound: sf_open failed");
|
throw std::runtime_error("sound: sf_open failed");
|
||||||
|
|
||||||
|
sf_command(sf, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE);
|
||||||
|
|
||||||
int16_t *fbuf = new int16_t[si.frames * si.channels];
|
int16_t *fbuf = new int16_t[si.frames * si.channels];
|
||||||
if (sf_readf_short(sf, fbuf, si.frames) != si.frames)
|
if (sf_readf_short(sf, fbuf, si.frames) != si.frames)
|
||||||
throw std::runtime_error("sound: incomplete file");
|
throw std::runtime_error("sound: incomplete file");
|
||||||
|
|||||||
Reference in New Issue
Block a user