Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I'm trying to add a music file (.it) to my project, so I don't have to send it with my executables all the time and don't have to enter a specific path on the clients, as the track is in the project itself. But I don't seem to be able to succeed. For all the things I've tried with corresponding errors, I refer to solution 3 of: http://www.codeproject.com/Questions/504637/Needplussupportplusforplusaplus-small-plusproject Am I doing anything wrong, does anyone have an idea? |
||||
|
Did you try using the memory playback? Like this? http://www.ambiera.com/irrklang/... |
||||
|
I tried memory playback, but not like this. I don't want it like this at all, so many code... I just try to exchange my play2D("C:\Test\music.it") with Isoundengine file = Resource.Properties.music.it play2D(file) Something like this in theory, is that possible this way, like it should be with other files? I haven't figured out how to use resources, so I hope this can be done. |
||||
|
Try loading the resource into a memory array. Then you can easily play it using AddSoundSourceFromMemory(). If you are able to IOStream from your resource, you could also use AddSoundSourceFromIOStream, which might be even easier. |
||||
|
IrrKlang.ISoundSource track = engine.AddSoundSourceFromIOStream(WindowsFormsApplication1.Properties.Resources.Xaser_Aeolus, "Xaser-Aeolus.it"); engine.Play2D(track, true); I just try something like this, but still all the same errors. Invalid arguments, Play2D expects a string, while I use a variable, cannot convert byte[] to string Etc.... :( I don't want to use memory. I can play it directly from my directory on the computer, why isn't that possible if I move the file to resources (delivered with the application?) if that IOStream is a possibility, how do I use it? I have no idea and only get errors related to all the arguments I use to call the resource file and in the Play2D method... Can someone help me? |
||||
|
the string you need to give to play2D is usually a filename, but if you add your sound using a custom sound source, you can use the name of the sound source you used. About how to get the IOStream from your resource: That's up to you. |
||||
|
I still haven't figured out how to play an .it file as a resource... I got help getting my nfo to wrk as a resource, but the steps to do this (resource property: Text, encoding text option) aren't related to this file. If I add an .it file as a resource, it needs to be a binary file? If I do this right, I can at least call the music without errors, but the play2D starts to yell if I want to add the source as 'string' without quotes (variable). How do I need to solve this? It's one of the last steps I need to finish the functionality of my application. |
||||
|
Anyone? :( What steps do I need when I add a .it/.mod file to Resources and play it from within application using the Resource? |
||||
|
I finally found a substitute for irrKlang that was able to play the tracks that failed: BASS combined with BASS.net. Now I'm also able to play the music from Resource, this way must be the same as irrKlang probably, just have to pass the resource modfile to another method. I'll update the way how on my article, once I've finished some other steps as future reference for those interested! http://www.codeproject.com/Articles/505994/Creating-a-NFO-Viewer-in-Csharp-as-a-beginner |
|