music

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by blue-speed.

hi
can anyone tell me why i cant hear the midi ?

LoadMovie( 0,"we.mid")
;---------------------------------------------
PlayMovie(0,0)
;----------- HAUPTSCHLEIFE--------------------
If start = 1

Repeat
FlipBuffers()
ClearScreen(0,0,0)
ExamineKeyboard()
move_text()
DisplaySprite(0,0,0)
DisplaySprite(1,text_x,text_y)
If KeyboardPushed(#PB_Key_Escape)
End
EndIf
ForEver
Else
MessageRequester("Fehler","Fehler: konnte keine fullscreen oeffnen",0) ; Naja is ja klar wir setzen eine fullscreen
EndIf
EndIf



WOOOOOOW!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by blue-speed.

here is the real code:

;===================================
;= TEXT SCROLL
;===================================

;--------- Globale ---------------------------
Global start : start = 1
Global text_x : text_x = 0
Global text_y : text_y = 600
;---------------------------------------------
;--------- INITIIALISIERUNG ------------------
If InitSprite() = 0
MessageRequester("Fehler","Fehler: Dx7 oder hoehernicht nicht verfuegbar",0) ; sprite initialisierung
EndIf

If InitKeyboard() = 0
MessageRequester("Fehler","Fehler: Dx7 oder hoehernicht nicht verfuegbar",0) ; keyboard initialisierung
EndIf

If InitMovie() = 0
MessageRequester("Fehler","Fehler: Dx oder hoehernicht nicht verfuegbar",0) ; sound initialisierung
EndIf
;---------------------------------------------



;---------- Prozeduren------------------------
Procedure move_text()
If text_y >= -700
text_y = text_y - 1
EndIf
If text_y <= - 700
text_y = 600
EndIf
EndProcedure
;---------------------------------------------


;------------ FULSCREEN/Fenster----------------

If OpenScreen(800,600,32,"SCROLLER") = 0
MessageRequester("Fehler","Fehler: konnte keine fullscreen oeffnen",0) ; Naja is ja klar wir setzen eine fullscreen
EndIf
;-------------------------------------------

;------------ sprite/sound laden -----------
LoadSprite(0,"hgrund.bmp",0)
LoadSprite(1,"text.bmp ",0)
LoadMovie( 0,"we.mid")
;---------------------------------------------
PlayMovie(0,0)
;----------- HAUPTSCHLEIFE--------------------
If start = 1

Repeat
FlipBuffers()
ClearScreen(0,0,0)
ExamineKeyboard()
move_text()
DisplaySprite(0,0,0)
DisplaySprite(1,text_x,text_y)
If KeyboardPushed(#PB_Key_Escape)
End
EndIf
ForEver
Else
MessageRequester("Fehler","Fehler: konnte keine fullscreen oeffnen",0) ; Naja is ja klar wir setzen eine fullscreen
EndIf
;---------------------------------------------

WOOOOOOW!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by MrVainSCL.

Hi Blue-Speed (BlueScreen :wink:)

I played a bit around with your code and now i founded a way to play MidiTunes in your program/game... Just have a look to my example... Its not the best way but it seems to work... Please document your source in english, its easier to understand for other people if you post something in this list i think... :wink:)

Falls Du probleme mit dem source hast, dann melde dich einfach. Good Luck...


;-----------------------------------
;
; PB Example to PlayMidi in Games
; by Mr.Vain of Secretly!
;
; (12-Dec-2001 - 23:24 pm)
;
;-----------------------------------


Global texty : texty = 600

;
;-------- Init and Play MidiTune --------
;
; Note: If you are planing to play a MidiTune in your game (using screen), you have to InitMovie() first!
; If you try to InitSprite() first, its not possible to play our Midi...!? So we will Init all the other
; stuff later... Does someone in this forum know how to use and play midi using 100% WinAPI commands? :wink:
; Please mail me, thanks!
;

If InitMovie() = 0
MessageBox_ (0,"Can't open DirectX 7 or later", "Error", #MB_ICONINFORMATION|#MB_OK)
EndIf

;-------- Load and Play Midi --------
;
; Its not possible to play Midi on a screen, because the PlayMovie() command need a event to play stuff,
; so we will trick a bit and open a small hidden window to play our background MidiTune! Its not the best
; way but it still works - i hope... :wink:
;

If LoadMovie(0, "Tune.mid") ;MovieName$)
OpenWindow(0, 0, 0, 1, 1, #PB_Window_SystemMenu, "PlayMidi Example for Games")
PlayMovie(0, WindowID()) ; Why isnt it possible to use "PlayMovie(0,ScreenID())" ? :wink:)
Else
MessageBox_ (0,"Can't load MidiTune", "Error", #MB_ICONINFORMATION|#MB_OK)
EndIf

;-------- Info --------
;
; If nothing failed, we should hear the background tune...
; Now we can Init all the other stuff and open our screen...
;

;
;-------- Init all the needed system stuff --------
;

If InitSprite() = 0 Or InitKeyboard() = 0
MessageBox_ (0,"Can't open DirectX 7 or later", "Error", #MB_ICONINFORMATION|#MB_OK)
End
EndIf

;
;-------- Init Screen and load stuff --------
;

If OpenScreen(800,600,32,"PB Example To PlayMidi in Game") = 0 ; INITSPRITE; INITPAL
MessageBox_ (0,"Could not open 640x480x16 screen", "Error", #MB_ICONINFORMATION|#MB_OK) ; MUST SET BEFORE
End ; ELSE CRASH! ;(
EndIf

LoadSprite ( 0, "Background.bmp",0) ; For example 800x600 Picture to fill the Background
LoadSprite ( 1, "SmallLogo.bmp",0) ; For example any small Picture for scrolling in Forground...

;-----------------------------------------
; M a i n L o o p -> Scroll Graphic
;-----------------------------------------

Repeat
ClearScreen(0,0,0)

If texty >= -700
texty = texty - 1
EndIf

If texty <= -700
texty = 600
EndIf

DisplaySprite ( 0, 0, 0)
DisplaySprite ( 1, 0, texty)
FlipBuffers()

ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)

End ; This will end our program and will automatical close our hidden window and stop the background Midi :wink:

;----------------------------------------------------------------------

MrVainSCL!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Hello MrVainSCL !!

We already figured this out in the german
PureBasic Forum few days ago... :)

>PlayMovie(0, WindowID()) ; Why isnt it possible to
>use "PlayMovie(0,ScreenID())" ? :wink:)

You dont need the hidden OpenWindow,
just set it to 0: PlayMovie(0,0)

You can also use PlayMovie(0, WindowID())
without a opened Window (i tested it).

Looks like WindowID() returns 0 if no
Window is opened (logical).

cya,
...Danilo


(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.

where can I find the german forum????



Tranquilizer/ Secretly!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

http://www.purebasic.de -> "Support: Deutsches Forum"

only a little forum atm...
new and better forum will come
within the next days.

cya,
...Danilo


(registered PureBasic user)
Post Reply