Skip to content

Commit

Permalink
hopefully fix crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
somewhatlurker committed Jun 28, 2019
1 parent 03e6677 commit de0c88c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions DivaSound/src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ void audioCallback(ma_device* pDevice, void* pOutput, const void* pInput, ma_uin
(void)pOutput;
(void)pInput;
(void)frameCount;

//printf("%d\n", *(uint64_t*)((uint64_t)divaAudInternalBufCls + 0x10));
//while (*(uint64_t*)((uint64_t)divaAudInternalBufCls + 0x10) != 32) { }; // loop until ready????
// this mess is probably far from ideal, but whatever
divaAudioFillbuffer(divaAudInternalBufCls, (int16_t*)pOutput, frameCount, 0, 0); // enableFlag);
//printf("%p %d\n", divaAudInternalBufCls, ((int16_t*)pOutput)[0]);
Expand All @@ -63,6 +66,7 @@ void hookedAudioInit(void *cls, uint64_t unk, uint64_t unk2)

//loopThread = std::thread(testLoop);

//WinMM seems to get lowest actual latency for me
ma_backend backends[] = { ma_backend_winmm };
//ma_backend backends[] = { ma_backend_wasapi };
//ma_backend backends[] = { ma_backend_dsound };
Expand All @@ -85,8 +89,7 @@ void hookedAudioInit(void *cls, uint64_t unk, uint64_t unk2)
//printf("winmm fragment size: %d\n", device.winmm.fragmentSizeInFrames);
//printf("wasapi buffer size: %d\n", device.wasapi.actualBufferSizeInFramesPlayback);

divaAudioAllocInternalBuffer(divaAudInternalBufCls, unk, unk2, 882); // allow for two full buffers
//divaAudioAllocInternalBuffer(divaAudInternalBufCls, unk, unk2, device.wasapi.actualBufferSizeInFramesPlayback);
divaAudioAllocInternalBuffer(divaAudInternalBufCls, unk, unk2, 4096); // this doesn't affect latency, so.... really large is fine
printf("[DivaSound] Allocated internal audio buffer\n");

if (ma_device_start(&device) != MA_SUCCESS) {
Expand Down

0 comments on commit de0c88c

Please sign in to comment.