mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
sound transcripts, event-started sound persistence
This commit is contained in:
16
audio.cpp
16
audio.cpp
@@ -65,6 +65,8 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
|
||||
// and get rid of the source, we shouldn't need it anymore
|
||||
// TBD, TODO: delay data fetching and transfers until the buffer is actually used?
|
||||
std::vector<std::int16_t>().swap( data );
|
||||
|
||||
fetch_caption();
|
||||
}
|
||||
|
||||
// mix specified number of interleaved multi-channel data, down to mono
|
||||
@@ -87,6 +89,20 @@ openal_buffer::narrow_to_mono( std::uint16_t const Channelcount ) {
|
||||
}
|
||||
}
|
||||
|
||||
// retrieves sound caption in currently set language
|
||||
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>() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
buffer_manager::~buffer_manager() {
|
||||
|
||||
Reference in New Issue
Block a user