Guidance
指路人
g.yi.org
software / rapidq / Examples / Audio & Video / Jojo.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
'Jojo 1.0, a multimedia player and image viewer
'Adapted from VidAudio Jojo 1.10
'By Achilles B. Mina
'Note: To view image file click Play

     DECLARE FUNCTION PlayAvi LIB "winmm.dll" ALIAS "mciSendStringA" _
      (BYVAL lpstrCommand AS STRING, lpstrReturnString AS LONG, uReturnLength AS _
      LONG, hwndCallback AS LONG) AS LONG
     DECLARE FUNCTION GetShortPathName LIB "kernel32" ALIAS "GetShortPathNameA" (BYVAL lpszLongPath AS STRING, BYVAL lpszShortPath AS LONG, BYVAL lBuffer AS LONG) AS LONG

     DECLARE SUB aTextAgain
     DECLARE SUB StopAudio
     DECLARE SUB AudioVideo
     DECLARE SUB CloseAudio
     DECLARE SUB InitAudio
     DECLARE SUB CloseAudioform
     DECLARE SUB Check(hand AS LONG, message AS LONG, one AS LONG, two AS LONG)
     DECLARE SUB Listening(Sender AS QCOOLBTN)

     DIM OpenDialog AS QOPENDIALOG
     DIM vFileName AS STRING
     DIM aFileName AS STRING
     DIM RetVideo AS STRING*256
     DEFINT oTop, oHeight, oWidth, oLeft
     DEFSTR audio$
     DEFBYTE loops

     CREATE Audio AS QFORM
      Width = 340
      Height = 205
      COLOR = &HFFFFFF
      AutoScroll = 0
      Center
      CAPTION = "Jojo"
      OnPaint = aTextAgain
      WndProc = Check
      CREATE AudSlide AS QTRACKBAR
       Top = 5
       Left = 1
       Height = 30
       Width = 280
      END CREATE
      CREATE AudS AS QCOOLBTN
       Flat = 1
       Font.Bold = 1
       CAPTION = "Skip"
       Top = 32
       Left = 125
       Width = 45
       Hint = "Stop play and rewind"
       ShowHint = 1
       OnClick = StopAudio
      END CREATE
      CREATE AudSnd AS QCOOLBTN
       Flat = 1
       Font.Bold = 1
       CAPTION = "Audio"
       Top = 2
       Left = 285
       Width = 45
       Hint = "Turn audio on or off"
       ShowHint = 1
       OnClick = AudioVideo
      END CREATE
      CREATE AudO AS QCOOLBTN
       Flat = 1
       Font.Bold = 1
       CAPTION = "Open"
       Top = 32
       Left = 285
       Width = 45
       Hint = "Select audio or video file"
       ShowHint = 1
       OnClick = Listening
      END CREATE
      CREATE AudA AS QCOOLBTN
       Flat = 1
       Font.Bold = 1
       CAPTION = "Play"
       Top = 62
       Left = 285
       Width = 45
       Hint = "Play selected file"
       ShowHint = 1
       OnClick = Listening
      END CREATE
      CREATE AudB AS QCOOLBTN
       Flat = 1
       Font.Bold = 1
       CAPTION = "Pause"
       Top = 92
       Left = 285
       Width = 45
       Hint = "Pause or resume current file"
       ShowHint = 1
       OnClick = Listening
      END CREATE
      CREATE AudL AS QCOOLBTN
       Flat = 1
       Font.Bold = 1
       CAPTION = "Loop"
       Top = 122
       Left = 285
       Width = 45
       Hint = "Play file continuously"
       ShowHint = 1
       OnClick = Listening
      END CREATE
      CREATE AudC AS QCOOLBTN
       Flat = 1
       Font.Bold = 1
       CAPTION = "Close"
       Top = 152
       Left = 285
       Width = 45
       Hint = "Close current file"
       ShowHint = 1
       OnClick = CloseAudio
      END CREATE
     END CREATE

     audio$ = "on"
     Audio.SHOWMODAL

     SUB AudioVideo
      IF audio$ = "off" THEN
       audio$ = "on"
       AudSnd.Font.Bold = 1
      ELSEIF audio$ = "on" OR audio$ = "" THEN
       audio$ = "off"
       AudSnd.Font.Bold = 0
      END IF
     END SUB

     SUB AudioView
      Audio.Visible = 1
      Audio.TextOut(106,80,"  LOAD A FILE...",0,&HFFFFFF)
     END SUB

     SUB Listening
      DIM RetLength AS STRING*256
      DIM RetAudio AS STRING*256
      DIM RetSlide AS STRING*256
      DIM sReturn AS STRING*256
      SELECT CASE Sender.Handle
      CASE AudO.Handle
       oHeight = Audio.Height
       oWidth = Audio.Width
       oTop = Audio.Top
       oLeft = Audio.Left
       OpenDialog.Filter = "Multimedia files|*.rmi;*.midi;*.mid;*.wav;*.au;*.snd;*.mpa;*.wma;_
      *.mp2;*.mp3;*.aif;*.iff;*.mpm;*.m1v;*.mpeg;*.mpg;*.mpe;*.avi;*.mov;*.wmv;*.mpv;*.qt;*.dat;_
      *.bmp;*.jpg|Audio files|*.rmi;*.midi;*.mid;*.wav;*.au;*.snd;*.mpa;*.wma;_
      *.mp2;*.mp3;*.aif;*.iff|MP3|*.mp3|MIDI|*.midi;*.mid|WAV|*.wav|_
      Video files|*.mpm;*.m1v;*.mpeg;*.mpg;*.mpe;*.avi;*.mov;*.wmv;*.mpv;*.qt;*.dat|_
      MPEG video|*.mpeg;*.mpe;*.mpg|AVI video|*.avi|QuickTime|*.mov;*.qt|_
      Image files|*.bmp;*.jpg|All files|*.*"
       IF OpenDialog.EXECUTE THEN
        DIM lngRes AS LONG
        strPath$ = STRING$(165, 0)
        lngRes = GetShortPathName(OpenDialog.FileName, VARPTR(strPath$), 164)
        aFileName = LEFT$(strPath$, lngRes)
        Audio.Repaint
        aTextAgain
        Audio.Repaint
        Audio.TextOut(65,80,"CLICK PLAY or LOAD ANOTHER...",0,&HFFFFFF)
       END IF
      CASE AudA.Handle
       IF AudB.CAPTION = "Resume" OR aFileName = "" THEN EXIT SUB
       Audio.Repaint
       aTextAgain
       Audio.Repaint
       Audio.TextOut(105,80,"  LOADING FILE... ",0,&HFFFFFF)
       end$ = RIGHT$(LCASE$(aFileName),3)
       DO
        SELECT CASE end$
        CASE "mpm","m1v",".qt","mpg","mpe","peg","avi","mov","wmv","mpv","dat","bmp","jpg"
         PlayAvi("open " + aFileName + " type MpegVideo"  + " parent " + STR$(Audio.Handle) + " style child",0,0,0)
         PlayAvi("Where " + aFileName + " destination", VARPTR(sReturn), LEN(sReturn) - 1, 0)
         lStart = INSTR(1, sReturn, " ") 'pos of top
         lPos = INSTR(lStart + 1, sReturn, " ") 'pos of left
         lStart = INSTR(lPos + 1, sReturn, " ") 'pos width
         Width$ = MID$(sReturn, lPos, lStart - lPos)
         Height$ = MID$(sReturn, lStart + 1)
         IF Audio.Height < (VAL(Height$) + 100) THEN
          Audio.Height = VAL(Height$) + 110
         END IF
         IF Audio.Width < (VAL(Width$) + 80) THEN
          Audio.Width = VAL(Width$) + 80
          AudSnd.Left = Audio.Width - 60
          AudO.Left = Audio.Width - 60
          AudA.Left = Audio.Width - 60
          AudB.Left = Audio.Width - 60
          AudL.Left = Audio.Width - 60
          AudC.Left = Audio.Width - 60
         END IF
         Audio.Repaint
         aTextAgain
         PlayAvi("put " + aFileName + " window at 14 60 " + Width$ + " " + Height$, 0, 0, 0)
        CASE ELSE
         PlayAvi("open " + aFileName + " type MpegVideo",0,0,0)
        END SELECT
        PlayAvi("status " + aFileName + " length",VARPTR(RetLength),256,0)
        AudSlide.Max = VAL(LEFT$(RetLength,7))
        AudSlide.Min = 0
        Audio.Repaint
        aTextAgain
        PlayAvi("play " + aFileName + " from " + STR$(AudSlide.Position),0,0,0)
        DO
         DOEVENTS
         PlayAvi("set " + aFileName + " audio all " + audio$, 0, 0, 0)
         PlayAvi("status " + aFileName + " mode",VARPTR(RetAudio),256,0)
         PlayAvi("status " + aFileName + " position",VARPTR(RetSlide),256,0)
         AudSlide.Position = VAL(LEFT$(RetSlide,7))
        LOOP UNTIL LEFT$(RetAudio,7) = "stopped" OR Audio.Visible = 0
        PlayAvi("close " + aFileName,0,0,0)
        AudSlide.Position = 0
        Audio.Top = oTop
        Audio.Height = oHeight
        Audio.Width = oWidth
        Audio.Left = oLeft
        Audio.Left = oLeft
        AudSnd.Left = 285
        AudO.Left = 285
        AudA.Left = 285
        AudB.Left = 285
        AudL.Left = 285
        AudC.Left = 285
       LOOP UNTIL loops = 0
       AudL.Font.Bold= 1
       InitAudio
      CASE AudB.Handle
       IF AudB.CAPTION = "Resume" THEN
        AudB.CAPTION = "Pause"
        PlayAvi("resume "+ aFileName,0,0,0)
       ELSEIF AudB.CAPTION = "Pause" THEN
        AudB.CAPTION = "Resume"
        PlayAvi("pause "+ aFileName,0,0,0)
       END IF
      CASE AudL.Handle
       IF loops = 0 THEN
        loops = 1
        AudL.Font.Bold = 1
       ELSE
        loops = 0
        AudL.Font.Bold = 1
       END IF
      CASE AudC.Handle
       CloseAudio
      END SELECT
     END SUB

     SUB CloseAudio
      PlayAvi("close all",0,0,0)
      aFileName = ""
      InitAudio
     END SUB

     SUB InitAudio
      loops = 0
      AudL.Font.Bold = 1
      AudSlide.Position = 0
      Audio.Repaint
      Audio.TextOut(65,80,"CLICK PLAY or LOAD ANOTHER...",0,&HFFFFFF)
      Audio.Top = oTop
      Audio.Height = oHeight
      Audio.Width = oWidth
      Audio.Left = oLeft
      Audio.Left = oLeft
      AudSnd.Left = 285
      AudO.Left = 285
      AudA.Left = 285
      AudB.Left = 285
      AudL.Left = 285
      AudC.Left = 285
     END SUB

     SUB Check
      IF message = &H10 THEN CloseAudioForm
     END SUB

     SUB CloseAudioForm
      PlayAvi("close all",0,0,0)
      Application.Terminate
     END SUB

     SUB StopAudio
      PlayAvi("stop "+ aFileName,0,0,0)
     END SUB

     SUB aTextAgain
      Audio.TextOut(10,Audio.Height - 50,"  " + aFileName + "  ",0,&HFFFFFF)
     END SUB
掌柜推荐
 
 
¥860.00 ·
 
 
¥900.00 ·
 
 
¥810.00 ·
 
 
¥317.00 ·
 
 
¥1,370.00 ·
 
 
¥660.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2002-12-02 09:55:16