Code: Select all
; *************************************
; Module in exe - PB 4
; *************************************
If InitAudio() And InitPTModule(0) And InitFile(0)
;write module to ram
length.l=?moddataend-?moddata ;
;get module adress
*jo=?moddata
If CreateFile(0,"Ram:test.mod")
For i=0 To length/4
WriteLong(PeekL(*jo+(i*4)))
Next
CloseFile(0)
Else
PrintN("Can't Allocate file.")
EndIf
AllocateAudioChannels(15)
UseAsPTModuleChannels(15)
LoadPTModule(0,"Ram:test.mod")
PlayPTModule(0)
Repeat
VWait() : VWait()
mb.w=MouseButtons()
Until mb.w
StopPTModule()
Else
PrintN("Can't do anyhing^^")
EndIf
End
;DataSection <- don't use it will be crash ^^
moddata:
IncludeBinary "codebench:purebasic/examples/sources/test.mod"
moddataend:
;EndDataSection
problems:
- a module of 50kb doesn't work ..10-20kb was ok
- WriteByte doesn't work..i don't know why ..so i use WriteLong ^^