Author Topic: Problem With Wiki Example  (Read 6487 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Problem With Wiki Example
« Reply #15 on: August 22, 2019, 10:40:46 pm »
Ah, if your files are near root C: I don't think Windows will let us go there. I could only navigate below users in my user name folder and below, Desktop, Documents, Downloads, ... there might be a way through but I don't know it.

You might want to look at my wallpaper changer, as well: https://www.qb64.org/forum/index.php?topic=1008.msg105845#msg105845

It uses SHELL and DIR to make a file listing, and strips out a lot of the unneeded info for you.

For directories only, you want: dir /A:D
files only: dir /A:-D
subfolders: dir /s
bare format: dir /b

Mix and match, as needed, to customize your command.  ;)
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Problem With Wiki Example
« Reply #16 on: August 23, 2019, 01:21:58 am »
You might want to look at my wallpaper changer, as well: https://www.qb64.org/forum/index.php?topic=1008.msg105845#msg105845

It uses SHELL and DIR to make a file listing, and strips out a lot of the unneeded info for you.

For directories only, you want: dir /A:D
files only: dir /A:-D
subfolders: dir /s
bare format: dir /b

Mix and match, as needed, to customize your command.  ;)

Yes, that's what I am doing. You know, I think the problem is not getting DIR info, it is the ChDir command to those folders that I was attempting when "The file does not exist." message pops up and ends the session with error after error.

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Problem With Wiki Example
« Reply #17 on: August 23, 2019, 04:46:10 am »
Hello people. Unfortunately, I also have to acknowledge that the Windows  open dialog in IDE 1.3 will end up saying that the program has stopped working. The same happens when using the IDE version 20180228/86 from git b301f92. However, after compiling the same resource in the 20170120/51 IDE, everything works as expected.

Attached source code contains my very old music player + EXE file compiled under IDE 20170120/51 (or older), if is compiled in this old version then works + skin file.

* qb64mp.zip (Filesize: 1.34 MB, Downloads: 137)

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Problem With Wiki Example
« Reply #18 on: August 23, 2019, 06:29:14 am »
Hello people. Unfortunately, I also have to acknowledge that the Windows  open dialog in IDE 1.3 will end up saying that the program has stopped working. The same happens when using the IDE version 20180228/86 from git b301f92. However, after compiling the same resource in the 20170120/51 IDE, everything works as expected.

Attached source code contains my very old music player + EXE file compiled under IDE 20170120/51 (or older), if is compiled in this old version then works + skin file.

The 2017 version is 32-bit; do you know if the others are, or not?
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Problem With Wiki Example
« Reply #19 on: August 23, 2019, 08:20:53 am »
Hi Steve i look to it and yes. All versions than the one oldest are 64 bit. Oldest is 32 bit.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Problem With Wiki Example
« Reply #20 on: August 23, 2019, 09:04:57 am »
Actually B+ your program starts out right where your QB64 programs are, not the Users folder. I just ran a scan on my computer and it doesn't have the file DIR$INF0.INF. I wonder if it's because I am 64 bit Windows 10. I have my programs in (you guys will laugh) C:\QBasic because when I started I converted a lot of QBasic programs to QB64. And I have my entire QB64 inside C:\QBasic. So, this demonstration program starts at C:\QBasic. I just can't get it to C: and you are probably right, Microsoft is being Microsoft again. lol

I need to do some things tonight so I'll look into all of this another day real soon. Thanks again you 2. I haven't given up hope, yet. lol

BTW you can't find DIR$INFO.INF because it is erased after info is extracted. I wonder how it works if move the exe  in the root of your music files directory, should be able to navigate inside folders you make. Tiny Navigator needs a window on files and allow file selection.

Steve's is nice, I wonder about problem Ken reported about not being able to go so far into folders could music files be structured different!

One problem I encountered was over scrolling directories, they can get stuck all the way at top not reachable by mouse.
« Last Edit: August 23, 2019, 09:19:09 am by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Problem With Wiki Example
« Reply #21 on: August 23, 2019, 09:18:22 am »
BTW you can't find DIR$INFO.INF because it is erased after info is extracted. I wonder how it works if move the exe  in the root of your music files directory, should be able to navigate inside folders you make. Tiny Navigator needs a window on files and allow file selection.

Steve's is nice, I wonder about problem Ken reported about not being able to go so far into folders could music files be structured different!

I’m wondering if there’s issues with access permission rights.  I made a test folder my machine, stacked a dozen levels deep, and had no issues opening/navigating through them.  There’s no hard set “folder depth”, as far as I can tell.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Problem With Wiki Example
« Reply #22 on: August 23, 2019, 09:21:24 am »
I’m wondering if there’s issues with access permission rights.  I made a test folder my machine, stacked a dozen levels deep, and had no issues opening/navigating through them.  There’s no hard set “folder depth”, as far as I can tell.

Neither can I. I get file info from root and Windows stuff... I did find the scroller scrolling directories out of mouse reach, I should check arrow keys work :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Problem With Wiki Example
« Reply #23 on: August 23, 2019, 09:28:27 am »
RE: Steves Path or File selector

No arrow keys, maybe I have to bang on scroll up bar 80 times?? to get .. to appear.
« Last Edit: August 23, 2019, 09:40:21 am by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Problem With Wiki Example
« Reply #24 on: August 23, 2019, 09:38:32 am »
I think I know why Tiny Navigator runs into "No file found error", because the temp file is being created in each directory it ChDir changes to and you can't create files in certain Windows directories, easy fix, I think...

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Problem With Wiki Example
« Reply #25 on: August 23, 2019, 09:58:52 am »
I repair problem with my windows browse dialog program and now it works. But it is not the same source code as Ken's. Problem was with LONG / _INTEGER64 types in library function FindWindow. Rewrited as _INTEGER64 and run fine. (i write about my player). Under 1.3.

See to row 463, HwndOwner

Upgraded source code: (need files from ZIP posted before)

