What is connected with creating a music player in .NET?

I always wanted to create a music player. But I have no idea how to do this. I don't need this to be cross-form while it works.

Each part is his own question, but let me know if I don’t see it. I broke it into simple, unknown and long

Plain

  • Select files / directories using a dialog
  • Saving playlist and other settings (json i choose you!)
  • GUI data sorting

Somewhat complicated

  • Global keys, so I don’t need to switch to the player window (I know that this is not supported in .NET :()
  • Search for songs (permission of the album and album to mix with the title and get what is considered the best result)

Unknown

  • Play current music with pause and stop with support for MP3, AAC and OGG.
  • Information about the composition (artist, album, title, year)

I have a feeling when I start, it will take a long time to complete. I plan to do this in C #. Should I use an external library to get information about the song? Is one of these harder than some people might think? any warnings about any of the above?

+6
music
source share
5 answers

I think that the best way to get an idea of ​​how to create a music player is to check the source of the existing one :) In this case, I recommend taking a look at Banshee , it is written in C # and is one of the leading music players for Linux - will be released soon Windows

+3
source share

I would suggest, instead of trying to take on such a project yourself, find an open source music player on SourceForge, GitHub, or one of the other sites of the OS project and join this project. There are many open source players, so I’m sure that one of them will meet your goals.

Good luck

+2
source share

First of all, although you can contribute to the world by joining an existing project, I say: where is it fun? Therefore, if you do this in order to learn and have fun, then you should definitely go with him.

Global keys :

Yes, it is possible by connecting to the Windows message path. Import dll is required for user32.dll and kernel32.dll. I previously did something like this:

using System; using System.Diagnostics; using System.Runtime.InteropServices; namespace DevBoard.App { internal class InterceptKeys { #region Delegates public delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam); #endregion private const int WH_KEYBOARD_LL = 13; private const int WM_KEYDOWN = 0x0100; public static IntPtr SetHook(LowLevelKeyboardProc proc) { using (Process curProcess = Process.GetCurrentProcess()) using (ProcessModule curModule = curProcess.MainModule) { return SetWindowsHookEx(WH_KEYBOARD_LL, proc,GetModuleHandle(curModule.ModuleName), 0); } } [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelKeyboardProc lpfn, IntPtr hMod, uint dwThreadId); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool UnhookWindowsHookEx(IntPtr hhk); [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam); [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] private static extern IntPtr GetModuleHandle(string lpModuleName); } } 

Search

If you want to do some advanced index search, you can look at Lucene.Net

Happy coding! :)

+2
source share

I used global hotkeys in .NET in an open source project

http://skd.codeplex.com/SourceControl/changeset/view/1306#28124

I think I got the code in a Codeplex article

+1
source share

I know that this concerns only one part of your question, but I saw several overly complex (or in one case completely wrong) examples and realized that I should add this.

The easiest way to add a system hotkey is ManagedWinapi . After adding a link to the project, you can put something like the following in the application launch code:

 hotkey = new ManagedWinapi.Hotkey(); hotkey.WindowsKey = true; hotkey.KeyCode = System.Windows.Forms.Keys.Space; hotkey.HotkeyPressed += new EventHandler(hotkey_HotkeyPressed); try { hotkey.Enabled = true; } catch (ManagedWinapi.HotkeyAlreadyInUseException) { System.Windows.MessageBox.Show("Could not register hotkey (already in use).", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } 
+1
source share

All Articles