Fixed QR code bug

This commit is contained in:
2018-05-11 09:26:18 -04:00
parent c28b794349
commit fe58e2d938
3 changed files with 7 additions and 3 deletions

View File

@@ -46,9 +46,11 @@ static u16 * camera_buf = NULL;
void exit_qr(qr_data *data)
{
DEBUG("Exiting QR");
svcSignalEvent(data->cancel);
while(!data->finished)
svcSleepThread(1000000);
svcCloseHandle(data->cancel);
data->capturing = false;
free(data->camera_buffer);
@@ -87,6 +89,7 @@ void capture_cam_thread(void *arg)
svcWaitSynchronizationN(&index, events, 3, false, U64_MAX);
switch(index) {
case 0:
DEBUG("Cancel event received\n");
cancel = true;
break;
case 1:

View File

@@ -471,6 +471,7 @@ Result load_audio(Entry_s entry, audio_s *audio)
}
audio->mix[0] = audio->mix[1] = 1.0f; // Determines volume for the 12 (?) different outputs. See http://smealum.github.io/ctrulib/channel_8h.html#a30eb26f1972cc3ec28370263796c0444
svcCreateEvent(&audio->finished, RESET_STICKY);
ndspChnSetInterp(0, NDSP_INTERP_LINEAR);
ndspChnSetRate(0, 44100);

View File

@@ -30,8 +30,6 @@
// Play a given audio struct
Result update_audio(audio_s *audio)
{
svcCreateEvent(&audio->finished, RESET_STICKY);
long size = audio->wave_buf[audio->buf_pos].nsamples * 4 - audio->data_read;
char size_info[50] = {0};
sprintf(size_info, "Audio Size: %ld\n", size);
@@ -78,6 +76,8 @@ void thread_audio(void* data) {
linearFree(audio->wave_buf[1].data_vaddr);
while (audio->wave_buf[0].status != NDSP_WBUF_DONE || audio->wave_buf[1].status != NDSP_WBUF_DONE) svcSleepThread(1e7);
svcSignalEvent(audio->finished);
svcSleepThread(1e8);
svcCloseHandle(audio->finished);
free(audio);
}