List of commits:
Subject Hash Author Date (UTC)
Moddable sound file loading via FileOpen ed4d1680cfb17f573fe799908d35e6856c183076 mse 2021-05-29 07:21:32
Update en_to_zh, start implementing moddable FileOpen, fix -Wsign-compare 89d00440e1c35d46851fb1d300107da9725d261d mse 2021-05-27 21:29:27
Add a third procedural basket and winnerberry translation string 9b970d581d5094fd3ea7b9da2b4e397c4f4c94db mse 2021-05-27 09:29:02
Add STOPSOUNDS command 22507196106fcd8db7b4bae15b6a2bf9168dd61e mse 2021-05-27 05:56:57
Wake player when hit b2bc7d9cb37a9c9a707e9b8428e6f4d3fa2f27b7 mse 2021-05-26 08:50:53
Minor clarifications d5a83695acdf78b21610239d530b1317dc4003cc mse 2021-05-24 00:11:59
DRM-free dynamic target c51ae66a80c38d4d8aec606ad04492ea12a56fcd mse 2021-05-23 23:53:32
Initial commit bfb7298e48367d2ac0924811b4950f3066ff075c mse 2021-05-22 05:08:16
Commit ed4d1680cfb17f573fe799908d35e6856c183076 - Moddable sound file loading via FileOpen
Author: mse
Author date (UTC): 2021-05-29 07:21
Committer name: mse
Committer date (UTC): 2021-05-29 07:21
Parent(s): 89d00440e1c35d46851fb1d300107da9725d261d
Signer:
Signing key:
Signing status: N
Tree: 56edca8d3ace65d1aafbf5af33e2fe7e94998385
File Lines added Lines deleted
confec.cpp 18 2
File confec.cpp changed (mode: 100644) (index 666321a..1a68e82)
... ... void csLoadSound(
246 246 float reverbDelayFactor ){ float reverbDelayFactor ){
247 247 // Load the sound file if it does not exist in sound_loaded. // Load the sound file if it does not exist in sound_loaded.
248 248 if( sound_loaded.find( file_name ) == sound_loaded.end() ){ if( sound_loaded.find( file_name ) == sound_loaded.end() ){
249 void *memory = nullptr;
250 size_t length = 0;
251 FILE *file = FileOpen( file_name.c_str(), "rb" );
252 if( file ){
253 // Adapted from cs_read_file_to_memory.
254 fseek( file, 0, SEEK_END );
255 length = ftell( file );
256 fseek( file, 0, SEEK_SET );
257 memory = malloc( length );
258 (void)(fread( memory, length, 1, file ) + 1); // Discard return value
259 fclose( file );
260 }
261 // Process the in-memory file into a playable audio clip.
262 cs_loaded_sound_t sound = { 0, 0, 0, 0, { nullptr, nullptr } };
249 263 if( file_name.length() >= 4 if( file_name.length() >= 4
250 264 && file_name.substr( file_name.length() - 4 ) == ".ogg" ){ && file_name.substr( file_name.length() - 4 ) == ".ogg" ){
251 sound_loaded[file_name] = cs_load_ogg( file_name.c_str() );
265 cs_read_mem_ogg( memory, length, &sound );
252 266 }else{ }else{
253 sound_loaded[file_name] = cs_load_wav( file_name.c_str() );
267 cs_read_mem_wav( memory, length, &sound );
254 268 } }
269 free( memory );
270 sound_loaded[file_name] = sound;
255 271 } }
256 272 // Cancel loading if the sound file failed to load. The unplayable // Cancel loading if the sound file failed to load. The unplayable
257 273 // sound stays in sound_loaded and prevents future loading attempts. // sound stays in sound_loaded and prevents future loading attempts.
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/mse/ConfectionerEngine

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/mse/ConfectionerEngine

Clone this repository using git:
git clone git://git.rocketgit.com/user/mse/ConfectionerEngine

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main