this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fixed Jxy command #1707

nesbox 23455834 b8f585c1

+36 -17
-6
src/core/sound.c
··· 260 260 if (row != music_state->music.row 261 261 && jumpCmd->active) 262 262 { 263 - if(!music_state->flag.music_loop) 264 - { 265 - stopMusic(memory); 266 - return; 267 - } 268 - 269 263 music_state->music.frame = jumpCmd->frame; 270 264 row = jumpCmd->beat * NOTES_PER_BEAT; 271 265 core->state.music.ticks = row2tick(core, track, row);
+13 -2
src/studio/studio.c
··· 359 359 360 360 tic_api_music(tic, track, -1, -1, false, editor->sustain, -1, -1); 361 361 362 - while(state->flag.music_status == tic_music_play) 362 + s32 frame = state->music.frame; 363 + s32 frames = MUSIC_FRAMES * 16; 364 + 365 + while(frames && state->flag.music_status == tic_music_play) 363 366 { 364 367 tic_core_tick_start(tic); 365 368 ··· 371 374 tic_core_synth_sound(tic); 372 375 373 376 wave_write(tic->samples.buffer, tic->samples.size / sizeof(s16)); 377 + 378 + if(frame != state->music.frame) 379 + { 380 + --frames; 381 + frame = state->music.frame; 382 + } 374 383 } 375 384 376 - wave_close(); 385 + tic_api_music(tic, -1, -1, -1, false, false, -1, -1); 386 + 387 + wave_close(); 377 388 return path; 378 389 } 379 390
+23 -9
src/system/sdl/main.c
··· 57 57 #define KBD_COLS 22 58 58 #define KBD_ROWS 17 59 59 60 + #define LOCK_MUTEX(MUTEX) SDL_LockMutex(MUTEX); SCOPE(SDL_UnlockMutex(MUTEX)) 61 + 60 62 enum 61 63 { 62 64 tic_key_board = tic_keys_count + 1, ··· 163 165 164 166 struct 165 167 { 168 + SDL_mutex *mutex; 166 169 SDL_AudioSpec spec; 167 170 SDL_AudioDeviceID device; 168 171 s32 bufferRemaining; ··· 250 253 251 254 static void audioCallback(void* userdata, u8* stream, s32 len) 252 255 { 253 - tic_mem* tic = platform.studio->tic; 256 + LOCK_MUTEX(platform.audio.mutex) 257 + { 258 + tic_mem* tic = platform.studio->tic; 254 259 255 - while(len--) 256 - { 257 - if (platform.audio.bufferRemaining <= 0) 260 + while(len--) 258 261 { 259 - platform.studio->sound(); 260 - platform.audio.bufferRemaining = tic->samples.size; 261 - } 262 + if (platform.audio.bufferRemaining <= 0) 263 + { 264 + platform.studio->sound(); 265 + platform.audio.bufferRemaining = tic->samples.size; 266 + } 262 267 263 - *stream++ = ((u8*)tic->samples.buffer)[tic->samples.size - platform.audio.bufferRemaining--]; 268 + *stream++ = ((u8*)tic->samples.buffer)[tic->samples.size - platform.audio.bufferRemaining--]; 269 + } 264 270 } 265 271 } 266 272 267 273 static void initSound() 268 274 { 275 + platform.audio.mutex = SDL_CreateMutex(); 276 + 269 277 SDL_AudioSpec want = 270 278 { 271 279 .freq = TIC80_SAMPLERATE, ··· 1521 1529 return; 1522 1530 } 1523 1531 1524 - platform.studio->tick(); 1532 + LOCK_MUTEX(platform.audio.mutex) 1533 + { 1534 + platform.studio->tick(); 1535 + } 1536 + 1525 1537 renderClear(platform.screen.renderer); 1526 1538 updateTextureBytes(platform.screen.texture, tic->screen, TIC80_FULLWIDTH, TIC80_FULLHEIGHT); 1527 1539 ··· 1687 1699 SDL_DestroyWindow(platform.window); 1688 1700 SDL_CloseAudioDevice(platform.audio.device); 1689 1701 } 1702 + 1703 + SDL_DestroyMutex(platform.audio.mutex); 1690 1704 } 1691 1705 } 1692 1706