mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Merge branch 'tmj-dev'
This commit is contained in:
27
audio.cpp
27
audio.cpp
@@ -13,10 +13,9 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#include "audio.h"
|
||||
#include "Globals.h"
|
||||
#include "McZapkie/mctools.h"
|
||||
#include "Logs.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "usefull.h"
|
||||
#include "utilities.h"
|
||||
|
||||
namespace audio {
|
||||
|
||||
@@ -80,14 +79,14 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
|
||||
void
|
||||
openal_buffer::fetch_caption() {
|
||||
|
||||
std::string captionfilename{ name };
|
||||
captionfilename.erase(captionfilename.rfind('.')); // obcięcie rozszerzenia
|
||||
captionfilename += "-" + Global::asLang + ".txt"; // już może być w różnych językach
|
||||
if (true == FileExists(captionfilename)) {
|
||||
// wczytanie
|
||||
std::ifstream inputfile(captionfilename);
|
||||
caption.assign(std::istreambuf_iterator<char>(inputfile), std::istreambuf_iterator<char>());
|
||||
}
|
||||
std::string captionfilename { name };
|
||||
captionfilename.erase( captionfilename.rfind( '.' ) ); // obcięcie rozszerzenia
|
||||
captionfilename += "-" + Global.asLang + ".txt"; // już może być w różnych językach
|
||||
if( true == FileExists( captionfilename ) ) {
|
||||
// wczytanie
|
||||
std::ifstream inputfile( captionfilename );
|
||||
caption.assign( std::istreambuf_iterator<char>( inputfile ), std::istreambuf_iterator<char>() );
|
||||
}
|
||||
}
|
||||
|
||||
buffer_manager::~buffer_manager() {
|
||||
@@ -118,13 +117,13 @@ buffer_manager::create( std::string const &Filename ) {
|
||||
|
||||
audio::buffer_handle lookup { null_handle };
|
||||
std::string filelookup;
|
||||
if( false == Global::asCurrentDynamicPath.empty() ) {
|
||||
if( false == Global.asCurrentDynamicPath.empty() ) {
|
||||
// try dynamic-specific sounds first
|
||||
lookup = find_buffer( Global::asCurrentDynamicPath + filename );
|
||||
lookup = find_buffer( Global.asCurrentDynamicPath + filename );
|
||||
if( lookup != null_handle ) {
|
||||
return lookup;
|
||||
}
|
||||
filelookup = find_file( Global::asCurrentDynamicPath + filename );
|
||||
filelookup = find_file( Global.asCurrentDynamicPath + filename );
|
||||
if( false == filelookup.empty() ) {
|
||||
return emplace( filelookup );
|
||||
}
|
||||
@@ -150,7 +149,7 @@ buffer_manager::create( std::string const &Filename ) {
|
||||
return emplace( filelookup );
|
||||
}
|
||||
// if we still didn't find anything, give up
|
||||
ErrorLog( "Bad file: failed do locate audio file \"" + Filename + "\"" );
|
||||
ErrorLog( "Bad file: failed do locate audio file \"" + Filename + "\"", logtype::file );
|
||||
return null_handle;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user