Which API should I use for playing audio on Windows? [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
There are many ways of playing sounds on Windows. Which are the differences, advantages and disavantages of each method?
I know there are at least 5 methods:
1991 WinMM.dll/mmsys.dll PlaySound
1995 MCIWnd (as suggested by #casablanca)
1996 DirectSound
1998 WaveOut
1999 ASIO
1999 Windows Media Player ActiveX control?
2005 WASAPI (which is used by XAudio2 - as suggested by #Han)
2007 XAudio2

QSound, then it will fit right in with the rest of your Qt application, and it will work not only on Windows but also on Mac OS X and Linux, as well. It is not uncommon to find a core, platform-specific API that isn't very friendly to developers, and then a myriad of more developer friendly APIs built on top of the core. Using a core API may be negligibly faster, but using the layers on top of these core
APIs is almost always more convenient and maintainable, and protects you from changes to the low-level core.
Edit
From the description of XAudio2:
XAudio2 is a low-level, cross-platform audio API for Microsoft Windows and Xbox 360. It provides a signal processing and mixing foundation for games that is similar to its predecessors, DirectSound and XAudio. For Windows game developers, XAudio2 is the long-awaited replacement for DirectSound.
So, it looks like that would be the API to use if you want a core, platform-specific audio library.
Edit 2
I was a little quick with my first answer... really, it depends on what you want to do. If all you want to do is play an audio file, then QSound is the way to go. If, however, you want to mix and generate audio on the fly, then using a more feature-capable library such as XAudio2 (which is a part of DirectX and is intended for creating sound as part of video games) would be the way to go.

Really depends on what you want to do. For most common scenarios, I've found that the MCIWnd functions work well: they're really easy to use and can play any format for which a codec is installed.
DirectSound is somewhat more difficult to use but gives you much more control over the output; it lets you add special effects and simulate 3D positioning.
The waveOut functions are the lowest level API you can get to and they are a kind of double-edged sword: you get to control exactly what goes out to the speakers, but they accept only raw waveform data, which means you are responsible for all decoding and post-processing of input data. PlaySound essentially provides a nice wrapper around this.

Related

Offscreen & embeddable browsers comparison (for use in a game) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
We've been looking at adding decent browser support to our C++ application; this question is about GUI-independent browser libraries since our project involves 3D rendering and doesn't quite fit a normal GUI.
The two I've seen so far are Berkelium and Awesomium. Both seem to work in a similar way from my quick investigation, rendering to an offscreen-buffer which you blt into your own window/game/anything. Awesomium is proprietary and costs a fair amount ($5k), Berkelium is open-source and free. Has anyone compared these (and other) such tools? Cross-platform is a benefit but not 100% essential.
Take a look at the Chromium Embedded Framework. CEF 3 supports off-screen rendering on all operating systems: Windows/Mac/Linux.
Disclaimer: I created Awesomium. Nevertheless, I will practice the utmost objectivity in my response.
Awesomium does cost a bit of money but it is definitely the best tool for the job, I'll defend my reasons with a bulleted list:
Simple, well-documented API; we've tried our best to keep the API as intuitive and readable as possible. That's really important when you're embedded something as large and complex as an entire browser framework. (Believe me, you don't want to embed WebKit directly-- that's like swallowing the sun.)
Windowless rendering; the library was designed from the outset to be used outside of a standard "windowing framework". We make it really easy to render a WebView to a texture:
void update()
{
if(webView->isDirty())
webView->render()->copyTo(texture, width * bpp, bpp, false);
}
Solid Javascript integration; if you use Awesomium as an HTML GUI renderer for your 3D game, you'll definitely want to take advantage of our Javascript <-> C++ integration. You can call Javascript functions directly from C++ and vice-versa, set callbacks, expose global properties, and more. I wrote up a big guide on my blog here.
Well-supported; we use the money we get from our top-tier commercial licenses to fund support and development of the library. If you need help, please visit http://support.awesomium.com and we'll be glad to lend a hand.
The library is free for non-commercial use and very affordable for indie developers. If you'd like to use Awesomium in your next project and are worried about the price-point, please email me at adam#khrona.com and I'll see if I can't help you out. :-)
Berkelium is really painless to use. I integrated it into my game in 6 days, you can read all about it (and some other options) here: http://www.onemanmmo.com/index.php?cmd=newsitem&comment=news.1.31.0
The only downside is no debug build and 40MB of binaries.

Finding C++ multimedia editing graph-like frameworks?

I'm searching for multimedia editing graph-like frameworks where you can create graph elements with C++ and where you can build graphs for your app needs from elements of framework.
So far I know there are
GStreamer
DirectShow
QuickTime
Qt Phonon (cross-platform wrapper around first 3)
I wonder to see what else is out there - are there proprietary or open source, cross-platform or platform-dependent alternatives and what are their main goals?
Microsoft Media Foundation -- more or less a replacement for DirectShow. I don't see any drastic improvements, but if you want to use (for example) Microsoft's new H.264 decoder, you're pretty much stuck with it. As you can undoubtedly guess from the name, it's Windows only. Perhaps less obviously, it's supported only on Vista and later.
Another that sort of fits the description is FFMpeg.

What to use when building a desktop application? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm making desktop application for my own use.
I can't decide on whcih language/toolkit/framework to use.
I would like a good User experience and a not so bad Performance.
The choices in my mind are:
wxPython
Titanium
Adobe AIR
any other suggestions that would fit
-- EDIT
I would also like it to be cross-platform
Experience, I've got some experience in Java, Python, HTML/JS. (Haven't done much .net stuff).
I would live to learn if needed.
There are a lot of other considerations.
What platform? What OS? What level of backward compatibility? What runtimes are on the clients?
What sort of graphics support do you need? 3D? 2D?
What kind of interoperability do you need?
What are your deployment scenarios?
What languages do you want to write this in?
There are literally hundreds of technologies out there. You can only come up with a design when you have specified what your main constraints are.
The first thing I'll say is that I would favour Web applications where possible. Of course for many things you can't—Web browsers for example. :) But where you can you should. Sure you have cross-browser issues but the OS/library cost of a desktop app is really high now.
That being said, if what you're doing needs to be done as a desktop app or you simply want to do it that way as a personal preference I would choose:
.Net (C# or VB.NET) if you only need to run on Windows or
Java (Swing, SWT, etc) if you want to run on non-Windows platforms.
I would choose from these two for no other reason than they're the most proven. Sure there are other options Adobe Air, Python, etc. Python in particular has real apps written in it so it would be my third choice. Overall though, these stacks are just less proven for this particular task.
depending on your desktop OS. For Windows, you may get Microsoft Visual Studio Express Edition of C# or VB.Net. For Mac computer intel based computer, you have free XCODE available to do it or use JavaScript to build widget applications.
Another option to look at would be QT. It's a cross platform C++ framework with Java & Python Bindings. It really does boil down to what type of application you want to build though and which platform(s) you want to target it at. If you're aiming at Windows specifically, you might want to consider using .NET and C# to take advantage of native support, on OSX, Objective-C and Cocoa, or on Linux C/C++ & whichever API set your targeted distro uses. And for cross-platform, which platforms would you like to target? Windows? OSX? Linux (Ubuntu, OpenSuse, Fedora etc.)? That will also dictate your choice.
Try Flexonrails
then convert with adobeAir
:)
it will be good
im doing my desktop application with that
Depending on what skills and tools you have available to you, as others have pointed out.
If you're on windows one simple accessable option is HTA applications.
http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx
if you're on a mac, dashcode is a similar option for, not just authoring widgets, but also full on web applications.
both options give you access to many more api's than typical javascript has access to, such as filesystem access, or the ability to execute system commands.
There's a zillion others, but those options come for for free with their respective operating systems.
Dependes on what kind of application you would like to build, but you definitely should put in your list of tools to evaluate (at least) Delphi.
It compiles to native win32, is a rapid application development tool and has support for a lot of areas like databases, internet, com and many many others. Also, is built into Object Pascal, a very simple to learn language.
Up to some point, you can make it's applications cross platform using others IDEs like Lazarus in Linux.
As of 20 march-2018 almost everything has shifted to javascript. Have a look at Electron.js . Its usefull to build cross platform desktop apps in javascript , html and css.

What disadvantages could I have using OpenGL for GUI design in a desktop application? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
There are tons of GUI libraries for C/C++, but very few of them are based on the idea that opengl is a rather multiplatform graphics library. Is there any big disadvantage on using this OpenGL for building my own minimal GUI in a portable application?
Blender is doing that, and it seems that it works well for it.
EDIT: The point of my question is not about using an external library or making my own. My main concern is about the use of libraries that use opengl as backend. Agar, CEGUI or Blender's GUI for instance.
Thanks.
Here's an oddball one that bit a large physics experiment I worked on: because an OpenGL GUI bypasses some of the usual graphics abstraction layers, it may defeat remote viewing applications.
In the particular instance I'm thinking of we wanted to allow remote shift operations over VNC. Everything worked fine except for the one program (which we only needed about once per hour, but we really needed) that used an OpenGL interface. We had to delay until a remote version of the OpenGL interface could be prepared.
You're losing the native platforms capabilities for accessibility. For example on Windows most controls provide information to screen readers or other tools supporting accessibility impaired users.
Basically unless you have a real reason to do this, you shouldn't.
Re-inventing the Wheel: Yeah, you'd be doing it. But I note OP used the word "minimal" in the problem statement, so assuming it really doesn't need to scale up to all that, it may be a small enough wheel as to not matter. The product I currently work on supports OpenGL on three platforms (Win, Mac, Linux) and we built all our own widgets (text boxes, buttons, dialogs). It's a lot of work but now that we've done it we own a huge chunk of our stack and don't have to debug into third party frameworks when things don't work as expected. It's nice having complete control of the experience. There's always something you want to do that a framework doesn't support. Like everything in our business, it is a trade-off and you just have to weigh your needs against your need to finish on time.
Portability: Yes, you will still have to write platform specific code to boot-strap everything. This will be difficult if you've not done it before as it requires you to understand all the target platforms.
Windows Drivers: We've found that graphics card manufacturers have much better support for DirectX on Windows than OpenGL, since that's what is required to get MSFT certification. Often low- to mid-range cards have bugs, missing functionality, or outright crashes in their OpenGL support.
With Qt 4.5 you can select if you want to use OpenGL as window renderer.
More info:
https://www.qt.io/blog/2008/10/22/so-long-and-thanks-for-the-blit
Read the comments to know about the problems about this.
The obvious one is that you're basically building the GUI elements yourself, instead of having a nice designed like for wxWidgets or Qt.
You cant just use opengl, you need a platform specific code to set up a window for opengl.
From the freely available opengl red book:
OpenGL is designed as a streamlined,
hardware-independent interface to be
implemented on many different hardware
platforms. To achieve these qualities,
no commands for performing windowing
tasks or obtaining user input are
included in OpenGL; instead, you must
work through whatever windowing system
controls the particular hardware
you're using.
There are multiplatform solutions for this like glut, qt, wxWidgets, ...
And if you have to use them anyway, why not use built in GUI elements. They also give you the opportunity to build your own, and make use of the framework to handle mouse/keyboard events and stuff.
If you want a GUI as in windows/button etc. Don't do it yourself. There a lot of free solutions for this, wxwidgets,qt or GTK. All have OpenGL support if you want a 3d window

GUI system development resources? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Could someone recommend any good resources for creating Graphics User Interfaces, preferably in C/C++?
Currently my biggest influence is 3DBuzz.com's C++/OpenGL VTMs (Video Training Modules). While they are very good, they cover a large area of graphics programming, so only skim the surface of GUI programming.
This question does relate to "How do I make a GUI?", where there is also a rough outline of my current structure.
Any response would be appreciated.
Edit:
I've just read some of the answers and spotted that I've missed some points. I had to type the question twice as I caught the wrong button and lost it.
I missed two important points, first: This will be used cross platform including homebrew on a Sony PSP. Second: I want to create a GUI system not use an existing one.
Edit 2: I think some of you are missing the point, I don't what to use an existing GUI system I want to build one.
Qt in it's current form is not portable to the PSP, never mind the overkill of such a task.
That said I've decided to create an IM-GUI, and have started to prototype the code.
I wouldn't use OpenGL for the GUI unless you are planning for hardware accelerated and/or 3D effects that you don't think you would get with a more traditional GUI toolkit (e.g Qt, wxWidgets, GTK, etc). If you just need a quick simple GUI for hosting your OpenGL graphics then FLTK is a nice choice. Otherwise, for rendering the GUI directly in OpenGL their are libraries like Crazy Eddie's GUI that do just that and provide lots of skinnable widgets that you won't have to reinvent. The window and OpenGL context could then be provide with a portable library like SDL.
EDIT: Now that I've gone back and taken at look your other post I think I have a better understanding of what you are asking. For a GUI on an embedded system like the Nintendo DS, I would consider using an "immediate mode" GUI. Jari Komppa has a good tutorial about them, but you could use a more object-oriented approach with C++ than the C code he presents.
http://www.fox-toolkit.org has an API reference, if you're looking how to work with a specific framework. Or were you more interested in general theory or something more along the lines of how to do the low-level stuff yourself?
For more information about "immediate mode" GUI, I can recommend the Molly Rocket forums. There's a good video presentation of the thinking behind IM-GUI, along with lots of discussion.
I recently hacked together a very quick IM-GUI system based on presentation on Jari's page, and in my case, where I really just wanted to be able to get a couple of buttons and boxes on the screen, and more or less just hard code the response to the inputs, it really felt like the right thing to do, instead of going for a more full blown GUI-architecture. (This was in a DirectX-application, so the number of choices I had was pretty limited).
One of the fastest ways is to use python with a gui binding like pyQt, PyFLTK, tkinter, wxPython or even via pygame which uses SDL.
Its easy fast and platform independent.
Also the management of the packages is unbeatable.
See:
http://wiki.python.org/moin/PyQt
http://www.fltk.org/
(tkinter is default and already packaged with python)
http://wxpython.org/
http://www.pygame.org/news.html
For a platform like the PSP, I'd worry slightly about the performance of an IM GUI solution. With a traditional retained mode type of solution, when you create a control, you can also create the vertex buffer/display list or what-have-you required to render it. With an immediate mode solution, it seems to me that you'd need to recreate this dynamically each frame.
You might not care about this, if you're only doing a few buttons, or it's not going to be used in-game (assuming you're making a game) but, especially if you have a fair bit of text, the cost of rendering might start to hurt if you can't find a way to cache the display lists somehow.
Have a look at Qt. It is an open source library for making GUI's. Unlike Swing in Java, it assumes a lot of stuff, so it is really easy to make functional GUI's. For example, a textarea assumes that you want a context menu when you right click it with copy, paste, select all, etc. The documentation is also very good.
I'll second Qt. It's cross platform, and I found it much easier to work with than the built in Visual Studio GUI stuff. It's dual-licensed, so if you don't want your code to be GPL you could purchase a license instead.
I've had a look at the Video from Molley Rocket and Looked through Jari Komppa's cached tutorials.
An IM-GUI seems the best way to go, I think it will be a lot more streamlined, and lot quicker to build than the system I originally had in mind.
Now a new issue, I can only except one Answer. :(
Thanks again to Monjardin and dooz, cheers.
thing2k
I'd have a look at GLAM and GLGooey