![]() |
|
[.NET] Playing an XM Song - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [.NET] Playing an XM Song (/showthread.php?tid=6019632) Pages: Pages
1
2
|
Playing an XM Song - requiredhq - Oct 26, 2019 Well, I've looked long and hard and the furthest I got was looking at a program irrklang. It didn't work. How do I play an xm song in the background of my vb.net app, im using visual studio 2012 if that matters. It's in literally every keygen on the internet, yet there isn't a single tutorial other than this one horrible video on youtube. XM Play using BassMod plugin - YouTube This is my last resort, I really want to add some background music to my changelog.. :l it's a small fun feature but a huge pain in the ass. RE: Playing an XM Song - Pawnhub - Oct 26, 2019 deployment - How to play background music in a C# Console Application - Stack Overflow Also check out the media.soundplayer class. You can convert the code from C# to VB online and both share the same framework (in this case .net) RE: Playing an XM Song - Eternal Darkness - Oct 26, 2019 https://github.com/veso266/Chip-Player -> https://github.com/veso266/Chip-Player/blob/master/ChipTune%20Player/PlayXM.cs More bassmod info: https://www.codeproject.com/Articles/120348/Play-XM-in-C-From-File-and-Memory RE: Playing an XM Song - requiredhq - Oct 26, 2019 (Oct 26, 2019 09:56 PM)Eternal Darkness Wrote: GitHub - veso266/Chip-Player: A Simple Chip Player using BASSMOD.dll to play ChipTunes -> Chip-Player/PlayXM.cs at master veso266/Chip-Player GitHub This is good but it's not in visual studio 2012 vn.net, it's in like C to my knowledge. I know I need to reference the dll and the libraries will either be included or not depending on if it's for .net. Still a bit confused. Then how do I simply play a xm in the background. One command, upon trying to figure this out i know i need to dim some type of player then direct it to my.resources.file.xm but I know different programs have different commands like 2player or soundengine. RE: Playing an XM Song - Eternal Darkness - Oct 26, 2019 (Oct 26, 2019 10:24 PM)requiredhq Wrote: This is good but it's not in visual studio 2012 vn.net, it's in like C to my knowledge. I know I need to reference the dll and the libraries will either be included or not depending on if it's for .net. Still a bit confused. Then how do I simply play a xm in the background. One command, upon trying to figure this out i know i need to dim some type of player then direct it to my.resources.file.xm but I know different programs have different commands like 2player or soundengine. The GitHub link is to a C# file, which is easily converted to VB.NET. VB.NET is what you are writing it in, correct? Some Converters: https://converter.telerik.com/ https://www.carlosag.net/tools/codetranslator/ https://codeconverter.icsharpcode.net/ https://www.developerfusion.com/tools/convert/csharp-to-vb/ https://www.dotnetspider.com/convert/Csharp-To-Vb.aspx https://www.tangiblesoftwaresolutions.com/product_details/csharp-to-vb-converter.html Likely you will need to touch up the output (conversion is not 100% accurate, but reasonably close). Look at the other .cs files in the github repo in order to understand how to use the linked class... The class allows you to play xm files, the actual usage is in Program.cs... RE: Playing an XM Song - requiredhq - Oct 27, 2019 (Oct 26, 2019 10:47 PM)Eternal Darkness Wrote: The GitHub link is to a C# file, which is easily converted to VB.NET. VB.NET is what you are writing it in, correct? Okay, I'm running into a few issues. First, I put song.xm in resources. However I'm having an issue "loading up" the song. Code Public Sub New(ByVal FileName As String)My Code Code Dim Data As New StringSimply doesn't work. It's saying 1 dimensional array cannot be converted to byte, etc. Error being my.resources.song and data. My next error comes with importing the dll and 'using it's library?', don't quote me on that but I think that's what I am trying to do. I've tried doing imports bassmod.dll, which gives me a namespace error. Here's the certain code that I'm trying to reference. Code <DllImport("BASSMOD.dll")>RE: Playing an XM Song - gigajew - Oct 27, 2019 You're defining xmdata asone byte. You need to define it as an array of byte like this: Dim xmdata As Byte() RE: Playing an XM Song - MavenGradle - Oct 27, 2019 (Oct 26, 2019 09:39 PM)UnknownPawn Wrote: deployment - How to play background music in a C# Console Application - Stack Overflow The System.Media.SoundPlayer does not play XM formats. I quote from the MS docs: Quote:Controls playback of a sound from a .wav file. https://docs.microsoft.com/en-us/dotnet/api/system.media.soundplayer?view=netframework-4.8 (Oct 27, 2019 03:33 AM)requiredhq Wrote: Okay, I'm running into a few issues. First, I put song.xm in resources. However I'm having an issue "loading up" the song. Do you actually know the difference between a byte array and a byte? I recommend you to look up how to declare array variables. Next up, in order to read a resource into a byte array, you do not use Code System.IO.File.ReadAllBytes()You could use something like this if you marked the file as a resource in your project: Code Dim xmData() As Byte = My.Resources.I_am_an_idiotRE: Playing an XM Song - Pawnhub - Oct 27, 2019 (Oct 27, 2019 09:52 AM)MavenGradle Wrote: --snip-- To be fair unless the program has to take in XM by default like from a 3rd party OP could use a utility like so. Transform XM to WAV audio files online and for free! RE: Playing an XM Song - gigajew - Oct 27, 2019 Not Visual Basic but easy enough to convert or learn from https://github.com/veso266/Chip-Player RE: Playing an XM Song - Eternal Darkness - Oct 27, 2019 (Oct 27, 2019 03:33 AM)requiredhq Wrote: Okay, I'm running into a few issues. First, I put song.xm in resources. However I'm having an issue "loading up" the song. System.IO.File.ReadAllBytes returns Byte() not a String. It loads a file from a string, not a Resource (info). If you compile the GitHub link I can confirm it works. All about knowing how things work... If this is too complicated you can use LibVLC as they support xm files. Might be slightly simpler, with a bigger dependency of course. Just hide the "player" from the UI... Find it funny the same GitHub repo was linked... Working VB.NET code (this is a console app OP, take the class and set up the main method however you need it implemented in your program). (If you want to test, De-base64 the github audio file, copy the dll file to the debug folder, and compile for x86/32-bit architecture). You can swap in your xm file too... Code Imports System.Runtime.InteropServicesYou should be able to use a resource even, like so: XM = New PlayXM(My.Resources.resourceName)... Just make sure it is File-type:Binary (Properties of Resources Tab)... RE: Playing an XM Song - 0xDEAD10CC - Oct 27, 2019 Personally I'd use minifmod.. This is the typical library used for most demoscene projects unless you've developed your own minimalistic library which benefits the file reduction techniques used. RE: Playing an XM Song - Anesthesia_Love - Oct 29, 2019 The Tutorial is pretty much on point on how to do this. Whats so stupid is you need it to use x86 not 64 for it to even work properly. also you can play from resources without an issue. RE: Playing an XM Song - fisica638 - Oct 30, 2019 It took me only a few minutes of basic documentation and 30m to do the program. Well I have 2 ways to do it: 1) use the original api in c ++ and code a complete Wrapper on vb.net. R : It will take me longer. So I did not. settle for the wrapper bug I found on the internet. 2) Use a Wrapper on .net that I found on the internet. Go a little bug. R : Do not debug the program or it will give you an error. (It's the Wrapper, it seems that it doesn't detect the api in c ++ or something) You have to build it and look for it manually in the debug folder and execute it that way. Well it works great. It is what you wanted not? Link : github.com/salsoft2111995/XM-Player/releases/tag/1.0 Please Comment! Thank you. 🤝 RE: Playing an XM Song - requiredhq - Nov 4, 2019 (Oct 30, 2019 10:48 AM)fisica638 Wrote: It took me only a few minutes of basic documentation and 30m to do the program. Hey man looks awesome, good work. I'm having trouble importing the dlls into my own project, something about a com reference. I added them as existing items instead, used some of your code and am getting a namespace error on Imports Un4seen.BassMOD.BassMOD. Any idea whats going on?
|