It is currently Mon Dec 10, 2018 3:38 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: How to include soundmodule in exe
PostPosted: Sun Apr 10, 2011 6:44 am 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 05, 2004 9:05 pm
Posts: 103
Location: germany
...by extreme easy way^^


Code:

; *************************************
;  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 ^^

_________________
Kultstudio


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye