embedding mod files?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Kale.

is there a way to embed mod files within PB maybe using somethign like:

Code: Select all

Music: IncludeBinary "whatever.mod"
LoadModule(0, ?Music)


--Kale

New to PureBasic and falling in Love! :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by TheBeck.

Look for the itcanbedone demo here: http://www.reelmediaproductions.com/pb/appsinpb.html
This demo puts a MIDI music track into the executable. When the program is run it saves the MIDI music file into a temp directory then loads it and erases the file upon exit. Hope this helps.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by chr1sb.

Here's an example which uses bassmod libray (from http://www.un4seen.com/music/) to play the mod straight from memory

Code: Select all

OpenLibrary(0, "bassmod.dll")

If OpenWindow(0, 200, 200, 200, 200, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget , "PureBasic Window")

CallFunction(0, "BASSMOD_Init" ,-1,44010,16)
CallFunction(0, "BASSMOD_MusicLoad",1,?music,0,0,2)
CallFunction(0, "BASSMOD_SetVolume",50)
CallFunction(0, "BASSMOD_MusicPlay")

Repeat

  EventID.l = WindowEvent()

  Until EventID = #PB_Event_CloseWindow
    
EndIf

Result = CallFunction(0, "BASSMOD_MusicStop")
CloseLibrary(0)

End

music:
IncludeBinary"music.mod"
BTW: I posted this example before but it's in the archived posts section. so sorry if I've contravened board etiquette by duplicating it here for convenience)

chr1sb
Post Reply