How to Include a sound clip in a release build - c++

Now that I had some feedback, I see I need to change my question. I would like know how to embed audio into an EXE using console C++ so that anyone can hear the sound when it's on any computer.
At the moment I got a working program that play sounds but the audio file is not embedded in it.

It souldn't be any difference from debug and release mode.

Related

After using QFileDialog program crashes after few seconds

I am making app to increase productivity in our company. It reads the whole .csv file and puts its contents to a table in .pdf format. I am using QT as GUI library and PoDoFo as .pdf library.
The thing is, after I let user select .csv file to get data from and path to save generated .pdf, the program crashes in two minutes or so. It varies from case to case. I was able to "track" the issue down to the QFileDialog.
It doesn't matter if I created it on the stack, or dynamically still the same thing happens. From the moment you press "Choose" in the GUI, which opens up file dialog, program will crash in something around a two minutes giving this in Visual Studio Community 2017
I was able to create minimalistic code, to reproduce the error. I am using Windows 7 Pro, Microsoft Visual Studio Community 2017, compiling 32-bit debug
.h,.cpp,.ui files: https://www.dropbox.com/sh/cf057p4lnumesol/AAD39zDJnrxGChXAuE7y27Kra?dl=0
Any help would be appreciated, I've spent 5 days of my free time trying to figure this out. Thanks
EDIT: I understand that the "Frame not in module" means that visual studio doesn't have debugging symbols for the part of code where crash occurred, since I did not built qt myself, that makes sense.
EDIT2: I am using QT Visual Studio Tools addon version 2.3.2
Qt version is 5.12.2
EDIT3: Crashes only occurs when compiling for 32-bit arch.
EDIT4: Crash is happening only if using native file dialog. If option QFileDialog::DontUseNativeDialog is set, then no crash occurrs.
Not sure if this is related, but I had an issue where if I gave a path to the FileDialog it would grind away for a few seconds because it was somehow interpreting it as a network path. To fix this I gave it a path that had a prefix of "file://". To accomplish this I did this:
QUrl().fromLocalFile(cell_info->progDir()).toString()
The original path came from cell_info->progDir(). Somehow that path was a regular windows specific path. Once I wrapped it in the from LocalFile call it produced what I needed for all platforms I was using it with.
Again, I have no idea if this is related to your issue, but it sounds fishy like it is grinding away in the background on something. If this is not related feel free to ignore.

Access SDL log file on iOS?

I am running SDL (2.0.3) on iOS (9.3) and it's up and running fine - only thing is when I have a runtime exception I can't see it. From what I've read, I think stderr is being redirected to a file but I can't access it.
I've added the UIFileSharingEnabled in info.plist
But when I look using iTunes File sharing, there are no files under my app (I was hoping to see stderr.txt there).
Any help on this would be greatly appreciated - have spent a very long time on this without result.
EDIT: Or if I knew what to change in the SDL code so that it does not redirect to a file in the first place but outputs to console then I could recompile the SDL library and solve the problem that way.
Turns out from version 2.0.4 of SDL running on iOS, output is not redirected but just shows up on the XCode console as normal.

OpenGL code runs perfectly from IDE, CodeXL and GPU PerfStudio, but gives blank screen if started from Windows

I have been improving an OpenGL code of my own since some days, and now I got a terrible surprise: My code works properly if run from inside CodeBlocks IDE (by Menu-> Build -> Run), but if I open it from the Windows Explorer, the program will still open and issue messages on the console as if it would be running properly, but I just get a blank screen.
I have trying re-building the code to see if the problem disappears from Windows, or to see if it also affects the run from inside CodeBlocks, but the outcome is still the same.
Some days ago (before much of the code change), I could start the program from both Windows and CodeBlocks and run perfectly in both cases, so this is totally surprising for me now.
I use GLFW3 and GLEW and I am linking to the following libraries:
C:\msys64\mingw64\lib\libglew32.dll.a
C:\msys64\mingw64\lib\libglfw3.a
opengl32
C:\msys64\mingw64\lib\libsfml-system.dll.a (I use the clock of this library)
gdi32
On the meantime I have deinstalled and installed msys64, but this didnt affect my other OpenGL projects linking the same libraries, so I suppose this is not the source of the problem
How would I proceed to debug such an issue? I have no clue about how to start troubleshooting this, so any comment on what extra info I should post is welcome.
Update: If I open the application from the GPU PerfStudio and CodeXL, everything works just fine, but not when I open via Windows Explorer.
How would I proceed to debug such an issue?
When I deal with bugs like this I use a tool called CodeXL. You can download the latest version here. It automatically breaks on any OpenGL error and shows you which of your OpenGL function calls caused it.
It is free and it works also with non-AMD GPUs.
It should not take you long time to learn how to use it: you just create a new project, give it path to your project folder and .exe and hit run. (make sure that Debug->Breakpoints->Break on OpenGL error is checked)
//Moreover, it visualizes your buffers, shows you your loaded textures, etc.. Definitely check it if you plan to program more Windows+OpenGL in the future.

CodeBlocks 13.12 adding sound

Hello I just started learning c++, and my teacher wants us to create a game for our final exam.
I am using CodeBlocks 13.12 and can't seem to be able to add any game sound. I just need to play a simple .wav file if you guys could show me how that would look I'd greatly appreciate it.
The teacher made adding sound extra credit because he didn't actually show us how to do that. I have no clue as to how to do it so please show if I have to change anything in the settings.
I haven't worked much with audio files either, but a quick search turned up the following links:
StackOverflow: Playing a wav file
CodeProject: Audio files in c++
It looks that (for Windows at least) you can use
PlaySound
Check out the Windows documentation for PlaySound and make sure to include windows.h!
#include <windows.h>
Note: I should expand on AdamS's comment. CodeBlocks is your Integrated Development Environment (IDE). Your question is specific to the language C++ but not to the IDE CodeBlocks. If your code is correct but you still can't hear the sounds, then it could be an issue with your IDE or your computer.

Porting GPUJPEG Project to Windows

I am currently trying to port the GPUJPEG (on sourceforge) library (based on CUDA) from Unix to Windows.
Now I am stuck - I have no idea what's happening or why it is happening, however when I run the test project, the console get's stuck on the blinky...
You can find the entire Visual Studio 2010 project (you'll need CUDA 5) here:
wingpujpeg.zip
I would be very happy if someone could check this out and maybe help me to port this thing to Windows.
Thanks in advance.
Edit:
I want to use / create a HIGH PERFORMANCE lib for converting real time data (converting 60 fps bmp files to jpeg). This is pretty much why the "common" libraries are not of much use. It's about converting HD images to jpeg in about 10 ms... If someone has another idea, I'd, of course, like to hear it.
I think the problem is that you are running this from Visual Studio for debugging (F5).
If you just run it (Ctrl+F5) it should finish.
At first I thought it's some other problem (deleted my answer), but it's just too slow.
The slowness is caused by the CUDA driver calling malloc/free way too much, causing the
debug runtime allocator to slow down a lot.
This allocator by default is started when you do F5
If you want to disable it, then put in your environment settings (Properties -> Debugging -> Environment this _NO_DEBUG_HEAP=1).
Look here too Set _NO_DEBUG_HEAP
This isn't exactly an answer, but since I can't comment yet: If you're looking for an implementation of JPEG which runs on CUDA, the NPP library supports various pieces of a standard JPEG codec pipeline, and it is included with CUDA. Check out the "jpegNPP" sample in the CUDA SDK: http://docs.nvidia.com/cuda/cuda-samples/