Code: QB64: [Select]
  1. DIM SHARED seznam2(1000) AS STRING * 255 '                 maximum files in directory limited to 1000
  2. DIM SHARED VFiles(1000) AS STRING * 255 '                  Dim for memory array contains VISIBLE file names (vith national characters others as US, displayed with _MAPUNICODE, BUT UNUSABLE TO OPERATION WITH FILES!
  3. DIM SHARED UFiles(1000) AS STRING * 255 '                  Dim for memory array contains UNVISIBLE, old filenames type 8.3. This is ussable to operation with files, but is not standardly displayed. One record lenght = 13.
  4. DIM SHARED MaskUFiles(1000) AS STRING * 255 '              Dim for array contains empty blocks + blocks with record accetable filemask - U = usable for file access
  5. DIM SHARED MaskVFiles(1000) AS STRING * 255 '              the same, but V = Visible - here are strings that can be correctly converted to screen with _MAPUNICODE, but are unussable to file access
  6. ' -------------------------------------------------        this all dims are erased if sub end. Final outputs are:
  7. DIM SHARED FinalVFiles(1000) AS STRING * 255 '             Contains all QB64 usable soundformat files from directory - names unusable for access
  8. DIM SHARED FinalUFiles(1000) AS STRING * 12 '               8 + "." + 3 the same as previous case, but usable for file access
  9. DIM SHARED sekunda(10) AS INTEGER, minuta(360) AS INTEGER 'Array contains seconds and minute for song time
  10. DIM SHARED text(27) AS STRING * 200 '                       27 linies, contains 200 characters (max)
  11. DIM SHARED RndFinalVFiles(1000) AS STRING * 255 '           its still copy FinalVFiles - if random play is off, its random array generated in VFiles copyed back from this still copy
  12. DIM SHARED RndFinalUFiles(1000) AS STRING * 255
  13. DIM SHARED copyU(1000) AS STRING * 200 ' bylo nastaveno max misto 1000 kdyby rndplay neslo...
  14. DIM SHARED copyV(1000) AS STRING * 200
  15. DIM SHARED Track(1000) AS INTEGER '                         contains track list in play order (every track listed by nacti.b has own rerord number)
  16.  
  17. path$ = ENVIRON$("SYSTEMROOT")
  18. path$ = path$ + "\fonts\cour.ttf"
  19. f& = _LOADFONT(path$, 32, "monospace, bold") '              Load font. Font is used for correct display song name
  20. Vol = 1
  21. polar = 10
  22.  
  23.  
  24. _TITLE "QB64 Music Player.      By Petr - Petr.Pr@email.cz" 'i dont know who is it  :-D
  25. i& = _NEWIMAGE(1024, 300, 32) '                              My screen window
  26. new& = _LOADIMAGE("skinDb.png", 32) '                        My all in one graphic file
  27. j& = _NEWIMAGE(1024, 300, 32)
  28. d& = _NEWIMAGE(491, 74, 32)
  29. GreenButtonPlay& = _NEWIMAGE(100, 100, 32)
  30. GreenButtonStop& = _NEWIMAGE(100, 100, 32)
  31. GreenButtonPower& = _NEWIMAGE(100, 100, 32)
  32. GreenButtonBack& = _NEWIMAGE(100, 100, 32)
  33. GreenButtonPause& = _NEWIMAGE(100, 100, 32)
  34. GreenButtonNext& = _NEWIMAGE(100, 100, 32)
  35. VolumePlus& = _NEWIMAGE(50, 50, 32)
  36. VolumeMinus& = _NEWIMAGE(50, 50, 32)
  37. ImageOpenFiles& = _NEWIMAGE(50, 50, 32)
  38. resicon& = _NEWIMAGE(114, 30, 32)
  39. infoicon& = _NEWIMAGE(50, 50, 32)
  40. LoopOneU& = _NEWIMAGE(50, 50, 32) ' U as unpressed or NOT pressed
  41. LoopAllU& = _NEWIMAGE(50, 50, 32)
  42. LoopOneP& = _NEWIMAGE(50, 50, 32) ' P as Pressed
  43. LoopAllP& = _NEWIMAGE(50, 50, 32)
  44. RandPlayOff& = _NEWIMAGE(27, 12, 32)
  45. RandPlayOn& = _NEWIMAGE(27, 12, 32)
  46. afterinfo& = _NEWIMAGE(1024, 300, 32)
  47. _PUTIMAGE (0, 0)-(26, 11), new&, RandPlayOff&, (560, 60)-(586, 71)
  48. _PUTIMAGE (0, 0)-(26, 11), new&, RandPlayOn&, (560, 74)-(586, 85)
  49. _PUTIMAGE (0, 0)-(49, 49), new&, LoopAllP&, (894, 592)-(960, 656)
  50. _PUTIMAGE (0, 0)-(49, 49), new&, LoopOneP&, (960, 590)-(1023, 650)
  51. _PUTIMAGE (0, 0)-(49, 49), new&, LoopAllU&, (896, 530)-(956, 590)
  52. _PUTIMAGE (0, 0)-(49, 49), new&, LoopOneU&, (950, 470)-(1010, 530)
  53. _PUTIMAGE (0, 0)-(49, 49), new&, infoicon&, (964, 538)-(1014, 588)
  54. _PUTIMAGE (0, 0)-(113, 29), new&, resicon&, (571, 8)-(684, 37)
  55. _PUTIMAGE (0, 0)-(49, 49), new&, ImageOpenFiles&, (899, 474)-(948, 523)
  56. _PUTIMAGE (0, 0)-(49, 49), new&, VolumeMinus&, (895, 412)-(945, 462)
  57. _PUTIMAGE (0, 0)-(49, 49), new&, VolumePlus&, (958, 412)-(1008, 462)
  58. _PUTIMAGE (0, 0), new&, GreenButtonNext&, (760, 540)-(860, 640)
  59. _PUTIMAGE (0, 0), new&, GreenButtonPause&, (650, 540)-(750, 640)
  60. _PUTIMAGE (0, 0), new&, GreenButtonBack&, (540, 540)-(640, 640)
  61. _PUTIMAGE (0, 0), new&, GreenButtonPower&, (770, 430)-(870, 530)
  62. _PUTIMAGE (0, 0), new&, GreenButtonStop&, (650, 430)-(750, 530)
  63. _PUTIMAGE (0, 0), new&, GreenButtonPlay&, (532, 431)-(632, 531)
  64. _PUTIMAGE (0, 0), new&, j&, (1, 100)-(1025, 401)
  65. _PUTIMAGE (0, 0), new&, d&, (0, 0)-(490, 73)
  66. 'j& = _LOADIMAGE("skin.png", 32) 'tohle
  67. 'd& = _LOADIMAGE("digits.png", 32) 'tohle
  68. _PUTIMAGE , j&, i&: m& = _NEWIMAGE(400, 100, 32): t& = _NEWIMAGE(5000, 120, 32) ' t& = song title - for long names
  69.  
  70.  
  71. titlemusic$ = "Stoped" '                                                          basic status
  72. InsertX = -200 '                                                                  its X axis for song name moving on screen
  73. 'mrizka 170, 10
  74. 'path$ = ENVIRON$("SYSTEMROOT")
  75. 'path$ = path$ + "\fonts\cour.ttf"
  76.  
  77. 'screen i&
  78. white& = _RGB32(255, 255, 255)
  79. whitetwo& = _RGB32(150, 150, 150)
  80. _SETALPHA 0, white& TO whitetwo&, VolumePlus&
  81. _SETALPHA 0, white& TO whitetwo&, VolumeMinus&
  82. _SETALPHA 0, white& TO whitetwo&, ImageOpenFiles&
  83. _SETALPHA 0, white& TO whitetwo&, infoicon&
  84. _SETALPHA 0, white& TO _RGB32(65, 65, 65), LoopOneU&
  85. _SETALPHA 0, white& TO _RGB32(65, 65, 65), LoopAllU&
  86. '_SETALPHA 0, white& TO _RGB32(65, 65, 65), LoopOneP&
  87. '_SETALPHA 0, white& TO _RGB32(65, 65, 65), LoopAllP&
  88. _PUTIMAGE (918, 170), LoopOneU&
  89. _PUTIMAGE (918, 115), LoopAllU&
  90.  
  91. _PUTIMAGE (739, 223), infoicon&
  92. _PUTIMAGE (799, 223), ImageOpenFiles&, i&
  93. _PUTIMAGE (859, 222), VolumePlus&, i&
  94. _PUTIMAGE (919, 222), VolumeMinus&, i&
  95. _PUTIMAGE (0, 0), i&, afterinfo&
  96. _SETALPHA 0, white& TO _RGB32(65, 65, 65), RandPlayOff&
  97. _PUTIMAGE (930, 91), RandPlayOff&, i&
  98. _SETALPHA 0, white& TO _RGB32(65, 65, 65), RandPlayOn&
  99.  
  100.  
  101. LoopOne = 0 '                                               basic status for neverending playing one track
  102. LoopAll = 0 '                                               basic status for neverending playing all tracks from selected directory
  103. WindowsFileOpenSystem
  104. IF PlEr = 1 THEN PlEr = 0: BEEP: WindowsFileOpenSystem '    PlEr = Play Error. 0 = no error, 1 = is error. WindowsFileOpenSystem is function for opening folders from windows.
  105. nacti.b '                                                   create list all playble files in selected folder to swap file, load it to memory, then delete swap file. Create unsorted list!
  106.  
  107. 'RndPlay 1 OK!!!!
  108.  
  109. reload = 1 '                                                'Reload = 1 started WindowsFileOpenSystem, Reload = 0 close it.
  110. RAP "StartDemo" '                                            Start basic mode
  111. ' WindowsFileOpenSystem ' if skiped this, its start automaticaly plays files in the same directory who is
  112.  
  113. dalsi:
  114. IF _SNDPLAYING(zvuk&) = 0 THEN minuta = 0: sekunda = 0: oldsec = sec 'dodana podminka    Reset song time if song playing is on the end
  115. IF posuv = 1 THEN posuv = 0: GOTO posunuto '                                             POSUV = song moving. 1 = is pressed next or back button
  116. IF LoopOne = 1 THEN GOTO posunuto '                                                      LoopOne = is pressed neverending playing for one song, also akt muss be the same.
  117. akt = akt + 1 '                                                                          akt = actual play track number. Here this say go playing next song in list.
  118.  
  119. posunuto:
  120. IF LoopAll = 1 AND akt > max THEN akt = 1 '                                              This reset playing to begin, if is selected neverending playing for all songs in directory.
  121. IF LoopAll = 0 AND akt > max THEN akt = 0: BEEP: stopp = 1: status$ = "Playlist end!" '  If all songs id directory are played to end and neverending playing for all not selected, beep and now new with status. Stopp = 1 = draw stop button to pressed.
  122.  
  123.  
  124.  
  125.  
  126. 'IF akt > max THEN akt = 1 'return plays to begin
  127. file$ = FinalUFiles$(akt)
  128. IF _SNDPLAYING(zvuk&) = 0 AND _SNDPAUSED(zvuk&) <> -1 AND stopp = 0 THEN hraj file$ 'tento krok zpusobuje chybu funkce STOP
  129. IF inf = 0 THEN _TITLE "QB64 Music Player.      By Petr - Petr.Pr@email.cz"
  130. DO WHILE _SNDPLAYING(zvuk&) = -1 OR _SNDPAUSED(zvuk&) = -1 OR stopp = 1 '                  Play sound if STOP is not pressed, playing is not in the end or PAUSE is not pressed
  131.     IF _FULLSCREEN > 0 THEN _FULLSCREEN _OFF '                                             if user press Alt + enter, do screen size back!
  132.     Rodent '                                                                               call mouse interaction sub
  133.     IF reload = 1 THEN reload = 0: akt = 0: GOTO dalsi '                                   this line is for RELOAD if you open next folder
  134.     RAP FinalVFiles$(akt) '                                                                draw visible song name to screen
  135.     '    COLOR _RGB(255, 255, 255): PRINT FinalVFiles$(akt): SLEEP
  136.     IF inf = 0 THEN _DISPLAY '                                                             inf is for info if icon INFO on screen is pressed or not. If is, then my screen is in the background
  137.     '_LIMIT 25
  138.     cj '                                                                                   cj - sub named as Cesky Jazyk - english - Czech language. It make Czech characters correctly readable an othe screen.
  139.     '--------------------------------------------------------- KEYBOARD INPUTS ---------------------------------------------- Keyboard inputs -------------
  140.     IF inf = 1 THEN info '                                                                  return to sub INFO. INFO is waiting for pressing Esc key to end him or up/dn to read text.
  141.     IF inf = 1 THEN GOTO rtr '                                                              if INFO icon is pressed, is keyboard input for my program off, but not for INFO window.
  142.     i$ = INKEY$
  143.     SELECT CASE i$
  144.         CASE CHR$(27)
  145.             RAP "shutdown.internal.cmd" '                                                  this shutdown this program, before is called other sub for ersing all images from memory.
  146.         CASE CHR$(13)
  147.             IF vs = 1 THEN vs = 0 ELSE vs = 1 '                                             switch song time    backward / normal
  148.         CASE "P", "p"
  149.             'previous
  150.             RAP "getback.internal.cmd" '                                                    say - play previous song
  151.             akt = akt - 1: posuv = 1
  152.             i$ = ""
  153.             IF akt < 1 THEN pl = max '                                                      if is played first song in list, then skip and play last from list
  154.             _SNDSTOP (zvuk&) '                                                              but first stop playing current song.
  155.             EXIT DO
  156.         CASE "N", "n"
  157.             'next
  158.             RAP "getnext.internal.cmd" '                                                    say - play next song
  159.             akt = akt + 1: posuv = 1
  160.             i$ = ""
  161.             IF akt > linka THEN pl = 1 'found and repaired ERROR                            if is played last song from list, then skip and play first from list
  162.             _SNDSTOP (zvuk&) '                                                              but first stop current song.
  163.             EXIT DO
  164.         CASE CHR$(32)
  165.             IF _SNDPAUSED(zvuk&) = -1 THEN _SNDPLAY (zvuk&) ELSE _SNDPAUSE zvuk& '          if is pressed spacebar, use _SNDPAUSE
  166.         CASE "<", ","
  167.             ch# = ch# - .01: IF ch# < -1 THEN ch# = -1
  168.             _SNDBAL zvuk&, ch# '                                                            if is pressed < or , or . or > then reselect balance settings. Using double values.
  169.         CASE ">", "."
  170.             ch# = ch# + .01: IF ch# > 1 THEN ch# = 1
  171.             _SNDBAL zvuk&, ch#
  172.         CASE "+"
  173.             Vol = Vol + .01: IF Vol > 1 THEN Vol = 1 '                                      if is pressed + or - then reselect volume level
  174.             _SNDVOL zvuk&, Vol
  175.         CASE "-"
  176.             Vol = Vol - .01: IF Vol < 0 THEN Vol = 0
  177.             _SNDVOL zvuk&, Vol
  178.     END SELECT
  179.     rtr:
  180.  
  181. IF reload = 1 THEN GOTO dalsi 'here is curent problem?
  182.  
  183. GOTO dalsi '                                                                                   go back to DALSI, its begin this my loop and wait until song is played to end or keys are pressed.
  184. 'konec:
  185. '_SNDSTOP (zvuk&)
  186. 'IF LoopAll = 1 THEN GOTO dalsi 'make neverending loop, plays all files from begin
  187.  
  188. SUB RndPlay (status AS INTEGER) 'sub is tested                                                   Create random order for playlist, status: 0 = not use random order, 1 = use random order
  189.     SHARED max, usingRND, gen, tracknumber, stav '                                                max = maximal songs number in list, usingRND - info if song list is original or randomized
  190.     IF RTRIM$(LTRIM$(FinalUFiles(1))) = "" OR RTRIM$(LTRIM$(FinalVFiles(1))) = "" THEN EXIT SUB
  191.     IF usingRND = 0 THEN
  192.         FOR StillCopy = 1 TO max
  193.             copyU(StillCopy) = FinalUFiles(StillCopy)
  194.             copyV(StillCopy) = FinalVFiles(StillCopy)
  195.         NEXT
  196.     END IF
  197.     gen = 0
  198.     SELECT CASE status
  199.         CASE 0 'Random music play is OFF
  200.             IF usingRND = 0 THEN EXIT SUB
  201.             FOR rewrite = 1 TO max '                                                             here copying old playlist to this arrays, randomlist is ready in finalufiles and finalvfiles. Its ready for rndmusic off.
  202.                 FinalUFiles(rewrite) = copyU(rewrite)
  203.                 FinalVFiles(rewrite) = copyV(rewrite)
  204.  
  205.             NEXT
  206.             usingRND = 0 '                                                                      select RndPlay as unused for next use
  207.  
  208.         CASE 1 'Random music play is ON
  209.             FOR generate = 1 TO max
  210.                 gene:
  211.                 RANDOMIZE generate
  212.                 tracknumber = INT(RND * (max * 2))
  213.                 IF tracknumber > max OR tracknumber <= 0 THEN GOTO gene
  214.                 FOR ctrl = 1 TO generate
  215.                     IF tracknumber = Track(ctrl) THEN GOTO gene
  216.                 NEXT ctrl
  217.                 gen = gen + 1
  218.                 Track(gen) = tracknumber
  219.             NEXT
  220.             '            PRINT "Generovana cisla stop priradim pisnickam:"
  221.  
  222.             FOR cisla = 1 TO max
  223.                 FinalVFiles(cisla) = copyV(Track(cisla))
  224.                 FinalUFiles(cisla) = copyU(Track(cisla))
  225.             NEXT
  226.             '            vypis
  227.             usingRND = 1 '                                                                        Rndmusic is used and is possible rewriting arrays back if is going off.
  228.     END SELECT
  229.  
  230.  
  231.  
  232. SUB Rodent
  233.     SHARED MouseX, MouseY, Lb, zvuk&, akt, posuv, Vol, ch#, vs, stopp, inf, LoopAll, LoopOne, LoopAllU&, LoopAllP&, LoopOneU&, LoopOneP&, i&, rndpl '  mouse interface
  234.     IF inf = 1 THEN EXIT SUB '                                                                                                                         if INFO icon is pressed, is mouse to program window off
  235.         MouseX = _MOUSEX
  236.         MouseY = _MOUSEY
  237.         Lb = _MOUSEBUTTON(1)
  238.     LOOP
  239.     White& = _RGB32(255, 255, 255)
  240.     'mouse interaction
  241.     IF MouseX > 27 AND MouseX < 86 AND MouseY > 40 AND MouseY < 105 AND Lb = -1 THEN GOSUB PlayPressed
  242.     IF MouseX > 145 AND MouseX < 190 AND MouseY > 40 AND MouseY < 105 AND Lb = -1 THEN GOSUB StopPressed
  243.     IF MouseX > 252 AND MouseX < 305 AND MouseY > 40 AND MouseY < 105 AND Lb = -1 THEN GOSUB PowerPressed
  244.     IF MouseX > 27 AND MouseX < 86 AND MouseY > 151 AND MouseY < 209 AND Lb = -1 THEN GOSUB BackPressed
  245.     IF MouseX > 145 AND MouseX < 190 AND MouseY > 151 AND MouseY < 209 AND Lb = -1 THEN GOSUB PausePressed
  246.     IF MouseX > 252 AND MouseX < 305 AND MouseY > 151 AND MouseY < 209 AND Lb = -1 THEN GOSUB NextPressed
  247.     IF MouseX > 861 AND MouseX < 900 AND MouseY > 230 AND MouseY < 265 AND Lb = -1 THEN GOSUB VolPlus
  248.     IF MouseX > 798 AND MouseX < 835 AND MouseY > 230 AND MouseY < 265 AND Lb = -1 THEN GOSUB FilesSelect: EXIT SUB
  249.     IF MouseX > 925 AND MouseX < 961 AND MouseY > 225 AND MouseY < 265 AND Lb = -1 THEN GOSUB VolMinus
  250.     IF MouseX > 410 AND MouseX < 460 AND MouseY > 160 AND MouseY < 205 AND Lb = -1 THEN GOSUB BalanceLeft
  251.     IF MouseX > 600 AND MouseX < 650 AND MouseY > 160 AND MouseY < 205 AND Lb = -1 THEN GOSUB BalanceRight
  252.     IF MouseX > 730 AND MouseX < 923 AND MouseX > 60 AND MouseY < 93 AND Lb = -1 THEN GOSUB ViewTime
  253.     IF MouseX > 745 AND MouseX < 785 AND MouseY > 230 AND MouseY < 265 AND Lb = -1 THEN GOSUB info
  254.     IF MouseX > 930 AND MouseX < 960 AND MouseY > 120 AND MouseY < 155 AND Lb = -1 THEN GOSUB PressedLoopAll
  255.     IF MouseX > 930 AND MouseX < 960 AND MouseY > 176 AND MouseY < 210 AND Lb = -1 THEN GOSUB PressedLoopOne
  256.     IF MouseX > 933 AND MouseX < 955 AND MouseY > 94 AND MouseY < 100 AND Lb = -1 THEN GOSUB RandomPlay
  257.     EXIT SUB
  258.     PlayPressed:
  259.     '_SNDPLAY (zvuk&)
  260.     IF stopp = 1 THEN stopp = 0 '                                                             if is stop button draw as pressed, then draw it as unpressed (stop button cooperation)
  261.     RETURN
  262.     StopPressed:
  263.     IF _SNDPLAYING(zvuk&) = -1 THEN _SNDSTOP (zvuk&)
  264.     IF stopp = 1 THEN stopp = 0 ELSE stopp = 1: _DELAY 0.5 '                                  Stop button cooperation
  265.     RETURN
  266.     PowerPressed: RAP "shutdown.internal.cmd" '                                               Power button cooperation
  267.     BackPressed: RAP "getback.internal.cmd": akt = akt - 1: posuv = 1: _SNDSTOP zvuk& '       Back button cooperation
  268.     IF akt < 1 THEN pl = max
  269.     RETURN
  270.     PausePressed: '                                                                           Pause button cooperation
  271.     IF _SNDPAUSED(zvuk&) = -1 THEN _SNDPLAY (zvuk&) ELSE _SNDPAUSE zvuk&
  272.     _DELAY 0.2
  273.     RETURN
  274.     NextPressed: '                                                                            Next button cooperation
  275.     RAP "getnext.internal.cmd"
  276.     akt = akt + 1: posuv = 1
  277.     IF pl > linka THEN pl = 1
  278.     _SNDSTOP (zvuk&)
  279.     RETURN
  280.     VolPlus: Vol = Vol + .01: IF Vol > 1 THEN Vol = 1 '                                       Volume plus button cooperation
  281.     _SNDVOL zvuk&, Vol: RETURN
  282.     VolMinus: Vol = Vol - .01: IF Vol < 0 THEN Vol = 0 '                                      Volume minus button cooperation
  283.     _SNDVOL zvuk&, Vol: RETURN
  284.     FilesSelect:
  285.     _SNDSTOP (zvuk&)
  286.     ' IF RTRIM$(LTRIM$(FinalUFiles(1))) = "" THEN
  287.     RndPlay 0
  288.     rndpl = 0
  289.     akt = 0
  290.     WindowsFileOpenSystem '                                                                   start first folder select window in program begin
  291.     RETURN
  292.     BalanceLeft:
  293.     ch# = ch# - .01: IF ch# < -1 THEN ch# = -1 '                                              balance (speakers) icon cooperation
  294.     _SNDBAL zvuk&, ch#
  295.     RETURN
  296.     BalanceRight:
  297.     ch# = ch# + .01: IF ch# > 1 THEN ch# = 1
  298.     _SNDBAL zvuk&, ch#
  299.     RETURN
  300.     ViewTime: IF vs = 1 THEN vs = 0: _DELAY .1 ELSE IF vs = 0 AND ab = 0 THEN vs = 1: _DELAY .1 ' If is enter pressed, so vs = 0 = show song time from begin, vs = 1 = show song time from end
  301.     ViewSongTime vs '                                                                           call sub for time view
  302.     RETURN
  303.     info:
  304.     info '                                                                                      call sub info, this view information in data block sub info
  305.     RETURN
  306.     PressedLoopAll:
  307.     IF LoopAll = 0 THEN LoopAll = 1 ELSE LoopAll = 0
  308.     PressLoop 1 '                                                                               set loop after loop for all songs icon click
  309.     _DELAY 0.2
  310.     RETURN
  311.     PressedLoopOne:
  312.     IF LoopOne = 0 THEN LoopOne = 1 ELSE LoopOne = 0 '                                          set loop after click to icon for one song loop
  313.     PressLoop 2
  314.     _DELAY 0.2
  315.     RETURN
  316.     RandomPlay: '                                                                               cooperation with RND icon (random order music play)
  317.     IF _SNDPLAYING(zvuk&) <> -1 THEN RETURN
  318.     IF rndpl = 0 THEN _DELAY .01: rndpl = 1 ELSE rndpl = 0
  319.     RETURN
  320.  
  321.  
  322.  
  323. SUB PressLoop (ico AS INTEGER)
  324.     SHARED LoopAll, LoopOne, LoopAllU&, LoopAllP&, LoopOneU&, LoopOneP&
  325.     SELECT CASE ico
  326.         CASE 1
  327.             SELECT CASE LoopAll
  328.                 CASE 0
  329.                     _PUTIMAGE (918, 115), LoopAllU&
  330.                 CASE 1
  331.                     _CLEARCOLOR _RGB32(255, 255, 255), LoopAllP&
  332.                     _SETALPHA 0, _RGB32(254, 255, 255) TO _RGB32(200, 200, 200), LoopAllP& '    draw loop icons on screen for both case
  333.                     _PUTIMAGE (920, 115), LoopAllP&
  334.             END SELECT
  335.         CASE 2
  336.             SELECT CASE LoopOne
  337.                 CASE 0
  338.                     _PUTIMAGE (918, 170), LoopOneU&
  339.                 CASE 1
  340.                     _CLEARCOLOR _RGB32(255, 255, 255), LoopOneP&
  341.                     _PUTIMAGE (918, 170), LoopOneP&
  342.             END SELECT
  343.     END SELECT
  344.  
  345.  
  346. SUB info 'hodnota inf se priradi pri prvnim spusteni subu info a smaze po jeho opusteni (nastavi se na nulu)
  347.     SHARED i&, inf, afterinfo&, sdeleni&, mov, mox, f&
  348.     IF inf = 1 THEN GOTO block ELSE inf = 1 '                                                    info subprogram started after info icon click
  349.     'text& = _NEWIMAGE(1024, 300, 32)
  350.     RESTORE txt
  351.     sdeleni& = _NEWIMAGE(1024, 300, 32)
  352.     _DEST sdeleni&
  353.     RESTORE txt
  354.     FOR viewtext = 0 TO 27 '28 data linies
  355.         READ r$
  356.         text$(viewtext) = r$
  357.     NEXT
  358.  
  359.     mov = 0
  360.     block:
  361.     _TITLE "QB64 Petr's Player - INFO window"
  362.     LOCATE 1, 1
  363.     SCREEN i&
  364.     ij$ = INKEY$
  365.     DO UNTIL ij$ = CHR$(27)
  366.         SELECT CASE ij$
  367.             CASE CHR$(0) + CHR$(72) 'up
  368.                 mov = mov - 1
  369.                 IF mov < 0 THEN mov = 0
  370.  
  371.  
  372.             CASE CHR$(0) + CHR$(80) 'down
  373.                 mov = mov + 1
  374.                 IF mov > 11 THEN mov = 11 '                                                        11 steps because one screen use 16 linies, data block is long 28 linies, 28 - 16 = 12 - 1 = 11
  375.  
  376.  
  377.         END SELECT
  378.         _DEST sdeleni&
  379.         mox = mov + 16 '                16 rows to one page
  380.         IF mox > 28 THEN mox = 28 '     total linies
  381.         FOR PAGE = mov TO mox
  382.             PRINT RTRIM$(text$(PAGE))
  383.         NEXT
  384.  
  385.  
  386.         _CLEARCOLOR _RGB32(0, 0, 0), sdeleni&
  387.         _SETALPHA 190, , sdeleni&
  388.  
  389.  
  390.         _DEST 0
  391.         '_PUTIMAGE (0, 0), i&, text& 'dokud nestisknes klavesu, tak se vraci rizeni pro i& mimo subu pro klavesnici a mys
  392.         _PUTIMAGE (0, 0), sdeleni&, i&
  393.         _DISPLAY
  394.         ' _DELAY 0.5
  395.         '  _DEST 0
  396.         EXIT SUB
  397.     LOOP
  398.  
  399.     inf = 0 'po stisku klavesy v okne info se vrati rizeni i pro klvesnici a mys a ukonci se sub info
  400.     SCREEN i&
  401.     _PUTIMAGE (0, 0), afterinfo&, i&
  402.     PCOPY _DISPLAY, 1
  403.     '_FREEIMAGE text& '
  404.     _FREEIMAGE sdeleni&
  405.     _TITLE "QB64 Music Player.      By Petr - Petr.Pr@email.cz"
  406.  
  407.  
  408.     txt:
  409.     DATA "                                                                                                                               "
  410.     DATA "                                                                                                                               "
  411.     DATA "About QB Player:                                                                                    USE KEY UP / KEY DOWN / ESC"
  412.     DATA "This open source player writed Petr Preclik. Its use QB64 commands, its based on the _SNDPLAY statement. This is my first ver- "
  413.     DATA "sion in graphic mode. To program:"
  414.     DATA "Is possible program using with mouse or keyboard. Use < or , and > or. for balance, + and - for volume and spacebar for pause"
  415.     DATA "Esc to quit program, enter for song time selecting. N, n for next song in selected directory, P, p for previous song."
  416.     DATA "With mouse is possible using LOOP one or LOOP all songs, play, stop, pause, next, previous, to time select click to song time"
  417.     DATA "display. Two icons are for LOOP / LOOP all (songs in selected dir). "
  418.     DATA "Files for this program: QBPlay.EXE, SKINDb.PNG, Demo.MP3. All used pictures are in the one PNG file, all pictures used in this"
  419.     DATA "PNG file from www.eu.fotolia.com. Program read none ID3, is without equalizer and without vizualization. Is possible, next ver-"
  420.     DATA "sion this already to have. For ID3TAG - See to http://www.[abandoned, outdated and now likely malicious qb64 dot net website - don’t go there]/forum/index.php?topic=14111.msg122204#msg122204,i wrote it"
  421.     DATA "but in this version is unimplemented. In the end this program is comming monkey."
  422.     DATA "QB64 users info:"
  423.     DATA "SUB Rodent / mouse coordination with program. Is off if this info is view,"
  424.     DATA "SUB WindowsFileOpenSystem / two QB64 WIKI sources in one SUB, returning path to directory in 8.3 format,"
  425.     DATA "SUB The End - monkeys and memory cleaning sub if program get out,"
  426.     DATA "SUB timing - yes. It calculate time. If is runned as timing TIMER, calculate current time from TIMER,"
  427.     DATA "SUBS ViewVolume, ViewFrequency, ViewVolumeLevel... the same _PUTIMAGE subs. Many coordinates...."
  428.     DATA "SUB rest - reset sound playng if error is comming, because _SNDPLAY generate none errors, is possible if uncompatible file is "
  429.     DATA " loaded,"
  430.     DATA "SUB hraj - its heart. This sub plays music."
  431.     DATA "SUB nacti.b - this sub is my FIRST, this load files with mask filtering to memory (old version was not here used named nacti.A"
  432.     DATA "reads it direct from harddrive), this sub is writed 14 days before i have found windows library file system..."
  433.     DATA "SUB cj - for Czech text correct readable by SUB znak and the to correct displayed"
  434.     DATA "SUB RAP - call other SUBS, because this sub is as graphic central, it displayed song name in the program"
  435.     DATA "SUB znak - First write to unvisible screen song name. Then with POINT is this scaning and every point is with LINE drawing to"
  436.     DATA "other unvisible screen. View this is then used as song name in program.                                    Happy coding! Petr"
  437.     DATA " And now.... i need 2D game in the Commander Keen style to write..."
  438.  
  439.  
  440.  
  441. SUB WindowsFileOpenSystem
  442.     SHARED reload, zvuk&, Lb, akt, stopp, rndpl
  443.  
  444.     wfos:
  445.         FUNCTION FindWindow&& (BYVAL ClassName AS _OFFSET, WindowName$)
  446.     END DECLARE
  447.  
  448.     '_TITLE "Super Window"
  449.     hwnd&& = FindWindow(0, "QB64 Music Player.      By Petr - Petr.Pr@email.cz" + CHR$(0))
  450.  
  451.     TYPE BROWSEINFO 'typedef struct _browseinfo 'Microsoft MSDN http://msdn.microsoft.com/en-us/library/bb773205%28v=vs.85%29.aspx
  452.         hwndOwner AS _INTEGER64 '              '  HWND
  453.         pidlRoot AS _OFFSET '            '  PCIDLIST_ABSOLUTE
  454.         pszDisplayName AS _OFFSET '      '  LPTSTR
  455.         lpszTitle AS _OFFSET '           '  LPCTSTR
  456.         ulFlags AS _UNSIGNED LONG '  UINT
  457.         lpfn AS _OFFSET '                '  BFFCALLBACK
  458.         lParam AS _OFFSET '              '  LPARAM
  459.         iImage AS LONG '                 '  int
  460.     END TYPE 'BROWSEINFO, *PBROWSEINFO, *LPBROWSEINFO;
  461.  
  462.     DECLARE DYNAMIC LIBRARY "shell32"
  463.         FUNCTION SHBrowseForFolder%& (x AS BROWSEINFO) 'Microsoft MSDN http://msdn.microsoft.com/en-us/library/bb762115%28v=vs.85%29.aspx
  464.         SUB SHGetPathFromIDList (BYVAL lpItem AS _OFFSET, BYVAL szDir AS _OFFSET) 'Microsoft MSDN http://msdn.microsoft.com/en-us/library/bb762194%28VS.85%29.aspx
  465.     END DECLARE
  466.  
  467.     DIM b AS BROWSEINFO
  468.     b.hwndOwner = hwnd
  469.     DIM s AS STRING * 1024
  470.     b.pszDisplayName = _OFFSET(s$)
  471.     a$ = "" + CHR$(0)
  472.     b.lpszTitle = _OFFSET(a$)
  473.     DIM o AS _OFFSET
  474.     o = SHBrowseForFolder(b)
  475.     IF o THEN
  476.         ' PRINT LEFT$(s$, INSTR(s$, CHR$(0)) - 1)
  477.         DIM s2 AS STRING * 1024
  478.         SHGetPathFromIDList o, _OFFSET(s2$)
  479.         FolderLong$ = LEFT$(s2$, INSTR(s2$, CHR$(0)) - 1)
  480.  
  481.         'this function make 8.3 worlwide full compatible format to correct acces to folder with no - english chars!:
  482.         DECLARE LIBRARY 'Directory Information using KERNEL32
  483.             FUNCTION GetShortPathNameA (lpLongPath AS STRING, lpShortPath AS STRING, BYVAL cBufferLen AS LONG)
  484.         END DECLARE
  485.  
  486.         '=== SHOW SHORT PATH NAME
  487.         FileOrPath$ = FolderLong$ '<< change to a relevant path or file name on computer
  488.         ShortPathName$ = SPACE$(260)
  489.         Result = GetShortPathNameA(FileOrPath$ + CHR$(0), ShortPathName$, LEN(ShortPathName$))
  490.         Folder$ = ShortPathName$
  491.  
  492.         'end of 8.3 function
  493.  
  494.     ELSE
  495.         EXIT SUB
  496.     END IF
  497.  
  498.     '    IF Folder$ = "" THEN EXIT SUB
  499.     _SNDSTOP (zvuk&)
  500.     _DELAY 0.5
  501.     IF Folder$ = "" THEN GOTO wfos
  502.     IF _DIREXISTS(Folder$) = 0 THEN GOTO wfos
  503.     CHDIR Folder$
  504.     mousex = 0: mousey = 0: Lb = 0
  505.     '    IF stopp = 1 THEN stopp = 0
  506.  
  507.  
  508.  
  509.  
  510.  
  511. SUB TheEnd
  512.     SHARED zvuk&, i&, new&, obraz&, f&, GreenButtonPlay&, GreenButtonStop&, j&, d&, GreenButtonPower&, GreenButtonBack&, GreenButtonPause&, GreenButtonNext&, VolumePlus&, VolumeMinus&, ImageOpenFiles&, resicon&, infoicon&, LoopOne&, loopall&, afterinfo&
  513.     _SNDSTOP (zvuk&)
  514.     IF VAL(LEFT$(TIME$, 3)) > 12 THEN GOSUB opic1 ELSE GOSUB opic2
  515.     b& = _RGB32(255, 255, 255)
  516.     _DEST i&
  517.     CLS
  518.     PCOPY 1, _DISPLAY
  519.     FOR krok = 1024 TO -1024 STEP -1
  520.         hovno = hovno + .2: IF hovno >= 255 THEN hovno = 255
  521.         visible = 255 - hovno
  522.         _SETALPHA visible, b&, obraz&
  523.         _PUTIMAGE (krok, 15), obraz&, i&
  524.         _DISPLAY
  525.         PCOPY 1, _DISPLAY
  526.     NEXT
  527.     'blok _FREE
  528.     SCREEN 0
  529.     _DEST 0
  530.     _FREEFONT f&
  531.     _FREEIMAGE GreenButtonPlay&
  532.     _FREEIMAGE GreenButtonStop&
  533.     _FREEIMAGE new&
  534.     _FREEIMAGE j&
  535.     _FREEIMAGE d&
  536.     _FREEIMAGE GreenButtonPower&
  537.     _FREEIMAGE GreenButtonBack&
  538.     _FREEIMAGE GreenButtonPause&
  539.     _FREEIMAGE GreenButtonNext&
  540.     _FREEIMAGE VolumePlus&
  541.     _FREEIMAGE VolumeMinus&
  542.     _FREEIMAGE ImageOpenFiles&
  543.     _FREEIMAGE resicon&
  544.     _FREEIMAGE obraz&
  545.     _FREEIMAGE i&
  546.     _FREEIMAGE infoicon&
  547.     '    _FREEIMAGE LoopOneU&
  548.     '   _FREEIMAGE LoopAllU&
  549.     '  _FREEIMAGE LoopOneP&
  550.     ' _FREEIMAGE LoopAllP&
  551.     _FREEIMAGE afterinfo&
  552.     _SNDCLOSE zvuk&
  553.     SYSTEM
  554.     opic1:
  555.     obraz& = _NEWIMAGE(252, 241, 32)
  556.     _PUTIMAGE (0, 0), new&, obraz&, (6, 410)-(260, 650)
  557.     RETURN
  558.     opic2:
  559.     obraz& = _NEWIMAGE(228, 246, 32)
  560.     _PUTIMAGE (0, 0), new&, obraz&, (273, 405)-(500, 650)
  561.     RETURN
  562.  
  563. SUB timing (hodnota AS DOUBLE) '                calculate time. Writed for Timer, _SndLen. Input format as TIMER or _SNDLEN WITH "."
  564.     SHARED hodin, minut, sekund, sets
  565.     IF hodnota < 60 THEN hodin = 0: minut = 0: sekund = hodnota: GOTO a1
  566.     IF hodnota > 60 AND hodnota < 3600 THEN hodin = 0: minut = hodnota / 60: GOTO a2
  567.     hodin = hodnota / 3600
  568.     hodin$ = STR$(hodin)
  569.     tecka = INSTR(0, hodin$, ".")
  570.     minut = (VAL("0." + RIGHT$(hodin$, LEN(hodin$) - tecka)) * 0.6) * 100
  571.     a2:
  572.     minut$ = STR$(minut)
  573.     tecka = INSTR(0, STR$(minut), ".")
  574.     sekund = (VAL("0." + RIGHT$(minut$, LEN(minut$) - tecka)) * 0.6) * 100
  575.     a1:
  576.     sekund$ = STR$(sekund)
  577.     tecka = INSTR(0, sekund$, ".")
  578.     sets = (VAL("0." + RIGHT$(sekund$, LEN(sekund$) - tecka)) * 1) * 100
  579.  
  580.  
  581. SUB ViewSongTime (Viewtype AS INTEGER)
  582.     SHARED zvuk&, oldsec!, d&, i&, MouseX, MouseY, Lb, sec, sekunda, minuta, mi, se, se2, hodin, minut, sekund, sets
  583.  
  584.     IF Viewtype = 1 THEN timing (_SNDLEN(zvuk&) - _SNDGETPOS(zvuk&)) ELSE timing _SNDGETPOS(zvuk&)
  585.     minuta = INT(minut)
  586.     sekunda = INT(sekund)
  587.     IF sekunda = 60 THEN sekunda = 0
  588.     set = INT(sets)
  589.  
  590.     IF set < 10 THEN set0 = 0 ELSE set0 = VAL(LEFT$(MID$(STR$(set), 2), 1))
  591.     IF set < 10 THEN set1 = VAL(RIGHT$(STR$(set), 1))
  592.     IF set > 10 THEN set1 = VAL(RIGHT$(STR$(set), 1))
  593.  
  594.     stp = 470: sty = -175
  595.  
  596.     SELECT CASE set1
  597.  
  598.         CASE 0
  599.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (285, 0)-(320, 47)
  600.  
  601.         CASE 1
  602.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (1, 0)-(33, 47)
  603.  
  604.         CASE 2
  605.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (30, 0)-(57, 47)
  606.  
  607.         CASE 3
  608.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (64, 0)-(95, 47)
  609.  
  610.         CASE 4
  611.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (95, 0)-(120, 47)
  612.  
  613.         CASE 5
  614.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (130, 0)-(154, 47)
  615.  
  616.         CASE 6
  617.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (156, 0)-(185, 47)
  618.  
  619.         CASE 7
  620.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (190, 0)-(217, 47)
  621.  
  622.         CASE 8
  623.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (225, 0)-(250, 47)
  624.  
  625.         CASE 9
  626.             _PUTIMAGE (432 + stp, 230 + sty), d&, i&, (260, 0)-(286, 47)
  627.  
  628.     END SELECT
  629.  
  630.     stp = 440: sty = -175
  631.  
  632.     SELECT CASE set0
  633.  
  634.         CASE 0
  635.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (285, 0)-(320, 47)
  636.  
  637.         CASE 1
  638.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (1, 0)-(33, 47)
  639.  
  640.         CASE 2
  641.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (30, 0)-(57, 47)
  642.  
  643.         CASE 3
  644.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (64, 0)-(95, 47)
  645.  
  646.         CASE 4
  647.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (95, 0)-(120, 47)
  648.  
  649.         CASE 5
  650.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (130, 0)-(154, 47)
  651.  
  652.         CASE 6
  653.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (156, 0)-(185, 47)
  654.  
  655.         CASE 7
  656.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (190, 0)-(217, 47)
  657.  
  658.         CASE 8
  659.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (225, 0)-(250, 47)
  660.  
  661.         CASE 9
  662.             _PUTIMAGE (432 + stp, 230 + sty), d&, i&, (260, 0)-(286, 47)
  663.  
  664.     END SELECT
  665.  
  666.  
  667.     IF sekunda < 10 THEN sekunda0 = 0 ELSE sekunda0 = VAL(LEFT$(MID$(STR$(sekunda), 2), 1))
  668.     IF sekunda < 10 THEN sekunda1 = VAL(RIGHT$(STR$(sekunda), 1))
  669.     IF sekunda > 10 THEN sekunda1 = VAL(RIGHT$(STR$(sekunda), 1))
  670.  
  671.     stp = 370: sty = -175
  672.  
  673.     SELECT CASE sekunda0
  674.  
  675.         CASE 0
  676.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (285, 0)-(320, 47)
  677.  
  678.         CASE 1
  679.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (1, 0)-(33, 47)
  680.  
  681.         CASE 2
  682.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (30, 0)-(57, 47)
  683.  
  684.         CASE 3
  685.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (64, 0)-(95, 47)
  686.  
  687.         CASE 4
  688.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (95, 0)-(120, 47)
  689.  
  690.         CASE 5
  691.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (130, 0)-(154, 47)
  692.  
  693.         CASE 6
  694.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (156, 0)-(185, 47)
  695.  
  696.         CASE 7
  697.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (190, 0)-(217, 47)
  698.  
  699.         CASE 8
  700.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (225, 0)-(250, 47)
  701.  
  702.         CASE 9
  703.             _PUTIMAGE (432 + stp, 230 + sty), d&, i&, (260, 0)-(286, 47)
  704.  
  705.     END SELECT
  706.  
  707.     stp = 400: sty = -175
  708.  
  709.     SELECT CASE sekunda1
  710.  
  711.         CASE 0
  712.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (285, 0)-(320, 47)
  713.  
  714.         CASE 1
  715.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (1, 0)-(33, 47)
  716.  
  717.         CASE 2
  718.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (30, 0)-(57, 47)
  719.  
  720.         CASE 3
  721.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (64, 0)-(95, 47)
  722.  
  723.         CASE 4
  724.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (95, 0)-(120, 47)
  725.  
  726.         CASE 5
  727.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (130, 0)-(154, 47)
  728.  
  729.         CASE 6
  730.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (156, 0)-(185, 47)
  731.  
  732.         CASE 7
  733.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (190, 0)-(217, 47)
  734.  
  735.         CASE 8
  736.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (225, 0)-(250, 47)
  737.  
  738.         CASE 9
  739.             _PUTIMAGE (432 + stp, 230 + sty), d&, i&, (260, 0)-(286, 47)
  740.  
  741.     END SELECT
  742.  
  743.     '    minuta = 20
  744.  
  745.     IF minuta < 10 THEN minuta0 = 0 ELSE minuta0 = VAL(LEFT$(MID$(STR$(minuta), 2), 1))
  746.     IF minuta < 10 THEN minuta1 = minuta 'VAL(RIGHT$(STR$(minuta), 1))
  747.     IF minuta >= 10 THEN minuta1 = VAL(RIGHT$(STR$(minuta), 1))
  748.     '    IF sec < 60 AND minuta < 1 THEN minuta = 0
  749.  
  750.     stp = 300: sty = -175
  751.  
  752.     SELECT CASE minuta0
  753.  
  754.         CASE 0 TO 0.99
  755.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (285, 0)-(320, 47)
  756.  
  757.         CASE 1 TO 1.99
  758.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (1, 0)-(33, 47)
  759.  
  760.         CASE 2 TO 2.99
  761.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (30, 0)-(57, 47)
  762.  
  763.         CASE 3 TO 3.99
  764.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (64, 0)-(95, 47)
  765.  
  766.         CASE 4 TO 4.99
  767.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (95, 0)-(120, 47)
  768.  
  769.         CASE 5 TO 5.99
  770.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (130, 0)-(154, 47)
  771.  
  772.         CASE 6 TO 6.99
  773.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (156, 0)-(185, 47)
  774.  
  775.         CASE 7 TO 7.99
  776.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (190, 0)-(217, 47)
  777.  
  778.         CASE 8 TO 8.99
  779.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (225, 0)-(250, 47)
  780.  
  781.         CASE 9 TO 9.99
  782.             _PUTIMAGE (432 + stp, 230 + sty), d&, i&, (260, 0)-(286, 47)
  783.  
  784.     END SELECT
  785.  
  786.     stp = 330: sty = -175
  787.  
  788.     SELECT CASE minuta1
  789.  
  790.         CASE 0 TO 0.99
  791.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (285, 0)-(320, 47)
  792.  
  793.         CASE 1 TO 1.99
  794.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (1, 0)-(33, 47)
  795.  
  796.         CASE 2 TO 2.99
  797.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (30, 0)-(57, 47)
  798.  
  799.         CASE 3 TO 3.99
  800.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (64, 0)-(95, 47)
  801.  
  802.         CASE 4 TO 4.99
  803.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (95, 0)-(120, 47)
  804.  
  805.         CASE 5 TO 5.99
  806.             _PUTIMAGE (430 + stp, 230 + sty), d&, i&, (130, 0)-(154, 47)
  807.  
  808.         CASE 6 TO 6.99
  809.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (156, 0)-(185, 47)
  810.  
  811.         CASE 7 TO 7.99
  812.             _PUTIMAGE (424 + stp, 230 + sty), d&, i&, (190, 0)-(217, 47)
  813.  
  814.         CASE 8 TO 8.99
  815.             _PUTIMAGE (426 + stp, 230 + sty), d&, i&, (225, 0)-(250, 47)
  816.  
  817.         CASE 9 TO 9.99
  818.             _PUTIMAGE (432 + stp, 230 + sty), d&, i&, (260, 0)-(286, 47)
  819.  
  820.     END SELECT
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842. SUB ViewFrequency
  843.     SHARED d&, i&
  844.     s = _SNDRATE
  845.     '    s = 25864
  846.     'use 5 chracters to view frequency
  847.     Ach = VAL(LEFT$(STR$(s), 2))
  848.     Bch = VAL(LEFT$(MID$(STR$(s), 3), 1))
  849.     Cch = VAL(LEFT$(MID$(STR$(s), 4), 1))
  850.     Dch = VAL(LEFT$(MID$(STR$(s), 5), 1))
  851.     Ech = VAL(LEFT$(MID$(STR$(s), 6), 1))
  852.  
  853.     '    COLOR _RGB32(255, 255, 255): PRINT Ach, Bch, Cch, Dch, Ech   'ALL pass
  854.     stp = 165
  855.  
  856.     SELECT CASE Ach
  857.  
  858.  
  859.         CASE 0
  860.             _PUTIMAGE (426 + stp, 230), d&, i&, (285, 0)-(320, 47)
  861.  
  862.         CASE 1
  863.             _PUTIMAGE (430 + stp, 230), d&, i&, (1, 0)-(33, 47)
  864.  
  865.         CASE 2
  866.             _PUTIMAGE (430 + stp, 230), d&, i&, (30, 0)-(57, 47)
  867.  
  868.         CASE 3
  869.             _PUTIMAGE (430 + stp, 230), d&, i&, (64, 0)-(95, 47)
  870.  
  871.         CASE 4
  872.             _PUTIMAGE (430 + stp, 230), d&, i&, (95, 0)-(120, 47)
  873.  
  874.         CASE 5
  875.             _PUTIMAGE (430 + stp, 230), d&, i&, (130, 0)-(154, 47)
  876.  
  877.         CASE 6
  878.             _PUTIMAGE (424 + stp, 230), d&, i&, (156, 0)-(185, 47)
  879.  
  880.         CASE 7
  881.             _PUTIMAGE (424 + stp, 230), d&, i&, (190, 0)-(217, 47)
  882.  
  883.         CASE 8
  884.             _PUTIMAGE (426 + stp, 230), d&, i&, (225, 0)-(250, 47)
  885.  
  886.         CASE 9
  887.             _PUTIMAGE (427 + stp, 230), d&, i&, (260, 0)-(286, 47)
  888.  
  889.     END SELECT
  890.  
  891.     stp = 190
  892.  
  893.     SELECT CASE Bch
  894.  
  895.         CASE 0
  896.             _PUTIMAGE (426 + stp, 230), d&, i&, (285, 0)-(320, 47)
  897.  
  898.         CASE 1
  899.             _PUTIMAGE (430 + stp, 230), d&, i&, (1, 0)-(33, 47)
  900.  
  901.         CASE 2
  902.             _PUTIMAGE (430 + stp, 230), d&, i&, (30, 0)-(57, 47)
  903.  
  904.         CASE 3
  905.             _PUTIMAGE (430 + stp, 230), d&, i&, (64, 0)-(95, 47)
  906.  
  907.         CASE 4
  908.             _PUTIMAGE (430 + stp, 230), d&, i&, (95, 0)-(120, 47)
  909.  
  910.         CASE 5
  911.             _PUTIMAGE (430 + stp, 230), d&, i&, (130, 0)-(154, 47)
  912.  
  913.         CASE 6
  914.             _PUTIMAGE (424 + stp, 230), d&, i&, (156, 0)-(185, 47)
  915.  
  916.         CASE 7
  917.             _PUTIMAGE (424 + stp, 230), d&, i&, (190, 0)-(217, 47)
  918.  
  919.         CASE 8
  920.             _PUTIMAGE (426 + stp, 230), d&, i&, (225, 0)-(250, 47)
  921.  
  922.         CASE 9
  923.             _PUTIMAGE (427 + stp, 230), d&, i&, (260, 0)-(286, 47)
  924.  
  925.  
  926.  
  927.     END SELECT
  928.  
  929.     stp = 215
  930.  
  931.     SELECT CASE Cch
  932.  
  933.         CASE 0
  934.             _PUTIMAGE (426 + stp, 230), d&, i&, (285, 0)-(320, 47)
  935.  
  936.         CASE 1
  937.             _PUTIMAGE (430 + stp, 230), d&, i&, (1, 0)-(33, 47)
  938.  
  939.         CASE 2
  940.             _PUTIMAGE (430 + stp, 230), d&, i&, (30, 0)-(57, 47)
  941.  
  942.         CASE 3
  943.             _PUTIMAGE (430 + stp, 230), d&, i&, (64, 0)-(95, 47)
  944.  
  945.         CASE 4
  946.             _PUTIMAGE (430 + stp, 230), d&, i&, (95, 0)-(120, 47)
  947.  
  948.         CASE 5
  949.             _PUTIMAGE (430 + stp, 230), d&, i&, (130, 0)-(154, 47)
  950.  
  951.         CASE 6
  952.             _PUTIMAGE (424 + stp, 230), d&, i&, (156, 0)-(185, 47)
  953.  
  954.         CASE 7
  955.             _PUTIMAGE (424 + stp, 230), d&, i&, (190, 0)-(217, 47)
  956.  
  957.         CASE 8
  958.             _PUTIMAGE (426 + stp, 230), d&, i&, (225, 0)-(250, 47)
  959.  
  960.         CASE 9
  961.             _PUTIMAGE (427 + stp, 230), d&, i&, (260, 0)-(286, 47)
  962.  
  963.     END SELECT
  964.  
  965.     stp = 240
  966.  
  967.     SELECT CASE Dch
  968.  
  969.         CASE 0
  970.             _PUTIMAGE (426 + stp, 230), d&, i&, (285, 0)-(320, 47)
  971.  
  972.         CASE 1
  973.             _PUTIMAGE (430 + stp, 230), d&, i&, (1, 0)-(33, 47)
  974.  
  975.         CASE 2
  976.             _PUTIMAGE (430 + stp, 230), d&, i&, (30, 0)-(57, 47)
  977.  
  978.         CASE 3
  979.             _PUTIMAGE (430 + stp, 230), d&, i&, (64, 0)-(95, 47)
  980.  
  981.         CASE 4
  982.             _PUTIMAGE (430 + stp, 230), d&, i&, (95, 0)-(120, 47)
  983.  
  984.         CASE 5
  985.             _PUTIMAGE (430 + stp, 230), d&, i&, (130, 0)-(154, 47)
  986.  
  987.         CASE 6
  988.             _PUTIMAGE (424 + stp, 230), d&, i&, (156, 0)-(185, 47)
  989.  
  990.         CASE 7
  991.             _PUTIMAGE (424 + stp, 230), d&, i&, (190, 0)-(217, 47)
  992.  
  993.         CASE 8
  994.             _PUTIMAGE (426 + stp, 230), d&, i&, (225, 0)-(250, 47)
  995.  
  996.         CASE 9
  997.             _PUTIMAGE (427 + stp, 230), d&, i&, (260, 0)-(286, 47)
  998.  
  999.     END SELECT
  1000.  
  1001.     stp = 265
  1002.  
  1003.     SELECT CASE Ech
  1004.  
  1005.         CASE 0
  1006.             _PUTIMAGE (426 + stp, 230), d&, i&, (285, 0)-(320, 47)
  1007.  
  1008.         CASE 1
  1009.             _PUTIMAGE (430 + stp, 230), d&, i&, (1, 0)-(33, 47)
  1010.  
  1011.         CASE 2
  1012.             _PUTIMAGE (430 + stp, 230), d&, i&, (30, 0)-(57, 47)
  1013.  
  1014.         CASE 3
  1015.             _PUTIMAGE (430 + stp, 230), d&, i&, (64, 0)-(95, 47)
  1016.  
  1017.         CASE 4
  1018.             _PUTIMAGE (430 + stp, 230), d&, i&, (95, 0)-(120, 47)
  1019.  
  1020.         CASE 5
  1021.             _PUTIMAGE (430 + stp, 230), d&, i&, (130, 0)-(154, 47)
  1022.  
  1023.         CASE 6
  1024.             _PUTIMAGE (424 + stp, 230), d&, i&, (156, 0)-(185, 47)
  1025.  
  1026.         CASE 7
  1027.             _PUTIMAGE (424 + stp, 230), d&, i&, (190, 0)-(217, 47)
  1028.  
  1029.         CASE 8
  1030.             _PUTIMAGE (426 + stp, 230), d&, i&, (225, 0)-(250, 47)
  1031.  
  1032.         CASE 9
  1033.             _PUTIMAGE (427 + stp, 230), d&, i&, (260, 0)-(286, 47)
  1034.  
  1035.     END SELECT
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045. SUB ViewBalanceLevel (channel AS DOUBLE)
  1046.     SHARED d&, i&, ch#
  1047.     '                                    Left Speaker --------#--------  Right Speaker       - usable with mouse to left or right speaker or keyboard "<" and  ","  or ">" and "." Full funcionality only
  1048.     '                                                -100 to  0  to 100                        with WAV files.
  1049.     REM    lvl& = _NEWIMAGE(150, 150, 32)
  1050.     _PUTIMAGE (400, 150), d&, i&, (321, 0)-(392, 65)
  1051.     _PUTIMAGE (590, 150), d&, i&, (321, 0)-(392, 65)
  1052.  
  1053.     LINE (480, 185)-(580, 185), _RGB32(0, 0, 0)
  1054.     LINE (525 - (channel# * 50), 175)-(535 - (channel# * 50), 195), _RGB32(20, 40, 20), BF
  1055.     '    COLOR _RGB32(255, 255, 255): PRINT  'ok, funguje s double
  1056.     REM  _FREEIMAGE lvl&
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067. SUB ViewVolumeLevel
  1068.     SHARED Vol, d&, i&
  1069.     bila& = _RGB32(255, 255, 255)
  1070.     bila2& = _RGB32(215, 215, 215)
  1071.     _SETALPHA 0, bila& TO bila2&, d&
  1072.  
  1073.     Volume = CINT(Vol * 100)
  1074.     '    Volume = 256
  1075.     IF LEN(STR$(Volume)) = 4 THEN fv = 1 ELSE fv = 0
  1076.     IF LEN(Volume) >= 2 THEN sv = VAL(LEFT$(RIGHT$(STR$(Volume), LEN(Volume) - 2), LEN(Volume) - 3)) ELSE sv = 0 'stale druha pozice i pri vol = 56
  1077.     Tv = VAL(RIGHT$(STR$(Volume), 1))
  1078.     '   firstV$ = "1"
  1079.     '  _DEST i&
  1080.     ' COLOR bila&
  1081.     '    CLS
  1082.     '   PRINT sv, 'STR$(Volume)
  1083.     '    SLEEP
  1084.     'fv = 0
  1085.  
  1086.     SELECT CASE fv 'first character Volume. Its 0 or 1 --------------------------  vloz to do noveho pole& a tam trochu zpruhledni ty bily segmenty a teprve pak to vloz do i&
  1087.  
  1088.         CASE 0
  1089.             'load null to view
  1090.             _PUTIMAGE (392, 230), d&, i&, (285, 0)-(320, 45)
  1091.  
  1092.         CASE 1
  1093.             'load one to view
  1094.             _PUTIMAGE (400, 230), d&, i&, (1, 0)-(23, 47)
  1095.  
  1096.  
  1097.     END SELECT
  1098.     'COLOR _RGB32(255, 255, 255): PRINT Tv ', LEN(STR$(Volume)) ' overeno, ze sv ukazuje spravne cislo, overeno a spraveno FV!, overena spravna hodnota Tv  - here i tested it
  1099.     'multipl = (23 * sv) + 10
  1100.     SELECT CASE sv 'second volume character. 0 - 9
  1101.         CASE 0
  1102.             _PUTIMAGE (426, 230), d&, i&, (285, 0)-(320, 47)
  1103.  
  1104.         CASE 1
  1105.             _PUTIMAGE (430, 230), d&, i&, (1, 0)-(33, 47)
  1106.  
  1107.         CASE 2
  1108.             _PUTIMAGE (430, 230), d&, i&, (30, 0)-(57, 47)
  1109.  
  1110.         CASE 3
  1111.             _PUTIMAGE (430, 230), d&, i&, (64, 0)-(95, 47)
  1112.  
  1113.         CASE 4
  1114.             _PUTIMAGE (430, 230), d&, i&, (95, 0)-(120, 47)
  1115.  
  1116.         CASE 5
  1117.             _PUTIMAGE (430, 230), d&, i&, (130, 0)-(154, 47)
  1118.  
  1119.         CASE 6
  1120.             _PUTIMAGE (424, 230), d&, i&, (156, 0)-(185, 47)
  1121.  
  1122.         CASE 7
  1123.             _PUTIMAGE (424, 230), d&, i&, (190, 0)-(217, 47)
  1124.  
  1125.         CASE 8
  1126.             _PUTIMAGE (426, 230), d&, i&, (225, 0)-(250, 47)
  1127.  
  1128.         CASE 9
  1129.             _PUTIMAGE (422, 230), d&, i&, (252, 0)-(286, 47)
  1130.  
  1131.     END SELECT
  1132.  
  1133.     stp = 30
  1134.  
  1135.     SELECT CASE Tv 'third volume character. 0 - 9
  1136.  
  1137.         CASE 0
  1138.             _PUTIMAGE (426 + stp, 230), d&, i&, (285, 0)-(320, 47)
  1139.  
  1140.         CASE 1
  1141.             _PUTIMAGE (430 + stp, 230), d&, i&, (1, 0)-(33, 47)
  1142.  
  1143.         CASE 2
  1144.             _PUTIMAGE (430 + stp, 230), d&, i&, (30, 0)-(57, 47)
  1145.  
  1146.         CASE 3
  1147.             _PUTIMAGE (430 + stp, 230), d&, i&, (64, 0)-(95, 47)
  1148.  
  1149.         CASE 4
  1150.             _PUTIMAGE (430 + stp, 230), d&, i&, (95, 0)-(120, 47)
  1151.  
  1152.         CASE 5
  1153.             _PUTIMAGE (430 + stp, 230), d&, i&, (130, 0)-(154, 47)
  1154.  
  1155.         CASE 6
  1156.             _PUTIMAGE (424 + stp, 230), d&, i&, (156, 0)-(185, 47)
  1157.  
  1158.         CASE 7
  1159.             _PUTIMAGE (424 + stp, 230), d&, i&, (190, 0)-(217, 47)
  1160.  
  1161.         CASE 8
  1162.             _PUTIMAGE (426 + stp, 230), d&, i&, (225, 0)-(250, 47)
  1163.  
  1164.         CASE 9
  1165.             _PUTIMAGE (427 + stp, 230), d&, i&, (260, 0)-(286, 47)
  1166.  
  1167.     END SELECT
  1168.  
  1169. SUB rest
  1170.     SHARED akt, pokus
  1171.     ' BEEP
  1172.     '  WindowsFileOpenSystem
  1173.     IF PlEr = 1 THEN PlEr = 0: BEEP: WindowsFileOpenSystem
  1174.     pokus = pokus + 1
  1175.     akt = 0 + pokus - 1
  1176.     nacti.b
  1177.     reload = 1
  1178.     RAP "StartDemo"
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185. SUB hraj (plaj AS STRING)
  1186.     IF plaj$ = "" THEN EXIT SUB
  1187.     IF PlEr = 1 THEN EXIT SUB
  1188.     SHARED zvuk&, hraju, ch#, Vol, reload, PlEr
  1189.     IF _SNDPLAYING(zvuk&) = -1 THEN PRINT "Sorry, now playing": EXIT SUB ELSE _SNDCLOSE (zvuk&) '    This is music program hearth.
  1190.     zvuk& = _SNDOPEN(plaj$, "VOL, PAUSE, SETPOS, SYNC, LEN"): ' oldzvuk& = _SNDCOPY(zvuk&)
  1191.     IF zvuk& > 0 THEN PRINT "" ELSE PRINT "File not ready - "; file$; "or uncompatible!": rest
  1192.     hraju = 1
  1193.     '    _SNDBAL zvuk&, ch# * 1000 'i have here not enought place for 5.1 / 7.1 speakers. :-D
  1194.     _SNDVOL zvuk&, Vol '  _SNDBAL funcionality is correct only with garanteed file types.
  1195.     _SNDPLAY zvuk&
  1196.     IF _SNDPLAYING(zvuk&) = 0 THEN _SNDPLAY (zvuk&)
  1197.  
  1198. SUB nacti.b
  1199.     SHARED seznam2$, NewRecNr, linka, max, reload: RESTORE FileMask
  1200.     seznam2$ = "": NewRecNr = 0: linka = 0: max = 0: reload = 0
  1201.     'nacte a vyfiltruje soubory do poli Rfiles a Vfiles (Read and open files a Viewed as files)
  1202.  
  1203.     comm$ = "dir *.* /x > filelist.qb64" '                                            vylistuje vsechny soubory ve slozce  8.3 a LONG / DIR make file filelist.qb64 with old type and new type file names
  1204.     SHELL _HIDE comm$
  1205.     IF _FILEEXISTS("filelist.qb64") = 0 THEN _DEST 0: PRINT "Error on line 1264: File list not created!": EXIT SUB 'chybu odchyti funkce plaj vypisem varovani
  1206.     OPEN "filelist.qb64" FOR INPUT AS #1
  1207.     zacatek:
  1208.     IF EOF(1) THEN GOTO konec
  1209.     LINE INPUT #1, nothing$ '                                                        This read rows from DIR outputfile and load its to memory. Its better for harddrive, for SSD extra!
  1210.     linies = linies + 1
  1211.     'PRINT linies
  1212.     seznam2$(linies) = nothing$
  1213.     GOTO zacatek
  1214.     konec:
  1215.     CLOSE #1
  1216.     KILL "filelist.qb64"
  1217.     'PRINT "Transformuji Seznam na pole U a V (usable a visible)"
  1218.     '    IF linies = 0 THEN _DEST 0: PRINT "No files for play.(line 1276)": BEEP: EXIT SUB
  1219.     FOR test = 0 TO linies '                                                       This For...Next read array seznam and make two new arrays: Vfiles and Ufiles. Ussable for us is record from row 7 to row
  1220.         '    PRINT seznam$(test); " = record nr. "; test '                              linies - 3
  1221.         text = text + 1
  1222.         ' IF text > 6 AND text < linies - 3 THEN             vyrazeno verzi 0.21C - necetl vsechny mozne soubory.
  1223.  
  1224.         VFiles$(test) = RIGHT$(seznam2$(test), LEN(seznam2$(test)) - 49)
  1225.         UFiles$(test) = RIGHT$(LEFT$(seznam2$(test), 49), 13)
  1226.         IF VFiles$(test) <> "" AND LTRIM$(UFiles$(test)) = "" THEN UFiles$(test) = VFiles$(test) 'LTRIM$ remove spaces. This IF muss to be used, because if filename is <8 characters or is used compatible
  1227.         '  COLOR , 2: PRINT "UFILE RECORD"; UFiles$(test) 'VTK OK!                                   filename with American ASCII, then filename is writed only as Vfile (visible and unvisible name is the same)
  1228.         '  COLOR , 6: PRINT "VFILE RECORD"; VFiles$(test) ' VTK OK!
  1229.         'END IF
  1230.     NEXT
  1231.  
  1232.  
  1233.     FOR mask = 1 TO 11 '                                                                     Have 11 filetypes in DATA - am end this sub
  1234.         READ FileMask$ '                                                                     in arrays we have all files in the directory. I need only types in DATA command. This filemask is filter.
  1235.         FOR FileFilter = 0 TO linies
  1236.             a$ = RIGHT$(LTRIM$(UCASE$(LEFT$(UFiles$(FileFilter), (INSTR(0, UFiles$(FileFilter), ".") + 3)))), 3)
  1237.             IF a$ = FileMask$ THEN MaskUFiles$(FileFilter) = RTRIM$(UFiles$(FileFilter)): MaskVFiles$(FileFilter) = RTRIM$(VFiles$(FileFilter))
  1238.             ' PRINT FileMask$, RIGHT$(LTRIM$(UCASE$(LEFT$(UFiles$(FileFilter), (INSTR(0, UFiles$(FileFilter), ".") + 3)))), 3), mask, FileFilter,
  1239.             ' PRINT a$, FileMask$: SLEEP
  1240.             'sleep
  1241.         NEXT FileFilter
  1242.     NEXT mask
  1243.  
  1244.     COLOR 7, 0
  1245.     'REDIM MaskUFiles
  1246.     'REDIM MaskVFiles
  1247.     IF linies = 0 THEN reload = 0: EXIT SUB
  1248.  
  1249.     FOR vypis = 0 TO linies 'here is already created filelist using filemask in DATA. But in array are empty records, this muss be removed.
  1250.  
  1251.         IF MaskUFiles$(vypis) = STRING$(255, "") THEN GOTO nowrite ELSE NewRecNr = NewRecNr + 1: FinalUFiles$(NewRecNr) = LTRIM$(MaskUFiles$(vypis))
  1252.         IF MaskVFiles$(vypis) = STRING$(255, "") THEN GOTO nowrite ELSE NewRecNr2 = NewRecNr2 + 1: FinalVFiles$(NewRecNr2) = LTRIM$(MaskVFiles$(vypis))
  1253.  
  1254.         nowrite:
  1255.     NEXT vypis
  1256.     IF NewRecNr <= 0 THEN reload = 0: EXIT SUB
  1257.     'IF RTRIM$(FinalUFiles$(1)) = "" THEN reload = 0: BEEP: EXIT SUB
  1258.     '   PRINT NewRecNr: SLEEP               chyba.
  1259.     'BEEP
  1260.     'COLOR _RGB32(255, 255, 255)
  1261.     'FOR ControlLoop = 0 TO NewRecNr
  1262.  
  1263.     'PRINT FinalUFiles$(ControlLoop); ControlLoop; NewRecNr
  1264.     'PRINT FinalVFiles$(ControlLoop); ControlLoop; NewRecNr2
  1265.     'PRINT "MaskUFiles record NR:"; vypis; MaskUFiles$(vypis); "LEN:"; LEN(MaskUFiles$(vypis))
  1266.     'PRINT "MaskVFiles record NR:"; vypis; MaskVfiles$(vypis); "LEN:"; LEN(MaskVfiles$(vypis))
  1267.     'SLEEP
  1268.     'NEXT ControlLoop
  1269.  
  1270.     'here are sub outputs:
  1271.     'NewRecNr - number new records - files accepts filemask
  1272.     'FinalUFiles$(record_number) - list files accepts filemasks, usable to file access
  1273.     'FinalVFiles$(record_number) - list files accepts filemasks, unusable to file acces if filename contains non US characters, but usable to correct view filenames with non US characters with _MAPUNICODE
  1274.     'If filename contains US compatible characters, are both records the same.
  1275.  
  1276.     'ERASE seznam2$, UFiles$, VFiles$, MaskUFiles$, MaskVFiles$
  1277.     'RESTORE FileMask
  1278.  
  1279.  
  1280.  
  1281.     FileMask:
  1282.     DATA WAV,OGG,AIFF,RIFF,VOC,MP3,MIDI,MOD,AIF,RIF,MID
  1283.     linka = NewRecNr: max = NewRecNr
  1284.  
  1285.  
  1286.  
  1287. SUB cj '                                                                                      Sub make Czech characters readable correctly on the screen. If you needed use this
  1288.     '                                                                                         for other language, is possible, you needed others DATA block. Data blocks are
  1289.     RESTORE Microsoft_pc_cpMIK '                                                              for more languages in QB64 help (Shift + F1 / Alphabetical index / _MAPUNICODE statement /
  1290.     '                                                                                         Code Pages)
  1291.     FOR ASCIIcode = 128 TO 255 '                                                              But if your problem is in acces to files with no english names, see to sub nacti.b used in
  1292.         '                                                                                     this program. This is first, based on DIR /X, uses 8.3 filenames, is full compatible for ALL
  1293.         READ unicode '                                                                        languages. It have 2 outputs. One as long filenames uses national characters, two in 8.3 to
  1294.         '                                                                                     file access. 8.3 is full compatible with all languages.
  1295.         _MAPUNICODE unicode TO ASCIIcode '                                                    And i. I need adress in memory to read sound wave. For drawing sound waves to screen :-D
  1296.  
  1297.     NEXT
  1298.  
  1299.  
  1300.  
  1301.     EXIT SUB
  1302.  
  1303.  
  1304.     Microsoft_pc_cpMIK:
  1305.  
  1306.     DATA 199,252,233,226,228,367,263,231,322,235,336,337,238,377,196,262
  1307.     DATA 201,313,314,244,246,317,318,346,347,214,220,356,357,321,215,269
  1308.     DATA 225,237,243,250,260,261,381,382,280,281,172,378,268,351,171,187
  1309.     DATA 9617,9618,9619,9474,9508,193,194,282,350,9571,9553,9559,9565,379,380,9488
  1310.     DATA 9492,9524,9516,9500,9472,9532,258,259,9562,9556,9577,9574,9568,9552,9580,164
  1311.     DATA 273,272,270,203,271,327,205,206,283,9496,9484,9608,9604,354,366,9600
  1312.     DATA 211,223,212,323,324,328,352,353,340,218,341,368,253,221,355,180
  1313.     DATA 173,733,731,711,728,167,247,184,176,168,729,369,344,345,9632,160
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319. SUB RAP (text AS STRING)
  1320.     IF text$ = "shutdown.internal.cmd" THEN GOTO sht
  1321.     SHARED t&, i&, InsertX, ch#, f&, zvuk&, GreenButtonPlay&, GreenButtonStop&, GreenButtonPower&, viewto, GreenButtonBack&, viewto2, GreenButtonNext&, GreenButtonPause&, MouseX, MouseY, vs
  1322.     SHARED resicon&, res, i&, polar, bmx, stopp, LoopAll, RandPlayOn&, RandPlayOff&, rndpl
  1323.     IF text$ = "StartDemo" THEN text$ = "Waiting": GOTO startdemo
  1324.     IF LEN(text$) > 75 THEN text$ = LEFT$(text$, 75)
  1325.     IF _SNDPLAYING(zvuk&) = 0 AND _SNDPAUSED(zvuk&) = 0 THEN znak "...STOP...": GOTO sk
  1326.     IF _SNDPAUSED(zvuk&) = -1 THEN znak RTRIM$("+   -Paused-    +"): GOTO sk
  1327.  
  1328.     startdemo:
  1329.     znak text$
  1330.     sk:
  1331.     _DEST i&
  1332.     black& = _RGB32(0, 0, 0)
  1333.  
  1334.     _SETALPHA 0, black&, t&
  1335.     IF InsertX > 7 * (LEN(RTRIM$(text$)) * _FONTWIDTH(f&)) THEN InsertX = -920 'display have 7 characters
  1336.     sht:
  1337.     IF text$ <> "StartDemo" THEN PCOPY 1, _DISPLAY
  1338.     ViewVolumeLevel
  1339.     ViewBalanceLevel ch#
  1340.     ViewFrequency
  1341.     PressLoop 1: PressLoop 2
  1342.     IF vs = 0 THEN ViewSongTime 0 ELSE ViewSongTime 1: GOSUB viewicon
  1343.     IF rndpl = 0 THEN _PUTIMAGE (930, 91), RandPlayOff&, i&: RndPlay 0 ELSE _PUTIMAGE (930, 91), RandPlayOn&, i&: RndPlay 1
  1344.  
  1345.  
  1346.     REM LOCATE 16, 1: COLOR _RGB(255, 255, 255): PRINT MouseX, MouseY, LoopAll
  1347.     LINE (435, 33)-(710, 128), _RGB32(0, 0, 0), B 'cernej obdelnik kolem TITLE
  1348.  
  1349.     IF text$ = "shutdown.internal.cmd" THEN _SNDSTOP (zvuk&): _PUTIMAGE (237, 41), GreenButtonPower&, i&: _DISPLAY: SLEEP 1: TheEnd
  1350.     IF _SNDPLAYING(zvuk&) = -1 THEN _PUTIMAGE (-1, 42), GreenButtonPlay&, i&
  1351.     IF _SNDPLAYING(zvuk&) = 0 AND _SNDPAUSED(zvuk&) = 0 AND text$ <> "shutdown.internal.cmd" THEN _PUTIMAGE (117, 41), GreenButtonStop&, i&
  1352.     IF text$ = "getback.internal.cmd" THEN viewto = TIMER + 4: text$ = "" ' this make green visible to 4 sec
  1353.     IF viewto > TIMER THEN _PUTIMAGE (7, 151), GreenButtonBack&, i&
  1354.     IF text$ = "getnext.internal.cmd" THEN viewto2 = TIMER + 4: text$ = ""
  1355.     IF viewto2 > TIMER THEN _PUTIMAGE (227, 151), GreenButtonNext&, i&
  1356.     IF _SNDPAUSED(zvuk&) = -1 THEN _PUTIMAGE (117, 151), GreenButtonPause&, i&
  1357.  
  1358.     _PUTIMAGE (450, 30)-(700, 144), t&, i&, (InsertX, -8)-(InsertX + 500, 150)
  1359.     InsertX = InsertX + 10
  1360.     'COLOR _RGB32(255, 255, 255): LOCATE 1, 1: PRINT _SNDLEN(zvuk&)
  1361.    
  1362.     EXIT SUB
  1363.  
  1364.     viewicon:
  1365.     res = res + polar / 2
  1366.     IF res >= 250 OR res <= 0 THEN polar = -polar
  1367.     IF res < 0 THEN res = 0: polar = -polar
  1368.     IF res > 255 THEN res = 255: polar = -polar
  1369.  
  1370.     _SETALPHA res, , resicon&
  1371.     _PUTIMAGE (865, 27), resicon&, i&
  1372.     'COLOR _RGB(255, 255, 255): PRINT res
  1373.  
  1374.     RETURN
  1375.  
  1376.  
  1377. SUB znak (txt AS STRING)
  1378.     'udela kompletni obraz do t&, txt$ prichazi spravne
  1379.     SHARED t&, f&, linka, akt, printed$
  1380.     text& = _NEWIMAGE(1980, 100, 32)
  1381.     _DEST t&: CLS
  1382.     _DEST text&
  1383.     cj
  1384.     _FONT f&
  1385.  
  1386.     printed$ = "(" + LTRIM$(STR$(akt)) + "/" + LTRIM$(STR$(linka)) + ")"
  1387.     '    IF linka > akt THEN linka = 1
  1388.     toend = 140 - LEN(printed$)
  1389.     PRINT printed$; txt$ ' + STRING$(toend, CHR$(32))
  1390.     '    SCREEN text&: SLEEP
  1391.     black& = _RGB32(0, 0, 0)
  1392.     cil = LEN(txt$) * 29
  1393.     _SOURCE text&
  1394.     FOR rozlozX = 0 TO cil
  1395.         FOR rozlozY = 1 TO 29
  1396.             scan& = POINT(rozlozX, rozlozY)
  1397.             IF scan& <> black& THEN _DEST t&: LINE ((tx + (rozlozX * 4)) - 2, (ty + (rozlozY * 4)) - 2)-((tx + (rozlozX * 4)) + 2, (ty + (rozlozY * 4)) + 2), _RGB32(33, 33, 38), B
  1398.             _DEST text&
  1399.         NEXT
  1400.     NEXT
  1401.     '    SCREEN t&: SLEEP
  1402.     _DEST i& 'pocat
  1403.     _FREEIMAGE text&
  1404.  
  1405.  

 
again live.jpg
« Last Edit: August 23, 2019, 10:43:36 am by Petr »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Problem With Wiki Example
« Reply #26 on: August 23, 2019, 10:15:22 am »
I tried to apply the same procedure to the source code of Ken but there I just managed to correct the compilation error so that the program compiles, but unfortunately does not invoke the windows dialog Open or Save, but it behaves as if I did not select anything and dialog directly closed. So the program scolds me (I need it :)) and that's it. I j rewritte the hwndOwner type to _INTEGER64 in FIELDDIALOGTYPE.  Then have function FindWindowA rewrited to _INTEGER64 type. I vaguely remember, Steve, that you were showing something with _WindowHandle somewhere (if it was you?) And that you no longer need to call FindWindowA. Somewhere in that window identification that calls Windows dialogs and it is likely to be a problem.
« Last Edit: August 23, 2019, 11:02:57 am by Petr »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Problem With Wiki Example
« Reply #27 on: August 23, 2019, 11:14:03 am »
I tried to apply the same procedure to the source code of Ken but there I just managed to correct the compilation error so that the program compiles, but unfortunately does not invoke the windows dialog Open or Save, but it behaves as if I did not select anything and dialog directly closed. So the program scolds me (I need it :)) and that's it. I j rewritte the hwndOwner type to _INTEGER64 in FIELDDIALOGTYPE.  Then have function FindWindowA rewrited to _INTEGER64 type. I vaguely remember, Steve, that you were showing something with _WindowHandle somewhere (if it was you?) And that you no longer need to call FindWindowA. Somewhere in that window identification that calls Windows dialogs and it is likely to be a problem.

Change line 460 in your program to hwnd& = _WINDOWHANDLE, and you won’t need FindWindowA.

As for the LONG/INTEGER64 type, at line 463, make it auto sizing with the precompiler:

$IF 32BIT THEN
    hwndOwner AS LONG
$ELSE
    hwndOwner AS _INTEGER64
$END IF
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Problem With Wiki Example
« Reply #28 on: August 23, 2019, 11:21:30 am »
Thank you, Steve

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Problem With Wiki Example
« Reply #29 on: August 23, 2019, 01:07:50 pm »
Wow... I read all of these replies and I have no idea where to start on mine. Or is it possible yet? I feel like I just walked into a classroom of PhD programmers. :)