Take the 2-minute tour ×

Im working on a program. But instead of using tons of background workers and threads to update the UI, could I use XNA instead? It's an application, so it will not be deployed to te XBox.

I understand the limitation of not using WinForms and WPF controls, but that won't be a problem as I can quickly write the only control I need, a slider.

share|improve this question
How would XNA be a subsitute for "tons of background workers and threads"? Please clarify your question.. –  tbridge May 14 '12 at 21:18
add comment

3 Answers

up vote 3 down vote accepted

Your question was a little unclear, but hopefully this can answer it:

Yes, you can definitely use XNA. It's a bit annoying to do it without a Game class because loading in graphical assets using XNA's Content system requires knowing about the Graphics device (this is all hidden under the implementation of Game). Basically you have to implement your own IServiceProvider (pretty much just a dictionary of Types to Objects) which XNA's content system will use to get the IGraphicsDeviceService, which you also have to implement on whatever object manages your graphics (lets call it GrahpicsManager, real original :P). On the GraphicsManager, you simply create a PresentationParameters object, fill in all the parameters you want to set (including your window or control handle and size), and then use it to create a GraphicsDevice. Note that the IGraphicsDeviceService interface requires you to invoke a few events (such as when you finish creating the graphics device, or when the device is lost, etc).

Here's my own implementation of IServiceProvider (you basically just instantiate a single one of those and share it everywhere):


Make sure to add your IGraphicsDeviceService to that service provider once you create it. I also whittled down my implementation of the graphics service so that you could check it out. Note that you would need to add your own Draw method that actually uses the GraphicsDevice, and calls GraphicsDevice.Present at the end.


See line 36 for where I add myself to the service container, and line 73 for where I setup the graphics device (note that the setup takes an IntPtr for the window handle that it will draw to).

You could also actually make the app using the Game, but its pretty annoying because Game takes over your main loop (generally that means you have to be responsible for pushing the windows message pump yourself inside of Update, I've tried it, it sucks).

Anyways, hope that answers your question!

share|improve this answer
No I implement the game class. I'm asking if using xna not on a game is ok –  Cole Johnson May 15 '12 at 13:36
Although highly helpful! –  Cole Johnson May 15 '12 at 13:38
add comment

While Xna if primaraly used for gaming, I belive you could use it for an application, If you really want lots of graphics and other stuff you would find in a game. I havent tried out too much with audio,but I belive there are some ways to "mix" it for your dj app. Experiment around with it and see if its up to your expectations. You can also use Neoforce Controls (http://neoforce.codeplex.com/) to create other controls easily if you ever need anything more than a slider.

share|improve this answer
What? {15 characters} –  Cyral May 14 '12 at 21:30
Nvm {15 characters} –  Cole Johnson May 14 '12 at 22:32
add comment

For a DJ application I wouldn't recommend using XNA. It's audio support is pretty limited and it presents problems when trying to play tracks backward and such. Also, loading assets (audio files) can take some time if not properly preloaded, which I figure would be complex for a decent DJ library.

You'd probably have to use a background library for the audio management and playing, but I'm not sure how easy that would be. I also think that loading and playing external audio files could be a challenge, given the limitations XNA imposes when accessing the audio subsystems.

share|improve this answer
I wrote my own audio library and use it on my other projects... –  Cole Johnson May 15 '12 at 1:37
The problem is that I can't guarantee that you can produce audio in XNA without using its SoundEffect/Instance and Song objects. And these must be there at runtime, so a DJ's library would become huge and consume tons of memory. –  Elideb May 15 '12 at 10:16
add comment

Your Answer


