How to use includeBinary() ?

Just starting out? Need help? Post your questions and find answers here.
rootuid
User
User
Posts: 48
Joined: Sat Nov 23, 2013 11:46 am

How to use includeBinary() ?

Post by rootuid »

I have some code which plays some music

Code: Select all

InitSound()
LoadMusic(1,"b.it")
  
If InitSprite() = 0 Or InitKeyboard() = 0
  MessageRequester("Error", "Sprite system can't be initialized", 0)
  End
EndIf

If OpenScreen(1920, 1200, 32, "Sprite")
  PlayMusic(1)
  Repeat

    ExamineKeyboard()
  Until KeyboardPushed(#PB_Key_Escape)
Else
  MessageRequester("Error", "Can't open creen !", 0)
EndIf
Now I want to embed the music into the final executable, but how?
I thought by using a DataSection would be the answer

Code: Select all

DataSection
    song:
    IncludeBinary "b.it"
  EndDataSection 
When I double click on IncludeBinary() I can see it has the contents of b.it.

but how do I reference the label 'song' in LoadMusic() ? I tried LoadMusic(1,?song) but LoadMusic() wants the second param to be a string
Last edited by rootuid on Fri Mar 08, 2024 2:45 pm, edited 1 time in total.
Fred
Administrator
Administrator
Posts: 18253
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: How to use includeBinary() ?

Post by Fred »

rootuid
User
User
Posts: 48
Joined: Sat Nov 23, 2013 11:46 am

Re: How to use includeBinary() ?

Post by rootuid »

Many thanks Fred, I got it working!
Post Reply