home *** CD-ROM | disk | FTP | other *** search
/ Dream 55 / Amiga_Dream_55.iso / RISCOS / MAGAZINE / LABOS / KING.ZIP / King / !Pulse / !RunImage (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  1998-01-14  |  96KB  |  3,903 lines

  1.  PULSE by -KING- (a french TECHNO & HARD-ROCK lover guy). 
  2.  All code in this basic file by KING. 
  3.  "<KINGBasicLib$Dir>.General"
  4.  "<KINGBasicLib$Dir>.Wimp"
  5. TaskName$="Pulse"
  6. PathApp$="<Pulse$Dir>"
  7. LibWimpInit
  8. InitVariables
  9. MemoryInit
  10. ExprMax%=100
  11. MaxEntry%=20
  12.  IconBlock% 200
  13.  "QTM_VUBarControl",2,-1
  14. Constants
  15. InitMode
  16. InitQTM
  17.  CurColor%(3)
  18.  XPitch%(61)
  19.  XNote%(61)
  20.  a%=0 
  21.  XPitch%(a%)
  22.  a%=0 
  23. $     A%=0
  24. S$,3,1)
  25. (A$)<<8
  26. S$,2,1)
  27.  A%=A% 
  28. (A$)<<16
  29. S$,1,1)
  30.  A%=A% 
  31. (A$)<<24
  32.  XNote%(a%)=A%
  33.  Options by default
  34. OQuickDraw%=
  35. OPaneVoice%=
  36. OPaneSeq%=
  37. OCursor%=2
  38. ReadOptions
  39. OHCell%=50
  40. OWCell%=450
  41. OQuickDraw%=
  42. OPaneVoice%=
  43. OPaneSeq%=
  44. OInitQTMPlay%=
  45. OCopyReverse%=
  46. OCopyMode%=0
  47. FontInit
  48.  "OS_SpriteOp",10,,"<PULSE$Dir>.Sprites"
  49.  "OS_ReadMemMapInfo" 
  50.  PageSize%
  51. F'TransfertPath$="<PULSE$Dir>.ForQTM"
  52. BASICSize%=
  53. -&8000
  54. Heap%=
  55. CreateMenus
  56. LibSetExtent(HFXControl%,500,CHIcons%*(&F+&F+1))
  57. PollMask%=%00000000110001
  58. CurrentMenu%=-1
  59. InitTempPattern
  60. UpdateNote(-1,-1)
  61.  Block%!0=0
  62.  "Wimp_Poll",PollMask%,Block%,TaskId% 
  63.  Poll%
  64.  Poll% 
  65.  0 : 
  66.  1 : 
  67. PollRedraw
  68.  2 : 
  69. PollOpenWindow
  70.  3 : 
  71. PollCloseWindow
  72.  6 : 
  73. PollMouseClick
  74.  7 : 
  75. EndDrag
  76.  8 : 
  77. KeyPressed
  78.  9 : 
  79. PollMenuSelection
  80.  11 : 
  81. LoseCaret
  82.  12 : 
  83. GainCaret
  84.  17,18,19 : 
  85. PollMessage
  86. GainCaret
  87. WinH%=Block%!0
  88. IconH%=Block%!4
  89.  WinH% 
  90.  HPlay%
  91.  IconH% 
  92. SelectIcon(10)
  93. LoseCaret
  94. WinH%=Block%!0
  95. IconH%=Block%!4
  96.  WinH% 
  97.  HPlay%
  98.  IconH% 
  99. DeselectIcon(10)
  100. CreateIcon(handle%,xpos%,ypos%,xs%,ys%,flags%,Title$,mem%,area%)
  101.  Block%!0=handle%
  102.  Block%!4=xpos%
  103.  Block%!8=ypos%
  104.  Block%!12=xpos%+xs%
  105.  Block%!16=ypos%+ys%
  106.  Block%!20=flags%
  107.  OK% 12
  108.  $OK%=Title$
  109.  Block%!24=OK%
  110.  Block%!28=area%
  111.  Block%!32=12
  112.  "Wimp_CreateIcon",,Block% 
  113.  Handle%
  114. =Handle%
  115. LibIconBarInstall
  116. LibLoadTemplates("<PULSE$Dir>.Templates")
  117. OpenWindow(WinH%)
  118.  Flags%
  119.  Block%!0=WinH%
  120.  "Wimp_GetWindowState",,Block%
  121.  Flags%=Block%!32
  122.  (Flags%>>16)
  123.   Block%!4 = 1000
  124.   Block%!8 = 0
  125.   Block%!12 = 3000
  126.   Block%!16 = 1000
  127.   Block%!20 = 0
  128.   Block%!24 = 0
  129.  Block%!28 = -1
  130.  "Wimp_OpenWindow",,Block%
  131. WinOpened(WinH%)
  132.  Block%!0=WinH%
  133.  "Wimp_GetWindowState",,Block%
  134.  Flags%=Block%!32
  135.  Cond%=(Flags%>>16)
  136.  Cond%=1 
  137. WinOpened(HPlayWin%) 
  138.  Update VUs
  139.   Block%!0=HVUs%
  140.   Block%!4=0
  141.   Block%!8=-200
  142.   Block%!12=OWCell%*4
  143.   Block%!16=0
  144.  "Wimp_UpdateWindow",,Block% 
  145.  Flag%
  146.   OX%=Block%!4-Block%!20
  147.   OY%=Block%!16-Block%!24
  148.  "QTM_ReadVULevels",1 
  149.  VU1%
  150.  "QTM_ReadVULevels",2 
  151.  VU2%
  152.  "QTM_ReadVULevels",3 
  153.  VU3%
  154.  "QTM_ReadVULevels",4 
  155.  VU4%
  156.  Flag%
  157.  OX%,OY%
  158. DrawVUs
  159.  "Wimp_GetRectangle",,Block% 
  160.  Flag%
  161.  VModify%=
  162.  OInitQTMPlay%=
  163. ReInitQTMMod
  164. UpdatePlayPosition
  165. DrawVUs
  166.  ORIGIN OX%,OY%
  167.  128,0,0,0
  168.  C%=VU1%/64*255
  169.  A%=VCurPlayEvent%/64*255
  170.  255,C%,0
  171.  RECTANGLE FILL -OWCell%/2*(VU1%/64)+OWCell%/2,-100,OWCell%*(VU1%/64),100
  172.  0,-100,OWCell%,VU1%/64*100
  173.  C%=VU2%/64*255
  174.  255,C%,0
  175.  OWCell%,-100,OWCell%,VU2%/64*100
  176.  C%=VU3%/64*255
  177.  255,C%,0
  178.  OWCell%*2,-100,OWCell%,VU3%/64*100
  179.  C%=VU4%/64*255
  180.  255,C%,0
  181.  OWCell%*3,-100,OWCell%,VU4%/64*100
  182.  0,255,255,255
  183.  OWCell%,0,OWCell%,-100
  184.  OWCell%*2,0,OWCell%*2,-100
  185.  OWCell%*3,0,OWCell%*3,-100
  186. RLibLoadTemplates
  187. ( HStore%=
  188. LibWindowTemplate("Store")
  189. ) PaneIconFlags%=!(TemplBuffer%+88+16)
  190. * PaneIconString%=!(TemplBuffer%+88+24)
  191. ( HPaneH%=
  192. LibWindowTemplate("PaneH")
  193. ( HPaneV%=
  194. LibWindowTemplate("PaneV")
  195. , HSplData%=
  196. LibWindowTemplate("SplData")
  197. * HParams%=
  198. LibWindowTemplate("Params")
  199.  Adr%=TemplBuffer%+88+32*51
  200.  X1NoteBBox%=!(Adr%)
  201.  Y1NoteBBox%=!(Adr%+4)
  202.  X2NoteBBox%=!(Adr%+8)
  203.  Y2NoteBBox%=!(Adr%+12)
  204. , HSamples%=
  205. LibWindowTemplate("Samples")
  206.  Adr%=TemplBuffer%+88+32*14
  207.  X1Spl%=!(Adr%)
  208.  Y1Spl%=!(Adr%+4)
  209.  X2Spl%=!(Adr%+8)
  210.  Y2Spl%=!(Adr%+12)
  211. . HSongInfo%=
  212. LibWindowTemplate("SongInfo")
  213. & HCopy%=
  214. LibWindowTemplate("Copy")
  215. & HSave%=
  216. LibWindowTemplate("Save")
  217. , HPatSave%=
  218. LibWindowTemplate("PatSave")
  219. + HInfo%=
  220. LibWindowTemplate("PULSEInfo")
  221. , HOptions%=
  222. LibWindowTemplate("Options")
  223. . HSequence%=
  224. LibWindowTemplate("Sequence")
  225. , HPlayWin%=
  226. LibWindowTemplate("PlayWin")
  227.     & HPlay%=
  228. LibWindowTemplate("Play")
  229. 0 HFXControl%=
  230. LibWindowTemplate("FXControl")
  231. $ HVUs%=
  232. LibWindowTemplate("VUs")
  233. Writable(IconH%)
  234.  Block%!0=WinH%
  235.  Block%!4=IconH%
  236.  "Wimp_GetIconState",,Block%
  237. =Block%!28
  238. PollCloseWindow
  239.  WinH%=Block%!0
  240. ! Entry%=
  241. HandleToEntry(WinH%)
  242.  Entry%=-1 
  243.  WinH% 
  244.  HSamples%
  245. LibCloseWindow(WinH%)
  246. LibCloseWindow(HSplData%)
  247.  HPlayWin%
  248. ClosePlayWindow 
  249. LibCloseWindow(WinH%)
  250.  Shell windows
  251. ClosePattern(WinH%)
  252. EndDrag
  253.  Send message to filer
  254.  "Wimp_GetPointerInfo",,Block%
  255.  WinH%=Block%!12
  256.  Block%!0=100
  257.  Block%!12=0
  258.  Block%!16=1 :
  259.  DataSave
  260.  Block%!20=WinH%
  261.  $(Block%+44)=""
  262.  Block%?(44+12)=0
  263.  "Wimp_SendMessage",17,Block%,WinH%
  264.  *********************************************MouseClick****************************************
  265. PollMouseClick
  266.  X%=Block%!0
  267.  Y%=Block%!4
  268.  MX%=X%
  269.  MY%=Y%
  270.  Mouse%=Block%!8
  271.  WinH%=Block%!12
  272.  IconH%=Block%!16
  273.  WinH% 
  274.  -2 : 
  275.  IconBar
  276.  Mouse% 
  277.  4 : 
  278.  Select
  279.  VModuleState%=
  280. L&    
  281.  Advice user to drag a module
  282.     Block%!0=0
  283.     Error%=%100100000101
  284. ON    $(Block%+4)="Drag an AMIGA module to this icon to edit it, simple no?"
  285. PE    
  286.  "Wimp_ReportError",Block%,Error%,TaskName$,-1,-1,-1 
  287.  ,OK%
  288. LibOpenWindow(HPlay%)
  289.  1 : 
  290.  Adjust
  291.  VModuleState%=
  292. OpenPlayWindow(
  293.  2 : 
  294.  Menu
  295.  VModuleState%=
  296. ZP    
  297.  EditEntry%=-1 
  298. LibMDisable(MPIconBar%,1) 
  299. LibMEnable(MPIconBar%,1)
  300. [!    
  301. LibMEnable(MPIconBar%,2)
  302. \!    
  303. LibMEnable(MPIconBar%,3)
  304. ]!    
  305. LibMEnable(MPIconBar%,4)
  306. ^!    
  307. LibMEnable(MPIconBar%,5)
  308. _!    
  309. LibMEnable(MPIconBar%,7)
  310. a"    
  311. LibMDisable(MPIconBar%,1)
  312. b"    
  313. LibMDisable(MPIconBar%,2)
  314. c"    
  315. LibMDisable(MPIconBar%,3)
  316. d"    
  317. LibMDisable(MPIconBar%,4)
  318. e"    
  319. LibMDisable(MPIconBar%,5)
  320. f"    
  321. LibMDisable(MPIconBar%,7)
  322. CheckTick(HParams%,1)
  323. CheckTick(HSamples%,2)
  324. CheckTick(HSongInfo%,3)
  325. CheckTick(HPlay%,4)
  326. CheckTick(HSequence%,5)
  327. m    
  328. CheckTick(HFXControl%,6)
  329. CheckTick(HPlayWin%,7)
  330. o2   
  331.  "Wimp_CreateMenu",,MPIconBar%,MX%-64,650
  332. p    CurrentMenu%=MENUIconBar%
  333.  HInfo%
  334.  Nothing
  335.  HParams%
  336.  HParams%
  337.   Entry%=EditEntry%
  338.   Block%!0=WinH%
  339.  "Wimp_GetWindowState",,Block%
  340.   X%=Block%!4
  341.   Y%=Block%!16
  342.  IconH% 
  343.  IDPPFX%
  344.  Effect POPUP
  345.    Block%!0=WinH%
  346.    Block%!4=IconH%
  347.  "Wimp_GetIconState",,Block%
  348.  "Wimp_CreateMenu",,MPEffects%,X%+Block%!16,Y%+Block%!20
  349.     CurrentMenu%=MENUEffects%
  350.  IDPPSpl%
  351.  SampleList POPUP
  352.    Block%!0=WinH%
  353.    Block%!4=IconH%
  354.  "Wimp_GetIconState",,Block%
  355.  "Wimp_CreateMenu",,MPSamples2%,X%+Block%!16,Y%+Block%!20
  356.     CurrentMenu%=MENUSamples%
  357.  IDNbSpl%
  358.  Open EditSample window.
  359. ReturnParams(KCurrentNote%,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  360. UpdateSampleInfo(Sample%)
  361. OpenSamples(
  362.  Sequence
  363. EnableIcon(37)
  364.  Pattern button isn't writable
  365.    Block%!0=WinH%
  366.    Block%!4=46
  367. !   Block%!8=(0<<15) 
  368.  (1<<12)
  369. "   Block%!12=(1<<15) 
  370.  (1<<12)
  371.  "Wimp_SetIconState",,Block%
  372.  "Wimp_SetCaretPosition",WinH%,37,0,0,-1,-1
  373.  Pattern
  374. DisableIcon(37)
  375.  Pattern button is writable
  376.    Block%!0=WinH%
  377.    Block%!4=46
  378.    Block%!8=1<<15
  379.    Block%!12=1<<15
  380.  "Wimp_SetIconState",,Block%
  381.  "Wimp_SetCaretPosition",WinH%,46,0,0,-1,-1
  382.  No note
  383.  Note%=0 
  384.     Sample%=0
  385.     Pitch%=&6B0
  386.     Effect%=0
  387.     PitchEffect%=0
  388. StoreParams
  389. %    
  390. UpdateNote(EditEntry%,Note%)
  391. UpdateShell(Note%)
  392.  New note=0
  393. !    
  394. UpdateNote(EditEntry%,0)
  395. UpdateShell(Note%)
  396.  Decrement
  397.  Increment
  398.  No Pitch
  399. ReturnParams(KCurrentNote%,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  400.    Pitch%=0
  401. 4   PitchEffect%=PitchEffect1%<<8 
  402.  PitchEffect2%
  403. StoreParams
  404. UpdateNote(EditEntry%,Note%)
  405. UpdateShell(Note%)
  406.  IconH%>=IDKeybrd% 
  407.  IconH%<=IDKeybrd%+12 
  408. )    Cursor%=Windows%(Entry%,WCursor%)
  409. 0    
  410.  SYS "QTM_PlaySample",1,10,IconH%-12,64
  411.  New sample pitch
  412. W    
  413. ReturnParams(KCurrentNote%,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  414.  Pitch%<>0 
  415.      b%=-1
  416.      
  417.       b%+=1
  418.      
  419.  XPitch%(b%)=Pitch%
  420.      b%=b% 
  421.         
  422.      b%=2
  423.         
  424.     a%=IconH%-IDKeybrd%
  425.      Pitch%=XPitch%(a%+b%*12)
  426. StoreParams
  427. %    
  428. UpdateNote(EditEntry%,Note%)
  429.  IconH%>=IDKeybrd%+12 
  430.  IconH%<=IDKeybrd%+12+5 
  431.  New octave pitch
  432. W    
  433. ReturnParams(KCurrentNote%,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  434.  Pitch%<>0 
  435.      b%=-1
  436.      
  437.       b%+=1
  438.      
  439.  XPitch%(b%)=Pitch%
  440.      b%=b% 
  441.         
  442.      b%=0
  443.         
  444.     a%=IconH%-IDKeybrd%-12
  445.      Pitch%=XPitch%(b%+a%*12)
  446. StoreParams
  447. %    
  448. UpdateNote(EditEntry%,Note%)
  449. UpdateShell(Note%)
  450.  HPlay%
  451.  HPlay%
  452.  IconH% 
  453.  16 : 
  454.  Rewind
  455.  SYS "QTM_Pos",-1,-1 TO Seq%,Event%
  456.    Seq%=VCurPlaySeq%
  457.    Event%=VCurPlayEvent%
  458.  Mouse%=4 
  459.  Event%-=1 
  460.  Seq%-=1 : Event%=0
  461.  Event%<0 
  462.  Event%=63 : Seq%-=1 
  463.  Seq%<0 
  464.  Seq%=0 : Event%=0
  465. SetPlayPosition(Seq%,Event%)
  466. PlayLine(Seq%,Event%)
  467.  18 : 
  468.  Forwind
  469.  SYS "QTM_Pos",-1,-1 TO Seq%,Event%
  470.    Seq%=VCurPlaySeq%
  471.    Event%=VCurPlayEvent%
  472.  Mouse%=4 
  473.  Event%+=1 
  474.  Seq%+=1 : Event%=0
  475.  Event%>63 
  476.  Event%=0 : Seq%+=1
  477.  Seq%>=NbSeq% 
  478.  Seq%=NbSeq%-1
  479. SetPlayPosition(Seq%,Event%)
  480. PlayLine(Seq%,Event%)
  481.  17 : 
  482.  Pause/Play
  483.  Mouse% 
  484. 6    
  485.  4 : 
  486.  VPlayStatus%=
  487. PauseMod 
  488. StartMod
  489.  2 : 
  490. StopMod
  491. ?    
  492.  1 : 
  493. SetPlayPosition(LastSeq%,LastEvent%) : 
  494. StartMod
  495.  14 : 
  496.  Follow edit cursor
  497.  VPlayEdit%=
  498.  VPlayEdit%=
  499.  VPlayEdit%=
  500.  10 :
  501.  Tempo button: open writable menu
  502.    Entry%=EditEntry%
  503.    Block%!0=WinH%
  504.  "Wimp_GetWindowState",,Block%
  505.    X%=Block%!4
  506.    Y%=Block%!16
  507.    Block%!0=WinH%
  508.    Block%!4=IconH%
  509.  "Wimp_GetIconState",,Block%
  510.    x%=Block%!8
  511.    y%=Block%!20
  512. CreateWritableMenu(x%+X%,y%+Y%,"Set new tempo value",VCurSpeed%)
  513.    MenuBlock%!0=1
  514.  Pattern number
  515. !/   
  516. NewPattern(
  517. SeqToPattern(VCurPlaySeq%))
  518.  Channels
  519. %    
  520.  IconH%>=4 
  521.  IconH%<=7 
  522.     C%=IconH%-3
  523. '     
  524. IconState(IconH%)=
  525. (#     
  526.  "QTM_RestoreChannel",C%
  527. )1     VOChPlayState%(C%-1)=VChPlayState%(C%-1)
  528.      VChPlayState%(C%-1)=1
  529.      
  530. UpdatePlayPosition
  531. ,        
  532. -"     
  533.  "QTM_RemoveChannel",C%
  534. .1     VOChPlayState%(C%-1)=VChPlayState%(C%-1)
  535.      VChPlayState%(C%-1)=0
  536.      
  537. UpdatePlayPosition
  538.  HOptions%
  539.  HOptions%
  540.  WinH%=HOptions%
  541.  IconH% 
  542.  4 : 
  543.  Update
  544. CheckOptions
  545.  3 : 
  546.  Save options
  547.    Block%!0=OQuickDraw%
  548.    Block%!4=OPaneVoice%
  549.    Block%!8=OPaneSeq%
  550.    Block%!12=OCursor%
  551.    Block%!16=OWCell%
  552.    Block%!20=OHCell%
  553. C2   
  554. Save(Block%,24,"<PULSE$Dir>.Options",&FFD)
  555.  HSamples%
  556.  HSamples%
  557.   Block%!0=WinH%
  558.  "Wimp_GetWindowState",,Block%
  559.   X%=Block%!4
  560.   Y%=Block%!16
  561.  IconH% 
  562.  Effect POPUP
  563.    Block%!0=WinH%
  564.    Block%!4=IconH%
  565. S%   
  566.  "Wimp_GetIconState",,Block%
  567. UA   
  568.  "Wimp_CreateMenu",,MPSamples%,X%+Block%!16,Y%+Block%!20
  569. V"   CurrentMenu%=MENUSamplesII%
  570.  16 : 
  571.  Update data information for this sample.
  572.    S%=CurrentEditSample%-1
  573.    Sample$=$
  574. Writable(2)
  575.    Sample$=
  576. Sample$,22)
  577.    $Block%=Sample$
  578.  No end char!
  579.    P%=SampleInfo%+S%*30
  580.  a%=0 
  581.     P%?a%=Block%?a%
  582.       
  583.  Finetune value
  584. e    Adr%=SampleInfo%+S%*30+24
  585.    V%=
  586. Writable(13))
  587.  V%<-128 
  588.  V%>128 
  589.    ?Adr%=V%
  590.  Volume
  591. k    Adr%=SampleInfo%+S%*30+25
  592.    V%=
  593. Writable(10))
  594.  V%<0 
  595.  V%>64 
  596.    ?Adr%=V%
  597.  Repeat offset
  598. q    Adr%=SampleInfo%+S%*30+26
  599.    V%=
  600. Writable(6))/2
  601.    ?Adr%=(V%>>8) 
  602.    Adr%+=1
  603.    ?Adr%=V% 
  604.  Repeat length
  605. x    Adr%=SampleInfo%+S%*30+28
  606.    V%=
  607. Writable(8))/2
  608.    ?Adr%=(V%>>8) 
  609.    Adr%+=1
  610.    ?Adr%=V% 
  611.  &FF   
  612. UpdateMenuSamples
  613.  No data button
  614. SampleInfo(CurrentEditSample%,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  615.  Length%<>0 
  616. 5    
  617.  Delete data sample: needs user confirmation
  618.     Block%!0=0
  619.     Error%=%100100000111
  620. E    $(Block%+4)="Delete data sample n
  621. (CurrentEditSample%)+"?"
  622. E    
  623.  "Wimp_ReportError",Block%,Error%,TaskName$,-1,-1,-1 
  624.  ,OK%
  625.  OK%=1 
  626. 2     Adr%=
  627. SearchAdrSample(CurrentEditSample%)
  628. #     
  629. MoveMemory(Adr%,-Length%)
  630.       S%=CurrentEditSample%-1
  631. "     P%=(SampleInfo%+S%*30)+22
  632.      P%!0=0
  633.      P%!4=0
  634. .     
  635. UpdateSampleInfo(CurrentEditSample%)
  636.      
  637. UpdateMenuSamples
  638.       SamplesLength%-=Length%
  639.      
  640. SongInfo
  641.         
  642.  Advice user to drag
  643.     Block%!0=0
  644.     Error%=%100100000101
  645. R    $(Block%+4)="To register this sample, just drag a sample file to the icon"
  646. E    
  647.  "Wimp_ReportError",Block%,Error%,TaskName$,-1,-1,-1 
  648.  ,OK%
  649.  No repeat
  650. NewSplRepeat(0,0)
  651.  End repeat
  652. SampleInfo(CurrentEditSample%,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  653. NewSplRepeat(RepeatO%,Length%-RepeatO%)
  654.  Test sample pitch.
  655.  VModify%=
  656. ReInitQTMMod
  657. PauseMod
  658.    Block%!0=WinH%
  659.    Block%!4=IconH%
  660.  "Wimp_GetIconState",,Block%
  661.    W%=Block%!16-Block%!8
  662. #   x%=(MX%-X%-Block%!8)/W%*35+1
  663.          
  664.  "QTM_RestoreChannel",1
  665.  "QTM_Stereo",1,0
  666.  "QTM_PlaySample",1,CurrentEditSample%,x%,64
  667.  Export a sample
  668. StartDrag(DRAGSample%,"file_ffd")
  669.  Export group of samples
  670. StartDrag(DRAGAllSamples%,"package")
  671.  HSplData%
  672.   Block%!0=WinH%
  673.  "Wimp_GetWindowState",,Block%
  674.   X%=MX%-Block%!4+Block%!20
  675. SampleInfo(CurrentEditSample%,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  676.   NRepeatO%=RepeatO%
  677.   NRepeatL%=RepeatL%
  678.  Mouse% 
  679.  Set Repeat offset
  680.    NRepeatO%=X%/2
  681. "   NRepeatO%=(NRepeatO% 
  682.  2)*2
  683. .   NRepeatL%=(RepeatL%+RepeatO%)-NRepeatO%
  684.  NRepeatL%<0 
  685.  NRepeatL%=10
  686.  Set Repeat end (length)
  687.    NRepeatL%=X%/2-RepeatO%
  688.  NRepeatL%<0 
  689.  NRepeatO%=NRepeatO%+NRepeatL%-10 : NRepeatL%=10
  690. NewSplRepeat(NRepeatO%,NRepeatL%)
  691.  HSongInfo%
  692.   HSongInfo%
  693.  IconH% 
  694.  11 : 
  695.  Open sequence table
  696. OpenWindow(HSequence%)
  697.  Update
  698.    TrackName$=$
  699. Writable(0)
  700.    $Module%=TrackName$
  701.  HSequence%
  702.  Block%!0=WinH%
  703.  "Wimp_GetWindowState",,Block%
  704.   X%=MX%-Block%!4+Block%!20
  705. #  Y%=-(MY%-Block%!16+Block%!24)
  706.   Seq%=Y% 
  707.   Pat%=?(MemSequence%+Seq%)
  708.  Mouse% 
  709. NewPattern(Pat%)
  710. /   Title$="Pattern for sequence n
  711. (Seq%)
  712. CreateWritableMenu(MX%,MY%,Title$,Pat%)
  713.    MenuBlock%!0=0
  714.    MenuBlock%!8=Seq%
  715.  HFXControl%
  716.   Block%!0=WinH%
  717.  "Wimp_GetWindowState",,Block%
  718.   X%=MX%-Block%!4+Block%!20
  719. #  Y%=-(MY%-Block%!16+Block%!24)
  720.   FX%=Y% 
  721.  Mouse% 
  722.  "QTM_EffectControl",-1 
  723.  State%,SubState%
  724.  FX%>=&E 
  725.  FX%<=(&E+&F) 
  726.  Extended effects
  727.     RFX%=(&E<<4)+(FX%-&E)
  728. (    FXState%=(SubState%>>(FX%-&E))
  729.     Effect%=&E
  730.     P1%=(FX%-&E)
  731.  Normal effects
  732. )    
  733.  FX%=&F+&F 
  734.  RFX%=&F 
  735.  RFX%=FX% 
  736.  RFX%=&F 
  737.       Effect%=&F
  738.       A%=15
  739.      
  740.       Effect%=FX%
  741.       A%=FX%
  742.      
  743.     FXState%=(State%>>A%)
  744.     P1%=0
  745.    S%=1-FXState% 
  746.  "QTM_EffectControl",RFX%,S%
  747.    Y%=-(FX%+1)*CHIcons%
  748.  "Wimp_ForceRedraw",HFXControl%,0,Y%,500,Y%+CHIcons%
  749.  Give help on this effect
  750.  HCopy%
  751.  Copy options buttons update in real time.
  752.  IconH%>=6 
  753.  IconH%<=9 : 
  754.  Swap origin and destination block
  755.     OCopyMode%=IconH%-6
  756.  IconH%=10 : 
  757.  Copy! 
  758.  HPatSave%
  759.   Block%!0=WinH%
  760.  "Wimp_GetWindowState",,Block%
  761.   X%=Block%!4
  762.   Y%=Block%!16
  763.  Save pattern
  764.  IconH% 
  765.  1 : 
  766.  Pattern
  767.    DragBlock%!0=0
  768. ,*   
  769. StartDrag(DRAGPattern%,"File_ffd")
  770.  2 : 
  771.  Group
  772. .)   
  773. StartDrag(DRAGAllPats%,"Package")
  774.  HSave%
  775.   Block%!0=WinH%
  776.  "Wimp_GetWindowState",,Block%
  777.   X%=Block%!4
  778.   Y%=Block%!16
  779.  IconH% 
  780.  1 : 
  781.  Drag
  782. 9(   
  783. StartDrag(DRAGTrack%,"File_001")
  784.  3 : 
  785.    Path$=$
  786. Writable(2)
  787.    ModulePath$=Path$
  788. >-   
  789. Save(Module%,ModuleLength%,Path$,001)
  790.  HPlayWin%
  791. B         
  792.   Block%!0=WinH%
  793.  "Wimp_GetWindowState",,Block%
  794. E*  X%=(X%-Block%!4+Block%!20) 
  795.  OWCell%
  796. F,  Y%=-(Y%-Block%!16+Block%!24) 
  797.  OHCell%
  798.   Seq%=Y% 
  799.   Event%=Y% 
  800. SetPlayPosition(Seq%,Event%)
  801. PlayLine(Seq%,Event%)
  802.  Shell windows
  803.   OldEntry%=EditEntry%
  804.  No shell window before: OldEntry%=-1
  805.  Set Wimp caret on the new shell window.
  806. S"  Entry%=
  807. HandleToEntry(WinH%)
  808.   Block%!0=WinH%
  809.  "Wimp_GetWindowState",,Block%
  810.   X%=X%-Block%!4+Block%!20
  811. X"  Y%=-(Y%-Block%!16+Block%!24)
  812. Y*  NewCursor%=X%/OWCell%+Y% 
  813.  OHCell%*4
  814.  Mouse% 
  815.  4 : 
  816.  Select button
  817.    xN%=NewCursor% 
  818.    yN%=NewCursor% 
  819.  VPlayEdit%=
  820.  Update edit cursor
  821. d%    
  822. NewCursor(Entry%,NewCursor%)
  823.  Set play position
  824.  Problem
  825. h2    Seq%=
  826. PatToSeq(Windows%(Entry%,WPattern%))
  827. i"    
  828. SetPlayPosition(Seq%,yN%)
  829. PlayLine(Seq%,yN%)
  830. k       
  831.  1 : 
  832.  New block defined from cursor to right button.
  833. n'   Start%=Windows%(Entry%,WCursor%)
  834. o>   
  835. NewBlock(Windows%(Entry%,WPattern%),Start%,NewCursor%)
  836.  2 : 
  837.  Menu
  838. r3   
  839. NewCursor(Entry%,Windows%(Entry%,WCursor%))
  840. sN   
  841.  BlockPattern%=-1 
  842. LibMDisable(MPShell%,3) 
  843. LibMEnable(MPShell%,3)
  844. tK   
  845.  EditEntry%=-1 
  846. LibMDisable(MPShell%,4) 
  847. LibMEnable(MPShell%,4)
  848. u-   
  849.  "Wimp_CreateMenu",,MPShell%,MX%,MY%
  850.    CurrentMenu%=MPShell%
  851.    MenuBlock%!0=Entry%
  852. InitMode
  853.  "Wimp_ReadSysInfo",1 
  854.  WIMPMode%
  855.  XScreen%=WIMPMode%!4
  856.  YScreen%=WIMPMode%!8
  857.  XS%=XScreen%
  858.  YS%=YScreen%
  859. PollMessage
  860.  Block%!16 
  861.  &400C0 : 
  862.  Menu warning
  863.  "Wimp_CreateSubMenu",,Block%!20,Block%!24,Block%!28
  864.  &400C1 : 
  865.  ModeChange
  866. InitMode
  867.   ChangeMode%=
  868.  0 : 
  869.  Quit
  870.  DataLoad
  871.   WinH%=Block%!20
  872.   IconH%=Block%!24
  873.   S%=Block%+44
  874.   N%=S%
  875.    N%+=1
  876.  ?N%=0
  877.   ?N%=&0D
  878.   Path$=$S%
  879.  WinH% 
  880.  HSamples%
  881.  WinH%=HSamples% 
  882.  IconH%=15 
  883. 8    
  884.  Replace the old sample by the new one dropped.
  885. "    Block%!16=4 :
  886.  DataLoadAck
  887. )    
  888.  "Wimp_SendMessage",18,Block%,0
  889. M    
  890. SampleInfo(CurrentEditSample%,OldLength%,RepeatO%,RepeatL%,DV%,FTV%)
  891. +    NewLength%=
  892. LibGetFileLength(Path$)
  893. 1    Adr%=
  894. SearchAdrSample(CurrentEditSample%)
  895. /    
  896. MoveMemory(Adr%,NewLength%-OldLength%)
  897. Load(Adr%,Path$)
  898.     S%=CurrentEditSample%-1
  899. !    P%=(SampleInfo%+S%*30)+22
  900.     A%=NewLength%/2
  901. $    P%!0=(A% 
  902.  &FF)<<8 
  903.  (A%>>8)
  904.     P%!4=0
  905.     P%?3=64
  906. -    
  907. UpdateSampleInfo(CurrentEditSample%)
  908. UpdateMenuSamples
  909. -    SamplesLength%+=NewLength%-OldLength%
  910. SongInfo
  911.  -2 :
  912.  Icon bar
  913.  Load a new module
  914. !   Block%!16=4 :
  915.  DataLoadAck
  916.  "Wimp_SendMessage",18,Block%,0
  917. LoadModule(Path$)
  918. #   Entry%=
  919. HandleToEntry(WinH%)
  920.  Entry%<>-1 
  921.  Load a pattern
  922. "    Block%!16=4 :
  923.  DataLoadAck
  924. )    
  925.  "Wimp_SendMessage",18,Block%,0
  926. '    Pat%=Windows%(Entry%,WPattern%)
  927.     P%=
  928. PatToMem(Pat%)
  929. 3    
  930.  "OS_File",13,Path$,,,Path$ 
  931.  ,,,,Length%
  932.  Length%=1024 
  933.      
  934. Load(P%,Path$)
  935.       
  936. LibUpdateWindow(WinH%)
  937.         
  938.          
  939.  2 : 
  940.  DataSaveAck
  941.  DragCase% 
  942.  DRAGSample%
  943.  Save sample data
  944.    N%=Block%+44
  945.     N%+=1
  946.  ?N%=0 
  947.    ?N%=&0D
  948.    Path$=$(Block%+44)
  949. SampleInfo(CurrentEditSample%,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  950. 0   Adr%=
  951. SearchAdrSample(CurrentEditSample%)
  952. Save(Adr%,Length%,Path$+"Sample"+
  953. (CurrentEditSample%),&ffd)
  954.  DRAGAllSamples%
  955.  Export all 31 samples in a directory
  956.    N%=Block%+44
  957.     N%+=1
  958.  ?N%=0 
  959.    ?N%=&0D
  960.    Path$=$(Block%+44)
  961.  Create directory
  962.    Dir$=Path$+"ModSamples"
  963.  "OS_File",8,Dir$,,,0
  964.  S%=1 
  965. :    
  966. SampleInfo(S%,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  967.  Length%<>0 
  968. "     Adr%=
  969. SearchAdrSample(S%)
  970. 6     
  971. Save(Adr%,Length%,Dir$+".Sample"+
  972. (S%),&ffd)
  973.         
  974.  DRAGTrack%
  975.  Save track file
  976.    S%=Block%+44
  977.    N%=S%
  978.     N%+=1
  979.  ?N%=0 
  980.    ?N%=&0D
  981. '   Leaf$=
  982. GetLeafPath(ModulePath$) 
  983.    ModulePath$=$S%+Leaf$
  984.    WinH%=HSave%
  985. LibSetIconText2(2,ModulePath$)
  986. Save(Module%,ModuleLength%,ModulePath$,001)
  987.  DRAGPattern%
  988.    S%=Block%+44
  989.    N%=S%
  990.     N%+=1
  991.  ?N%=0 
  992.    ?N%=&0D
  993. 9   Pat%=Windows%(EditEntry%,WPattern%) :
  994. DragBlock%!0
  995.    Path$=$S%+"Pat"+
  996. (Pat%)
  997. #   Pattern%=Patterns%+1024*Pat%
  998. Save(Pattern%,64*4*4,Path$,&ffd)
  999.  DRAGAllPats%
  1000.    S%=Block%+44
  1001.    N%=S%
  1002.     N%+=1
  1003.  ?N%=0 
  1004.    ?N%=&0D
  1005.    Path$=$S%
  1006.  Create directory
  1007.    Dir$=Path$+"ModPats"
  1008.  "OS_File",8,Dir$,,,0
  1009.  Pat%=0 
  1010.  NbPat%
  1011.      Adr%=
  1012. PatToMem(Pat%)
  1013. 2     
  1014. Save(Adr%,1024,Dir$+".Pat"+
  1015. (Pat%),&ffd)
  1016.          
  1017. !       
  1018.  **********************************Redraw*****************************
  1019. NewSplRepeat(NRepeatO%,NRepeatL%)
  1020.  VModify%=
  1021. SampleInfo(CurrentEditSample%,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  1022. ,  NRepeatO%=(NRepeatO% 
  1023.  2)*2
  1024. -  NRepeatL%=(NRepeatL% 
  1025.  2)*2
  1026.  XRepeatO%=RepeatO%
  1027.  XRepeatL%=RepeatL%
  1028.  Block%!0=HSplData%
  1029.  "Wimp_GetWindowState",,Block%
  1030.  XMin%=Block%!20/2
  1031. 4+ XMax%=(Block%!12-Block%!4+Block%!20)/2
  1032.  OX%=Block%!4
  1033.  OY%=Block%!16  
  1034. 7         
  1035.  Block%!0=HSplData%
  1036.  Block%!4=0
  1037.  Block%!8=-1000
  1038.  Block%!12=Length%*2
  1039.  Block%!16=0
  1040.  "Wimp_UpdateWindow",,Block% 
  1041.  Flag%
  1042.  Flag%
  1043.  OX%,OY%
  1044.  Erase previous repeat block
  1045.   RepeatO%=XRepeatO%
  1046.   RepeatL%=XRepeatL%
  1047. DrawRepeatBlock
  1048.  Draw new repeat block
  1049.   RepeatO%=NRepeatO%
  1050.   RepeatL%=NRepeatL%
  1051. DrawRepeatBlock
  1052.  "Wimp_GetRectangle",,Block% 
  1053.  Flag%
  1054.  S%=CurrentEditSample%-1 
  1055.  WinH%=HSamples%
  1056.  Repeat offset
  1057.  Adr%=SampleInfo%+S%*30+26
  1058. LibSetIconText2(6,
  1059. (RepeatO%))
  1060.  V%=RepeatO%/2
  1061.  ?Adr%=(V%>>8) 
  1062.  Adr%+=1
  1063.  ?Adr%=V% 
  1064.  Repeat length
  1065.  Adr%=SampleInfo%+S%*30+28
  1066. LibSetIconText2(8,
  1067. (RepeatL%))
  1068.  V%=RepeatL%/2
  1069.  ?Adr%=(V%>>8) 
  1070.  Adr%+=1
  1071.  ?Adr%=V% 
  1072. DrawAllSeqPat(Seq%)
  1073.  Pat%=
  1074. SeqToPattern(Seq%)
  1075.  S%=0 
  1076.  NbSeq%
  1077.  Pat%=?(MemSequence%+S%) 
  1078.  3,100,0,0
  1079. i#   
  1080.  100,-(S%+1)*50,500,50 
  1081. PollRedraw
  1082.  WinH%=Block%!0
  1083.  WinH% 
  1084.  HSequence%
  1085.  "Wimp_RedrawWindow",,Block% 
  1086.  Flag%
  1087.   OX%=Block%!4-Block%!20
  1088.   OY%=Block%!16-Block%!24
  1089.   OHSeq%=50
  1090.  Flag%
  1091. y6   YMin%=-(Block%!40-Block%!16+Block%!24) 
  1092.  OHSeq%
  1093. z5   YMax%=(Block%!16-Block%!32-Block%!24) 
  1094.  OHSeq%
  1095.    Y%=-YMin%*(OHSeq%)
  1096.  S%=YMin% 
  1097.  YMax%
  1098.     Y%-=OHSeq%
  1099. ~7    
  1100. PlotIcon(0,Y%,100,OHSeq%,
  1101. (S%),PaneIconFlags%)
  1102. "    Pat$=
  1103. (?(MemSequence%+S%))
  1104. E    
  1105. PlotIcon(100,Y%,200,OHSeq%,"Pattern n
  1106. "+Pat$,PaneIconFlags%)
  1107.  OX%,OY%
  1108.  3,100,0,0
  1109.  0,-(VCurPlaySeq%+1)*50,100,50
  1110. DrawAllSeqPat(VCurPlaySeq%)
  1111.  "Wimp_GetRectangle",,Block% 
  1112.  Flag%
  1113.  HFXControl%
  1114.  "Wimp_RedrawWindow",,Block% 
  1115.  Flag%
  1116.   HFX%=50
  1117.  Flag%
  1118. 4   YMin%=-(Block%!40-Block%!16+Block%!24) 
  1119.  HFX%
  1120. 3   YMax%=(Block%!16-Block%!32-Block%!24) 
  1121.  HFX%
  1122.    Y%=-YMin%*HFX%
  1123.  "QTM_EffectControl",-1 
  1124.  State%,SubState%
  1125.  FX%=YMin% 
  1126.  YMax%
  1127.     Y%-=HFX%
  1128. "    
  1129.  FX%>=&E 
  1130.  FX%<=(&E+&F) 
  1131.      
  1132.  Extended effects
  1133.      RFX%=(&E<<4)+(FX%-&E)
  1134. )     FXState%=(SubState%>>(FX%-&E))
  1135.      Effect%=&E
  1136.      P1%=(FX%-&E)
  1137.         
  1138.      
  1139.  Normal effects
  1140. .     
  1141.  FX%=&F+&F 
  1142.  RFX%=&FF 
  1143.  RFX%=FX%<<4 
  1144.          
  1145.      
  1146.  RFX%=&FF 
  1147.       Effect%=&F
  1148.       A%=15
  1149.      
  1150.       Effect%=FX%
  1151.       A%=FX%
  1152.      
  1153.       FXState%=(State%>>A%)
  1154.      P1%=0
  1155.         
  1156. Effects(Effect%,P1%,0)
  1157.     Icon%=PaneIconFlags%
  1158. I    
  1159.  FXState%=0 
  1160.  Icon%=(PaneIconFlags% 
  1161. (%1111<<24)) 
  1162.  (11<<24)  
  1163. ;    
  1164. PlotIcon(0,Y%,500,HFX%,
  1165. ~(RFX%)+"."+LongFX$,Icon%)
  1166.  "Wimp_GetRectangle",,Block% 
  1167.  Flag%
  1168.  HSplData%
  1169.   Block%!0=WinH%
  1170.  "Wimp_GetWindowState",,Block%
  1171.   XMin%=Block%!20/2
  1172. ,  XMax%=(Block%!12-Block%!4+Block%!20)/2
  1173.   OX%=Block%!4
  1174.   OY%=Block%!16
  1175.  "Wimp_RedrawWindow",,Block% 
  1176.  Flag%
  1177.       
  1178. SampleInfo(CurrentEditSample%,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  1179. /  Adr%=
  1180. SearchAdrSample(CurrentEditSample%)
  1181.  Flag%
  1182. -   XL%=(Block%!28-Block%!4+Block%!20)/2  
  1183. -   XR%=(Block%!36-Block%!4+Block%!20)/2  
  1184.  OX%,OY%
  1185.       
  1186.    D%=(XR%-XL%)
  1187.  Length%<X2Spl%-X1Spl% 
  1188.  D%=Length%
  1189.     O%=(Block%!28-Block%!4)/2
  1190.  Length%<>0 
  1191.  0,0,0
  1192.     Scale=1/128*CenterYSpl%
  1193.  P%=0 
  1194.      A%=?(Adr%+P%+XL%)
  1195.      S%=(A%>>7) 
  1196.      A%=A% 
  1197.  %1111111
  1198.      
  1199.  S%=1 
  1200.  A%=A%-128
  1201. @     
  1202.  (O%+P%)*2,CenterYSpl%,(O%+P%)*2,-A%*Scale+CenterYSpl%
  1203.         
  1204.        
  1205.  0,255,0,0
  1206.  0,CenterYSpl%,X2Spl%-X1Spl%,CenterYSpl%
  1207.  Length%<>0 
  1208. DrawRepeatBlock
  1209. !    
  1210.  Length%<X2Spl%-X1Spl% 
  1211.      
  1212.  255,0,0
  1213. G     
  1214.  Length%*2,CenterYSpl%*2,(X2Spl%-X1Spl%)*2,-CenterYSpl%*2
  1215.         
  1216.  "Wimp_GetRectangle",,Block% 
  1217.  Flag%
  1218.  HVUs%
  1219.  "QTM_ReadVULevels",1 
  1220.  VU1%
  1221.  "QTM_ReadVULevels",2 
  1222.  VU2%
  1223.  "QTM_ReadVULevels",3 
  1224.  VU3%
  1225.  "QTM_ReadVULevels",4 
  1226.  VU4%
  1227.  "Wimp_RedrawWindow",,Block% 
  1228.  Flag%
  1229.   OX%=Block%!4-Block%!20
  1230.   OY%=Block%!16-Block%!24
  1231.  Flag%
  1232.  OX%,OY%
  1233. DrawVUs
  1234.  "Wimp_GetRectangle",,Block% 
  1235.  Flag%
  1236.  HPlayWin%
  1237.  Play window
  1238.  "Wimp_RedrawWindow",,Block% 
  1239.  Flag%
  1240.   FX%=Block%!4-Block%!20
  1241.   FY%=Block%!16-Block%!24
  1242.  Flag%
  1243. 5   XMin%=(Block%!28-Block%!4+Block%!20) 
  1244.  OWCell%
  1245. 5   XMax%=(Block%!36-Block%!4+Block%!20) 
  1246.  OWCell%
  1247. 7   YMin%=-(Block%!40-Block%!16+Block%!24) 
  1248.  OHCell%
  1249. 6   YMax%=(Block%!16-Block%!32-Block%!24) 
  1250.  OHCell%
  1251.    SeqMin%=YMin% 
  1252.    SeqMax%=YMax% 
  1253.    YMin%=YMin% 
  1254.    YMax%=YMax% 
  1255.  128,0,0,0
  1256.    OX%=FX%
  1257. !   OY%=FY%-SeqMax%*64*OHCell%
  1258.  OX%,OY%
  1259.  0,0,255
  1260.  LINE 0,0,OWCell%*4,0
  1261.  x%=10 
  1262.  OWCell%*4-100 
  1263.  x%,0,10
  1264.  0,0,100
  1265.  3,0,0,255
  1266.    A%=50
  1267.    B%=0
  1268.      
  1269.  4*OWCell%,0,200-A%
  1270.     B%+=2
  1271.     A%+=B%
  1272.  A%>200
  1273.    Seq$=
  1274. (SeqMax%)
  1275. (Seq$) 
  1276.  1 : A%=1000
  1277.  2 : A%=500
  1278.  3 : A%=500
  1279.  <   
  1280.  "Font_FindFont",,"Homerton.Medium",A%,A%,0 
  1281.  Font%
  1282. ![   
  1283.  "ColourTrans_SetFontColours",0,0<<24 
  1284.  0<<16 
  1285.  0<<8,255<<24 
  1286.  100<<16 
  1287.  100<<8,14
  1288. "7   
  1289.  "Font_Paint",Font%,Seq$,&11 
  1290.  1<<8,OX%,OY%-50
  1291. $%   Pat$=
  1292. SeqToPattern(SeqMax%))
  1293. (Pat$) 
  1294.  1 : A%=1000
  1295.  2 : A%=500
  1296.  3 : A%=500
  1297. *<   
  1298.  "Font_FindFont",,"Homerton.Medium",A%,A%,0 
  1299.  Font%
  1300. +[   
  1301.  "ColourTrans_SetFontColours",0,0<<24 
  1302.  0<<16 
  1303.  0<<8,255<<24 
  1304.  100<<16 
  1305.  100<<8,14
  1306. ,E   
  1307.  "Font_Paint",Font%,Pat$,&11 
  1308.  1<<8,OX%+4*OWCell%-100,OY%-50
  1309.  SeqMin%<SeqMax% 
  1310.  2 patterns to draw.
  1311. 0'    Pattern%=
  1312. SeqToPattern(SeqMin%)
  1313. 1         
  1314.     OX%=FX%
  1315. 4"    OY%=FY%-SeqMin%*64*OHCell%
  1316.  OX%,OY%
  1317. 7*    
  1318. DrawTracker(XMin%,XMax%,YMin%,63)
  1319. 8'    Pattern%=
  1320. SeqToPattern(SeqMax%)
  1321.     OX%=FX%
  1322. :"    OY%=FY%-SeqMax%*64*OHCell%
  1323.  OX%,OY%
  1324.        
  1325. =)    
  1326. DrawTracker(XMin%,XMax%,0,YMax%)
  1327.     OX%=FX%
  1328. @#    OY%=FY%-SeqMin%*64*OHCell% 
  1329.  OX%,OY%
  1330. B'    Pattern%=
  1331. SeqToPattern(SeqMin%)
  1332. C-    
  1333. DrawTracker(XMin%,XMax%,YMin%,YMax%)
  1334. D       
  1335. F?   
  1336.  IF VCurPlaySeq%<SeqMax% AND VCurPlaySeq%>SeqMin% THEN 
  1337.  FX%,FY%
  1338. HH   
  1339. DrawPlayPosition(VCurPlayEvent%+VCurPlaySeq%*64,VChPlayState%())
  1340. I         
  1341. K-   
  1342.  "Wimp_GetRectangle",,Block% 
  1343.  Flag%
  1344.  Shell windows
  1345. ShellRedraw
  1346. R&  Pat%=
  1347. SeqToPattern(VCurPlaySeq%)
  1348. S"  PlayEntry%=
  1349. PatToEntry(Pat%)
  1350.  PlayEntry%<>-1 
  1351. U`   
  1352.  WinH%=Windows%(PlayEntry%,WHShell%) 
  1353. DrawPlayPosition(VCurPlayEvent%,VChPlayState%())
  1354. PlotIcon(x1%,y1%,w%,h%,String$,IconFlags%)
  1355.  $String%=String$
  1356.  String%?(
  1357. (String$))=&0D
  1358.  IconBlock%!0=x1%
  1359.  IconBlock%!4=y1%
  1360.  IconBlock%!8=x1%+w%
  1361.  IconBlock%!12=y1%+h%
  1362.  IconBlock%!16=IconFlags%
  1363.  IconBlock%!20=String%
  1364. f" IconBlock%!24=PaneIconString%
  1365.  IconBlock%!28=
  1366. (String$)
  1367.  "Wimp_PlotIcon",,IconBlock%
  1368. PollOpenWindow
  1369.  WinH%=Block%!0
  1370.  WinH% 
  1371.  HSamples%
  1372. OpenSamples(
  1373.  HSplData%
  1374.  "Wimp_OpenWindow",,Block% 
  1375.  HPlayWin%
  1376. OpenPlayWindow(
  1377.  "Wimp_OpenWindow",,Block%
  1378. SetPanes
  1379.  OPaneSeq%=
  1380.   Block2%!0=HPaneV%
  1381.  "Wimp_GetWindowState",,Block2%
  1382.   Block2%!4=Block%!4
  1383.   Block2%!8=Block%!8
  1384.   Block2%!12=Block%!4+100
  1385.   Block2%!16=Block%!16
  1386.   Block2%!20=0
  1387.   Block2%!24=Block%!24
  1388.   Block2%!28=HShell%
  1389.  "Wimp_OpenWindow",,Block2%
  1390.  OPaneVoice%=
  1391.   Block2%!0=HPaneH%
  1392.  "Wimp_GetWindowState",,Block2%
  1393.   Block2%!4=Block%!4+100
  1394.   Block2%!8=Block%!16-100
  1395.   Block2%!12=Block%!12
  1396.   Block2%!16=Block%!16
  1397.   Block2%!20=Block%!20
  1398.   Block2%!24=0
  1399.   Block2%!28=HPaneV%
  1400.  "Wimp_OpenWindow",,Block2%
  1401.  Block%!28=HPaneH%
  1402.  "Wimp_OpenWindow",,Block%
  1403. SetExtent(Entry%,WkX%,WkY%)
  1404.  OPaneSeq%=
  1405.  OX%=50 
  1406.  OX%=0
  1407.  OPaneVoice%=
  1408.  OY%=-50 
  1409.  OY%=0
  1410.  Block%!0=OX%
  1411.  Block%!4=-WkY%+OY%
  1412.  Block%!8=WkX%+OX%
  1413.  Block%!12=OY%
  1414.  "Wimp_SetExtent",Windows%(Entry%,WHShell%),Block%
  1415. ' Block%!0=Windows%(Entry%,WHShell%)
  1416.  "Wimp_GetWindowState",,Block%
  1417.  "Wimp_OpenWindow",,Block%
  1418.  Block2%!0=0
  1419.  Block2%!4=OY%
  1420.  Block2%!8=WkX%-OX%
  1421.  Block2%!12=0
  1422.  SYS "Wimp_SetExtent",Windows%(Entry%,WHPaneH%),Block2%
  1423.  Block2%!0=0
  1424.  Block2%!4=-WkY% :
  1425.  Block2%!8=100
  1426.  Block2%!12=OY%
  1427.  SYS "Wimp_SetExtent",Windows%(Entry%,WHPaneV%),Block2%
  1428. MemoryInit
  1429.  String% 255
  1430.  Block2% 500
  1431.  Icon% 50
  1432.  TemplBuffer% 3024*2
  1433.  Windows(100,50)
  1434.  Windows%(100,50)
  1435.  Windows$(100,3)
  1436.  Win% 500
  1437.  MenuBlock% 500 
  1438.  ******************************Key pressed***************************
  1439. KeyPressed
  1440.  WinH%=Block%!0
  1441.  IconH%=Block%!4
  1442.  WinH% 
  1443.  HParams%
  1444.   Index%=Block%!20
  1445.  IconH% 
  1446.  IDVal1%,IDVal2% : 
  1447. DirectInput(IconH%)
  1448.  HPlay%
  1449.  IconH% 
  1450.  10 :
  1451.  Speed tempo
  1452.  HSave%
  1453.  IconH% 
  1454.  Path
  1455.    Path$=
  1456. Writable(2)
  1457.  Valid path?
  1458.    ModulePath$=Path$
  1459. Save(Module%,ModuleLength%,ModulePath$,001)
  1460.  HSamples%
  1461.  Shell windows
  1462.  Entry%=FNHandleToEntry(WinH%)
  1463.   Entry%=EditEntry%
  1464.  EditEntry%=-1 
  1465. '  Cursor%=Windows%(Entry%,WCursor%)
  1466.   CC%=Block%!24
  1467.  CC%>=&18C 
  1468.  CC%<=&18E
  1469.    X%=Cursor% 
  1470.    Y%=Cursor% 
  1471.  Let's clear the old cursor position
  1472. F   OldNote%=!(Patterns%+Cursor%*4+1024*Windows%(Entry%,WPattern%))
  1473. RedrawCursor(
  1474. ,Entry%)
  1475.  CC% 
  1476.  &18C
  1477.  Left
  1478.     X%-=1
  1479.  X%<0 
  1480.  X%=0
  1481.  &18D
  1482.  Right
  1483.     X%+=1
  1484.  X%>3 
  1485.  X%=3
  1486.  &18F
  1487.     Y%-=1
  1488.  Y%<0 
  1489.  Y%=0
  1490.  &18E
  1491.  Down
  1492.     Y%+=1
  1493.  Y%>63 
  1494.  Y%=63
  1495.  &19E
  1496.  Page down
  1497.  &19F
  1498.  Page up
  1499. (    
  1500.  A Numeric key has been pressed
  1501.    Cursor%=X%+Y%*4
  1502. F   NewNote%=!(Patterns%+Cursor%*4+1024*Windows%(Entry%,WPattern%))
  1503.    Block%!0=HShell%
  1504.  "Wimp_GetWindowState",,Block%
  1505.    X1%=Block%!4+Block%!20
  1506.    Y1%=Block%!8-Block%!24
  1507.    X2%=Block%!12+Block%!20
  1508.    Y2%=Block%!16-Block%!24
  1509.      PageW%=Block%!12-Block%!4
  1510. !    PageH%=Block%!16-Block%!8
  1511.    A%=X%*OWCell%
  1512.    B%=Y%*OHCell%
  1513. &#   
  1514.  A%<X1% 
  1515.  Block%!20-=PageW%
  1516. '#   
  1517.  A%>X2% 
  1518.  Block%!20+=PageW%
  1519. (#   
  1520.  B%<Y1% 
  1521.  Block%!24+=PageH%
  1522. )#   
  1523.  B%>Y2% 
  1524.  Block%!24-=PageH%
  1525. +&   
  1526.  SYS "Wimp_OpenWindow",,Block%
  1527. -(   Windows%(Entry%,WCursor%)=Cursor%
  1528. /-   
  1529.  Let's update the new cursor position
  1530. RedrawCursor(
  1531. ,Entry%)
  1532. 2#   
  1533. UpdateNote(Entry%,NewNote%)
  1534.  CC%=&181 :
  1535.  CC%=&07F : 
  1536.  Delete
  1537. DeleteBlock
  1538.  "Wimp_ProcessKey",CC%
  1539.  ********************************END: KeyPressed**********************
  1540. CreateMenus
  1541. LibMenuInit
  1542.                    
  1543.  CompactFlag%=
  1544.  Samples list menus 
  1545.  MPSamples% 28+24*31+500
  1546.  SamplesName% 50*31 
  1547.  MPSamples2% 28+24*31+500
  1548.  SamplesName2% 50*31 
  1549.  Effect list menu 
  1550.  MPEffects% 28+24*50 
  1551.  MenuPtr%=MPEffects% 
  1552. LibMenuHeader("Effects",100)
  1553. LibMenuItem(0,-1,IconFlag%,"Arpeggio")
  1554. LibMenuItem(0,-1,IconFlag%,"Pitch slide up")
  1555. LibMenuItem(0,-1,IconFlag%,"Pitch slide down")
  1556. LibMenuItem(0,-1,IconFlag%,"Tone portamento")
  1557. LibMenuItem(0,-1,IconFlag%,"Vibrato")
  1558. LibMenuItem(0,-1,IconFlag%,"Tone portamento + Volume slide")
  1559. LibMenuItem(0,-1,IconFlag%,"Vibrato + Volume slide")
  1560. LibMenuItem(0,-1,IconFlag%,"Tremolo")
  1561. LibMenuItem(0,-1,IconFlag%,"Fine Pan Position *")
  1562. LibMenuItem(0,-1,IconFlag%,"Set sample offset")
  1563. LibMenuItem(0,-1,IconFlag%,"Volume slide")
  1564. LibMenuItem(0,-1,IconFlag%,"Jump to sequence")
  1565. LibMenuItem(0,-1,IconFlag%,"Set volume")
  1566. LibMenuItem(0,-1,IconFlag%,"Pattern break")
  1567.  MSExtFX% 28+24*50 
  1568. LibMenuItem(SubMenu%,MSExtFX%,IconFlag%,"Extended effects")
  1569. LibMenuItem(Last%,-1,IconFlag%,"Set speed/tempo")
  1570.  Extended Effect list submenu
  1571.  MenuPtr%=MSExtFX% 
  1572. LibMenuHeader("Extended effects",100)
  1573. LibMenuItem(0,-1,IconFlag%,"Set filter")
  1574. LibMenuItem(0,-1,IconFlag%,"Fine pitch slide up")
  1575. LibMenuItem(0,-1,IconFlag%,"Fine pitch slide down")
  1576. LibMenuItem(0,-1,IconFlag%,"Set glissando control")
  1577. LibMenuItem(0,-1,IconFlag%,"Set vibrato control")
  1578. LibMenuItem(0,-1,IconFlag%,"Set fine tuning")
  1579. LibMenuItem(0,-1,IconFlag%,"Pattern loop")
  1580. LibMenuItem(0,-1,IconFlag%,"Set tremolo control")
  1581. LibMenuItem(0,-1,IconFlag%,"Set pan position *")
  1582. LibMenuItem(0,-1,IconFlag%,"Retrig note")
  1583. LibMenuItem(0,-1,IconFlag%,"Fine volume slide up")
  1584. LibMenuItem(0,-1,IconFlag%,"Fine volume slide down")
  1585. LibMenuItem(0,-1,IconFlag%,"Note cut")
  1586. LibMenuItem(0,-1,IconFlag%,"Note delay")
  1587. LibMenuItem(0,-1,IconFlag%,"Pattern delay")
  1588. LibMenuItem(Last%,-1,IconFlag%,"Invert loop")
  1589.  IconBar menu 
  1590.  MPIconBar% 28+24*20 
  1591.  MenuPtr%=MPIconBar% 
  1592. LibMenuHeader("Pulse",100)
  1593. LibMenuItem(SubMenu%+DotLine%,HInfo%,IconFlag%,"Info")
  1594. LibMenuItem(0,-1,IconFlag%,"Note Edition")
  1595. LibMenuItem(0,-1,IconFlag%,"Sample definition")
  1596. LibMenuItem(0,-1,IconFlag%,"Song informations")
  1597. LibMenuItem(0,-1,IconFlag%,"Play position")
  1598. LibMenuItem(0,-1,IconFlag%,"SequenceTable")
  1599. LibMenuItem(0,-1,IconFlag%,"QTM Effects control")
  1600. LibMenuItem(0,-1,IconFlag%,"Play window")
  1601. LibMenuItem(DotLine%,-1,IconFlag%,"Close all windows")
  1602. LibMenuItem(0,-1,IconFlag%,"Options...")
  1603. LibMenuItem(0,-1,IconFlag%,"Reinit QTM")
  1604. LibMenuItem(Last%,-1,IconFlag%,"Quit")
  1605.  Shell menu 
  1606.  MPShell% 28+24*20
  1607.  MPSelect% 28+24*20
  1608.  MenuPtr%=MPShell% 
  1609. LibMenuHeader("PULSE",100)
  1610. LibMenuItem(SubMenu%,HSave%,IconFlag%,"Module...")
  1611. LibMenuItem(SubMenu%,HPatSave%,IconFlag%,"Pattern...")
  1612. LibMenuItem(SubMenu%,HCopy%,IconFlag%,"Copy Options...")
  1613. LibMenuItem(SubMenu%,MPSelect%,IconFlag%,"Selection...")
  1614. LibMenuItem(0,-1,IconFlag%,"Set play position")
  1615. LibMenuItem(0,-1,IconFlag%,"Reinit QTM")
  1616. LibMenuItem(Last%,-1,IconFlag%,"Clear pattern")
  1617.  MenuPtr%=MPSelect%
  1618. LibMenuHeader("Selection",100)
  1619. LibMenuItem(0,-1,IconFlag%,"Just forget")
  1620. LibMenuItem(0,-1,IconFlag%,"Delete")
  1621. LibMenuItem(SubMenu%,MPSamples2%,IconFlag%,"Change Sample")
  1622. LibMenuItem(SubMenu%,MPEffects%,IconFlag%,"Change Effect")
  1623. LibMenuItem(0,-1,IconFlag%,"Transpose")
  1624. LibMenuItem(Last%,-1,IconFlag%,"Quit")
  1625.  For writable menus
  1626.  WritableMenuBlock% 28+20+100
  1627.  MenuWrStr% 100
  1628.  Effects menus
  1629.   Wave form
  1630.  MPVibrato%  28+24*10
  1631.  MenuPtr%=MPVibrato% 
  1632. LibMenuHeader("Wave Form",100)
  1633. LibMenuItem(0,-1,IconFlag%,"Sine")
  1634. LibMenuItem(0,-1,IconFlag%,"Ramp down")
  1635. LibMenuItem(Last%,-1,IconFlag%,"Square")
  1636.  Glissando control
  1637.  MPGlissando% 28+24*5
  1638.  MenuPtr%=MPGlissando% 
  1639. LibMenuHeader("Glissando control",100)
  1640. LibMenuItem(0,-1,IconFlag%,"On (smooth slide)")
  1641. LibMenuItem(Last%,-1,IconFlag%,"Off (halftone to halftone)")
  1642.  MPPatBreak% 28+24*5
  1643.  MenuPtr%=MPGlissando% 
  1644. LibMenuHeader("Pattern",100)
  1645. LibMenuItem(0,-1,IconFlag%,"On")
  1646. LibMenuItem(Last%,-1,IconFlag%,"Off")
  1647.  *************************UpdateMenuSamples***************************
  1648. UpdateMenuSamples
  1649. ->CurrentEditSample%
  1650.  Edit samples Menu 
  1651.  MenuPtr%=MPSamples%
  1652. LibMenuHeader("Sample list",100)
  1653.  mem%=MenuPtr%
  1654.  N%=SamplesName%
  1655.  MenuFlag%=0
  1656.  S%=0 
  1657.  S%=30 
  1658.  MenuFlag%=%010000000
  1659. SampleInfo(S%+1,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  1660.    Name$=
  1661. GetSampleName(S%+1)
  1662.   SIconFlag%=IconFlag%
  1663.  Name$+=" (No sample)"
  1664.  Length%=0 
  1665.  SIconFlag%=(IconFlag% 
  1666. (&FF<<24)) 
  1667.  (11<<24)
  1668. /  Name$=
  1669. (S%+1)+". "+Name$+"  ^"+
  1670. (Length%)
  1671.   !mem%=MenuFlag%
  1672.   !(mem%+4)=-1
  1673.   L%=
  1674. (Name$)
  1675. 2  !(mem%+8)=SIconFlag% 
  1676.  (1<<8) : 
  1677.  Indirected
  1678.   !(mem%+12)=N%
  1679.   !(mem%+16)=0
  1680.   !(mem%+20)=L%
  1681.   $N%=Name$
  1682. !  N%?L%=&0D : 
  1683.  End character
  1684.   N%+=L%+1
  1685.   mem%+=24
  1686.  Put left tick
  1687.  CurrentEditSample%<>-1 
  1688. 2  Adr%=MPSamples%+28+24*(CurrentEditSample%-1)
  1689.   !Adr%=(!Adr% 
  1690.  Note menu samples.
  1691.  MenuPtr%=MPSamples2%
  1692. LibMenuHeader("Sample list",100)
  1693.  mem%=MenuPtr%
  1694.  N%=SamplesName2%
  1695.  MenuFlag%=0
  1696.  Name$="No sample"
  1697.  !mem%=MenuFlag%
  1698.  !(mem%+4)=-1
  1699. (Name$)
  1700. L !(mem%+8)=((IconFlag% 
  1701. (&FF<<24)) 
  1702.  (11<<24)) 
  1703.  (1<<8) : 
  1704.  Indirected
  1705.  !(mem%+12)=N%
  1706.  !(mem%+16)=0
  1707.  !(mem%+20)=L%
  1708.  $N%=Name$
  1709.   N%?L%=&0D : 
  1710.  End character
  1711.  N%+=L%+1
  1712.  mem%+=24
  1713.  S%=0 
  1714.  S%=30 
  1715.  MenuFlag%=%010000000
  1716. /  Length%=(!(SampleInfo%+S%*30+22)) 
  1717.  &FFFF
  1718.    Name$=
  1719. GetSampleName(S%+1)
  1720.   SIconFlag%=IconFlag%
  1721.  Length%=0 
  1722.  SIconFlag%=(IconFlag% 
  1723.  (1<<22))
  1724.   Name$=
  1725. (S%+1)+". "+Name$
  1726.   !mem%=MenuFlag%
  1727.   !(mem%+4)=-1
  1728.   L%=
  1729. (Name$)
  1730. 2  !(mem%+8)=SIconFlag% 
  1731.  (1<<8) : 
  1732.  Indirected
  1733.   !(mem%+12)=N%
  1734.   !(mem%+16)=0
  1735.   !(mem%+20)=L%
  1736.   $N%=Name$
  1737. !  N%?L%=&0D : 
  1738.  End character
  1739.   N%+=L%+1
  1740.   mem%+=24
  1741.  Put left tick 
  1742.  KCurrentNote%<>-1 
  1743. ReturnParams(KCurrentNote%,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  1744. $  Adr%=MPSamples2%+28+24*Sample%
  1745.   !Adr%=(!Adr% 
  1746. 1)+1 
  1747.  *******************************Menu selection****************************
  1748. PollMenuSelection
  1749.  CurrentMenu% 
  1750.  Note parameters
  1751.  MENUEffects%
  1752.  SelectEffect%=Block%!0
  1753.  SubEffect%=Block%!4
  1754. ReturnParams(KCurrentNote%,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  1755.  Effect%=SelectEffect%
  1756.  PitchEffect1%=0
  1757.  PitchEffect2%=0
  1758.  Effect%=14 
  1759.  PitchEffect1%=SubEffect%
  1760. 02 PitchEffect%=PitchEffect1%<<8 
  1761.  PitchEffect2%
  1762. StoreParams
  1763. UpdateNote(EditEntry%,Note%)
  1764. UpdateShell(Note%)
  1765.  MENUSamples%
  1766.  Note parameters
  1767.  NSample%=Block%!0
  1768. ReturnParams(KCurrentNote%,OSample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  1769.  Sample%=NSample%
  1770.  PitchEffect%=PitchEffect1%<<8 OR PitchEffect2%
  1771. StoreParams
  1772. UpdateNote(EditEntry%,Note%)
  1773. UpdateShell(Note%)
  1774.  MENUSamplesII%
  1775.  Sample edition.
  1776.  S%=(Block%!0)+1
  1777. UpdateSampleInfo(S%)
  1778.  MENUIconBar%
  1779.  Block%!0 
  1780.  1 : 
  1781.  Note edit
  1782. OpenWindow(HParams%)
  1783. OpenSamples(
  1784.  Window(HSamples%)
  1785. OpenWindow(HSongInfo%)
  1786.  4 : 
  1787.  Play position
  1788. OpenWindow(HPlay%)
  1789.  5 : 
  1790.  Sequence table
  1791. OpenWindow(HSequence%)
  1792.  6 : 
  1793.  QTM FX Control
  1794. OpenWindow(HFXControl%)
  1795.  7 : 
  1796.  Play window
  1797. OpenPlayWindow(
  1798.  8 : 
  1799.  Hide all windows
  1800. HideAllWins
  1801.  9 : 
  1802.  Options 
  1803. UpdateOptions
  1804. OpenWindow(HOptions%)
  1805.  10 : 
  1806.  Reinit QTM module
  1807. ReInitQTMMod
  1808.  MPShell%
  1809.  Entry%=Block%!0
  1810.  Entry% 
  1811.  2 : 
  1812.  Copy options
  1813. OpenWindow(HCopy%)
  1814.  3 : 
  1815.  Selection
  1816.   Entry%=Block%!4
  1817.  Entry% 
  1818.  0 : 
  1819.  Just forget
  1820. NoEditBlock
  1821.  1 : 
  1822.  Delete block
  1823. DeleteBlock
  1824.  2 : 
  1825.  Change sample
  1826. ChangeSample(Block%!8)
  1827.  3 : 
  1828.  Change effect
  1829. ChangeFX(Block%!8) 
  1830.  4 : 
  1831.  Set play position
  1832. x.  Event%=Windows%(EditEntry%,WCursor%) 
  1833. y4  Seq%=
  1834. PatToSeq(Windows%(EditEntry%,WPattern%))
  1835. SetPlayPosition(Seq%,Event%)
  1836.  5 : 
  1837. ReInitQTMMod 
  1838.  6 : 
  1839.  Clear whole pattern 
  1840. 2  P%=
  1841. PatToMem(Windows%(EditEntry%,WPattern%))
  1842.  A%=0 
  1843.  1024 
  1844.    P%!A%=0
  1845. LibUpdateWindow(Windows%(EditEntry%,WHShell%)) 
  1846.  WritableMenuBlock%
  1847.  AdrValue%=MenuBlock%!4
  1848.  Value%=
  1849. ($AdrValue%)
  1850.  MenuBlock%!0 
  1851.  0 : 
  1852.  Sequence menu
  1853.   Pat%=Value%
  1854.   Seq%=MenuBlock%!8
  1855.  Pat%<=NbPat% 
  1856.     ?(MemSequence%+Seq%)=Pat%
  1857.    Y%=-(Seq%+1)*CHIcons%
  1858.  "Wimp_ForceRedraw",HSequence%,0,Y%,400,Y%+CHIcons%
  1859.    Block%!0=0
  1860.    Error%=%100100000101
  1861. H   $(Block%+4)="Illegal pattern number: increase number of patterns"
  1862.  "Wimp_ReportError",Block%,Error%,TaskName$,-1,-1,-1 
  1863.  ,OK%
  1864.  Tempo settings
  1865.  Value%>255 
  1866.  Value%=255 : 
  1867.  "QTM_SetSpeed",Value%
  1868. UpdateInfoPlayPosition
  1869.  ****************************UPDATE NOTE**************************
  1870. UpdateNote(NewEntry%,NewNote%)
  1871.  Update note window regarding to NewNote%
  1872.  Update shell windows accordingly
  1873.  Sets VCurEditNote%=NewNote%,VCurEditEntry%=NewEntry%
  1874.  Note%,Octave%
  1875.  WinH%=HParams%
  1876.  OldEntry%=EditEntry%
  1877.  OldNote%=KCurrentNote%
  1878.  OldEntry%<>NewEntry% 
  1879.  NewEntry%=-1 
  1880.  Close Edit note window
  1881.    Block%!0=HParams%
  1882.  "Wimp_CloseWindow",,Block%
  1883.    EditEntry%=-1
  1884.  OldEntry%=-1 
  1885.  Open Edit note window
  1886. OpenWindow(HParams%)
  1887.  NewNote%<>OldNote% 
  1888. ReturnParams(OldNote%,OSample%,OPitch%,OEffect%,OPitchEffect1%,OPitchEffect2%)
  1889.  OPitchEffect%=PitchEffect%
  1890. ReturnParams(NewNote%,NSample%,NPitch%,NEffect%,NPitchEffect1%,NPitchEffect2%)
  1891.  NPitchEffect%=PitchEffect%
  1892.  NPitch%<>0 
  1893.  NPitch%<=&358 
  1894.  NPitch%>=&071 
  1895.  VPlayStatus%=
  1896.  "QTM_PlaySample",1,NSample%,NPitch%,64
  1897.  OSample%<>NSample% 
  1898.  NSample%<>0 
  1899. %   Name$=
  1900. GetSampleName(NSample%)
  1901. LibSetIconText2(IDNbSpl%,
  1902. (NSample%))
  1903. LibSetIconText2(IDSplName%,Name$)
  1904. LibSetIconText2(IDNbSpl%,"0")
  1905. LibSetIconText2(IDSplName%,"No sample")
  1906.  Sample Note Menu
  1907.  Remove old tick
  1908. %  Adr%=MPSamples2%+28+24*OSample%
  1909.   !Adr%=!Adr% 
  1910.  Tick to new sample
  1911. %  Adr%=MPSamples2%+28+24*NSample%
  1912.   !Adr%=(!Adr% 
  1913.  OPitch%<>NPitch% 
  1914.   WinH%=HParams%
  1915.  OPitch%>=&36 
  1916.  OPitch%<=&6B0 
  1917.    a%=-1
  1918.     a%+=1
  1919.  XPitch%(a%)=OPitch%
  1920.    XNote%=a%
  1921.    OOctave%=a%
  1922.  No pitch before
  1923.    XNote%=-1
  1924.    OOctave%=-1
  1925.  NPitch%>=&36 
  1926.  NPitch%<=&6B0 
  1927.    a%=-1
  1928.     a%+=1
  1929.  XPitch%(a%)=NPitch%
  1930.    NNote%=a%
  1931.    NOctave%=a%
  1932.    Note$=""
  1933.    A%=XNote%(a%)
  1934.    Note$+=
  1935. ((A%>>24) 
  1936.  &FF)
  1937.    Note$+=
  1938. ((A%>>16) 
  1939.  &FF)
  1940.    Note$+=
  1941. ((A%>>8) 
  1942.  &FF)
  1943. LibSetIconText2(IDNote%,Note$)
  1944.  No pitch now
  1945.    NNote%=-1
  1946.    NOctave%=-1
  1947.  XNote%=-1 
  1948.  NNote%<>-1 
  1949. DeselectIcon(35) : 
  1950. SelectIcon(IDKeybrd%+NNote%) : 
  1951. SelectIcon(IDKeybrd%+NOctave%+12)
  1952.  XNote%<>-1
  1953.  NNote%<>-1 
  1954. Z    
  1955.  XNote%<>NNote% 
  1956. DeselectIcon(IDKeybrd%+XNote%) : 
  1957. SelectIcon(IDKeybrd%+NNote%)
  1958. h    
  1959.  OOctave%<>NOctave% 
  1960. DeselectIcon(IDKeybrd%+OOctave%+12) : 
  1961. SelectIcon(IDKeybrd%+NOctave%+12)
  1962. "    
  1963.  XNote%<>-1 AND NNote%=-1
  1964. '    
  1965. DeselectIcon(IDKeybrd%+XNote%)
  1966. ,    
  1967. DeselectIcon(IDKeybrd%+OOctave%+12)
  1968. SelectIcon(35)
  1969.       
  1970. UpdatePitchEffect
  1971.  KCurrentNote%=NewNote%
  1972.  EditEntry%=NewEntry%
  1973. UpdatePitchEffect
  1974.  -> NEffect%,NPitchEffect1%,NPitchEffect2%,OPitchEffect1%,OPitchEffect2%
  1975.  -> WinH%
  1976.  OEffect%<>NEffect% 
  1977.  OPitchEffect%<>NPitchEffect% 
  1978.  Update FX Menu
  1979.  Remove old tick
  1980. $  Adr%=MPEffects%+28+24*OEffect%
  1981.   !Adr%=!Adr% 
  1982.  Tick to new FX
  1983. $  Adr%=MPEffects%+28+24*NEffect%
  1984.   !Adr%=(!Adr% 
  1985.   P1%=IDPitch1%
  1986.   V1%=IDVal1%
  1987.   P2%=IDPitch2%
  1988.   V2%=IDVal2%
  1989.  OEffect%<>NEffect% 
  1990. '7   
  1991. Effects(NEffect%,NPitchEffect1%,NPitchEffect2%)
  1992. (*   
  1993. LibSetIconText2(IDFXName%,LongFX$)
  1994.   KFXType%=FXType% 
  1995.  KFXType% 
  1996. .$   
  1997. LibSetIconText2(P1%,Pitch1$)
  1998. /$   
  1999. LibSetIconText2(P2%,Pitch2$)
  2000. 1.   
  2001. UndeleteIcon(P1%) : 
  2002. UndeleteIcon(V1%)
  2003. 2.   
  2004. UndeleteIcon(P2%) : 
  2005. UndeleteIcon(V2%)
  2006. 3(   
  2007. DeleteIcon(52) : 
  2008. DeleteIcon(51)
  2009.  KFXType% 
  2010. 8-   
  2011. LibSetIconText2(V1%,
  2012. (NPitchEffect%))
  2013. :    
  2014. LibSetIconText2(V2%,"0")
  2015. ;*   
  2016. EnableIcon(P1%) : 
  2017. EnableIcon(V1%)
  2018. <,   
  2019. DisableIcon(P2%) : 
  2020. DisableIcon(V2%)
  2021. ?*   
  2022. EnableIcon(P1%) : 
  2023. EnableIcon(V1%)
  2024. @*   
  2025. EnableIcon(P2%) : 
  2026. EnableIcon(V2%)
  2027. A/   
  2028.  IF OPitchEffect1%<>NPitchEffect1% THEN
  2029. B/    
  2030. LibSetIconText2(V1%,
  2031. (NPitchEffect1%))
  2032.  ENDIF
  2033. D/   
  2034.  IF OPitchEffect2%<>NPitchEffect2% THEN
  2035. E/    
  2036. LibSetIconText2(V2%,
  2037. (NPitchEffect2%))
  2038.  ENDIF
  2039.  Popup
  2040. J*   
  2041. DeleteIcon(P1%) : 
  2042. DeleteIcon(V1%)
  2043. K*   
  2044. DeleteIcon(P2%) : 
  2045. DeleteIcon(V2%)
  2046. L,   
  2047. UndeleteIcon(52) : 
  2048. UndeleteIcon(51)
  2049. M.   
  2050.  Text%=!(Menu%+28+24*PitchEffect1%+12)
  2051. N'   
  2052.  PROCLibSetIconText2(53,$Text%)
  2053.  Sub effect
  2054. Q$   
  2055. LibSetIconText2(P1%,Pitch1$)
  2056. R.   
  2057. LibSetIconText2(V1%,
  2058. (NPitchEffect2%))
  2059. S    
  2060. LibSetIconText2(V2%,"0")
  2061. T*   
  2062. EnableIcon(P1%) : 
  2063. EnableIcon(V1%)
  2064. U,   
  2065. DisableIcon(P2%) : 
  2066. DisableIcon(V2%)
  2067. V$   
  2068. LibSetIconText2(P2%,Pitch2$)
  2069.  ****************************END: UPDATE NOTE*********************************************
  2070. SetIconText(WinHandle%,IconHandle%,S$)
  2071.  Block%!0=WinHandle%
  2072.  Block%!4=IconHandle%
  2073.  "Wimp_GetIconState",,Block%
  2074.  Block%!8=0
  2075.  Block%!12=0
  2076. !!!!! Not documented in the PRM !!!!!
  2077.  $(Block%!28)=S$
  2078.  "Wimp_SetIconState",,Block%
  2079. FontInit
  2080.  A%=OWCell%/500*200
  2081.  "Font_FindFont",,"Homerton.Medium",A%,A%,0 
  2082.  DigitFont%
  2083.  A%=OWCell%/500*150
  2084.  "Font_FindFont",,"Corpus.Medium",A%,A%,0 
  2085.  EffectFont%
  2086.  Flag%=%0111
  2087.  SYS "Font_MakeBitmap",,DigitFont%,A%,A%,0,0,Flag%
  2088.  SYS "Font_MakeBitmap",,EffectFont%,A%,A%,0,0,Flag%
  2089. SetFontColour(R%,G%,B%)
  2090.  "ColourTrans_SetFontColours",0,0<<24 
  2091.  0<<16 
  2092.  0<<8,B%<<24 
  2093.  G%<<16 
  2094.  R%<<8,14
  2095. SongInfo
  2096.  NbVoices%=4
  2097.  NbPat%=NbPatterns%
  2098.  WinH%=HSongInfo%
  2099. LibSetIconText2(4,
  2100. (NbPat%))
  2101. LibSetIconText2(13,
  2102. (NbSamples%))
  2103. LibSetIconText2(7,
  2104. (NbVoices%))
  2105.  Tot. sample length
  2106. LibSetIconText2(16,
  2107. (SamplesLength%))
  2108.  "OS_ConvertFileSize",ModuleLength%,String%,100 
  2109.  T%?0=&0D
  2110.  PROCLibSetIconText2(10,$String%)
  2111. LibSetIconText2(10,
  2112. (ModuleLength%))
  2113.  TrackName$=""
  2114.  P%=Module%
  2115.      n%=0
  2116.   TrackName$+=
  2117. (?P%)
  2118.   P%+=1
  2119.   n%+=1
  2120.  n%=22 
  2121. LibSetIconText2(0,TrackName$)
  2122. IconState(IconH%)
  2123.  Block%!0=WinH%
  2124.  Block%!4=IconH%
  2125.  "Wimp_GetIconState",,Block%
  2126.  IconFlags%=Block%!24
  2127.  A%=(IconFlags%>>21) 
  2128.  A%=1 
  2129. SelectIcon(IconH%)
  2130.  Block%!0=WinH%
  2131.  Block%!4=IconH%
  2132.  Block%!8=1<<21
  2133.  Block%!12=1<<21
  2134.  "Wimp_SetIconState",,Block%
  2135. DeselectIcon(IconH%)
  2136.  Block%!0=WinH%
  2137.  Block%!4=IconH%
  2138.  Block%!8=0<<21
  2139.  Block%!12=1<<21
  2140.  "Wimp_SetIconState",,Block%
  2141. ReadOptions
  2142. Load(Block%,"<Pulse$Dir>.Options")
  2143.  OQuickDraw%=Block%!0
  2144.  OPaneVoice%=Block%!4
  2145.  OPaneSeq%=Block%!8
  2146.  OCursor%=Block%!12
  2147.  OWCell%=Block%!16
  2148.  OHCell%=Block%!20
  2149.  Width%=OWCell%
  2150.  Heigth%=OHCell%
  2151. UpdateOptions
  2152.  WinH%=HOptions%
  2153.  OQuickDraw%=
  2154. SelectIcon(1)
  2155. SelectIcon(2)
  2156.  IF OPaneVoice%=TRUE THEN PROCSelectIcon(6)
  2157.  IF OPaneSeq%=TRUE THEN PROCSelectIcon(7)
  2158.  CASE OCursor% OF
  2159.  WHEN 0 : PROCSelectIcon(10)
  2160.  WHEN 1 : PROCSelectIcon(11)
  2161.  WHEN 2 : PROCSelectIcon(12)
  2162.  ENDCASE
  2163. SetIconText(HOptions%,9,
  2164. (OWCell%))
  2165.  VModuleState%=
  2166. StopMod
  2167. InitQTM
  2168. RestoreQTM
  2169.  "Wimp_CloseDown",TaskName$,"TASK"
  2170.  "OS_Exit"
  2171. SampleInfo(Sample%,
  2172.  Length%,
  2173.  RepeatO%,
  2174.  RepeatL%,
  2175.  DV%,
  2176.  FTV%)
  2177. $ Adr%=SampleInfo%+30*(Sample%-1)
  2178. ! Length%=(!(Adr%+22)) 
  2179.  &FFFF
  2180. . Length%=Length%>>8 
  2181.  (Length%<<8) 
  2182.  &FF00
  2183.  Length%=Length%*2
  2184. " RepeatO%=(!(Adr%+26)) 
  2185.  &FFFF
  2186. 1 RepeatO%=RepeatO%>>8 
  2187.  (RepeatO%<<8) 
  2188.  &FF00
  2189.  RepeatO%=RepeatO%*2
  2190. " RepeatL%=(!(Adr%+28)) 
  2191.  &FFFF
  2192. 1 RepeatL%=RepeatL%>>8 
  2193.  (RepeatL%<<8) 
  2194.  &FF00
  2195.  RepeatL%=RepeatL%*2
  2196.  DV%=?(Adr%+25)
  2197.  FTV%=?(Adr%+24)
  2198. ReturnParams(Note%,
  2199.  Sample%,
  2200.  Pitch%,
  2201.  Effect%,
  2202.  PitchEffect1%,
  2203.  PitchEffect2%)
  2204.  <- PitchEffect%
  2205. - Sample%=(Note% 
  2206.  &F0) 
  2207.  (Note%>>20 
  2208. 0 Pitch%=(Note%>>8 
  2209.  &FF) 
  2210.  ((Note% 
  2211.  &F)<<8)
  2212.  Effect%=(Note%>>16) 
  2213. # PitchEffect1%=(Note%>>28) 
  2214. # PitchEffect2%=(Note%>>24) 
  2215.  Attention!
  2216. # PitchEffect%=(Note%>>24) 
  2217. StoreParams
  2218. -> Sample%,Pitch%,Effect%,PitchEffect%
  2219. <- Note%
  2220.  No PitchEffect1% or PitchEffect2%
  2221.  Note%=0
  2222. 7 Note%=Note% 
  2223.  (Sample% 
  2224.  &F)<<20 
  2225.  (Sample% 
  2226.  &F0)
  2227. 7 Note%=Note% 
  2228.  (Pitch% 
  2229.  &FF)<<8 
  2230.  (Pitch%>>8 
  2231.   Note%=Note% 
  2232.  (Effect%<<16)
  2233. % Note%=Note% 
  2234.  (PitchEffect%<<24)
  2235. DisableIcon(IconH%)
  2236.  Block%!0=WinH%
  2237.  Block%!4=IconH%
  2238.  Block%!8=1<<22
  2239.  Block%!12=1<<22
  2240.  "Wimp_SetIconState",,Block%
  2241. EnableIcon(IconH%)
  2242.  Block%!0=WinH%
  2243.  Block%!4=IconH%
  2244.  Block%!8=0<<22
  2245.  Block%!12=1<<22
  2246.  "Wimp_SetIconState",,Block%
  2247. DeleteIcon(IconH%)
  2248.  Block%!0=WinH%
  2249.  Block%!4=IconH%
  2250.  Block%!8=1<<23
  2251.  Block%!12=1<<23
  2252.  "Wimp_SetIconState",,Block%
  2253. UndeleteIcon(IconH%)
  2254.  Block%!0=WinH%
  2255.  Block%!4=IconH%
  2256.  Block%!8=0<<23
  2257.  Block%!12=1<<23
  2258.  "Wimp_SetIconState",,Block%
  2259. DrawBlock(Entry%,A%,B%)
  2260.  Entry%<>-1 
  2261.   X1%=(A% 
  2262.  4) * OWCell%
  2263.   Y2%=-(A% 
  2264.  4) * OHCell%
  2265.     1   X2%=(B% 
  2266.  4 + 1) * OWCell%
  2267.     2!  Y1%=-(B% 
  2268.  4 + 1) * OHCell%
  2269.     4(  Block%!0=Windows%(Entry%,WHShell%)
  2270.   Block%!4=X1%-2
  2271.   Block%!8=Y1%-2
  2272.   Block%!12=X2%+2
  2273.   Block%!16=Y2%+2
  2274.     :,  
  2275.  "Wimp_UpdateWindow",,Block% 
  2276.  Flag%
  2277.   OX%=Block%!4-Block%!20
  2278.   OY%=Block%!16-Block%!24
  2279.  Flag%
  2280.  OX%,OY%
  2281.     A1   
  2282.  3,CurColor%(0),CurColor%(1),CurColor%(2)
  2283.     B$   
  2284.  X1%,Y1%,X2%-X1%,Y2%-Y1%
  2285.     D-   
  2286.  "Wimp_GetRectangle",,Block% 
  2287.  Flag%
  2288. NoEditBlock
  2289.     J* Cursor%=Windows%(EditEntry%,WCursor%)
  2290.     K+ BlockEntry%=
  2291. PatToEntry(BlockPattern%)
  2292. SetBlockColor
  2293. DrawBlock(BlockEntry%,EditStart%,EditEnd%)
  2294. SetEditColor
  2295. DrawBlock(EditEntry%,Cursor%,Cursor%+(EditEnd%-EditStart%))
  2296.  BlockPattern%=-1
  2297.  EditStart%=-1
  2298.  EditEnd%=-1
  2299. NewBlock(NPattern%,NStart%,NEnd%)
  2300.  <- BlockPattern%,EditStart%,EditEnd%,EditEntry% 
  2301.  "Wimp_SetCaretPosition",WinH%,-1,0,0,-1,-1
  2302.  OEntry%=-1
  2303.     Z# NEntry%=
  2304. PatToEntry(NPattern%)
  2305.  OCursor%=-1
  2306.     \( NCursor%=Windows%(NEntry%,WCursor%)
  2307.  OStart%=EditStart%
  2308.  OEnd%=EditEnd%
  2309.     _/ EditCursor%=Windows%(EditEntry%,WCursor%) 
  2310.  BlockPattern%<>-1 
  2311.     b(  OEntry%=
  2312. PatToEntry(BlockPattern%)
  2313.     d9  
  2314.  OEntry%<>-1 
  2315.  OCursor%=Windows%(OEntry%,WCursor%)
  2316.     f0  
  2317.  OEntry%<>NEntry% 
  2318.  NEntry%<>EditEntry% 
  2319.     g0   
  2320.  Transform cursor in current edit cursor
  2321. RedrawCursor(
  2322. ,OEntry%)
  2323. RedrawCursor(
  2324. ,OEntry%)
  2325. RedrawCursor(
  2326. ,NEntry%)
  2327. RedrawCursor(
  2328. ,NEntry%)
  2329.  OCopyMode%<>2 
  2330.     p$   
  2331.  Erase previous origin block
  2332. SetBlockColor
  2333.     r(   
  2334. DrawBlock(OEntry%,OStart%,OEnd%)
  2335.     s)   
  2336.  Erase previous destination block
  2337. SetEditColor
  2338.     uE   
  2339. DrawBlock(EditEntry%,EditCursor%,EditCursor%+(OEnd%-OStart%))
  2340.  Duplicate mode
  2341.     x(   
  2342. DrawBlock(NEntry%,NStart%,NEnd%)
  2343.  OCopyMode%<>2 
  2344.     ~>  
  2345.  Draw origin block + destination block at the same pos.
  2346. SetBlockColor
  2347. DrawBlock(NEntry%,NCursor%,NCursor%+(NEnd%-NStart%))
  2348. SetEditColor                                       
  2349. DrawBlock(NEntry%,NCursor%,NCursor%+(NEnd%-NStart%))
  2350. DrawBlock(NEntry%,NCursor%,NCursor%)
  2351.  BlockPattern%=NPattern%
  2352.  EditStart%=NStart%
  2353.  EditEnd%=NEnd%
  2354.  EditEntry%=NEntry%
  2355. NewCursor(NEntry%,NCursor%)
  2356.  <- EditEntry%,Windows%(Entry%,WCursor%)
  2357.  Set new cursor position
  2358. % WinH%=Windows%(NEntry%,WHShell%)
  2359.  "Wimp_SetCaretPosition",WinH%,-1,0,0,-1,-1
  2360.  OEntry%=EditEntry%
  2361.  OCursor%=-1
  2362.  OEntry%<>-1 
  2363. )  OCursor%=Windows%(OEntry%,WCursor%)
  2364.  BlockPattern%<>-1 
  2365.  Erase old ghost block
  2366. SetEditColor
  2367. DrawBlock(OEntry%,OCursor%,OCursor%+(EditEnd%-EditStart%))
  2368.  OEntry%<>NEntry% 
  2369. RedrawCursor(
  2370. ,OEntry%)
  2371. RedrawCursor(
  2372. ,OEntry%)
  2373.  OEntry%<>NEntry% 
  2374. RedrawCursor(
  2375. ,NEntry%)
  2376.  BlockPattern%<>-1 
  2377.  Draw new ghost block
  2378. SetEditColor
  2379. DrawBlock(NEntry%,NCursor%,NCursor%+(EditEnd%-EditStart%))
  2380. ( Windows%(NEntry%,WCursor%)=NCursor%
  2381. RedrawCursor(
  2382. ,NEntry%)
  2383. F NewNote%=!(Patterns%+NCursor%*4+1024*Windows%(NEntry%,WPattern%))
  2384. UpdateNote(NEntry%,NewNote%)
  2385.  EditEntry%=NEntry%
  2386. RedrawCursor(Current%,Entry%)
  2387.  Entry%=-1 
  2388. & Cursor%=Windows%(Entry%,WCursor%)
  2389.  X%=Cursor% 
  2390.  Y%=Cursor% 
  2391. ' Block%!0=Windows%(Entry%,WHShell%)
  2392.  Block%!4=X%*OWCell%+2-10
  2393.   Block%!8=-OHCell%*(Y%+1)-10
  2394. $ Block%!12=X%*OWCell%+OWCell%+20
  2395. + Block%!16=-OHCell%*(Y%+1)+OHCell%+2+20
  2396.  "Wimp_UpdateWindow",,Block% 
  2397.  Flag%
  2398.  OX%=Block%!4-Block%!20
  2399.  OY%=Block%!16-Block%!24
  2400.  Flag%
  2401.  OX%,OY%
  2402.  Current%=
  2403.  3,255,0,0
  2404.  X%*OWCell%,-OHCell%*(Y%+1),OWCell%,OHCell%
  2405.  X%*OWCell%-2,-OHCell%*(Y%+1)-2,OWCell%+4,OHCell%+4
  2406.  X%*OWCell%-4,-OHCell%*(Y%+1)-4,OWCell%+8,OHCell%+8
  2407.                                 
  2408.  3,255,255,255
  2409.  X%*OWCell%,-OHCell%*(Y%+1),OWCell%,OHCell%
  2410.  "Wimp_GetRectangle",,Block% 
  2411.  Flag%
  2412. NewPattern(Pat%)
  2413.  PROCUpdatePlayPosition
  2414.  NbEntry%>0 
  2415. PatToEntry(Pat%)<>-1 
  2416.  NbEntry%+=1
  2417.  Entry%=
  2418. SearchEntry
  2419.  P%=TitlePat%+50*Entry%
  2420.   Title$="Pattern n
  2421. (Pat%)
  2422.  $P%=Title$
  2423.  New title
  2424.  TempPattern%!72=P%
  2425.  TempPattern%!76=0
  2426. % TempPattern%!80=5 :
  2427.  LEN(Title$)
  2428. ?(P%+5)=&0
  2429.  "Wimp_CreateWindow",,TempPattern% 
  2430.  HShell%
  2431. & Windows%(Entry%,WHPaneH%)=HPaneH%
  2432. & Windows%(Entry%,WHPaneV%)=HPaneV%
  2433. & Windows%(Entry%,WHShell%)=HShell%
  2434.   Windows%(Entry%,WCursor%)=0
  2435. - Windows%(Entry%,WFreeFlag%)=-1 :
  2436.  Locked
  2437. $ Windows%(Entry%,WPattern%)=Pat%
  2438. SetExtent(Entry%,OWCell%*4,64*OHCell%)
  2439.  Block%!0 = HShell%
  2440.  Block%!4 = 100
  2441.  Block%!8 = 100
  2442.  Block%!12 = 2000
  2443.  Block%!16 = 1200
  2444.  Block%!20 = 0
  2445.  Block%!24 = 0
  2446.  Block%!28 = -1
  2447.  PROCSetPanes
  2448.  PROCOpenWindow(HShell%)
  2449.  Block%!0=HShell%
  2450.  Block%!4 = 0.1*XScreen%*2
  2451.  Block%!8 = 0.1*YScreen%*2
  2452.  Block%!12 = 0.9*XScreen%*2
  2453.  Block%!16 = 0.9*YScreen%*2
  2454.  Block%!20 = 0
  2455.  Block%!24 = 0
  2456.  Block%!28 = -1
  2457.  "Wimp_OpenWindow",,Block%
  2458. InitTempPattern
  2459.  TitlePat% 1000 : 
  2460.  Win titles
  2461.  TempPattern% 500
  2462.  "Wimp_OpenTemplate",,"<PULSE$Dir>.Templates"
  2463.  "Wimp_LoadTemplate",,TempPattern%,TitlePat%,TitlePat%+500,-1,"Shell",0
  2464.  "Wimp_CloseTemplate"
  2465. ClosePattern(WinH%)
  2466. ! Entry%=
  2467. HandleToEntry(WinH%)
  2468.  IF Entry%<>-1 THEN
  2469. #  Windows%(Entry%,WFreeFlag%)=0
  2470.   Block%!0=WinH%
  2471.  "Wimp_CloseWindow",,Block%
  2472.  Entry%=EditEntry% 
  2473.  Disable note window.
  2474. UpdateNote(-1,-1)
  2475.  IF Entry%=BlockEntry% THEN
  2476.  BlockEntry%=-1
  2477.  Erase destination block
  2478.  ENDIF
  2479.   NbEntry%-=1
  2480.  ENDIF
  2481. PatToMem(Pat%)
  2482. =Patterns%+1024*Pat%
  2483. SearchEntry
  2484.  Entry%
  2485.  Entry%=-1
  2486.   Entry%+=1
  2487.  Windows%(Entry%,WFreeFlag%)=0
  2488. =Entry%
  2489. HandleToEntry(WinH%)
  2490.  Entry%,Offset%
  2491.  Entry%=0
  2492.  Offset%=0
  2493.  Entry%=NbEntry% 
  2494.  Windows%(Offset%,WFreeFlag%)=-1 
  2495. 34   
  2496.  Windows%(Offset%,WHShell%)=WinH% 
  2497.  =Offset%
  2498.    Entry%+=1
  2499.   Offset%+=1
  2500. PatToEntry(Pattern%)
  2501.  Entry%,Offset%
  2502.  Entry%=0
  2503.  Offset%=0
  2504.  Entry%=NbEntry% 
  2505.  Windows%(Offset%,WFreeFlag%)=-1 
  2506. @8   
  2507.  Windows%(Offset%,WPattern%)=Pattern% 
  2508.  =Offset%
  2509.    Entry%+=1
  2510.   Offset%+=1
  2511. SeqToPattern(S%) = ?(MemSequence%+S%)
  2512. PatToSeq(P%)
  2513. I    A%=-1
  2514.  A%+=1
  2515.  ?(MemSequence%+A%)=P%
  2516. UpdateSampleInfo(Sample%)
  2517.  "Wimp_SetCaretPosition",-1
  2518.  Remove old menu tick
  2519.  CurrentEditSample%<>-1 
  2520. S2  Adr%=MPSamples%+28+24*(CurrentEditSample%-1)
  2521.   !Adr%=!Adr% 
  2522.  Tick to new sample
  2523. W& Adr%=MPSamples%+28+24*(Sample%-1)
  2524.  !Adr%=(!Adr% 
  2525.  CurrentEditSample%=Sample%
  2526. [" Name$=
  2527. GetSampleName(Sample%)
  2528.  Name$="*Untitled*" 
  2529.  Name$=""
  2530.  WinH%=HSamples%
  2531. LibSetIconText2(1,
  2532. (Sample%)) : 
  2533.  Sample number
  2534. LibSetIconText2(2,Name$)
  2535. SampleInfo(Sample%,Length%,RepeatO%,RepeatL%,DV%,FTV%)
  2536. LibSetIconText2(4,
  2537. (Length%))
  2538. LibSetIconText2(6,
  2539. (RepeatO%))
  2540. LibSetIconText2(8,
  2541. (RepeatL%))
  2542. LibSetIconText2(10,
  2543. (DV%))
  2544. LibSetIconText2(13,
  2545. (FTV%))
  2546.  Length%=0
  2547. SelectIcon(17)
  2548. DisableIcon(6)
  2549. DisableIcon(8)
  2550. DisableIcon(10)
  2551. DisableIcon(13)
  2552. DisableIcon(18)
  2553. LibSetExtent(HSplData%,X2Spl%-X1Spl%,500)
  2554.  "Wimp_ForceRedraw",HSplData%,0,Y1Spl%-Y2Spl%,X2Spl%-X1Spl%,0
  2555.  Length%<X2Spl%-X1Spl%
  2556. DeselectIcon(17)
  2557. EnableIcon(6)
  2558. EnableIcon(8)
  2559. EnableIcon(10)
  2560. EnableIcon(13)
  2561. EnableIcon(18)
  2562.  Redraw sample data window
  2563. LibSetExtent(HSplData%,X2Spl%-X1Spl%,500)
  2564.  "Wimp_ForceRedraw",HSplData%,0,Y1Spl%-Y2Spl%,X2Spl%-X1Spl%,0
  2565. DeselectIcon(17)
  2566. EnableIcon(6)
  2567. EnableIcon(8)
  2568. EnableIcon(10)
  2569. EnableIcon(13)
  2570. EnableIcon(18)
  2571.  Redraw sample data window
  2572. LibSetExtent(HSplData%,Length%*2,500)
  2573.  "Wimp_ForceRedraw",HSplData%,0,Y1Spl%-Y2Spl%,Length%*2,0
  2574. LibWinInitScroll(HSplData%)
  2575. Constants
  2576.  Arrays
  2577.  WHShell%=0
  2578.  WHPaneH%=1
  2579.  WHPaneV%=2
  2580.  WCursor%=3
  2581.  WNote%=4
  2582.  WPattern%=5
  2583.  WFreeFlag%=6
  2584.  Others...
  2585.  MENUSamples%=0
  2586.  MENUEffects%=1
  2587.  MENUSamplesII%=2
  2588.  MENUIconBar%=3
  2589.  DRAGSample%=0
  2590.  DRAGTrack%=1
  2591.  DRAGAllSamples%=2
  2592.  DRAGPattern%=3
  2593.  DRAGAllPats%=4
  2594. " CenterYSpl%=(Y1Spl%-Y2Spl%)/2
  2595.  CHIcons%=50
  2596. SetIconIDs
  2597. InitVariables
  2598. ! EditPattern%=0 : 
  2599.  Don't use
  2600. ! BlockEntry%=-1 : 
  2601.  Don't use
  2602. ) EditEntry%=0 : 
  2603.  Edit Cursor's entry
  2604. ) BlockPattern%=-1 : 
  2605.  Block's pattern
  2606. + EditStart%=-1 : 
  2607.  Start block's offset
  2608. ' EditEnd%=-1 : 
  2609.  End block's offset
  2610.  NbEntry%=0
  2611.  DragCase%=0
  2612.  VModuleState%=
  2613.  VPlayStatus%=
  2614.  VCurPlayEntry%=-1
  2615.  VCurSpeed%=-1
  2616.  VoiceSpl%(4,2)
  2617.  VChPlayState%(3)
  2618.  VOChPlayState%(3)
  2619.  DragBlock% 100
  2620.  VChPlayState%()=1
  2621.  VOChPlayState%()=1
  2622.  VCurPlaySeq%=-1
  2623.  VCurPlayEvent%=-1
  2624.  CurrentEditSample%=-1
  2625.  KCurrentNote%=-1
  2626.  ChangeMode%=
  2627.  VModify%=
  2628.  VPlayEdit%=
  2629. SetIconIDs
  2630.  Note parameters
  2631.  IDNoteFX%=1
  2632.  IDPPFX%=2
  2633.  IDFXName%=3
  2634.  IDPitch1%=4
  2635.  IDPitch2%=6
  2636.  IDVal1%=5
  2637.  IDVal2%=7
  2638.  IDSample%=9
  2639.  IDPPSpl%=10
  2640.  IDNbSpl%=11
  2641.  IDSplName%=12
  2642.  IDKeybrd%=13
  2643.  IDLNote%=30
  2644.  IDNote%=31
  2645.  IDRNote%=32
  2646.  IDNoNote%=33
  2647.  IDEditMode%=34
  2648.  IDSndOn%=35
  2649. NewNote(Entry%)
  2650.  Update cursor of Entry%
  2651. & Handle%=Windows%(Entry%,WHShell%)
  2652. & Cursor%=Windows%(Entry%,WCursor%)
  2653.  X0%=(Cursor% 
  2654.  4)*OWCell%
  2655. " Y0%=-(Cursor% 
  2656.  4 +1)*OHCell%
  2657.  "Wimp_ForceRedraw",Handle%,X0%,Y0%,X0%+OWCell%,Y0%+OHCell%
  2658.  VModify%=
  2659. SearchAdrSample(A%)
  2660.  Length%
  2661.  0<=A%<=31
  2662.  A%=0 
  2663.  P%=MemSamples%
  2664.  Length%=0
  2665.      S%=0
  2666.   P%+=Length%
  2667. 0  Length%=!(MemSampleInfo%+S%*30+22) 
  2668.  &FFFF
  2669. 1  Length%=Length%>>8 
  2670.  ((Length%<<8) 
  2671.  &FF00)
  2672.   Length%=Length%*2
  2673.   S%+=1
  2674.  S%=A%
  2675. MoveMemory(P%,Offset%)
  2676.  Offset%: Size to move
  2677.  "Hourglass_On"
  2678.   L%=ModuleLength%-(P%-Heap%)
  2679.  HeapSize%+=Offset%
  2680.  ModuleLength%+=Offset%
  2681. # NbPages%=HeapSize% 
  2682.  PageSize%
  2683.  (HeapSize% 
  2684.  PageSize%)>0 
  2685.  NbPages%+=1
  2686.  "Wimp_SlotSize",BASICSize%+PageSize%*NbPages%,-1 
  2687.  SlotSize%
  2688.  Offset%>0 
  2689.  A%=P%+L% 
  2690.    ?(A%+Offset%)=?A%
  2691.  A%=P% 
  2692.  P%+L% 
  2693.    ?A%=?(A%-Offset%)
  2694.  "Hourglass_Off"
  2695.  VModify%=
  2696. LoadModule(Path$)
  2697.  LastSeq%=0
  2698.  LastEvent%=0
  2699.  "Hourglass_On"
  2700.  ModulePath$=Path$
  2701.  "OS_File",20,Path$ 
  2702.  ,,,,ModuleLength%
  2703. 0' HeapSize%=ModuleLength%+BASICSize%
  2704. 2# NbPages%=HeapSize% 
  2705.  PageSize%
  2706.  (HeapSize% 
  2707.  PageSize%)>0 
  2708.  NbPages%+=1
  2709.  "Wimp_SlotSize",PageSize%*NbPages%,-1 :
  2710.  TO SlotSize%
  2711.  Heap%=
  2712.  Module%=Heap%
  2713.  Update Save window
  2714.  WinH%=HSave%
  2715. LibSetIconText2(2,Path$)
  2716. Load(Module%,Path$)
  2717.  "QTM_Load",Path$,0
  2718. =' Patterns%=Module%+20+30*31+2+128+4
  2719.  MemPatterns%=Patterns%
  2720. ?$ MemSequence%=Module%+20+30*31+2
  2721.  Let's find the number of patterns by scanning the sequence
  2722.  Max%=0
  2723.  A%=0 
  2724.   B%=?(MemSequence%+A%)
  2725.  B%>Max% 
  2726.  Max%=B%
  2727.  NbPatterns%=Max%
  2728. J1 Samples%=MemPatterns%+(NbPatterns%+1)*4*4*64
  2729.  MemSamples%=Samples%
  2730.  SampleInfo%=Module%+20
  2731.  MemSampleInfo%=SampleInfo%
  2732.  Then the total data sample length 
  2733.  Length%=0
  2734. Q     S%=0
  2735.  SamplesLength%=0
  2736. S     N%=0
  2737. U0  Length%=!(MemSampleInfo%+S%*30+22) 
  2738.  &FFFF
  2739. V1  Length%=Length%>>8 
  2740.  ((Length%<<8) 
  2741.  &FF00)
  2742.   SamplesLength%+=Length%*2
  2743.  Length%<>0 
  2744.  N%+=1
  2745.   S%+=1
  2746.  S%=31
  2747.  NbSamples%=N%
  2748. SongInfo
  2749. UpdateNbSeq 
  2750. UpdateMenuSamples
  2751. UpdateSampleInfo(1)
  2752.  NbEntry%>0 
  2753.  Close all previous shell windows
  2754.   I%=0
  2755.   A%=0
  2756. f%   
  2757.  Windows%(I%,WFreeFlag%)=-1 
  2758. g#    WinH%=Windows%(I%,WHShell%)
  2759. ClosePattern(WinH%)
  2760.     A%+=1
  2761.    I%+=1
  2762.  NbEntry%=0
  2763.  VModuleState%=
  2764. OpenSamples(
  2765. OpenWindow(HPlay%)
  2766. OpenWindow(HSongInfo%)
  2767.   VModuleState%=
  2768. StopMod
  2769. ReInitQTMMod
  2770. ResizePlayWindow
  2771. LibUpdateWindow(HPlayWin%)
  2772. LibWinSetScroll(HPlayWin%,0,100)
  2773.  "Hourglass_Off"
  2774. DirectInput(IconH%)
  2775.  S$=$
  2776. Writable(IconH%)
  2777.  Let's find an illegal character in S$
  2778. S$,1)
  2779.  C%<&30 
  2780.  C%>&39 
  2781. S$) : 
  2782. LibSetIconText2(IconH%,S$) 
  2783.  S$="" 
  2784.   Val%=0
  2785.  PROCLibSetIconText2(IconH%,"0")
  2786.   Val%=
  2787. ReturnParams(KCurrentNote%,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  2788.  PFX1%=PitchEffect1%
  2789.  PFX2%=PitchEffect2%
  2790.  KFXType% 
  2791.  Val%>255 
  2792.  Val%=255 : 
  2793. LibSetIconText2(IconH%,"255") : 
  2794.  IconH% 
  2795.  IDVal1% : PFX2%=Val%
  2796.   PitchEffect%=PFX2%
  2797.  Val%>15 
  2798.  Val%=15 : 
  2799. LibSetIconText2(IconH%,"15") : 
  2800.  IconH% 
  2801.  IDVal1% : PFX1%=Val%
  2802.  IDVal2% : PFX2%=Val%
  2803. %  PitchEffect%=(PFX1%<<4) 
  2804.  PFX2%
  2805.  IF PitchEffect1%<>Val% OR PitchEffect2%<>Val% THEN
  2806. StoreParams
  2807. \  !(Patterns%+Windows%(EditEntry%,WCursor%)*4+1024*Windows%(EditEntry%,WPattern%))=Note%
  2808.   KCurrentNote%=Note%
  2809. NewNote(EditEntry%)
  2810.  ENDIF
  2811.  Entry%=EditEntry%
  2812.  The selected block is pasted...
  2813. & Cursor%=Windows%(Entry%,WCursor%)
  2814. , PatternDest%=Windows%(Entry%,WPattern%)
  2815.  EditPattern%=BlockPattern%
  2816. $ WinH%=Windows%(Entry%,WHShell%)
  2817.  X1%=EditStart% 
  2818.  Y1%=EditStart% 
  2819.  X2%=EditEnd% 
  2820.  Y2%=EditEnd% 
  2821.  X0%=Cursor% 
  2822.  Y0%=Cursor% 
  2823.  D%=Block%
  2824.  Y%=Y1% 
  2825.  X%=X1% 
  2826. 4   O%=MemPatterns%+1024*EditPattern%+(X%+Y%*4)*4
  2827.    !D%=!O%
  2828.    D%+=4
  2829. % A%=Cursor%+(EditEnd%-EditStart%)
  2830.  X1%=Cursor% 
  2831.  Y1%=Cursor% 
  2832.  X2%=A% 
  2833.  Y2%=A% 
  2834.  OCopyMode%=2 
  2835.    A%=Y2% : B%=Y1% : Step%=-1
  2836.   A%=Y1% : B%=Y2% : Step%=1
  2837.  OCopyMode%<>3 
  2838.  O%=Block%
  2839.  Y%=A% 
  2840.  Step%
  2841.  X%=X1% 
  2842. 4   D%=MemPatterns%+1024*PatternDest%+(X%+Y%*4)*4
  2843.    !D%=!O%
  2844.    O%+=4
  2845.  Duplicate
  2846. 7 O%=!(MemPatterns%+1024*EditPattern%+(X0%+Y0%*4)*4)
  2847.  Y%=A% 
  2848.  Step%
  2849.  X%=X1% 
  2850. 4   D%=MemPatterns%+1024*PatternDest%+(X%+Y%*4)*4
  2851.    !D%=O%
  2852.  X2%+=1
  2853.  Y2%+=1
  2854.  Now, let's redraw the destination block
  2855.  "Wimp_ForceRedraw",WinH%,X1%*OWCell%,-Y2%*OHCell%,X2%*OWCell%,-Y1%*OHCell%
  2856.  VModify%=
  2857. Effects(FX%,P1%,P2%)
  2858.  P%=P1%<<8 
  2859.  P2% 
  2860.  <- ShortFX$, LongFX$, PitchStr$, Pitch1$, Pitch2$, FXType%, Menu%
  2861.  FXType%:    0: Error, undefined 
  2862.              1: 1 Pitch value  
  2863.              2: 2 Pitchs values
  2864.              3: 1 Pitch sub effect
  2865.              4: 1 Pitch text sub effect (popup)
  2866.  ShortFX$:   Abreviation FX for printing
  2867.  LongFX$:    Real name FX for popup
  2868.  PitchStr$:  Pitch text abreviation.
  2869.  Pitch1$:    Pitch 1
  2870.  Pitch2$:    Pitch 2
  2871.  Menu%:      MenuPopup if FXType%=4
  2872.  Pitch1$="Pitch 1"
  2873.  Pitch2$="Pitch 2"
  2874. $ FXType%=2 :
  2875.  Default (2 pitchs)
  2876.  FX% 
  2877.  &0 : 
  2878.  Arpeggio
  2879.   LongFX$="Arpeggio"
  2880. #  Pitch1$="1st halftone (0-15)"
  2881. #  Pitch2$="2nd halftone (0-15)"
  2882.   ShortFX$="Arpgio"
  2883.  &1 : 
  2884.  Portamento Up
  2885.   LongFX$="Portamento Up"
  2886.   Pitch1$="Increase speed"
  2887.   ShortFX$="PortUp"
  2888.   FXType%=1
  2889.  &2 : 
  2890.  Portamento Down
  2891.   LongFX$="Portamento Down"
  2892.   Pitch1$="Decrease speed"
  2893.   ShortFX$="PortDn"
  2894.   FXType%=1
  2895.  &3 : 
  2896.  Portamento to Note
  2897. "  LongFX$="Portamento to Note"
  2898. !  Pitch1$="Pitch slide speed"
  2899.   ShortFX$="TonPrt"
  2900.   FXType%=1
  2901.  &4 : 
  2902.  Vibrato
  2903.   LongFX$="Vibrato"
  2904.   Pitch1$="Speed"
  2905.   Pitch2$="Depth"
  2906.   ShortFX$="Vibrto"
  2907.   Menu%=MPVibrato%
  2908.  &5 : 
  2909.  PTN + Vol sliding
  2910. +  LongFX$="Portamento + Volume sliding"
  2911.    Pitch1$="Portamento Speed"
  2912.  "  Pitch2$="Slide Volume Speed"
  2913.   ShortFX$="TPt+VS"
  2914.  &6 : 
  2915.  Vibrato + Vol sliding
  2916. #(  LongFX$="Vibrato + Volume sliding"
  2917.   Pitch1$="Vibrato Speed"
  2918. %"  Pitch2$="Slide Volume Speed"
  2919.   ShortFX$="Vrt+VS"
  2920.  &7 : 
  2921.  Tremolo
  2922.   LongFX$="Tremolo"
  2923. )#  Pitch1$="Volume change speed"
  2924. *#  Pitch2$="Volume change depth"
  2925.   ShortFX$="Tremlo"
  2926.   LongFX$="Undefined"
  2927.   ShortFX$="Undefined"
  2928.   FXType%=0 
  2929.  &9 : 
  2930.  Sample Offset
  2931.   FXType%=1
  2932. 2!  LongFX$="Set Sample Offset"
  2933. 3(  Pitch1$="Offset in sample DIV 256"
  2934.   ShortFX$="SplOff"
  2935.  &A : 
  2936.  Volume slide
  2937.  Special case (n0 or 0n)
  2938.   ShortFX$="VolSld"
  2939.   LongFX$="Volume slide"
  2940.   FXType%=1
  2941.  P2%=0 
  2942.  PitchEffect%=P1% 
  2943.  PitchEffect%=-P2%
  2944.  &B : 
  2945.  Pos jump
  2946.   LongFX$="Position jump"
  2947.   Pitch1$="Pattern Number"
  2948.   FXType%=1
  2949.   ShortFX$="PosJmp"
  2950.  &C : 
  2951.  Set volume
  2952.   LongFX$="Set volume"
  2953.   ShortFX$="SetVol"
  2954. C!  Pitch1$="New volume (0-64)"
  2955.   FXType%=1
  2956.  &D : 
  2957.  Pattern break
  2958.   LongFX$="Pattern break"
  2959.   ShortFX$="PatBrk"
  2960.   FXType%=1
  2961.  Extended Effects
  2962.   FXType%=3
  2963.   PitchEffect%=P2%
  2964.  P1% 
  2965.  0 : ShortFX$="SetFilter" : LongFX$="Set Filter" : FXType%=4
  2966.  1 : ShortFX$="SldUp" : LongFX$="Slide up" : FXType%=4
  2967.  2 : ShortFX$="SldDown" : LongFX$="Slide down"
  2968.  3 : ShortFX$="Glisndo" : LongFX$="Glissando"
  2969. T1   
  2970.  P2%=1 
  2971.  PitchStr$="On" 
  2972.  PitchStr$="Off"
  2973.    FXType%=4
  2974.  4 : ShortFX$="VbrCtrl" : LongFX$="Set vibrato control" 
  2975.  PitchEffect% 
  2976.  0 : PitchStr$="Sinus"
  2977.  1 : PitchStr$="Const"
  2978. [    
  2979.  2 : PitchStr$="SinRect"
  2980.  3 : PitchStr$="Random"
  2981.    FXType%=4
  2982.  5 : ShortFX$="FineTun" : LongFX$="Set Fine Tune"
  2983.  7 : ShortFX$="TremForm" : LongFX$="Set Tremolo Waveform"
  2984.  PitchEffect% 
  2985.  0 : PitchStr$="Sinus"
  2986. e!   
  2987.  1 : PitchStr$="RampDown"
  2988.  2 : PitchStr$="Square"
  2989.    FXType%=4
  2990.  8 : ShortFX$="NotUsed" : LongFX$="Not Used" : FXType%=0
  2991.  9 : ShortFX$="RetrigNote" : LongFX$="Retrig Note"
  2992.  10 : ShortFX$="FinVolSld+" : LongFX$="Fine Volume Slide Up"
  2993.  11 : ShortFX$="FinVolSld-" : LongFX$="Fine Volume Slide Down"
  2994.  12 : ShortFX$="NoteCut" : LongFX$="Note Cut"
  2995.  13 : ShortFX$="NoteDelay" : LongFX$="Note Delay"
  2996.  14 : ShortFX$="PatrnDelay" : LongFX$="Pattern Delay"
  2997.  15 : ShortFX$="InvrtLoop" : LongFX$="Invert Loop"
  2998.    ShortFX$=
  2999. (P1%)
  3000.   ShortFX$="SetSpeed"
  3001.   LongFX$="Set speed/tempo"
  3002.   FXType%=1
  3003.   ShortFX$=
  3004. (FX%)
  3005.   FXType%=0 
  3006. CreateSplDir(Path$)
  3007.  "OS_File",8,Path$,,,0
  3008. GetSampleName(S%)
  3009.  0<=S%<=31
  3010.  S%>0 
  3011.  M%=SampleInfo%+(S%-1)*30
  3012.  ?M%<>0 
  3013.  ?M%<>&0D 
  3014.    Name$=""
  3015.    a%=0
  3016.  ?M%<>0 
  3017.  a%<>22
  3018.     Name$+= 
  3019. (?M%)
  3020.     M%+=1
  3021.     a%+=1
  3022.    Name$="*Untitled*"
  3023.   Name$="No sample"
  3024. =Name$
  3025. PlayLine(Seq%,Event%)
  3026. 7 Adr%=Patterns%+Event%*4*4+
  3027. SeqToPattern(Seq%)*1024
  3028.  Note1%=!(Adr%)
  3029.  Note2%=!(Adr%+4)
  3030.  Note3%=!(Adr%+8)
  3031.  Note4%=!(Adr%+12)
  3032. ReturnParams(Note1%,Sample1%,Pitch1%,Effect1%,PitchEffect11%,PitchEffect21%)
  3033. ReturnParams(Note2%,Sample2%,Pitch2%,Effect2%,PitchEffect12%,PitchEffect22%)
  3034. ReturnParams(Note3%,Sample3%,Pitch3%,Effect3%,PitchEffect13%,PitchEffect23%)
  3035. ReturnParams(Note4%,Sample4%,Pitch4%,Effect4%,PitchEffect14%,PitchEffect24%)
  3036. Z Cond1%=Sample1%<>0 
  3037.  Pitch1%<>0 
  3038.  Pitch1%>=&071 
  3039.  Pitch1%<=&358 
  3040.  VOChPlayState%(0)=1
  3041. Z Cond2%=Sample2%<>0 
  3042.  Pitch2%<>0 
  3043.  Pitch2%>=&071 
  3044.  Pitch2%<=&358 
  3045.  VOChPlayState%(1)=1
  3046. Z Cond3%=Sample3%<>0 
  3047.  Pitch3%<>0 
  3048.  Pitch3%>=&071 
  3049.  Pitch3%<=&358 
  3050.  VOChPlayState%(2)=1
  3051. Z Cond4%=Sample4%<>0 
  3052.  Pitch4%<>0 
  3053.  Pitch4%>=&071 
  3054.  Pitch4%<=&358 
  3055.  VOChPlayState%(3)=1
  3056.  Cond1% 
  3057.  "QTM_PlaySample",1,Sample1%,Pitch1%,64
  3058.  Cond2% 
  3059.  "QTM_PlaySample",2,Sample2%,Pitch2%,64
  3060.  Cond3% 
  3061.  "QTM_PlaySample",3,Sample3%,Pitch3%,64
  3062.  Cond4% 
  3063.  "QTM_PlaySample",4,Sample4%,Pitch4%,64
  3064. UpdateInfoPlayPosition
  3065.  Update play window
  3066.  <-VCurSpeed%
  3067.  WinH%=HPlay%
  3068. UpdatePlaySpeed
  3069.  OldSeq%<>NewSeq% 
  3070. LibSetWritableText(3,
  3071. (NewSeq%))
  3072. LibSetWritableText(2,
  3073. SeqToPattern(NewSeq%)))
  3074.  OldEvent%<>NewEvent% 
  3075. LibSetWritableText(12,
  3076. (NewEvent%))
  3077.  VCurSpeed%=NewSpeed%
  3078. UpdatePlaySpeed
  3079.  OldSpeed%=VCurSpeed%
  3080.  "QTM_ReadSpeed" 
  3081.  ,NewSpeed%
  3082.  OldSpeed%<>NewSpeed% 
  3083. LibSetWritableText(10,
  3084. (NewSpeed%))
  3085. SetPlayPosition(Seq%,Event%)
  3086.  "QTM_Pos",Seq%,Event%
  3087. UpdatePlayPosition
  3088. SetCurPlayVars
  3089.  OldEntry%=VCurPlayEntry%
  3090.  OldSeq%=VCurPlaySeq%
  3091.  OldEvent%=VCurPlayEvent%
  3092.  "QTM_Pos",-1,-1 
  3093.  NewSeq%,NewEvent%
  3094.   Pat%=
  3095. SeqToPattern(NewSeq%)
  3096.   NewEntry%=
  3097. PatToEntry(Pat%)
  3098. UpdatePlayPosition
  3099.  Update BASIC vars.
  3100.  ->VCurPlayEntry%,VCurPlaySeq%,VCurPlayEvent%
  3101.  <-VCurPlayEntry%,VCurPlaySeq%,VCurPlayEvent%
  3102. SetCurPlayVars
  3103.  ChannelStateChanged%=VOChPlayState%(0)<>VChPlayState%(0) 
  3104.  VOChPlayState%(1)<>VChPlayState%(1) 
  3105.  VOChPlayState%(2)<>VChPlayState%(2) 
  3106.  VOChPlayState%(3)<>VChPlayState%(3)
  3107.  OldSeq%<>NewSeq% 
  3108.  Update sequence table.
  3109.   Block%!0=HSequence%
  3110.   Block%!4=0
  3111.   Block%!8=-50*NbSeq%
  3112.   Block%!12=OWCell%*4
  3113.   Block%!16=0
  3114.  "Wimp_UpdateWindow",,Block% 
  3115.  Flag%
  3116.   OX%=Block%!4-Block%!20
  3117.   OY%=Block%!16-Block%!24
  3118.  Flag%
  3119.  OX%,OY%
  3120.  3,100,0,0
  3121.  0,-(OldSeq%+1)*50,100,50
  3122.  3,100,0,0
  3123.  0,-(NewSeq%+1)*50,100,50
  3124. DrawAllSeqPat(OldSeq%)
  3125. DrawAllSeqPat(NewSeq%)
  3126.  "Wimp_GetRectangle",,Block% 
  3127.  Flag%
  3128.  OldSeq%<>NewSeq% 
  3129.  OldEvent%<>NewEvent% 
  3130.  ChannelStateChanged% 
  3131. UpdateInfoPlayPosition
  3132.  Update Play window
  3133.   Block%!0=HPlayWin%
  3134.   Block%!4=0
  3135. (  Y%=-OHCell%*(OldEvent%+OldSeq%*64)
  3136.   Block%!8=Y%-OHCell%
  3137.   Block%!12=OWCell%*4
  3138.   Block%!16=Y%+2
  3139.  "Wimp_UpdateWindow",,Block% 
  3140.  Flag%
  3141.   OX%=Block%!4-Block%!20
  3142.   OY%=Block%!16-Block%!24
  3143.   OY%-=OldSeq%*64*OHCell%
  3144.  Flag%
  3145.  OX%,OY%
  3146. DrawPlayPosition(OldEvent%,VOChPlayState%())
  3147.  "Wimp_GetRectangle",,Block% 
  3148.  Flag%
  3149.   Block%!0=HPlayWin%
  3150.   Block%!4=0
  3151. (  Y%=-OHCell%*(NewEvent%+NewSeq%*64)
  3152.   Block%!8=Y%-OHCell%
  3153.   Block%!12=OWCell%*4
  3154.   Block%!16=Y%+2
  3155.  "Wimp_UpdateWindow",,Block% 
  3156.  Flag%
  3157.   OX%=Block%!4-Block%!20
  3158.   OY%=Block%!16-Block%!24
  3159.   OY%-=NewSeq%*64*OHCell%
  3160.  Flag%
  3161.  OX%,OY%
  3162. !3   
  3163. DrawPlayPosition(NewEvent%,VChPlayState%())
  3164. #-   
  3165.  "Wimp_GetRectangle",,Block% 
  3166.  Flag%
  3167.  (OldEntry%=NewEntry% 
  3168.  NewEntry%<>-1) 
  3169.  Same window
  3170. ),   Block%!0=Windows%(NewEntry%,WHShell%)
  3171.    Block%!4=0
  3172.    Block%!8=-64*50*2
  3173.    Block%!12=OWCell%*4
  3174.    Block%!16=0
  3175. /-   
  3176.  "Wimp_UpdateWindow",,Block% 
  3177.  Flag%
  3178.    OX%=Block%!4-Block%!20
  3179.    OY%=Block%!16-Block%!24
  3180.  Flag%
  3181.  OX%,OY%
  3182. 45    
  3183. DrawPlayPosition(OldEvent%,VOChPlayState%())
  3184. 54    
  3185. DrawPlayPosition(NewEvent%,VChPlayState%())
  3186. 7.    
  3187.  "Wimp_GetRectangle",,Block% 
  3188.  Flag%
  3189. :9   
  3190.  The play pointer has moved out of a shell window
  3191.  OldEntry%<>-1 
  3192. <-    Block%!0=Windows%(OldEntry%,WHShell%)
  3193.     Block%!4=0
  3194.     Block%!8=-64*50*2
  3195.     Block%!12=OWCell%*4
  3196.     Block%!16=0
  3197. B.    
  3198.  "Wimp_UpdateWindow",,Block% 
  3199.  Flag%
  3200.     OX%=Block%!4-Block%!20
  3201.     OY%=Block%!16-Block%!24
  3202.  Flag%
  3203.      
  3204.  OX%,OY%
  3205. G=     
  3206. DrawPlayPosition(OldEvent%,VOChPlayState%())       
  3207.      
  3208. I/     
  3209.  "Wimp_GetRectangle",,Block% 
  3210.  Flag%
  3211. J        
  3212.  NewEntry%<>-1 
  3213. N-    Block%!0=Windows%(NewEntry%,WHShell%)
  3214.     Block%!4=0
  3215.     Block%!8=-64*50*2
  3216.     Block%!12=OWCell%*4
  3217.     Block%!16=0
  3218. T.    
  3219.  "Wimp_UpdateWindow",,Block% 
  3220.  Flag%
  3221.     OX%=Block%!4-Block%!20
  3222.     OY%=Block%!16-Block%!24
  3223.  Flag%
  3224.      
  3225.  OX%,OY%
  3226. Y5     
  3227. DrawPlayPosition(NewEvent%,VChPlayState%())
  3228.      
  3229.  0,0      
  3230. [/     
  3231.  "Wimp_GetRectangle",,Block% 
  3232.  Flag%
  3233. \        
  3234.   VCurPlaySeq%=NewSeq%
  3235.   VCurPlayEvent%=NewEvent%
  3236.   VCurPlayEntry%=NewEntry%
  3237. d% VOChPlayState%()=VChPlayState%()
  3238. CreateWritableMenu(MX%,MY%,MenuName$,InitValue%)
  3239.  <- MenuBlock%!4:String adress
  3240. i$ CurrentMenu%=WritableMenuBlock%
  3241. j  MenuPtr%=WritableMenuBlock%
  3242. LibMenuHeader(MenuName$,100)
  3243.  MenuPtr%-=28
  3244.  $MenuWrStr%=MenuName$
  3245.  MenuPtr%!0=MenuWrStr%
  3246.  MenuPtr%!4=0
  3247.  MenuPtr%!8=
  3248. (MenuName$)
  3249.  MenuPtr%+=28
  3250. LibMenuItem(Last%+Writable%+TitleInd%,-1,IconFlag%,"9999")
  3251.  MenuPtr%-=24
  3252. u' MenuPtr%!12=MenuWrStr%+50 :
  3253.  Value
  3254. v, MenuPtr%!16=MenuWrStr%+30 :
  3255.  Validation
  3256.  $(MenuWrStr%+30)="A0-9"
  3257. x# $(MenuWrStr%+50)=
  3258. (InitValue%)
  3259.  "Wimp_CreateMenu",,WritableMenuBlock%,MX%,MY%
  3260.  MenuBlock%!4=MenuWrStr%+50
  3261. DefineIconH
  3262.  ->WinH%,IconH%
  3263.  WinH% 
  3264.  HParams%
  3265.  Drawing procedures
  3266. ShellRedraw
  3267.  Shell windows redraw
  3268. ! Entry%=
  3269. HandleToEntry(WinH%)
  3270. & Cursor%=Windows%(Entry%,WCursor%)
  3271. ( Pattern%=Windows%(Entry%,WPattern%)
  3272.  "Wimp_RedrawWindow",,Block% 
  3273.  Flag%
  3274.  OX%=Block%!4-Block%!20
  3275.  OY%=Block%!16-Block%!24
  3276.  SYS "QTM_Pos",-1,-1 TO Seq%,Event%
  3277.  Seq%=0
  3278.  Event%=0
  3279.  Flag%
  3280. 4  XMin%=(Block%!28-Block%!4+Block%!20) 
  3281.  OWCell%
  3282. 4  XMax%=(Block%!36-Block%!4+Block%!20) 
  3283.  OWCell%
  3284. 6  YMin%=-(Block%!40-Block%!16+Block%!24) 
  3285.  OHCell%
  3286. 5  YMax%=(Block%!16-Block%!32-Block%!24) 
  3287.  OHCell%
  3288.  YMax%>64 
  3289.  YMax%=64
  3290.  YMin%<64 
  3291.   HShell%=WinH%
  3292.  WinH% 
  3293.  HPaneV%
  3294.     Y%=-YMin%*(OHCell%+1)
  3295.  S%=YMin% 
  3296.  YMax%
  3297.      Y%-=OHCell%+1
  3298. 9     
  3299. PlotIcon(0,Y%,100,OHCell%,
  3300. (S%),PaneIconFlags%)
  3301.         
  3302.  HPaneH%
  3303. <    
  3304. PlotIcon(0,-50,OWCell%,50,"Voice 1",PaneIconFlags%)
  3305. B    
  3306. PlotIcon(OWCell%,-50,OWCell%,50,"Voice 2",PaneIconFlags%)
  3307. D    
  3308. PlotIcon(OWCell%*2,-50,OWCell%,50,"Voice 3",PaneIconFlags%)
  3309. D    
  3310. PlotIcon(OWCell%*3,-50,OWCell%,50,"Voice 4",PaneIconFlags%)
  3311.  HShell%
  3312.  128,0,0,0
  3313.  16   
  3314.  OX%,OY%
  3315. DrawTracker(XMin%,XMin%,YMin%,YMax%)
  3316.  VCurPlayEntry%=Entry% 
  3317. DrawPlayPosition(VCurPlayEvent%,VChPlayState%())
  3318.  Edition Cursor
  3319.     X0%=(Cursor% 
  3320.  4)*OWCell%
  3321. $   Y0%=-(Cursor% 
  3322.  4 +1)*OHCell%
  3323.  EditEntry%<>Entry% 
  3324.  3,255,255,255
  3325. "    
  3326.  X0%,Y0%,OWCell%,OHCell%
  3327. SetBlockColor
  3328. "    
  3329.  X0%,Y0%,OWCell%,OHCell%
  3330. *    
  3331.  X0%-2,Y0%-2,OWCell%+4,OHCell%+4
  3332. *    
  3333.  X0%-4,Y0%-4,OWCell%+8,OHCell%+8
  3334.  BlockPattern%<>-1 
  3335. $    X1%=(EditStart% 
  3336.  4)*OWCell%
  3337. %    Y1%=-(EditStart% 
  3338.  4)*OHCell%
  3339. &    X2%=(EditEnd% 
  3340.  4 + 1)*OWCell%
  3341. '    Y2%=-(EditEnd% 
  3342.  4 + 1)*OHCell%
  3343.  Ghost Block (Blue)
  3344.  EditEntry%=Entry% 
  3345.      
  3346. SetEditColor
  3347.      Y0%+=OHCell%
  3348. &     
  3349.  X0%,Y0%,X2%-X1%,Y2%-Y1%
  3350.         
  3351.  Edit Block (Red)
  3352. 4    
  3353.  BlockPattern%=Windows%(Entry%,WPattern%) 
  3354.      
  3355. SetBlockColor
  3356. &     
  3357.  X1%,Y1%,X2%-X1%,Y2%-Y1%
  3358.         
  3359.       
  3360.  "Wimp_GetRectangle",,Block% 
  3361.  Flag%
  3362. DrawTracker(XMin%,XMin%,YMin%,YMax%)
  3363.  -> ORIGIN OX%,OY%
  3364.  -> OX%,OY% for fonts!
  3365.  -> Pattern%
  3366. SetFontColour(255,255,255)
  3367.  Here, we search for same sample: same colour
  3368. ! Pos%=Patterns%+1024*Pattern%
  3369.  VoiceSpl%(0,0)=0
  3370.  VoiceSpl%(1,0)=0
  3371.  VoiceSpl%(2,0)=0
  3372.  VoiceSpl%(3,0)=0
  3373.  VoiceSpl%(0,1)=0
  3374.  VoiceSpl%(1,1)=0
  3375.  VoiceSpl%(2,1)=0
  3376.  VoiceSpl%(3,1)=0
  3377.  E%=0 
  3378.  YMin%
  3379.  C%=0 
  3380. ReturnParams(Pos%!0,NSample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  3381.    OSample%=VoiceSpl%(C%,0)
  3382.  NSample%<>0 
  3383.  OSample%<>NSample% 
  3384. )    VoiceSpl%(C%,1)=1-VoiceSpl%(C%,1)
  3385.      VoiceSpl%(C%,0)=NSample%
  3386.    Pos%+=4
  3387.  N% = YMin% 
  3388.  YMax%
  3389.  V% = XMin% 
  3390.  XMax%
  3391. /   Pos%=Patterns%+N%*4*4+V%*4+1024*Pattern%
  3392. ReturnParams(Pos%!0,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  3393.  Sample%<>0 
  3394.  VoiceSpl%(V%,0)<>Sample% 
  3395. )    VoiceSpl%(V%,1)=1-VoiceSpl%(V%,1)
  3396.     VoiceSpl%(V%,0)=Sample%
  3397.     4   
  3398. Effects(Effect%,PitchEffect1%,PitchEffect2%)
  3399.  Pos%!0<>0 
  3400.    Note$=""
  3401.  Pitch%<>0 
  3402.     a%=-1
  3403.         
  3404.      a%+=1
  3405. $    
  3406.  XPitch%(a%)=Pitch% 
  3407.  a%>60
  3408.  a%<60 
  3409.      A%=XNote%(a%)
  3410. !     Note$+=
  3411. ((A%>>24) 
  3412.  &FF)
  3413. !     Note$+=
  3414. ((A%>>16) 
  3415.  &FF)
  3416.       Note$+=
  3417. ((A%>>8) 
  3418.  &FF)
  3419.         
  3420.      Note$="???"
  3421.         
  3422.  OQuickDraw%=
  3423.     X%=V%*OWCell%-120
  3424.     Y%=-N%*OHCell%-10
  3425.  Sample%<>0 
  3426.  7     
  3427.  VoiceSpl%(V%,1)=0 
  3428.  255,0,0 
  3429.  255,255,0 
  3430.      
  3431.  X%,Y%
  3432.      
  3433.  Sample%
  3434. #        
  3435.  0,255,0
  3436.  X%+200,Y%
  3437.  Note$
  3438.  255,255,255
  3439. *#    
  3440.  Effect%=0 
  3441.  100,100,100
  3442. ,(    
  3443.  Effect%<>0 
  3444.  PitchEffect%<>0 
  3445.      
  3446.  X%+300,Y%
  3447.      
  3448.  ShortFX$
  3449. /        
  3450.      FXType%=0
  3451. 1        
  3452.  FXType% 
  3453.      
  3454.  0,0,255
  3455.      
  3456.  X%+350,Y%
  3457.      
  3458.  PitchEffect1%
  3459.      
  3460.  0,0,255
  3461.      
  3462.  X%+400,Y%
  3463.      
  3464.  PitchEffect2%
  3465.      
  3466.  100,100,255
  3467.      
  3468.  X%+350,Y%
  3469.      
  3470.  PitchEffect%
  3471. A        
  3472. D3    
  3473.  Font antialiased mode (slow mode...ACORN)
  3474.     X%=V%*OWCell%+OX%
  3475.     Y%=-(N%+1)*OHCell%+OY%
  3476.     y%=1/5*OHCell%
  3477. J         
  3478.  Sample%<>0 
  3479. MS     
  3480.  VoiceSpl%(V%,1)=0 
  3481. SetFontColour(255,0,0) 
  3482. SetFontColour(255,255,0) 
  3483. NO     
  3484.  "Font_Paint",DigitFont%,
  3485. (Sample%),&11 
  3486.  1<<8,X%+2/50*OWCell%,Y%+y%
  3487. O        
  3488. SetFontColour(0,255,0)
  3489. TJ    
  3490.  "Font_Paint",DigitFont%,Note$,&11 
  3491.  1<<8,X%+12/50*OWCell%,Y%+y%
  3492.  FXType% 
  3493. W+    
  3494.  -1 : 
  3495. SetFontColour(255,100,100) 
  3496. X&    
  3497.  -2 : 
  3498. SetFontColour(255,0,0)
  3499. Y'    
  3500.  0 : 
  3501. SetFontColour(255,255,0)
  3502. Z'    
  3503. SetFontColour(255,255,255)
  3504. [        
  3505. ](    
  3506.  Effect%<>0 
  3507.  PitchEffect%<>0 
  3508. ^O     
  3509.  "Font_Paint",EffectFont%,ShortFX$,&11 
  3510.  1<<8,X%+22/50*OWCell%,Y%+y%
  3511. _        
  3512.      FXType%=0
  3513. a        
  3514.  FXType% 
  3515. e"     
  3516. SetFontColour(100,0,255)
  3517. fV     
  3518.  "Font_Paint",DigitFont%,
  3519. (PitchEffect1%),&11 
  3520.  1<<8,X%+37/50*OWCell%,Y%+y%
  3521. gV     
  3522.  "Font_Paint",DigitFont%,
  3523. (PitchEffect2%),&11 
  3524.  1<<8,X%+43/50*OWCell%,Y%+y%
  3525.  1,-1
  3526. i$     
  3527. SetFontColour(100,100,255)
  3528. jU     
  3529.  "Font_Paint",DigitFont%,
  3530. (PitchEffect%),&11 
  3531.  1<<8,X%+40/50*OWCell%,Y%+y%
  3532.  0,-2
  3533. l        
  3534.  Voices separation
  3535.  0,255,0,255
  3536.  OWCell%,0,OWCell%,-OHCell%*64
  3537.  OWCell%*2,0,OWCell%*2,-OHCell%*64
  3538.  OWCell%*3,0,OWCell%*3,-OHCell%*64
  3539. DrawPlayPosition(Event%,Ch%())
  3540.  ->ORIGIN
  3541.  Y%  
  3542.  3,255,255,255
  3543.  0,-OHCell%*(Event%+1),OWCell%*4,OHCell%
  3544.  3,255,255,0
  3545.  Y%=-OHCell%*(Event%+1)
  3546.  Ch%(0)=1 
  3547.  0,Y%,OWCell%,OHCell%
  3548.  Ch%(1)=1 
  3549.  OWCell%,Y%,OWCell%,OHCell%
  3550.  Ch%(2)=1 
  3551.  OWCell%*2,Y%,OWCell%,OHCell%
  3552.  Ch%(3)=1 
  3553.  OWCell%*3,Y%,OWCell%,OHCell%
  3554. DrawRepeatBlock
  3555.  ->ORIGIN OX%,OY%
  3556.  ->XMax%,XMin%,RepeatO%,RepeatL%
  3557.  RepeatO%<XMax% 
  3558.  RepeatL%>0 
  3559.   A%=RepeatO%-XMin%
  3560. "  B%=(RepeatO%+RepeatL%)-XMax%
  3561.   D%=(X2Spl%-X1Spl%)/2
  3562.  A%<0 
  3563.  x1%=0 
  3564.  x1%=A%
  3565.  B%<0 
  3566.  x2%=D%+B% 
  3567.  x2%=D%
  3568.  x1%<x2% 
  3569.  x2%>0 
  3570.  3,255,255,0
  3571.  x1%*2,CenterYSpl%*2,(x2%-x1%)*2,-CenterYSpl%*2
  3572. ReInitQTMMod
  3573.  Tempory: Save track file for QTM
  3574.  VModuleState%=
  3575.  "Hourglass_On"
  3576.  "QTM_ReadSpeed" 
  3577.  Play%,Speed%
  3578. Save(Module%,ModuleLength%,TransfertPath$,001)
  3579.  "QTM_Load",TransfertPath$,0
  3580.  "QTM_Pos",VCurPlaySeq%,VCurPlayEvent%
  3581.  Play%<>0 
  3582.  "QTM_Start" 
  3583.  "QTM_SetSpeed",Play%
  3584.  "QTM_SetSpeed",Speed%
  3585.  "Hourglass_Off"
  3586.  VModify%=
  3587. RestoreQTM
  3588.  A%=&0 
  3589.  "QTM_EffectControl",A%,1
  3590.  "QTM_EffectControl",(&E<<4)
  3591. HideAllWins
  3592. LibCloseWindow(HSplData%)
  3593. LibCloseWindow(HSamples%)
  3594. LibCloseWindow(HSongInfo%)
  3595. LibCloseWindow(HOptions%)
  3596. LibCloseWindow(HSequence%)
  3597. LibCloseWindow(HPlay%)
  3598. LibCloseWindow(HParams%)
  3599. ClosePlayWindow
  3600.  Close all shell windows
  3601.      I%=0
  3602.      A%=0
  3603.  A%<NbEntry%
  3604.  Windows%(I%,WFreeFlag%)=-1 
  3605.    A%+=1
  3606. LibCloseWindow(Windows%(I%,WHShell%))
  3607.   I%+=1
  3608. PauseMod
  3609.  "QTM_Pause"
  3610. % PollMask%=(PollMask% 
  3611.  1)) +1
  3612.  VPlayStatus%=
  3613. StartMod
  3614. SoundModule
  3615.  VModify%=
  3616. ReInitQTMMod
  3617.  LastSeq%=VCurPlaySeq%
  3618.  LastEvent%=VCurPlayEvent%
  3619.  "QTM_Start"
  3620.   PollMask%=PollMask% 
  3621.  VPlayStatus%=
  3622. StopMod
  3623. PauseMod
  3624. SetPlayPosition(0,0) 
  3625. UpdateShell(NewNote%)
  3626. * Cursor%=Windows%(EditEntry%,WCursor%)
  3627. H !(Patterns%+Cursor%*4+1024*Windows%(EditEntry%,WPattern%))=NewNote%
  3628. NewNote(EditEntry%)
  3629.  VModify%=
  3630. GetLeafPath(Path$)
  3631.  Length%=
  3632. (Path$)
  3633.      B%=0
  3634.   L%=B%
  3635.   B%=
  3636. Path$,".",L%+1)
  3637.  B%=0
  3638.  Leaf$=
  3639. Path$,Length%-L%)
  3640. =Leaf$
  3641. InitQTM
  3642. RestoreQTMSound
  3643. SoundModule
  3644.  VChPlayState%(0)=1 
  3645.  "QTM_RestoreChannel",1 
  3646.  "QTM_RemoveChannel",1
  3647.  VChPlayState%(1)=1 
  3648.  "QTM_RestoreChannel",2 
  3649.  "QTM_RemoveChannel",2
  3650.  VChPlayState%(2)=1 
  3651.  "QTM_RestoreChannel",3 
  3652.  "QTM_RemoveChannel",3
  3653.  VChPlayState%(3)=1 
  3654.  "QTM_RestoreChannel",4 
  3655.  "QTM_RemoveChannel",4
  3656.  "QTM_Stereo",1,-127
  3657.  "QTM_Stereo",4,-127
  3658.  "QTM_Stereo",2,127
  3659.  "QTM_Stereo",3,127
  3660. RestoreQTMSound
  3661.  "QTM_SoundControl",4,0,-1
  3662.  C%=1 
  3663.  "QTM_RestoreChannel",C%
  3664.  "QTM_Stereo",1,-127
  3665.  "QTM_Stereo",4,-127
  3666.  "QTM_Stereo",2,127
  3667.  "QTM_Stereo",3,127
  3668. StartDrag(Drag%,Sprite$)
  3669.  -> X%,Y%
  3670.  Block%!0=WinH%
  3671.  Block%!4=IconH%
  3672.  "Wimp_GetIconState",,Block%
  3673.  X%+=Block%!16
  3674.  Y%+=Block%!20
  3675.  Flags%=%11000101
  3676.  Block%!0=X%+16
  3677.  Block%!4=Y%+16
  3678.  Block%!8=X%-16
  3679.  Block%!12=Y%-16
  3680.  "DragASprite_Start",Flags%,1,Sprite$,Block%,0
  3681.  DragCase%=Drag%
  3682.  &6B0,&650,&5F5,&5A0,&54F,&503,&4BB,&477,&436,&3FA,&3C1,&386
  3683.  &358,&328,&2FA,&2D0,&2A6,&280,&25C,&23A,&21A,&1FC,&1E0,&1C5
  3684.  &1AC,&194,&17D,&168,&153,&140,&12E,&11D,&10D,&0FE,&0F0,&0E2
  3685.  &0D6,&0CA,&0BE,&0B4,&0AA,&0A0,&097,&08F,&087,&07F,&078,&071
  3686.  &06B,&065,&05F,&05A,&055,&04C,&047,&043,&040,&03C,&039,&036
  3687.  C-1,C#1,D-1,D#1,E-1,F-1,F#1,G-1,G#1,A-1,A#1,B-1
  3688.  C-2,C#2,D-2,D#2,E-2,F-2,F#2,G-2,G#2,A-2,A#2,B-2
  3689.  C-3,C#3,D-3,D#3,E-3,F-3,F#3,G-3,G#3,A-3,A#3,B-3
  3690.  C-4,C#4,D-4,D#4,E-4,F-4,F#4,G-4,G#4,A-4,A#4,B-4
  3691.  C-5,C#5,D-5,D#5,E-5,F-5,F#5,G-5,G#5,A-5,A#5,B-5
  3692. DeleteBlock
  3693.  X1%=EditStart% 
  3694.  Y1%=EditStart% 
  3695.  X2%=EditEnd% 
  3696.  Y2%=EditEnd% 
  3697.  Y%=Y1% 
  3698.  X%=X1% 
  3699. 17   Adr%=MemPatterns%+1024*BlockPattern%+(X%+Y%*4)*4
  3700.    Adr%!0=0
  3701.  Now, let's redraw the block
  3702. RedrawBlockContents
  3703. NoEditBlock
  3704.  VModify%=
  3705. ChangeSample(S%)
  3706.  X1%=EditStart% 
  3707.  Y1%=EditStart% 
  3708.  X2%=EditEnd% 
  3709.  Y2%=EditEnd% 
  3710.  Y%=Y1% 
  3711.  X%=X1% 
  3712. C7   Adr%=MemPatterns%+1024*BlockPattern%+(X%+Y%*4)*4
  3713.    Note%=!Adr%
  3714. EN   
  3715. ReturnParams(Note%,Sample%,Pitch%,Effect%,PitchEffect1%,PitchEffect2%)
  3716.  Sample%<>0 
  3717.     Sample%=S%
  3718. StoreParams
  3719.     !Adr%=Note%
  3720.  Now, let's redraw the block
  3721. RedrawBlockContents
  3722. NoEditBlock
  3723.  VModify%=
  3724. ChangeFX(FX%)
  3725.  X1%=EditStart% 
  3726.  Y1%=EditStart% 
  3727.  X2%=EditEnd% 
  3728.  Y2%=EditEnd% 
  3729.  Y%=Y1% 
  3730.  X%=X1% 
  3731. Z7   Adr%=MemPatterns%+1024*BlockPattern%+(X%+Y%*4)*4
  3732.    Note%=!Adr%
  3733. \:   
  3734. ReturnParams(Note%,Sample%,Pitch%,Effect%,P1%,P2%)
  3735. ]%   
  3736.  FX%<>0 
  3737.  (P1%<>0 
  3738.  P2%<>0) 
  3739.     Effect%=FX%
  3740. StoreParams
  3741.     !Adr%=Note%
  3742.  Now, let's redraw the block
  3743. RedrawBlockContents
  3744. NoEditBlock
  3745.  VModify%=
  3746. RedrawBlockContents
  3747. l+ BlockEntry%=
  3748. PatToEntry(BlockPattern%)
  3749.  X1%=EditStart% 
  3750.  Y1%=EditStart% 
  3751.  X2%=EditEnd% 
  3752.  Y2%=EditEnd% 
  3753.  X2%+=1
  3754.  Y2%+=1
  3755.  "Wimp_ForceRedraw",Windows%(BlockEntry%,WHShell%),X1%*OWCell%,-Y2%*OHCell%,X2%*OWCell%,-Y1%*OHCell%
  3756. CheckOptions
  3757.  Old%=OQuickDraw%
  3758. IconState(1)=
  3759.  OQuickDraw%=
  3760.  OQuickDraw%=
  3761.  IF FNIconState(6)=TRUE THEN OPaneVoice%=TRUE ELSE OPaneVoice%=FALSE
  3762.  IF FNIconState(7)=TRUE THEN OPaneSeq%=TRUE ELSE OPaneSeq%=FALSE
  3763.  IF FNIconState(5)=TRUE THEN OCursor%=0
  3764.  IF FNIconState(6)=TRUE THEN OCursor%=1
  3765.  IF FNIconState(7)=TRUE THEN OCursor%=2
  3766.  OldW%=OWCell%
  3767.  OldH%=OHCell%
  3768.  OWCell%=
  3769. Writable(9))
  3770.  OHCell%=OWCell%/10
  3771.  Old%<>OQuickDraw% 
  3772.  OldW%<>OWCell% 
  3773.  Update all shell windows
  3774. FontInit
  3775.   I%=0
  3776.   A%=0
  3777.  A%<NbEntry%
  3778.  Windows%(I%,WFreeFlag%)=-1 
  3779.     A%+=1
  3780. +    
  3781. SetExtent(I%,OWCell%*4,64*OHCell%)
  3782. #    WinH%=Windows%(I%,WHShell%)
  3783. UpdateWindow(WinH%)
  3784.    I%+=1
  3785. ResizePlayWindow
  3786. ResizePlayWindow
  3787.  OX%=0
  3788.  OY%=100
  3789.  WkX%=OWCell%*4
  3790.  WkY%=64*OHCell%*NbSeq%
  3791.  Block%!0=OX%
  3792.  Block%!4=-WkY%
  3793.  Block%!8=WkX%
  3794.  Block%!12=OY%
  3795.  "Wimp_SetExtent",HPlayWin%,Block%
  3796. LibSetExtent(HVUs%,OWCell%*4,100)
  3797. UpdateWindow(HPlayWin%)
  3798. LibResizeWindow(HPlayWin%)
  3799. LibResizeWindow(HVUs%)
  3800. UpdateNbSeq
  3801.  NbSeq%=?(Module%+950)
  3802.  WinH%=HSongInfo%
  3803. LibSetIconText2(5,
  3804. (NbSeq%))
  3805.  WinH%=HPlay%
  3806. LibSetIconText2(20,
  3807. (NbSeq%-1))
  3808. LibSetExtent(HSequence%,300,CHIcons%*NbSeq%)
  3809. UpdateWindow(HSequence%)
  3810. LibWinInitScroll(HSequence%)
  3811. ResizePlayWindow
  3812. CheckTick(WinH%,Item%)
  3813. WinOpened(WinH%)=
  3814. LibMTick(MPIconBar%,Item%) 
  3815. LibMUntick(MPIconBar%,Item%)
  3816. SetBlockColor
  3817.  3,255,0,0
  3818.  CurColor%(0)=255
  3819.  CurColor%(1)=0
  3820.  CurColor%(2)=0
  3821. SetEditColor
  3822.  3,0,0,100
  3823.  CurColor%(0)=0
  3824.  CurColor%(1)=0
  3825.  CurColor%(2)=100
  3826. OpenSamples(Front%)
  3827.  ->Block%
  3828.  Block2%!0=HSamples%
  3829.  "Wimp_GetWindowInfo",,Block2%+1
  3830.  WX1%=Block2%!44
  3831.  WX2%=Block2%!52
  3832.  WY1%=Block2%!48
  3833.  WY2%=Block2%!56
  3834.  WX%=WX2%-WX1%
  3835.  WY%=-(WY2%-WY1%)
  3836.  Block%!0=HSamples%
  3837.  Front%=
  3838.   Block%!4 = XScreen%-WX%/2
  3839.    Block%!16 = YScreen%-WY%/2
  3840.   Block%!12 = Block%!4+WX%
  3841.   Block%!8 = Block%!16+WY%
  3842.     Block%!20 = 0
  3843.   Block%!24 = 0
  3844.   Block%!28 = -1
  3845.  X1%=Block%!4
  3846.  Y2%=Block%!16
  3847.  Win%=Block%!28
  3848.  First, let the WIMP correct Block% coordinates.
  3849.  Block%!0=HSamples%
  3850.  Block%!28=HSplData%
  3851.  "Wimp_OpenWindow",,Block%
  3852.  Then, put pane window front of its mother
  3853.  For previous scroll offset
  3854.  Block2%!0=HSplData%
  3855.  "Wimp_GetWindowState",,Block2%
  3856.  W%=-(WX2%-WX1%-X2Spl%)
  3857.  H%=(WY2%-WY1%+Y1Spl%)
  3858.  Block2%!4=Block%!4+X1Spl%
  3859.  Block2%!8=Block%!8+H%
  3860.  Block2%!12=Block%!12+W%
  3861.   Block2%!16=Block%!16+Y2Spl%
  3862.  Block2%!28=Win%
  3863.  "Wimp_OpenWindow",,Block2%
  3864.  And finally, the mother behind her child
  3865.  Block%!0=HSamples%
  3866.  Block%!28=HSplData%
  3867.  "Wimp_OpenWindow",,Block%
  3868. OpenPlayWindow(Poll%)
  3869.  ->Block%
  3870.  Block%!0 = HPlayWin% 
  3871.  Poll% 
  3872.   Block%!4 = 0.1*XScreen%*2
  3873.   Block%!8 = 0.1*YScreen%*2
  3874.    Block%!12 = 0.9*XScreen%*2
  3875.    Block%!16 = 0.9*YScreen%*2
  3876.   Block%!20 = 0
  3877.   Block%!24 = 100
  3878.   Block%!28 = -1
  3879.  Win%=Block%!28
  3880.  First, let the WIMP correct Block% coordinates.
  3881.  Block%!0=HPlayWin%
  3882.  Block%!28=HVUs%
  3883.  "Wimp_OpenWindow",,Block%
  3884.  Then, put pane window front of its mother
  3885.  Block2%!0=HVUs%
  3886.  Block2%!4=Block%!4
  3887.  Block2%!8=Block%!16-100
  3888.  Block2%!12=Block%!12
  3889.  Block2%!16=Block%!16
  3890.  Block2%!20=Block%!20
  3891.  Block2%!24=Block%!24
  3892.  Block2%!28=Win%
  3893.  "Wimp_OpenWindow",,Block2%
  3894.  And finally, the mother behind her child
  3895.  Block%!0=HPlayWin%
  3896.  Block%!28=HVUs%
  3897.  "Wimp_OpenWindow",,Block%
  3898. ClosePlayWindow
  3899.  Block%!0 = HPlayWin% 
  3900.  "Wimp_CloseWindow",,Block% 
  3901.  Block%!0 = HVUs% 
  3902.  "Wimp_CloseWindow",,Block% 
  3903.