Include TristarSoundMonitor Musix

Share your advanced PureBasic knowledge/code with the community.
xperience2003
Enthusiast
Enthusiast
Posts: 113
Joined: Tue Oct 05, 2004 9:05 pm
Location: germany
Contact:

Include TristarSoundMonitor Musix

Post by xperience2003 »

tsm is a sound (modul) format for tiny intros (and/or games)

test exe (10kb)
www.games-mafia.de/puretsm.exe

under v4 its very easy to import the replayer lib

Code: Select all

;tsm music fun  xp^tristar/deviance/secretly!
;
;pure v4

 import "dsound.lib"  
    _DirectSoundCreate() as "_DirectSoundCreate@12"
 endimport
 
 import "TSMReplay.obj"
   TSM_Init(a.l,b.l) as "_TSM_Init@12"  ;musix-memory, winhandle 
   TSM_Stop() as "_TSM_Stop@0"
   TSM_Play() as "_TSM_Play@0"
  endimport

If OpenWindow(0, 100, 200, 195,260,"PureBla",#PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
hDC = GetForegroundWindow_()

TSM_Init(?musix, hDC)

  Repeat
    TSM_Play()  ;call the player
   
    If WindowEvent() = #PB_Event_CloseWindow 
      Quit = 1
    EndIf
  Sleep_(1)
  Until Quit = 1
  
  TSM_Stop()
EndIf
End   

datasection
musix: includebinary "Wizardry.TSM" ;simply include
enddatasection
complete system here
www.games-mafia.de/puretsm.rar

-------------------------------

..for purebasic <=3.94

Code: Select all

; tsm music fun  xp^tristar/deviance/secretly!
 
!JMP doneInit
  !extrn _TSM_Init@12
  !extrn _TSM_Stop@0
  !extrn _TSM_Play@0
  
  !section '.drectve' drectve hidden
  !DB 'c:\LinkStuff\TSMReplay.obj c:\LinkStuff\dsound.lib'
  !section '.text' code readable executable
!doneInit:

TSM_Init.l    : !MOV [v_TSM_Init], _TSM_Init@12
TSM_Play.l    : !MOV [v_TSM_Play], _TSM_Play@0
TSM_Stop.l    : !MOV [v_TSM_Stop], _TSM_Stop@0
 
tuneadr.l = ?tune
hwnd = GetForegroundWindow_()
!PUSH dword [v_hwnd]
!PUSH dword [v_tuneadr]
!CALL [v_TSM_Init]

Repeat
  !CALL [v_TSM_Play]
  Delay(1)
Until GetAsyncKeyState_(#VK_ESCAPE)

!CALL [v_TSM_Stop]

End
;
DataSection
  tune:
  IncludeBinary "c:\LinkStuff\wizardry.TSM"
EndDataSection 
have fun =)
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

sweet :wink:
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
THCM
Enthusiast
Enthusiast
Posts: 276
Joined: Fri Apr 25, 2003 5:06 pm
Location: Gummersbach - Germany
Contact:

Post by THCM »

Nice!
The Human Code Machine / Masters' Design Group
Post Reply