CocosDenshion::SimpleAudioEngine pauses all actions when playing an effect - c++

I have implemented audio in my project, when initiating my own Sprite class in create() function with this code:
CocosDenshion::SimpleAudioEngine::sharedEngine()->getInstance()->preloadEffect("fx/frog.wav");
and when the sprite class is playing the effect with this code:
CocosDenshion::SimpleAudioEngine::sharedEngine()->getInstance()->playEffect("fx/frog.wav");
the backgound stops scrolling and other sprites stop moving until the sound effect ends.
I need your help please, I'm working with cocos2d-x-3.3 beta, and targeting WIN32 project.
Debug Output if needed:
Ready for GLSL
Ready for OpenGL 2.0
OpenGL error 0x0500 in ..\base\CCConfiguration.cpp cocos2d::Configuration::gatherGPUInfo 142
{
gl.version: 3.2.9756 Compatibility Profile Context
gl.supports_NPOT: true
cocos2d.x.version: cocos2d-x 3.3beta0
cocos2d.x.compiled_with_profiler: false
cocos2d.x.build_type: DEBUG
cocos2d.x.compiled_with_gl_state_cache: true
gl.max_texture_size: 16384
gl.vendor: ATI Technologies Inc.
gl.renderer: ATI Mobility Radeon HD 5470
gl.max_texture_units: 32
gl.supports_ETC1: false
gl.supports_S3TC: true
gl.supports_ATITC: false
gl.supports_PVRTC: false
gl.supports_BGRA8888: false
gl.supports_discard_framebuffer: false
gl.supports_vertex_array_object: true
}
AppDelegate : sd resolution
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\MMDevAPI.dll'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\propsys.dll'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wdmaud.drv'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ksuser.dll'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\avrt.dll'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\AudioSes.dll'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msacm32.drv'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msacm32.dll'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\midimap.dll'. Cannot find or open the PDB file.
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mciwave.dll'. Cannot find or open the PDB file.
The thread 0xc90 has exited with code 0 (0x0).
'HangingSpider.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Cannot find or open the PDB file.
The thread 0x920 has exited with code 0 (0x0).
The thread 0x1a38 has exited with code 0 (0x0).
The thread 0x1924 has exited with code 0 (0x0).
The thread 0x1a70 has exited with code 0 (0x0).
The thread 0x1ba0 has exited with code 0 (0x0).
The thread 0x1504 has exited with code 0 (0x0).
The thread 0xc30 has exited with code 0 (0x0).
The thread 0x1bf0 has exited with code 0 (0x0).
The thread 0x3f0 has exited with code 1 (0x1).
The thread 0x16e4 has exited with code 1 (0x1).
The thread 0x1354 has exited with code 1 (0x1).
The thread 0x10b0 has exited with code 1 (0x1).
The program '[4276] HangingSpider.exe' has exited with code 1 (0x1).

Related

visual studio 2019 project

Everytime I run debugger I receive this message in the output:
'Project1.exe' (Win32): Loaded 'C:\Users\123em\OneDrive\Project1.exe'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'.
'Project1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'.
The thread 0x23e1c has exited with code 0 (0x0).
The program '[139372] Project1.exe' has exited with code 0 (0x0).
How can I see the result of my project? I am building a code to rotate an array.
I don't know what kind of result you expect, so I listed two methods for your reference.
Set a breakpoint and add the variable you want to monitor in "Add item to watch", so that you can observe the value of the variable, and it needs to be used with F11, I suggest you refer to this document for this.
Right-click the breakpoint, then select Action, and enter your ideal output format. When executing the program, you can see the output you set in output.

How can I overcome the issue of output console disappearing after taking input or compiling in Visual Studio-2013 for C++?

I am new to C++ coding and in Visual studio environment. My simple code to find a sqrt of a number is being compiled and even run but the console disappears after taking number as input and I am left with the debugging messages and final message of Program terminated with exit code 0. Basically no output is shown.
#include <cmath>
#include <iostream>
int main()
{
double x{ 0.0 };
std::cout << "Enter x-";
std::cin >> x;
if (x >= 0)
std::cout << "\nSqrt(" << x << ") = " << std::sqrt(x) << std::endl;
else
std::cout << "\nWrong Value - cannot compute sqrt\n";
}
The code seems okay, it runs on online compilers. I have tried checking 'console' option from Linker->System->Sub-system->Console (/SUBSYSTEM:CONSOLE). But nothing works.
There are also certain debugging messages that seem to be generated some of them I am showing below -
......
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\CtxGraphicsHelper.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\mmhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\Sfrhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wtsapi32.dll'. Symbols loaded.
The thread 0x498 has exited with code 0 (0x0).
The thread 0x2500 has exited with code 0 (0x0).
The thread 0x30f0 has exited with code 0 (0x0).
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\ShellHook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\windows.storage.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Symbols loaded.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\scardhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\twnhook.dll'. Cannot find or open the PDB file.
'Project2.exe' (Win32): Loaded 'C:\Program Files (x86)\Citrix\System32\cxinjime.dll'. Cannot find or open the PDB file.
The program '[10912] Project2.exe' has exited with code 0 (0x0).
I tried checking the Tools->debugging->symbols->Microsoft Symbol Servers. Some PDF files were found and some were not. I want to get to the root of this issue and basically get my program to behave the way as its coded with output console taking input and showing the result.
You can temporarily add a simple line at the end of code:
system("pause");
Don't forget to include: #include <cstdlib>

NVidia NVML nvmlDeviceGetMemoryInfo() loads and unloads nvapi64.dll immediately

