Click here to Skip to main content
15,908,581 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've succesfully implemented BASS [http://www.un4seen.com/] and I can use this to play the files I want.

The problem I still have is: if I need to share my app, I also need to find the corresponding track it plays and that track must be placed on a specific location on the computer (fixed path) or it won't play at all of course.

I want to add my modfiles as a resource in my project and then play it from there (locally), so it works instantly from any location my apps run and I don't have to send my modfiles all the time.
I can't seem to get this working the easy way:
just add as resource and use 'resource path' [e.g. Properties.Resources.Trackname] instead of 'location as string' [e.g. "C:\Test\Trackname.mod"]).

I've tried to search for help at the official forum for BASS at the website mentioned above, but no one seems to know how it works, as they don't program in C# (.NET)... Very nice.

This is keeping me busy for over a month now, is there someone here that knows or can find out:
How to play a modfile from resource using the BASS modplayer?

Working code after BASS-implementation to play files on the computer:
C#
using Un4seen.Bass;
        int vol = 10000;
            Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
            int load = Bass.BASS_MusicLoad("C:\\Test\\TestTrack.mod", 0, 0, BASSFlag.BASS_SAMPLE_LOOP, 0);
            Bass.BASS_SetConfig(BASSConfig.BASS_CONFIG_GVOL_MUSIC, vol);
            Bass.BASS_ChannelPlay(load, false);

So I want to change
C#
// This:
MusicLoad("C:\\Test\\TestTrack.mod", ... )
// To:
MusicLoad(Properties.Resources.TestTrack, ... )

And still have the playing music, which won't work this way.
At the BASS forum they said it had to do with resource importing methods from .NET, not with functions of BASS itself.

Any ideas?
Posted
Updated 22-Feb-13 0:26am
v2

1 solution

The problem I still have is: if I need to share my app, I also need to find the corresponding track it plays and that track must be placed on a specific location on the computer (fixed path) or it won't play at all of course.

Then your program needs to be modified to read files from any location as provided by the user.
 
Share this answer
 
Comments
DarkTyranno 22-Feb-13 6:05am    
If you add the file as a Resource, then it can always load it locally, wherever you run the app. That's what I want to accomplish. I don't install my application, so no extraction of music anywhere. I'm just creating an instant run application.
Richard MacCutchan 22-Feb-13 6:09am    
Well, you need to provide a lot more information. We cannot guess what is happening in your code or why it does not work; edit your question and add the detail there.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900