March 29, 2024, 05:00:04 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Music files as a resource: how to use MP3 as a resource

Started by AdrianFox, December 03, 2012, 07:05:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

AdrianFox

I have no problem using wave files as a resource and using 'LOADRESOURCE'  
with playwave mymem, @sndasync  or whatever.

I was intrigued by Graham's use of midi (or mp3) files  using the API call:
declare "WINMM",mciSendStringA(command:STRING,temp:STRING,length:INT,callBack:INT),INT

You then load a music file from disk musicfile = getstartpath + "Music.mp3"

and play it with mciSendStringA("Play " + musicfile,"",0,0)

But how would you go about loading such a music file from resources?  Can that be done with a midi or mp3 file,  and can I use the API call from Graham's program to somehow play it?

What would the code be to load the resource?  I've tried:

loadresource("RES_SND", "MP3",mymem)

which to my simple mind means I have loaded my customised resource into memory,  but how then do I go on to PLAY it from memory?

I hope I've explained that clearly!

???
Adrian Fox

GWS

Hi,

I never use resources. ::)

To my mind, if you stuff them into the executable for your program, you are in a way, 'contaminating' the program. :P

The only merit is if you don't wish the user to know what is being used.  That never worries me. :)

It might look somehow more efficient, but I prefer to see exactly what files, music and graphics etc. are being used by the program.

If I wish, I can then change one or more of the utility files to give another effect, without fiddling with the program itself.

Also, as you see, there can be problems.

I've looked through my reference material, but could find nothing useful.

Just my preference, but I like the KISS principle. ;D

best wishes, :)

Graham
Tomorrow may be too late ..

AdrianFox

I guess you are right as it is  in any case easier to use resources which can be easily embedded (like wav files) rather than struggle with those that can't. The only reason I try to include music and images in things like Xmas cards is because many of our friends don't know much about computers and find it difficult  enough to download and run a single file.  Once they have to make sure that a music file and a couple of  images have to be in the same directory they get worried.   Of course, I can send out the file as a self extracting installation file, but then some people run scared of that thinking you are going to do something horrible to their computer!   ;)
With this year's card, I'm doing  a mixture of both so I can use your program for the DX  falling snow (if that's  ok with you)  combined with my own stuff which will be mostly using resources.
Thanks for your help with my aspirations.  I will send you my finished stuff when it's completed, if you like.

;D
Adrian Fox

GWS

That's fine Adrian - I hope you and yours have a lovely Christmas.

Best wishes, :)

Graham
Tomorrow may be too late ..