I use some NVIDIA Management Library features to produce metrics in my application.
Every 1 second I call nvmlDeviceGetMemoryInfo() in a thread, and after a few minutes, in the output of Visual Studio, I can read hundreds of :
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
...
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
'MyApp.exe' (Win32): Loaded 'C:\Windows\System32\nvapi64.dll'.
'MyApp.exe' (Win32): Unloaded 'C:\Windows\System32\nvapi64.dll'
...
Other functions from NVML like nvmlDeviceGetCount(), nvmlDeviceGetHandleByIndex(), nvmlDeviceGetClockInfo() or nvmlDeviceGetUtilizationRates() don't produce this ponctual loading/unloading of the nvapi64.dll.
Is it possible to avoid unloading this dll, to keep it available for my next call to nvmlDeviceGetMemoryInfo() ?
EDIT :
I call this function to retreive gpu memory statistics like that :
nvmlMemory_t memInfo;
if (nvmlDeviceGetMemoryInfo(device, &memInfo) == NVML_SUCCESS) {
this->gpuMemUsed = memInfo.used;
this->gpuMemTotal = memInfo.total;
}
I see these output line in Debug and Release, each time I call nvmlDeviceGetMemoryInfo() there is on couple of Loaded nvapi64.dll / Unloaded nvapi64.dll
NVML comes with Cuda V10.2 .
you can simply call LoadLibraryW(L"nvapi64.dll"); after this dll already will be not unloaded (RbMm)
This did the trick

C++ program Hello World exception after main returned

After installing Visual Studio 2013 Express on my Windows 7 64-bit PC, I tested the following simple Hello World C++ program:
1 #include <iostream>
2 using namespace std;
3
4 int main() {
5 cout << "Hello World" << endl;
6 return 0;
7 }
When I run this code in normal execution (using ctr+F5), the programs runs fine. However, when I run it with the debugger (using F5 only), I get the following message box that appears :
"First-chance exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
If there is a handler for this exception, the program may be safely continued."
I press continue and then another message box appear saying :
Unhandled exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
If there is a handler for this exception, the program may be safely continued.
I press continue again and the console output is the following :
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Users\212426625\Desktop\ConsoleApplication1\Debug\ConsoleApplication1.exe'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DgApi.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mpr.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\userenv.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AE_MailSensor_Plugin.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AME_OutlookSensor.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AME_SmtpSensor.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\8E4EA70A-6128-4B57-BD3F-8E9E0F0DA6BB\OS_Plugin.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\8E4EA70A-6128-4B57-BD3F-8E9E0F0DA6BB\COM_Sensor.dll'. Cannot find or open the PDB file.
The thread 0x1f34 has exited with code 0 (0x0).
First-chance exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
Unhandled exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
The program '[1836] ConsoleApplication1.exe' has exited with code 0 (0x0).
So I tried to figure out what's going on by putting a break point at line #5 and stepping with F10. I can step passed the closing bracket of the main() and then enter in a file called "crtexe.c" (see code block below). I continue stepping through this file until the exception pops up at line #649:
645 #else /* !defined (_WINMAIN_) && defined (_CRT_APP) */
646 if ( !managedapp )
647 {
648 #ifndef _CRT_APP
649 exit(mainret);
650 #else
What is the explanation for this behavior and how can I get it to work as expected?
Edit:
The stack trace is as follow (Since I can't post pictures, I wrote it down):
Call Stack
Name Language
ntdll.dll!ZwClose#4() Unknown
KernelBase.dll!_CloseHandle#4() Unknown
kernel32.dll!_CloseHandleImplementation#4() Unknown
AME_OutlookSensor.dll!732cc94d() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for AME_OutlookSensor.dll]
AME_OutlookSensor.dll!732b91bc() Unknown
AME_OutlookSensor.dll!732b928f() Unknown
AME_OutlookSensor.dll!732b44c4() Unknown
AME_OutlookSensor.dll!732b461f() Unknown
AME_OutlookSensor.dll!732b468a() Unknown
[External Code]

Trouble while compiling a multithreaded code

I've try to compile this code with Visual Studio 2012 but I get the errors below. How can I fix that? And they are due to what? However the program run fine but in singlethreaded mode.
#include <stdio.h>
#include <time.h>
#include <omp.h>
int main() {
double start, end;
double runTime;
start = omp_get_wtime();
int num = 1,primes = 0;
int limit = 1000000;
#pragma omp parallel for schedule(dynamic) reduction(+ : primes)
for (num = 1; num <= limit; num++) {
int i = 2;
while(i <= num) {
if(num % i == 0)
break;
i++;
}
if(i == num)
primes++;
// printf("%d prime numbers calculated\n",primes);
}
end = omp_get_wtime();
runTime = end - start;
printf("This machine calculated all %d prime numbers under %d in %g seconds\n",primes,limit,runTime);
return 0;
}
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Users\Administrator\Documents\Visual Studio 2012\Projects\ConsoleApplication4\x64\Debug\ConsoleApplication4.exe'. Symbols loaded.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\msvcp110d.dll'. Symbols loaded.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\msvcr110d.dll'. Symbols loaded.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\vcomp110d.dll'. Symbols loaded.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\lpk.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\usp10.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\imm32.dll'. Cannot find or open the PDB file.
'ConsoleApplication4.exe' (Win32): Loaded 'C:\Windows\System32\msctf.dll'. Cannot find or open the PDB file.
The thread 0x11f0 has exited with code -1073741510 (0xc000013a).
The program '[4908] ConsoleApplication4.exe' has exited with code -1073741510 (0xc000013a).