How to use includeBinary() ?
Posted: Fri Mar 08, 2024 2:30 pm
I have some code which plays some music
Now I want to embed the music into the final executable, but how?
I thought by using a DataSection would be the answer
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
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
I thought by using a DataSection would be the answer
Code: Select all
DataSection
song:
IncludeBinary "b.it"
EndDataSection
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