Music spectrum visualization with better effects/graphics - c#

I'm creating a music player in C# / WPF.
With the BASS audio engine, I can create simple spectrums like this:
But I'm looking to create nicer looking ones like those seen in YouTube videos created in After Effects.
Are there any DirectX, OpenGL or other engines that can produce similar effects that I can use in my application?

Well, first, your question isn't the best (fit wise) to SO, since it's not about a problem you have with code.
Having said that, WPF supports OpenGL, as you can see
Using OpenGL in a WPF Application
Creating OpenGL Windows in WPF
And also DirectX (although 9 it seems)
Walkthrough: Hosting Direct3D9 Content in WPF
So, yes, you can choose your engine :)

Related

What's the deal with Monogame, SharpDX, and XNA?

I've been doing research on good tools to create games with, and I came across Monogame, Sharpx, and XNA. I have some questions regarding each:
When I create a new windows project (which advertises that it uses DirectX 12), the code template looks like this:
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
I understand Monogame is a re-implementation of XNA, but where is the "re" part? This code shows Monogame using Microsoft's XNA, and doesn't even hint at the usage of DirectX 12.
SharpDX has an advantage of using WinRT (so i've heard), but what exactly does that mean to me? I know that SharpDX is a layer that sits on top of DirectX to allow it to be used in C#, and naturally should use WinRT. What excuse does Monogame have not to use WinRT?
I feel I'm confused at something and want clarity. Keep in mind that I'm a total noob at this stuff, anything helps!
MonoGame is indeed a reimplementation of XNA. It uses Microsoft.Xna.Framework.* namespaces to preserve source code compatibility with XNA projects. MonoGame does not currently support DirectX 12 - the desktop version has DirectX 11 and OpenGL backends.
It provides simple, cross-platform classes for common game tasks (loading content, rendering, sound playback, etc.) and a pipeline for building runtime-optimized content files. MonoGame is really powerful for most projects and great for quick development, though not a fully featured game engine like Unity. Since it is modelled after XNA (discontinued a few years ago), most XNA samples/tutorials work just fine.
SharpDX is a low-level wrapper of DirectX types. You should go with it only if you want to get your hands dirty with low-level plumbing, which doesn't appear to be the case.
The DirectX implementation of MonoGame (used for classic Windows, UWP, and Windows 8 apps) internally uses SharpDX for communicating with DirectX. When it comes to WinRT, it is just an implementation detail of "modern" Windows app platform.
Wikipedia has a few pages on the history of XNA. In short it is no longer supported. MonoGame extends it. SlimDX and SharpDX use their own DirectX wrappers and are basically copies of each other. Going by a recent post SlimDX future
It will not be continued. I do not know MonoGame but am strong in SharpDX and it provides current support for DirectX 12. If you also want to use OpenGL, you could try ANX but I do not know it. The SharpDX guy also wrote a Collada class which is on GitHub and there is an Assimp class that is compatible. None of the above have an integrated physics system but PhysX for .Net works fine with SharpDX.
In summary if you only need Direct X for C# then SharpDX would be the most straight forward choice. If you think you might expand to other platforms, you might want to check out MonoGame or ANX but I can't vouch for either. None of the above mentioned are complete Game Engines (such as Unity or UE4) they simply allow the use of features such as DirectX that are not natively supported by Visual Studio C#.

C# Equivalent to java's Graphics2D

I've recently started about thinking about making a 2D game engine in C# from scratch.
Now, I've wondered: In java, I'd use the java.awt.Graphics2d and java.awt.Container classes.
What would you suggest me to use in C#?
Apparently, google couldn't help me with that one.
In .NET you could use Windows Presentation Foundation, it offers a great lot of graphic-manipulation. But if it fits to create a game-engine, I am not sure.
See MSDN for an overview.
Though, if you really want to have power, you should stick with DirectX and C++.
Note: there is FNA and MonoGame (both reimplementations of the now discontinued XNA), but they are both frameworks for creating games, not creating a game engine...
You can easily build games (2D/3D) with FNA or MonoGame (reimplementations of the now discontinued XNA). They aren't engines but they are both a layer architecture for simple DirectX-usage.
If you're looking for image manipulation within Windows Forms (PictureBox, Draw()-method overrides) you should have a look at System.Drawing.

Multiplatform project (iOS/OSX, Windows and optionally Android) using C#

I know this type of question has been asked a lot, but I really can't find something that nails what I'm looking for, so hopefully this is not considered an "asked without research"-question.
The backstory: I'm developing an app that initially was supposed to work on OSX/iOS, but having a Windows version is already a must. I'm trying to find out the easiest way for me to have to translate as little as possible between each version, and preferrably without having to learn too much new (I have a little time constraint).
I'm using C#, currently developing in Mono
I'm used to the Cocoa API on iPhone using MonoTouch
So, my options (as I see them now):
Go native on mac, meaning having to make a separate graphics routines for the other OSes - makes the mac version easy-peasy, and I could postpone any learning curve for the other ports, however I guess it requires a lot more meddling when porting
Use some kind of XML markup or HTML/JavaScript as a presentation layer, with hooks on links triggering backend events (I don't know how well that would work on different platforms) - would require me to learn a bit of JQuery, but it seems pretty straightforward
Make it an XNA project and use MonoXNA (or similar) to port - would require me to learn enough XNA to do it, don't know if it's a pain
Use some other multiplatform 2D kit I don't know of
Basically, I need animated 2D sprites, mouse and touch input, and it would really be nice to have movement keyframes and maybe rotation.
There's also sound, of course, but playing a sound file seems so simple on all platforms that writing platform-specific shouldn't be much hassle.
Have a look at MonoGame. It should suit your needs pretty well I think.

Is it practical to port code from Flash to C#?

My goal is to gain a better understanding of the characteristics of C#, and become more comfortable creating simple apps. I am fairly competent with Flash (Actionscript 3), and found an old Tic-Tac-Toe game I'd written. I started wondering about porting this code into a C# application. Not knowing much about C#, I'm wondering how difficult the migration would be.
On the one hand, the underlying game logic is syntactically similar, and therefore would be easy to port.
However, as far as the graphics are concerned, I don't even know where to begin. So far, I've only exposed myself to Windows Forms and Console apps in C#.
I'm wondering if these Flash concepts have similar analogs in C#, or if the procedures and syntax are radically different:
Placing graphic elements on a stage
Rendering lines from start/end coordinates
Event listeners on movie clips
Swapping the image inside a graphic element (or, in my Flash version, nextFrame() in a movie clip)
You may want to try developping your little game using Silverlight. Silverlight applications, coded using C# and Xaml, are pretty similar in form with flash applications, and you should find everything you need without trouble.
So I suggest you download the Silverlight SDK (free) and give it a try.
Firstly, Flash is to WPF (close enough) as ActionScript is to C#.
The WPF/Silverlight model is much more similar to Flex that it is to Flash. Everything is added to the UI tree as a object, even lines.
Likewise, adding event handlers to controls (like a button click) can be done in the "code behind" (the code that lives with the view), but the recommendation is to use the MVVM pattern. If you are new to the concepts of separation of concerns and unit testing, feel free to start with the simpler "code behind" method.
While WPF and Silverlight are very similar, I'd recommend starting with Silverlight as the SDK and available samples are richer. You can easily move onto WPF later on (though porting an application from Silverlight to WPF is not automatic).
Swapping images, as you mentioned, would be done via "Visual States" in Silverlight (or possibly changing the image reference, which is more "hacky").
Have a look at the following links to get started:
Learn # Silverlight.net
Silverlight on MSDN
Shapes and Drawing (Silverlight)
If you're looking specifically to do games and the like, you may wish to look into the free XNA framework. However, there will be differences as Flash gives you far more ability to "set up" things beforehand and modify them.
Placing graphic elements on a stage
If you go the XNA route, you will be drawing sprites using the spritebatch, you tell them where and how to draw and that's where they will go
Rendering lines from start/end coordinates
In windows forms you can do this via a simple System.Drawing call, however if you wish to do this in XNA, you will either have to make a 1 pixel square and stretch/rotate it to what you want, or use 3d primitives (Though this will limit you to a 1 pixel line)
Event listeners on movie clips
Look into delegates, but there isn't really an equivalent for movie clips to my knowledge
Swapping the image inside a graphic element (or, in my Flash version, nextFrame() in a movie clip)
This is fairly simple, depending on what you mean. If you want to, say, animate a sprite. You can do this by moving the source rectangle or changing the texture of the spritesheet. If you mean the screen as a whole, this is mostly handled for you provided you use the spritebatch. In windows forms you'll have to do more of it yourself, but the base concepts are the same.
Overall it's not that bad, but if that doesn't sound appealing check out Silverlight. It's basically C# styled flash so you may find the transition easier.
Good luck and hope this helps.

OpenGL in C# in WinForms

I have to write a simple program that will draw something in a Windows Forms Application using OpenGL and C#? Can you give me example of library and/or maybe a tutorial?
I found this: http://sourceforge.net/projects/csgl/files/CsGL/1.4.1/ but it is from 2002. Is there anything newer?
You could check this out: http://opentk.net/
The Open Toolkit is set of fast, low-level C# bindings for OpenGL, OpenGL ES and OpenAL. It runs on all major platforms and powers hundreds of apps, games and scientific research.
OpenTK provides several utility libraries, including a math/linear algebra package, a windowing system, and input handling.
Another alternative is SharpGL on Code Project.

Categories