Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > irrKlang
using music from resource folder

DARkTYranno
Guest
Quote
2012-12-08 12:20:04

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?


niko
Moderator
Quote
2012-12-10 22:05:32

Did you try using the memory playback? Like this? http://www.ambiera.com/irrklang/...


DARkTYranno
Guest
Quote
2012-12-12 10:59:57

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.


erik
Registered User
Quote
2012-12-13 12:43:26

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.


DARkTYranno
Guest
Quote
2012-12-16 15:47:18

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?


niko
Moderator
Quote
2012-12-19 09:54:51

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.


DARkTYranno
Guest
Quote
2013-01-01 13:23:50

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.


DARkTYranno
Guest
Quote
2013-01-11 16:39:45

Anyone? :(

What steps do I need when I add a .it/.mod file to Resources and play it from within application using the Resource?


DARkTYranno
Guest
Quote
2013-03-22 10:52:12

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


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Int?rnational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact