c++

Audio Programming in C++

I wanna know how can I create sounds in LINUX with different frequencies using C++ libraries ? Is there any library for audio programming ( specially creating sounds with different freqs ) in C++ ? How can I simulate piano and other musical instruments(MIDI) sounds using C++. [EDIT] for example I want to create A Major with different ...

OpenGL antialiasing isnt working

I'm using the following code in order to antialiase only the edges of my polygons: glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); glEnable(GL_POLYGON_SMOOTH); But it doesn't work. I can force enable antialiasing by the nvidia control panel, and it does antialiase my application polygons. With the code above, I even enabled blending, but ...

TI C2800 DSPs: troubleshooting linker problems between C++ and assembly code

I have a function sincos_Q15_asm() in assembly, in file sincos_p5sh.asm with directives as follows: .sect ".text" .global _sincos_Q15_asm .sym _sincos_Q15_asm,_sincos_Q15_asm, 36, 2, 0 .func 1 The function works fine when I test it by itself (assembly only), but when I try to link to it, I get a linker error: undefined ...

Should C++ programmer avoid memset?

I heard a saying that c++ programmers should avoid memset, class ArrInit { //! int a[1024] = { 0 }; int a[1024]; public: ArrInit() { memset(a, 0, 1024 * sizeof(int)); } }; so considering the code above,if you do not use memset,how could you make a[1..1024] filled with zero?Whats wrong with memset in C++? thanks. ...

Beneficial to limit scope of Qt objects?

Qt objects which are allocated with new are pretty much handled for you. Things will get cleaned up at some point (almost always when the parent gets destructed) because Qt objects have a nice parent child relationship. So my question is this: given that some widgets exist for the life of the application, is it considered good/beneficia...

Accessing native C++ data from managed C++

I have an native C++ library which makes use of a large static buffer (it acquires data from a device). Let's say this buffer is defined like this: unsigned char LargeBuffer[1000000]; Now I would like to expose parts of this buffer to managed C++, e.g. when 1000 bytes of new data are stored by the library at LargeBuffer[5000] I would...

How do I use a class as a value to be used on set::find()? - C++

So I'm working on a project and I have to use the set library on class objects. Those objects have many attributes, ID being one of them. What I wanted to do was search for an object inside a "set" by its ID. The problem is set only has find and I don't know how to search for an ID this way since I'd have to use find(class object) and n...

Format string into scientific notation [C++]

I have a string that looks like this: "0.4794255386042030002732879352156" which is approximately the sin(0.5). I would like to format the string to look a much nicer "4.794255386042e-1" How can I achieve this? Remember I am dealing with strings and not numbers (float, double). Also I need to round to keep the number as accurate as ...

Template Return Types / Cast as function of Template

I'm working with some generated classes with broken polymorphism. For every generated class T, there are a handful of T_type_info, T_writer, T_reader classes which are only related to T conceptually. What I'm trying to do is something like this: template <class T> class Wrapper { public: template <class W> W topic_cast(BrokenBaseC...

learning c++ on linux mint ( for .net developer )

My goal is to hop on to C++ programming language by doing a homework project on linux mint and learn some linux & c++ at the same time. I intend to write a small desktop application to show current network traffic ( like DU meter in windows). I have following questions: I noticed in mint there is an application called 'System Monitor'...

3d max integration with c++, Cal3D where to start?

okay i'm making a game using c++ (for the engine) and openGL, now i've had lots of trouble using cal3d library for importing my 3d max models into my c++ project, as a matter of fact i dunno where to even start, i can't find any decent guide and their documentation is pure shit really. i've been searching and trying stuff in this for ov...

Starting a program fails with error code 1

Hi! I made an application and a dll, which are working this way: I have to register the dll. After registering the dll if i right click on an .exe file, the pop-up menu appears, and i have inserted into this menu one line ("Start MyApp"), and if i click there, it should start MyApp. MyApp has one parameter which is the full path of the ...

Why won't my C++ program link when my class has static members?

I have a little class called Stuff that I want to store things in. These things are a list of type int. Throughout my code in whatever classes I use I want to be able to access these things inside the Stuff class. Main.cpp: #include "Stuff.h" int main() { Stuff::things.push_back(123); return 0; } Stuff.h: #include <list> ...

C++ library to interface .dmg files on Mac

I want to write a C++ program that spawns off a thread to execute a .dmg file and monitor its completion (success/fail) on Snow Leopard. Would this be as trivial as fork/exec a shell script on Linux? Would I need a 3rd party C++ library to interface .dmg files? ...

Asynchronous request using wininet

I have already used wininet to send some synchronous HTTP requests. Now, I want to go one step further and want to request some content asynchronously. The goal is to get something "reverse proxy"-like. I send an HTTP request which gets answered delayed - as soon as someone wants to contact me. My thread should continue as if there was...

OOP Game Design Theory

I've tried to develop a 2D game with C++ in the past using mere objects, however, in the design process I don't know how and what parts of the engine I should split into smaller objects, what exactly they should do and how to make them interact with each other properly. I'm looking for books, tutorials, papers, anything that explains the...

C++ range/xrange equivalent in STL or boost?

hello Is there C++ equivalent for python Xrange generator in either STL or boost? xrange basically generates incremented number with each call to ++ operator. the constructor is like this: xrange(first, last, increment) was hoping to do something like this using boost for each: foreach(int i, xrange(N)) I. am aware of the for loo...

changing value in a stl map in place.

I understand that when we insert values into the STL map, a copy is made and stored. I have code that essentially does a find on the map and obtains an iterator. I then intend to use the iterator to change the value in the map. The results are not what I would expect ie: the value is not changed when accessed from another part of the pr...

Efficiently finding multiple items in a container

I need to find a number of objects from a large container. The only way I can think of to do that seems to be to just search the container for one item at a time in a loop, however, even which an efficient search with an average case of say "log n" (where n is the size of the container), this gives me "m log n" (where m is the number of...

OpenGL Rotations around World Origin when they should be around Local Origin

I'm implementing a simple camera system in OpenGL. I set up gluPerspective under the projection matrix and then use gluLookAt on the ModelView matrix. After this I have my main render loop which checks for keyboard events and, if any of the arrow keys are pressed, modifies angular and forward speeds (I only rotate through the y axis and ...