first try in sound (but executable is b&%$ing around)

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
x_eqis
Posts: 18
Joined: April 10th, 2012, 5:37 pm

first try in sound (but executable is b&%$ing around)

Post by x_eqis » April 25th, 2012, 8:37 pm

Hey everybody,

I've tried to implement the new sound function into that pong clone, and most of it works
- inside visual c++.

However, when I close vc++ and run the exe in the release folder instead, it crashes instantly.
When I run the exe in the debug folder, it gives me the error that in the sound.cpp line 104;

assert( error == 0 );

was a wrong assertion.

I don't really get why the compiler shuts up when running the program inside visual c++....until today, I thought a program would either crash or not crash....I have the strong feeling I'm not getting something.. :?
Attachments
Chili DirectX Framework V12.04.24 (SFX).rar
pong with sound
(516.56 KiB) Downloaded 421 times

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: first try in sound (but executable is b&%$ing around)

Post by LuX » April 25th, 2012, 8:45 pm

Yeah I got that error too...
I don't really get why the compiler shuts up when running the program inside visual c++....until today, I thought a program would either crash or not crash....I have the strong feeling I'm not getting something..
Not sure if I understood you correctly there, a program does or doesn't crash, true, unless you add error handlers that make the program skip the script and jump right to the error handler. Looking at the whole project I think there is such a thing in assertion.h or something like this... Not completely sure.

I guess Chili is the best to answer how to get the music playin' as he made the damn thing.
ʕ •ᴥ•ʔ

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: first try in sound (but executable is b&%$ing around)

Post by chili » April 26th, 2012, 1:45 am

Somebody didn't read the blog post carefully. Shame on you eqis. ;)

That behavior isn't strange at all. As LuX mentioned, assert() inserts error checking code in a debug build, but it inserts nothing in a non-debug build. So in the debug version you get a message telling you where your app is gagging, and in release it just crashes with no info.

Now here is the part that you guys do not understand. When you run a program by double-clicking it in Windows, the path (the default folder that the program looks for shit in when opening files) is set to be the folder that the program is in. However, when you execute the program from within Visual Studio, it runs the program as if it were in the project folder (i.e. path="..\Chili DirectX Framework\Chili DirectX Framework\").

So the moral of this story is: when you're running the program outside of the development environment, make sure you put the media files in the same friggin' directory as the .exe file! :P

P.S. Feels like real pong now with the sound effects added. :D
Chili

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: first try in sound (but executable is b&%$ing around)

Post by LuX » April 26th, 2012, 2:00 pm

Somebody didn't read the blog post carefully.
...There is a... ...Blog post?

:lol: Didn't see that earlier >.> Now that I look at it I see how you mention me :o
I'm famous! 8-)

Edit: Had to update LuX Image scanner, just to celebrate this ;)
ʕ •ᴥ•ʔ

x_eqis
Posts: 18
Joined: April 10th, 2012, 5:37 pm

Re: first try in sound (but executable is b&%$ing around)

Post by x_eqis » April 26th, 2012, 8:24 pm

wonderful! :D thank you chili

I'm pleasantly surprised the solution was so easy. I shall never again show disrespect to your blog posts! At least Lux found out about the blog now, so it had something good to it..

Post Reply