here is what makes up qmusic v2
This will not run without media attached....this is just to take a look to see what makes it tick
(source code)
Rem Project: Q Music Vr2
rem source code by SMD3D Interactive c(2007-2008)
rem By Sheldon MacDonald
Rem Created: 11/5/2007 5:07:43 PM
rem distrubute freely and modify
rem will not run without a few key media files
rem this is just for seeing what makes this program tick
rem if you want to modify and get this running then download the 113 meg file above and make sure
rem that you have blue gui installed ...then just enter the user key below
startBlue "user","key"
disable escapekey
global ver$="3qm_1.01b"
#constant GUI_CONSTANTS 1
#constant COMMAND 0x111
#constant MOUSE_CLICK 0x202
#constant LEFTBUTTON_UP 0x202
#constant RIGHTMOUSE_CLICK 0x205
#constant RIGHTBUTTON_UP 0x205
#constant MOUSE_MOVE 0x200
#constant GADGET_TIMER 0x113
#constant TOOLBAR_CLICK 0x111
#constant HOTKEY 0x312
#constant LEFTBUTTON_DOWN 513
#constant RIGHTBUTTON_DOWN 0x204
#constant KEYDOWN 0x100
#constant KEYUP 0x101
#constant LOSEFOCUS 0x8
#constant GADGET_SIZING 0x214
#constant GADGET_SIZE 0x5
#constant WINDOW_CLOSE 0x10
#constant LEFTBUTTON_DOUBLECLICK 0x203
#constant MENU_CLICK 0x0400+1
#constant COMBOBOX_CHANGE 0x0400+3
#constant TREEVIEW_CHANGE 0x0400+4
#constant BORDER_NONE 0
#constant BORDER_FLAT 1
#constant BORDER_3D 2
#constant BORDER_SUNKEN 3
#constant ALIGN_NONE 0
#constant ALIGN_ALL 1
#constant ALIGN_TOP 2
#constant ALIGN_LEFT 3
#constant ALIGN_RIGHT 4
#constant ALIGN_BOTTOM 5
#constant TOOLBAR_CUT 0
#constant TOOLBAR_COPY 1
#constant TOOLBAR_PASTE 2
#constant TOOLBAR_UNDO 3
#constant TOOLBAR_REDO 4
#constant TOOLBAR_DELETE 5
#constant TOOLBAR_NEW 6
#constant TOOLBAR_OPEN 7
#constant TOOLBAR_SAVE 8
#constant TOOLBAR_PRINTPREVIEW 9
#constant TOOLBAR_PROPERTIES 10
#constant TOOLBAR_HELP 11
#constant TOOLBAR_FIND 12
#constant TOOLBAR_REPLACE 13
#constant TOOLBAR_PRINT 14
#constant WINDOW_TITLEBAR 12582912
#constant WINDOW_CLOSEBUTTON 524288
#constant WINDOW_MAXBUTTON 65536
#constant WINDOW_MINBUTTON 131072
#constant WINDOW_RESIZEABLE 262144
#constant WINDOW_NOBORDER -2147483648
#constant WINDOW_TOOLWINDOW 128
#constant WINDOW_NORMAL 13565952
#constant WINDOW_FIXED 13107200
#constant WINDOW_OVR 0
#constant LISTVIEW_ICON 0 `Big icons with captions underneath, ideal for texture/model browsers etc
#constant LISTVIEW_REPORT 1 `A table where each item can have additional information (subitems) listed as well
#constant LISTVIEW_LIST 3 `Small icons with captions to their right.
autocam off
load sound "glitchfix.wav",90000
sync on
sync rate 0
set window on
aba=get display width()
abb=get display height()
if aba<800 or abb<700 then set window position 0,0:goto skipres
set window position aba/2-400,abb/2-350
skipres:
set display mode 800,700,16
set window size 800,700
set window layout 1,1,1
set window title "Q-Music Editor VR2.0B"
resetMainWindow
global mainMenu
global fileMenu
global helpMenu
global editMenu
global toolmenu
`Create a new main menu
mainMenu=createMenu(0)
`Add items to the main menu, specifying the values
`we want them to return when they are selected
addMenuItem mainMenu,"File",1,1
addMenuItem mainMenu,"Tools",3,3
addMenuItem mainMenu,"Help",4,4
fileMenu=createSubMenu(mainMenu,1)
helpMenu=createSubMenu(mainMenu,4)
toolmenu=createsubmenu(mainmenu,3)
editmenu=createsubmenu(mainmenu,2)
`Add items to the submenus
addMenuItem fileMenu,"Open",50000,1
addMenuItem fileMenu,"Save",50001,2
addMenuItem fileMenu,"Reset",50002,4
addmenusplitter filemenu
addmenuitem filemenu,"Exit",50003,6
addmenuitem toolmenu,"Create Instrument",50004,1
addmenuitem toolmenu,"Record Music",50005,3
addmenuitem toolmenu,"Convert wav to ogg",50006,3
addMenuItem helpMenu,"For help look at the pictures in the help folder",17,1
addMenuItem helpMenu,"By SMD3D Interactive 2007",18,2
setMenuItemEnabled filemenu,7,0
setMenuItemEnabled editmenu,12,0
setMenuItemEnabled editmenu,13,0
setMenuItemEnabled editmenu,11,0
global frame
frame=createpanel(0,1,792,100,0)
global frame2
frame2=createpanel(782,1,800,119,0)
global fileedit
fileedit=createedit(5,25,100,20,0,frame)
global label1
label1=createlabel(5,5,100,20,"Song Name",frame)
global label2
label2=createlabel(5,50,100,20,"FPS Tempo[1-255]",frame)
global syncedit
syncedit=createedit(5,70,45,20,0,frame)
global delayedit
delayedit=createedit(60,70,45,20,0,frame)
global size
size=createedit(160,70,45,20,0,frame)
global label3
label3=createlabel(120,70,45,20,"Notes",frame)
setgadgettext size,"79"
setgadgettext syncedit,"0"
setgadgettext delayedit,"180"
global label9
label9=createlabel(465,70,165,30,"PlayNote=[0000] CursorNote[0000]",frame)
global button6
button6=createbutton(340,70,50,20,"Play",0,frame)
global button7
button7=createbutton(390,70,50,20,"Stop",0,frame)
global button8
button8=createbutton(320,70,20,20,"<|",0,frame)
global button9
button9=createbutton(440,70,20,20,"|>",0,frame)
global tab
tab=createedit(260,70,45,20,0,frame)
global lab
lab=createlabel(220,70,38,20,"Tabs",frame)
setgadgettext tab,"16"
setgadgetenabled tab,0
global button1
button1=createbutton(110,5,100,20,"Instrument 1",0,frame)
global pan1
pan1=createtrackbar(110,25,100,20,0,frame)
global vol1
vol1=createtrackbar(110,45,100,20,0,frame)
setTrackbarRange pan1,1,5
setTrackbarRange vol1,0,25
setTrackbarPosition pan1,3
setTrackbarPosition vol1,25
global button2
button2=createbutton(215,5,100,20,"Instrument 2",0,frame)
global pan2
pan2=createtrackbar(215,25,100,20,0,frame)
global vol2
vol2=createtrackbar(215,45,100,20,0,frame)
setTrackbarRange pan2,1,5
setTrackbarRange vol2,0,25
setTrackbarPosition pan2,3
setTrackbarPosition vol2,25
global button3
button3=createbutton(320,5,100,20,"Instrument 3",0,frame)
global pan3
pan3=createtrackbar(320,25,100,20,0,frame)
global vol3
vol3=createtrackbar(320,45,100,20,0,frame)
setTrackbarRange pan3,1,5
setTrackbarRange vol3,0,25
setTrackbarPosition pan3,3
setTrackbarPosition vol3,25
global button4
button4=createbutton(425,5,100,20,"Instrument 4",0,frame)
global pan4
pan4=createtrackbar(425,25,100,20,0,frame)
global vol4
vol4=createtrackbar(425,45,100,20,0,frame)
setTrackbarRange pan4,1,5
setTrackbarRange vol4,0,25
setTrackbarPosition pan4,3
setTrackbarPosition vol4,25
global button5
button5=createbutton(530,5,100,20,"Instrument 5",0,frame)
global pan5
pan5=createtrackbar(530,25,100,20,0,frame)
global vol5
vol5=createtrackbar(530,45,100,20,0,frame)
setTrackbarRange pan5,1,5
setTrackbarRange vol5,0,25
setTrackbarPosition pan5,3
setTrackbarPosition vol5,25
global check1
check1=createcheckbox(635,5,120,15,"Selection Tool",frame)
global check2
check2=createcheckbox(635,20,120,15,"Looping Note",frame)
global check3
check3=createcheckbox(635,35,120,15,"Play + Start Note",frame)
global check4
check4=createcheckbox(635,60,120,15,"Repeat Music",frame)
global check5
check5=createcheckbox(635,75,120,15,"Reset Instruments",frame)
setChecked check1,1
setchecked check4,1
global sbar
sbar=createScrollbar(0,100,782,20,0,sbar)
setScrollbarThumbSize sbar,9
load image "note1.bmp",1,1
load image "note2.bmp",2,1
load image "select.bmp",3,1
load image "bar.bmp",4,1
dim music(10000,22,5)
dim files$(5)
scroll=0
note=0
playing=0
set=3
for x=1 to 5
music(0,11,x)=3
music(0,12,x)=10
next x
edit=0
load image "backgr1.bmp",10,1
load image "backgr2.bmp",11,1
setgadgetenabled syncedit,0
back=10
got=0
bk2=0
rem global ftpcheck
rem ftpcheck=createWindow(aba/2-100,abb/2-100,200,200, "Check for updates...",1,1,0,0)
do
cls
got=got+1
bk2=bk2+1
if bk2=>6 then bk2=1
if got=>400 then back=back+1:got=0:if back=12 then back=10
setgadgettext label9,"PlayNote["+str$(note)+"] CursorNote["+str$(cx)+"]"
setgadgettext syncedit,str$(screen fps())
ink rgb(0,0,0),0
rem box 0,0,1200,50
paste image 4,0,140,1
paste image 4,0,250,1
paste image 4,0,360,1
paste image 4,0,470,1
paste image 4,0,580,1
gosub setbarsize
gosub checkboxes
gosub updatenotes
getevent
rem aba$=inkey$()
rem if playing=1 then goto skiprr
if eventtype()=mouse_click and eventsource()=button1 then show mouse:setgadgetvisible button1,0:setgadgetvisible button1,1:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:boy$=opendialog("Open Instrument file","Instrument... [*.3in]|*.3in",0,"ins"):if boy$<>"" then gosub open1
if eventtype()=mouse_click and eventsource()=button2 then show mouse:setgadgetvisible button2,0:setgadgetvisible button2,1:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:boy$=opendialog("Open Instrument file","Instrument... [*.3in]|*.3in",0,"ins"):if boy$<>"" then gosub open2
if eventtype()=mouse_click and eventsource()=button3 then show mouse:setgadgetvisible button3,0:setgadgetvisible button3,1:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:boy$=opendialog("Open Instrument file","Instrument... [*.3in]|*.3in",0,"ins"):if boy$<>"" then gosub open3
if eventtype()=mouse_click and eventsource()=button4 then show mouse:setgadgetvisible button4,0:setgadgetvisible button4,1:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:boy$=opendialog("Open Instrument file","Instrument... [*.3in]|*.3in",0,"ins"):if boy$<>"" then gosub open4
if eventtype()=mouse_click and eventsource()=button5 then show mouse:setgadgetvisible button5,0:setgadgetvisible button5,1:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:boy$=opendialog("Open Instrument file","Instrument... [*.3in]|*.3in",0,"ins"):if boy$<>"" then gosub open5
if eventData()=50000 then show mouse:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:gosub openff
if eventData()=50001 then show mouse:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:gosub saveas
if eventData()=50002 then show mouse:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:qc=questionMessage("Reset data?",""):if qc=1 then gosub resetdata
if eventData()=50003 then show mouse:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:qc=questionMessage("Exit?","All data will be lost!"):if qc=1 then end
if getChecked(check5)=1 then playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:setChecked check5,0:gosub resetdata2:
if eventData()=50004 then show mouse:gosub makenewinstrument:sleep 500
if eventData()=50005 then show mouse:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:gosub record:sleep 500
if eventData()=50006 then show mouse:playing=0:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:gosub convertogg:sleep 500
rem skiprr:
if activegadget()=button8 then note=0:setgadgetvisible button8,0:setgadgetvisible button8,1:setscrollbarposition sbar,0
if activegadget()=button9 then a$=getgadgettext(size):setgadgetvisible button9,0:setgadgetvisible button9,1:note=val(a$):setscrollbarposition sbar,note-60
if activeGadget()=button6 and playing=0 then playing=1:setgadgetvisible button6,0:setgadgetvisible button6,1:last_timerfix=0:delay=0:delay_start=0:setscrollbarposition sbar,note-80:aba$="":sleep 20
if activegadget()=button7 and playing=1 then playing=0:setgadgetvisible button7,0:setgadgetvisible button7,1:last_timerfix=0:delay=0:delay_start=0:gosub offnotes:aba$="":sleep 20
if playing=1 then gosub playnotes
if playing=0 and mouseposy()<120 then show mouse else hide mouse:gosub mouseboy:paste image set,mx,my,1
if playing=0 and mousey()>690 then show mouse
if playing=1 then show mouse
if playing=0 and set=1 and mouseposy()=>130 then gosub editone
if playing=0 and set=2 and mouseposy()=>130 then gosub edit3
if playing=0 and set=1 and mouseposy()=>130 or set=2 and mouseposy()=>130 then gosub edittwo
if playing=0 and set=3 and mouseposy()=>130 then gosub edit4
if playing=0 and set=3 and mouseposy()=>130 then gosub edit5
if mouseposy()<130 then edit=0
rem ink rgb(0,0,0),0
rem set cursor 20,680:print "SYNC RATE [";screen fps();"] EDIT NOTE [";CX;"]";
if playing=0 and activegadget()=button7 then setgadgetvisible button7,0:setgadgetvisible button7,1
if playing=1 and activegadget()=button6 then setgadgetvisible button6,0:setgadgetvisible button6,1
sync
loop
convertogg:
boob$=opendialog("Convert Wav file to Ogg Vorbis","Wave... [*.wav|*.wav",0,"music")
if boob$="" then return
if file exist(boob$)=0 then return
boob=len(boob$)
boob2$=left$(boob$,boob-3)
boob2$=boob2$+"ogg"
ENCODE To OGG VORBIS boob$, boob2$
message "Done"
return
editone:
if mouseclick()=1 and edit<>1 and ci<>0 and cy<>0 then edit=1:rx=cx:ry=cy:ri=ci
if mouseclick()=0 and edit=1 then edit=0:gosub dropnotes1:
if ri=0 then return
if sound exist((ri*100)+ry)=0 then goto skippy1
if edit=0 and sound exist((ri*100)+ry)=1 and sound playing((ri*100)+ry)=1 then set sound volume ((ri*100)+ry),0:stop sound ((ri*100)+ry)
if edit=1 and sound exist((ri*100)+ry)=1 and sound playing((ri*100)+ry)=0 then set sound volume (ri*100)+ry,100:play sound ((ri*100)+ry)
skippy1:
if edit<>1 then return
ink rgb(255,0,0),0
if ri=1 then adjust=135
if ri=2 then adjust=245
if ri=3 then adjust=355
if ri=4 then adjust=465
if ri=5 then adjust=575
if rx>cx then rx=cx
box (rx*10)-(screenx*10),(ry*10)+adjust-5,(cx*10)+10-(screenx*10),(ry*10)+adjust+5
return
edittwo:
if playing=1 then return
if mouseclick()=2 and edit<>2 and ci<>0 and cy<>0 then edit=2:rx=cx:ry=cy:ri=ci
if mouseclick()=0 and edit=2 then edit=0:gosub errasenotes:
if ri=0 then return
if sound exist((ri*100)+ry)=0 then goto skippy2
if edit=0 and sound exist((ri*100)+ry)=1 and sound playing((ri*100)+ry)=1 then set sound volume ((ri*100)+ry),0:stop sound ((ri*100)+ry)
if edit=2 and sound exist((ri*100)+ry)=1 and sound playing((ri*100)+ry)=0 then set sound volume (ri*100)+ry,100:play sound ((ri*100)+ry)
skippy2:
if edit<>2 then return
ink rgb(0,0,255),0
if ri=1 then adjust=135
if ri=2 then adjust=245
if ri=3 then adjust=355
if ri=4 then adjust=465
if ri=5 then adjust=575
if cy<ry then ry=cy
if rx>cx then rx=cx
box (rx*10)-(screenx*10),(ry*10)+adjust-5,(cx*10)+10-(screenx*10),(cy*10)+adjust+5
return
edit4:
if mouseclick()=1 and edit<>4 and ci<>0 and cy<>0 then edit=4:rx=cx:ry=cy:ri=ci:note=cx
if mouseclick()=0 and edit=4 then edit=0:gosub copynotes:
if edit<>4 then return
ink rgb(0,0,255),0
if ri<ci then ri=ci:ry=cy
if ri>ci then ri=ci
if ri=1 then adjust=135
if ri=2 then adjust=245
if ri=3 then adjust=355
if ri=4 then adjust=465
if ri=5 then adjust=575
if ry>cy then ry=cy
if rx>cx then rx=cx
line (rx*10)-(screenx*10),(ry*10)+adjust,(cx*10)+10-(screenx*10),(ry*10)+adjust
line (cx*10)+10-(screenx*10),(ry*10)+adjust,(cx*10)+10-(screenx*10),(cy*10)+adjust
line (cx*10)+10-(screenx*10),(cy*10)+adjust,(rx*10)-(screenx*10),(cy*10)+adjust
line (rx*10)-(screenx*10),(cy*10)+adjust,(rx*10)-(screenx*10),(ry*10)+adjust
return
edit5:
if mouseclick()=2 and edit<>5 and ci<>0 and cy<>0 then edit=5:rx=cx:ry=cy:ri=ci
if edit<>5 then return
rx=cx:ry=cy:ri=ci
if copy1=0 and copy2=0 and copy3=0 and copy4=0 and copy5=0 then edit=0:return
if mouseclick()<>0 then return
for x1=copy1 to copy3
for y1=copy2 to copy4
if music(x1,y1,copy5)=music(cx+x1-copy1,cy+y1-copy2,ci) then music(cx+x1-copy1,cy+y1-copy2,ci)=0:goto skip5
if music(x1,y1,copy5)<>0 and cy+y1-copy2<11 then music(cx+x1-copy1,cy+y1-copy2,ci)=music(x1,y1,copy5)
skip5:
next y1
next x1
edit=0
return
copynotes:
if cx=rx and cy=ry then copy1=0:copy2=0:copy3=0:copy4=0:copy5=0:return
copy1=rx
copy2=ry
copy3=cx
copy4=cy
copy5=ri
return
edit3:
if mouseclick()=1 and edit<>3 and ci<>0 and cy<>0 then edit=3:rx=cx:ry=cy:ri=ci
if mouseclick()=0 and edit=3 then edit=0:gosub dropnotes2:
if ri=0 then return
if sound exist((ri*100)+ry)=0 then goto skippy3
if edit=0 and sound playing((ri*100)+ry)=1 then stop sound ((ri*100)+ry)
if edit=3 and sound playing((ri*100)+ry)=0 then play sound ((ri*100)+ry)
skippy3:
if edit<>3 then return
ink rgb(0,255,0),0
if ri=1 then adjust=135
if ri=2 then adjust=245
if ri=3 then adjust=355
if ri=4 then adjust=465
if ri=5 then adjust=575
if rx>cx then rx=cx
box (rx*10)-(screenx*10),(ry*10)+adjust-5,(cx*10)+10-(screenx*10),(ry*10)+adjust+5
return
dropnotes2:
for x=rx to cx
music(x,ry,ri)=2
next x
return
dropnotes1:
for x=rx to cx
music(x,ry,ri)=1
next x
return
errasenotes:
for x=rx to cx
for y=ry to cy
music(x,y,ri)=0
next y
next x
return
setbarsize:
bob$=getgadgettext(size)
bob=val(bob$)
if bob<1 then bob=0:setgadgettext size,"0"
if bob>10000 then bob=10000:setgadgettext size,"10000"
setScrollbarThumbSize sbar,9
setScrollbarRange sbar,0,bob-71
screenx=getscrollbarposition(sbar)
return
updatenotes:
flash=flash+1
if flash=>40 then flash=1
for x=screenx to screenx+79
for z=1 to 10
if music(x,z,1)=1 then ink rgb(155,0,0),0
if music(x,z,1)=2 then ink rgb(0,155,0),0
if music(x,z,1)<>0 and flash=>20 and copy5=1 and copy1=<x and copy3=>x and copy2=<z and copy4=>z then ink rgb(155,155,155),0
if music(x,z,1)=1 then box (x*10)-(screenx*10),(z*10)+130,(x*10)-(screenx*10)+10,(z*10)+130+10
if music(x,z,1)=2 then box (x*10)-(screenx*10),(z*10)+130,(x*10)-(screenx*10)+10,(z*10)+130+10
if music(x,z,2)=1 then ink rgb(155,0,0),0
if music(x,z,2)=2 then ink rgb(0,155,0),0
if music(x,z,2)<>0 and flash=>20 and copy5=2 and copy1=<x and copy3=>x and copy2=<z and copy4=>z then ink rgb(155,155,155),0
if music(x,z,2)=1 then box (x*10)-(screenx*10),(z*10)+240,(x*10)-(screenx*10)+10,(z*10)+240+10
if music(x,z,2)=2 then box (x*10)-(screenx*10),(z*10)+240,(x*10)-(screenx*10)+10,(z*10)+240+10
if music(x,z,3)=1 then ink rgb(155,0,0),0
if music(x,z,3)=2 then ink rgb(0,155,0),0
if music(x,z,3)<>0 and flash=>20 and copy5=3 and copy1=<x and copy3=>x and copy2=<z and copy4=>z then ink rgb(155,155,155),0
if music(x,z,3)=1 then box (x*10)-(screenx*10),(z*10)+350,(x*10)-(screenx*10)+10,(z*10)+350+10
if music(x,z,3)=2 then box (x*10)-(screenx*10),(z*10)+350,(x*10)-(screenx*10)+10,(z*10)+350+10
if music(x,z,4)=1 then ink rgb(155,0,0),0
if music(x,z,4)=2 then ink rgb(0,155,0),0
if music(x,z,4)<>0 and flash=>20 and copy5=4 and copy1=<x and copy3=>x and copy2=<z and copy4=>z then ink rgb(155,155,155),0
if music(x,z,4)=1 then box (x*10)-(screenx*10),(z*10)+460,(x*10)-(screenx*10)+10,(z*10)+460+10
if music(x,z,4)=2 then box (x*10)-(screenx*10),(z*10)+460,(x*10)-(screenx*10)+10,(z*10)+460+10
if music(x,z,5)=1 then ink rgb(155,0,0),0
if music(x,z,5)=2 then ink rgb(0,155,0),0
if music(x,z,5)<>0 and flash=>20 and copy5=5 and copy1=<x and copy3=>x and copy2=<z and copy4=>z then ink rgb(155,155,155),0
if music(x,z,5)=1 then box (x*10)-(screenx*10),(z*10)+570,(x*10)-(screenx*10)+10,(z*10)+570+10
if music(x,z,5)=2 then box (x*10)-(screenx*10),(z*10)+570,(x*10)-(screenx*10)+10,(z*10)+570+10
rem flash
bb$=getgadgettext(tab)
bb=val(bb$)
if bb=<4 then bb=4:setgadgettext tab,"4"
ax=x/bb*10
ink rgb(50,50,50),0
box (ax*bb)-(screenx*10)-1,140,(ax*bb)-(screenx*10),680
skipr:
next z
next x
a$=getgadgettext(size)
if note>val(a$) and playing=0 then note=val(a$)
ink rgb(250,250,0),0
if playing=0 then note=note+1
box (note*10)-(screenx*10)-10,130,(note*10)-(screenx*10),140
box (note*10)-(screenx*10)-10,240,(note*10)-(screenx*10),250
box (note*10)-(screenx*10)-10,350,(note*10)-(screenx*10),360
box (note*10)-(screenx*10)-10,460,(note*10)-(screenx*10),470
box (note*10)-(screenx*10)-10,570,(note*10)-(screenx*10),580
box (note*10)-(screenx*10)-10,680,(note*10)-(screenx*10),690
ink rgb(255,255,255),0
if playing=0 then note=note-1
return
checkboxes:
quickc=activeGadget()
if quickc<>check1 and quickc<>check2 and quickc<>check3 then return
if quickc=check1 then setChecked check2,0:setChecked check3,0:set=3
if quickc=check2 then setChecked check1,0:setChecked check3,0:set=1
if quickc=check3 then setChecked check1,0:setChecked check2,0:set=2
if getchecked(check1)=0 and getchecked(check2)=0 and getchecked(check3)=0 then goto resetcheck
return
resetcheck:
if set=3 then setchecked check1,1
if set=2 then setchecked check3,1
if set=1 then setchecked check2,1
return
mouseboy:
mx=mousex()
my=mousey()
my=(my/10)*10
mx=(mx/10)*10
cx=mx/10
cy=my/10
ci=0
if cy<14 then cy=0:ci=0
if cy=>14 then cy=cy-13:ci=1
if cy=11 then cy=0:ci=0
if cy=>12 then cy=cy-11:ci=2
if cy=11 then cy=0:ci=0
if cy=>12 then cy=cy-11:ci=3
if cy=11 then cy=0:ci=0
if cy=>12 then cy=cy-11:ci=4
if cy=11 then cy=0:ci=0
if cy=>12 then cy=cy-11:ci=5
if cy=>11 then cy=0:ci=0:
cx=cx+screenx
bob$=getgadgettext(size)
bob=val(bob$)
if bob<0 then bob=0
if cx>bob then cx=bob
return
open1:
f$=boy$
if file exist(f$)=0 then return
open to read 1,f$
read string 1,dumb$:if dumb$<>"Instrument wav sound set #0012ab" then close file 1:return
for x=101 to 110
if sound exist(x)=1 then delete sound x
next x
for x=101 to 110
if memblock exist(x)=1 then delete memblock x
next x
for x=101 to 110
read memblock 1,x
next x
close file 1
make sound from memblock 101,101
make sound from memblock 102,102
make sound from memblock 103,103
make sound from memblock 104,104
make sound from memblock 105,105
make sound from memblock 106,106
make sound from memblock 107,107
make sound from memblock 108,108
make sound from memblock 109,109
make sound from memblock 110,110
setgadgettext button1,right$(boy$,12)
return
open2:
f$=boy$
if file exist(f$)=0 then return
open to read 1,f$
read string 1,dumb$:if dumb$<>"Instrument wav sound set #0012ab" then close file 1:return
for x=201 to 210
if sound exist(x)=1 then delete sound x
next x
for x=101 to 110
if memblock exist(x)=1 then delete memblock x
next x
for x=101 to 110
read memblock 1,x
next x
close file 1
make sound from memblock 201,101
make sound from memblock 202,102
make sound from memblock 203,103
make sound from memblock 204,104
make sound from memblock 205,105
make sound from memblock 206,106
make sound from memblock 207,107
make sound from memblock 208,108
make sound from memblock 209,109
make sound from memblock 210,110
setgadgettext button2,right$(boy$,12)
return
open3:
f$=boy$
if file exist(f$)=0 then return
open to read 1,f$
read string 1,dumb$:if dumb$<>"Instrument wav sound set #0012ab" then close file 1:return
for x=301 to 310
if sound exist(x)=1 then delete sound x
next x
for x=101 to 110
if memblock exist(x)=1 then delete memblock x
next x
for x=101 to 110
read memblock 1,x
next x
close file 1
make sound from memblock 301,101
make sound from memblock 302,102
make sound from memblock 303,103
make sound from memblock 304,104
make sound from memblock 305,105
make sound from memblock 306,106
make sound from memblock 307,107
make sound from memblock 308,108
make sound from memblock 309,109
make sound from memblock 310,110
setgadgettext button3,right$(boy$,12)
return
open4:
f$=boy$
if file exist(f$)=0 then return
open to read 1,f$
read string 1,dumb$:if dumb$<>"Instrument wav sound set #0012ab" then close file 1:return
for x=401 to 410
if sound exist(x)=1 then delete sound x
next x
for x=101 to 110
if memblock exist(x)=1 then delete memblock x
next x
for x=101 to 110
read memblock 1,x
next x
close file 1
make sound from memblock 401,101
make sound from memblock 402,102
make sound from memblock 403,103
make sound from memblock 404,104
make sound from memblock 405,105
make sound from memblock 406,106
make sound from memblock 407,107
make sound from memblock 408,108
make sound from memblock 409,109
make sound from memblock 410,110
setgadgettext button4,right$(boy$,12)
return
open5:
f$=boy$
if file exist(f$)=0 then return
open to read 1,f$
read string 1,dumb$:if dumb$<>"Instrument wav sound set #0012ab" then close file 1:return
for x=501 to 510
if sound exist(x)=1 then delete sound x
next x
for x=101 to 110
if memblock exist(x)=1 then delete memblock x
next x
for x=101 to 110
read memblock 1,x
next x
close file 1
make sound from memblock 501,101
make sound from memblock 502,102
make sound from memblock 503,103
make sound from memblock 504,104
make sound from memblock 505,105
make sound from memblock 506,106
make sound from memblock 507,107
make sound from memblock 508,108
make sound from memblock 509,109
make sound from memblock 510,110
setgadgettext button5,right$(boy$,12)
return
resetdata:
for x=0 to 10000
for y=0 to 10
for z=0 to 5
music(x,y,z)=0
next z
next y
next x
for x=100 to 600
if sound exist(x)=1 then gosub delsound
next x
note=0
settrackbarposition sbar,0
setgadgettext delayedit,"180"
setgadgettext syncedit,"60"
setgadgettext size,"80"
setgadgettext fileedit,""
setgadgettext button1,"Instrument 1"
setgadgettext button2,"Instrument 2"
setgadgettext button3,"Instrument 3"
setgadgettext button4,"Instrument 4"
setgadgettext button5,"Instrument 5"
setgadgettext tab,"16"
return
delsound:
if x=90000 then return
delete sound x
return
resetdata2:
for x=100 to 600
if sound exist(x)=1 then gosub delsound
next x
setgadgettext button1,"Instrument 1"
setgadgettext button2,"Instrument 2"
setgadgettext button3,"Instrument 3"
setgadgettext button4,"Instrument 4"
setgadgettext button5,"Instrument 5"
return
openff:
bob$=opendialog("Open Q-Music File","Q-Music(2.0)... [*.3qn]|*.3qn|Q-Music(1.0b)... [*.3qm]|*.3qm",0,"music")
if bob$="" then return
open to read 1,bob$
read string 1,dum$:
if dum$="q-music vr1.0" then gosub resetdata:gosub standard:note=0:setgadgettext sbar,"0":return
if dum$="q-music vr2.0" then gosub resetdata:gosub newstandard:note=0:setgadgettext sbar,"0":return
if dum$="q-music vr2.1" then gosub resetdata:gosub newffload:note=0:setgadgettext sbar,"0":return
close file 1
return
newstandard:
gosub resetdata
read string 1,dum$:setgadgettext delayedit,dum$
read string 1,dum$:setgadgettext syncedit,dum$
read string 1,dum$:setgadgettext size,dum$
read string 1,dum$:setgadgettext fileedit,dum$
songto$=getgadgettext(size)
songto=val(songto$)
for x=0 to songto
for y=0 to 10
for z=0 to 5
read long 1,music(x,y,z)
next z
next y
next x
read string 1,dum$:setgadgettext button1,dum$
read string 1,dum$:setgadgettext button2,dum$
read string 1,dum$:setgadgettext button3,dum$
read string 1,dum$:setgadgettext button4,dum$
read string 1,dum$:setgadgettext button5,dum$
read string 1,dum$:setgadgettext tab,"16"
if getgadgettext(button1)<>"Instrument 1" then gosub readins1
if getgadgettext(button2)<>"Instrument 2" then gosub readins2
if getgadgettext(button3)<>"Instrument 3" then gosub readins3
if getgadgettext(button4)<>"Instrument 4" then gosub readins4
if getgadgettext(button5)<>"Instrument 5" then gosub readins5
vol=10
pan=3
for y=1 to 5
read long 1,vol
read long 1,pan
if y=1 then setTrackbarPosition vol1,vol:setTrackbarPosition pan1,pan
if y=2 then setTrackbarPosition vol2,vol:setTrackbarPosition pan2,pan
if y=3 then setTrackbarPosition vol3,vol:setTrackbarPosition pan3,pan
if y=4 then setTrackbarPosition vol4,vol:setTrackbarPosition pan4,pan
if y=5 then setTrackbarPosition vol5,vol:setTrackbarPosition pan5,pan
next y
close file 1
return
readins1:
for x=101 to 110
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock x,100
next x
return
readins2:
for x=201 to 210
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock x,100
next x
return
readins3:
for x=301 to 310
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock x,100
next x
return
readins4:
for x=401 to 410
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock x,100
next x
return
readins5:
for x=501 to 510
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock x,100
next x
return
standard:
gosub resetdata
read string 1,dum$:setgadgettext delayedit,dum$
read string 1,dum$:dum=val(dum$):dum=dum-3:setgadgettext size,str$(dum)
for x=0 to 1000
for y=0 to 9
for z=0 to 5
bo=x-3
if bo<0 then bo=0
read long 1,music(bo,y+1,z)
next z
next y
next x
read string 1,dum$:setgadgettext button1,dum$
read string 1,dum$:setgadgettext button2,dum$
read string 1,dum$:setgadgettext button3,dum$
read string 1,dum$:setgadgettext button4,dum$
read string 1,dum$:setgadgettext button5,dum$
if getgadgettext(button1)<>"Instrument 1" then gosub readins1
if getgadgettext(button2)<>"Instrument 2" then gosub readins2
if getgadgettext(button3)<>"Instrument 3" then gosub readins3
if getgadgettext(button4)<>"Instrument 4" then gosub readins4
if getgadgettext(button5)<>"Instrument 5" then gosub readins5
vol=10
pan=3
for y=1 to 5
read long 1,vol:vol=vol*2
read long 1,pan:
if pan=2 then pan=3 else if pan=3 then pan=5
if y=1 then setTrackbarPosition vol1,vol:setTrackbarPosition pan1,pan
if y=2 then setTrackbarPosition vol2,vol:setTrackbarPosition pan2,pan
if y=3 then setTrackbarPosition vol3,vol:setTrackbarPosition pan3,pan
if y=4 then setTrackbarPosition vol4,vol:setTrackbarPosition pan4,pan
if y=5 then setTrackbarPosition vol5,vol:setTrackbarPosition pan5,pan
next y
close file 1
return
readins1:
for x=101 to 110
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
if sound exist(x)=1 then delete sound x
make sound from memblock x,100
next x
return
readins2:
for x=201 to 210
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
if sound exist(x)=1 then delete sound x
make sound from memblock x,100
next x
return
readins3:
for x=301 to 310
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
if sound exist(x)=1 then delete sound x
make sound from memblock x,100
next x
return
readins4:
for x=401 to 410
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
if sound exist(x)=1 then delete sound x
make sound from memblock x,100
next x
return
readins5:
for x=501 to 510
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
if sound exist(x)=1 then delete sound x
make sound from memblock x,100
next x
return
offnotes:
rem if playing=1 and rep=1 then return
for x=100 to 600
if sound exist(x)=1 then gosub offss
next x
return
offss:
if sound playing(x)=1 then set sound volume x,0:stop sound x
return
playnotes:
ch=getchecked(check4)
if ch=1 then rep=1 else rep=0
if delay_start=0 then delay_start=timer()
boo$=getgadgettext(delayedit)
if val(boo$)>255 then boo=255:setgadgettext delayedit,"255"
if val(boo$)=<1 then boo=1
boo=255-val(boo$)
if timer()-delay_start<=boo*2 then return
rem delay_start=0
rem delay_start=timer()
left_over=timer()-delay_start-(boo*2)
delay_start=timer()-left_over
gg$=getgadgettext(size)
gg=val(gg$)
if note>gg then playing=0:delay=1000
if playing=0 and rep=1 then playing=1:delay=0:note=0:setscrollbarposition sbar,note
if playing=0 then gosub offnotes:return
for x=1 to 10
for y=1 to 5
if y=1 then pan=gettrackbarposition(pan1):vol=gettrackbarposition(vol1)
if y=2 then pan=gettrackbarposition(pan2):vol=gettrackbarposition(vol2)
if y=3 then pan=gettrackbarposition(pan3):vol=gettrackbarposition(vol3)
if y=4 then pan=gettrackbarposition(pan4):vol=gettrackbarposition(vol4)
if y=5 then pan=gettrackbarposition(pan5):vol=gettrackbarposition(vol5)
if music(note,x,y)=1 and sound exist((y*100)+x)=1 then gosub lsound
if music(note,x,y)=2 and sound exist((y*100)+x)=1 then gosub psound
if music(note,x,y)=0 and sound exist((y*100)+x)=1 then gosub ssound
next y
next x
note=note+1:
boo$=getgadgettext(size)
boo=val(boo$)
if note=>60 and boo>note+20 then setscrollbarposition sbar,note-58
return
lsound:
if sound playing((y*100)+x)=1 then return
set sound volume (y*100)+x,0
loop sound (y*100)+x
set sound volume (y*100)+x,vol*2+50
if pan=1 then set sound pan (y*100)+x,-10000
if pan=2 then set sound pan (y*100)+x,-5000
if pan=3 then set sound pan (y*100)+x,0
if pan=4 then set sound pan (y*100)+x,5000
if pan=5 then set sound pan (y*100)+x,10000
return
psound:
stop sound (y*100)+x
set sound volume (y*100)+x,0
play sound (y*100)+x
set sound volume (y*100)+x,vol*2+50
if pan=1 then set sound pan (y*100)+x,-10000
if pan=2 then set sound pan (y*100)+x,-5000
if pan=3 then set sound pan (y*100)+x,0
if pan=4 then set sound pan (y*100)+x,5000
if pan=5 then set sound pan (y*100)+x,10000
return
ssound:
if sound playing((y*100)+x)=1 then set sound volume (y*100)+x,0:stop sound (y*100)+x
return
saveas:
ok1=questionmessage("If [yes] you will have to reload instrument files to edit further!","Save as Finished Project?")
bob$=savedialog("Save Q-Music File","Q-Music(2.0)... [*.3qn]|*.3qn","music")
if bob$="" then return
if file exist(bob$)=1 then delete file bob$
open to write 1,bob$
if ok1=0 then write string 1,"q-music vr2.0"
if ok1=1 then write string 1,"q-music vr2.1":goto newffsave
write string 1,getgadgettext(delayedit)
write string 1,getgadgettext(syncedit)
write string 1,getgadgettext(size)
write string 1,getgadgettext(fileedit)
songto$=getgadgettext(size)
songto=val(songto$)
for x=0 to songto
for y=0 to 10
for z=0 to 5
write long 1,music(x,y,z)
next z
next y
next x
write string 1,getgadgettext(button1)
write string 1,getgadgettext(button2)
write string 1,getgadgettext(button3)
write string 1,getgadgettext(button4)
write string 1,getgadgettext(button5)
write string 1,"16"
if getgadgettext(button1)<>"Instrument 1" then gosub fixglitch1:gosub writeins1
if getgadgettext(button2)<>"Instrument 2" then gosub fixglitch2:gosub writeins2
if getgadgettext(button3)<>"Instrument 3" then gosub fixglitch3:gosub writeins3
if getgadgettext(button4)<>"Instrument 4" then gosub fixglitch4:gosub writeins4
if getgadgettext(button5)<>"Instrument 5" then gosub fixglitch5:gosub writeins5
vol=10
pan=3
for y=1 to 5
if y=1 then vol=getTrackbarPosition(vol1):pan=getTrackbarPosition(pan1)
if y=2 then vol=getTrackbarPosition(vol2):pan=getTrackbarPosition(pan2)
if y=3 then vol=getTrackbarPosition(vol3):pan=getTrackbarPosition(pan3)
if y=4 then vol=getTrackbarPosition(vol4):pan=getTrackbarPosition(pan4)
if y=5 then vol=getTrackbarPosition(vol5):pan=getTrackbarPosition(pan5)
write long 1,vol
write long 1,pan
next y
close file 1
return
fixglitch1:
for x=101 to 110
if sound exist(x)=0 then load sound "glitchfix.wav",x
next x
return
fixglitch2:
for x=201 to 210
if sound exist(x)=0 then load sound "glitchfix.wav",x
next x
return
fixglitch3:
for x=301 to 310
if sound exist(x)=0 then load sound "glitchfix.wav",x
next x
return
fixglitch4:
for x=401 to 410
if sound exist(x)=0 then load sound "glitchfix.wav",x
next x
return
fixglitch5:
for x=501 to 510
if sound exist(x)=0 then load sound "glitchfix.wav",x
next x
return
newffload:
read string 1,dum$:setgadgettext delayedit,dum$
read string 1,dum$:setgadgettext syncedit,dum$
read string 1,dum$:setgadgettext size,dum$
read string 1,dum$:setgadgettext fileedit,dum$
songto$=getgadgettext(size)
songto=val(songto$)
for x=0 to songto
for y=0 to 10
for z=0 to 5
read byte 1,music(x,y,z)
next z
next y
next x
read string 1,dum$:setgadgettext button1,dum$
read string 1,dum$:setgadgettext button2,dum$
read string 1,dum$:setgadgettext button3,dum$
read string 1,dum$:setgadgettext button4,dum$
read string 1,dum$:setgadgettext button5,dum$
read string 1,dum$:`"16"
if getgadgettext(button1)<>"Instrument 1" then gosub rins_1
if getgadgettext(button2)<>"Instrument 2" then gosub rins_2
if getgadgettext(button3)<>"Instrument 3" then gosub rins_3
if getgadgettext(button4)<>"Instrument 4" then gosub rins_4
if getgadgettext(button5)<>"Instrument 5" then gosub rins_5
vol=10
pan=3
for y=1 to 5
read byte 1,vol
read byte 1,pan
if y=1 then setTrackbarPosition vol1,vol :setTrackbarPosition pan1,pan
if y=2 then setTrackbarPosition vol2,vol :setTrackbarPosition pan2,pan
if y=3 then setTrackbarPosition vol3,vol :setTrackbarPosition pan3,pan
if y=4 then setTrackbarPosition vol4,vol :setTrackbarPosition pan4,pan
if y=5 then setTrackbarPosition vol5,vol :setTrackbarPosition pan5,pan
next y
close file 1
return
newffsave:
write string 1,getgadgettext(delayedit)
write string 1,getgadgettext(syncedit)
write string 1,getgadgettext(size)
write string 1,getgadgettext(fileedit)
songto$=getgadgettext(size)
songto=val(songto$)
for x=0 to songto
for y=0 to 10
for z=0 to 5
write byte 1,music(x,y,z)
next z
next y
next x
write string 1,getgadgettext(button1)
write string 1,getgadgettext(button2)
write string 1,getgadgettext(button3)
write string 1,getgadgettext(button4)
write string 1,getgadgettext(button5)
write string 1,"16"
if getgadgettext(button1)<>"Instrument 1" then gosub writeins_1
if getgadgettext(button2)<>"Instrument 2" then gosub writeins_2
if getgadgettext(button3)<>"Instrument 3" then gosub writeins_3
if getgadgettext(button4)<>"Instrument 4" then gosub writeins_4
if getgadgettext(button5)<>"Instrument 5" then gosub writeins_5
vol=10
pan=3
for y=1 to 5
if y=1 then vol=getTrackbarPosition(vol1):pan=getTrackbarPosition(pan1)
if y=2 then vol=getTrackbarPosition(vol2):pan=getTrackbarPosition(pan2)
if y=3 then vol=getTrackbarPosition(vol3):pan=getTrackbarPosition(pan3)
if y=4 then vol=getTrackbarPosition(vol4):pan=getTrackbarPosition(pan4)
if y=5 then vol=getTrackbarPosition(vol5):pan=getTrackbarPosition(pan5)
write byte 1,vol
write byte 1,pan
next y
close file 1
return
rins_1:
read long 1,x
if x=12 then return
if memblock exist(100)=1 then delete memblock 100
if sound exist(x+100)=1 then delete sound x+100
read memblock 1,100
if memblock exist(100)=0 then goto rins_1
make sound from memblock 100+x,100
goto rins_1
rins_2:
read long 1,x
if x=12 then return
if memblock exist(100)=1 then delete memblock 100
if sound exist(x+200)=1 then delete sound x+200
read memblock 1,100
if memblock exist(100)=0 then goto rins_2
make sound from memblock 200+x,100
goto rins_2
rins_3:
read long 1,x
if x=12 then return
if memblock exist(100)=1 then delete memblock 100
if sound exist(x+300)=1 then delete sound x+300
read memblock 1,100
if memblock exist(100)=0 then goto rins_3
make sound from memblock 300+x,100
goto rins_3
rins_4:
read long 1,x
if x=12 then return
if memblock exist(100)=1 then delete memblock 100
if sound exist(x+400)=1 then delete sound x+400
read memblock 1,100
if memblock exist(100)=0 then goto rins_4
make sound from memblock 400+x,100
goto rins_4
rins_5:
read long 1,x
if x=12 then return
if memblock exist(100)=1 then delete memblock 100
if sound exist(x+500)=1 then delete sound x+500
read memblock 1,100
if memblock exist(100)=0 then goto rins_5
make sound from memblock 500+x,100
goto rins_5
writeins_1:
for x=101 to 110
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then goto skip_a
for c=0 to songto
if music(c,x-100,1)<>0 then make memblock from sound 100,x:write long 1,x-100:write memblock 1,100:goto skip_a
next c
skip_a:
next x
write long 1,12
return
writeins_2:
for x=201 to 210
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then goto skip_b
for c=0 to songto
if music(c,x-200,2)<>0 then make memblock from sound 100,x:write long 1,x-200:write memblock 1,100:goto skip_b
next c
skip_b:
next x
write long 1,12
return
writeins_3:
for x=301 to 310
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then goto skip_c
for c=0 to songto
if music(c,x-300,3)<>0 then make memblock from sound 100,x:write long 1,x-300:write memblock 1,100:goto skip_c
next c
skip_c:
next x
write long 1,12
return
writeins_4:
for x=401 to 410
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then goto skip_d
for c=0 to songto
if music(c,x-400,4)<>0 then make memblock from sound 100,x:write long 1,x-400:write memblock 1,100:goto skip_d
next c
skip_d:
next x
write long 1,12
return
writeins_5:
for x=501 to 510
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then goto skip_e
for c=0 to songto
if music(c,x-500,5)<>0 then make memblock from sound 100,x:write long 1,x-500:write memblock 1,100:goto skip_e
next c
skip_e:
next x
write long 1,12
return
rem !@@@!!!!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@2222
writeins1:
for x=101 to 110
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then gosub clsound
make memblock from sound 100,x
write memblock 1,100
next x
return
clsound:
load sound "glitchfix.wav",x
return
writeins2:
for x=201 to 210
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then gosub clsound
make memblock from sound 100,x
write memblock 1,100
next x
return
writeins3:
for x=301 to 310
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then gosub clsound
make memblock from sound 100,x
write memblock 1,100
next x
return
writeins4:
for x=401 to 410
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then gosub clsound
make memblock from sound 100,x
write memblock 1,100
next x
return
writeins5:
for x=501 to 510
if memblock exist(100)=1 then delete memblock 100
if sound exist(x)=0 then gosub clsound
make memblock from sound 100,x
write memblock 1,100
next x
return
makenewinstrument:
global win
global cancel
win=0
cancel=0
ed2=0
but1=0
but2=0
but3=0
but4=0
but5=0
but6=0
but7=0
but8=0
but9=0
but10=0
mkf=0
lbl1=0
lbl2=0
lbl3=0
lbl4=0
lbl5=0
lbl6=0
lbl7=0
lbl8=0
lbl9=0
lbl0=0
win=createWindow(350,350,550,350,"Create a new Instrument",1,1,0,win)
cancel=createbutton(300,250,200,30,"Done/Cancel",0,win)
ed2=createedit(100,20,100,20,0,win)
mkf=createbutton(210,20,50,20,"Save File",0,win)
but1=createbutton(100,50,40,20,"+5",0,win)
but2=createbutton(100,70,40,20,"+4",0,win)
but3=createbutton(100,90,40,20,"+3",0,win)
but4=createbutton(100,110,40,20,"+2",0,win)
but5=createbutton(100,130,40,20,"+1",0,win)
but6=createbutton(100,150,40,20,"-1",0,win)
but7=createbutton(100,170,40,20,"-2",0,win)
but8=createbutton(100,190,40,20,"-3",0,win)
but9=createbutton(100,210,40,20,"-4",0,win)
but10=createbutton(100,230,40,20,"-5",0,win)
lbl1=createlabel(150,50,400,20,"? WAV Filename ?",win)
lbl2=createlabel(150,70,400,20,"? WAV Filename ?",win)
lbl3=createlabel(150,90,400,20,"? WAV Filename ?",win)
lbl4=createlabel(150,110,400,20,"? WAV Filename ?",win)
lbl5=createlabel(150,130,400,20,"? WAV Filename ?",win)
lbl6=createlabel(150,150,400,20,"? WAV Filename ?",win)
lbl7=createlabel(150,170,400,20,"? WAV Filename ?",win)
lbl8=createlabel(150,190,400,20,"? WAV Filename ?",win)
lbl9=createlabel(150,210,400,20,"? WAV Filename ?",win)
lbl0=createlabel(150,230,400,20,"? WAV Filename ?",win)
flushevents
sleep 500
show mouse
do
getevent
if eventtype()=mouse_click and eventsource()=cancel then deletegadget win:return
if eventtype()=mouse_click and eventsource()=but1 then fil1$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl1,"... "+right$(fil1$,25)
if eventtype()=mouse_click and eventsource()=but2 then fil2$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl2,"... "+right$(fil2$,25)
if eventtype()=mouse_click and eventsource()=but3 then fil3$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl3,"... "+right$(fil3$,25)
if eventtype()=mouse_click and eventsource()=but4 then fil4$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl4,"... "+right$(fil4$,25)
if eventtype()=mouse_click and eventsource()=but5 then fil5$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl5,"... "+right$(fil5$,25)
if eventtype()=mouse_click and eventsource()=but6 then fil6$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl6,"... "+right$(fil6$,25)
if eventtype()=mouse_click and eventsource()=but7 then fil7$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl7,"... "+right$(fil7$,25)
if eventtype()=mouse_click and eventsource()=but8 then fil8$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl8,"... "+right$(fil8$,25)
if eventtype()=mouse_click and eventsource()=but9 then fil9$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl9,"... "+right$(fil9$,25)
if eventtype()=mouse_click and eventsource()=but10 then fil0$=opendialog("Open Wav Sound File","Wav... [*wav]|*.wav"):sleep 500:setgadgettext lbl0,"... "+right$(fil0$,25)
if eventtype()=mouse_click and eventsource()=mkf and getgadgettext(ed2)<>"" then gosub saveinsfile
sync rate 0
fastsync
loop
saveinsfile:
cd "ins"
f$=getgadgettext(ed2)
if file exist(f$+".3in") then doit=questionMessage("","Overwrite existing file?"):if doit=1 then delete file f$+".3in" else cd "..":return
open to write 1,f$+".3in"
write string 1,"Instrument wav sound set #0012ab"
for x=11 to 20
if sound exist(x)=1 then delete sound x
next x
if file exist(fil1$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil1$,11
play sound 11:sleep 100
if sound playing(11)=1 then stop sound 11
if file exist(fil2$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil2$,12
play sound 12:sleep 100
if sound playing(12)=1 then stop sound 12
if file exist(fil3$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil3$,13
play sound 13:sleep 100
if sound playing(13)=1 then stop sound 13
if file exist(fil4$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil4$,14
play sound 14:sleep 100
if sound playing(14)=1 then stop sound 14
if file exist(fil5$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil5$,15
play sound 15:sleep 100
if sound playing(15)=1 then stop sound 15
if file exist(fil6$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil6$,16
play sound 16:sleep 100
if sound playing(16)=1 then stop sound 16
if file exist(fil7$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil7$,17
play sound 17:sleep 100
if sound playing(17)=1 then stop sound 17
if file exist(fil8$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil8$,18
play sound 18:sleep 100
if sound playing(18)=1 then stop sound 18
if file exist(fil9$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil9$,19
play sound 19:sleep 100
if sound playing(19)=1 then stop sound 19
if file exist(fil0$)=0 then message "Sound file missing?":close file 1:delete file f$+".3in":cd "..":return
load sound fil0$,20
play sound 20:sleep 100
if sound playing(20)=1 then stop sound 20
for x=11 to 20
if memblock exist(x)=1 then delete memblock x
next x
make memblock from sound 11,11
make memblock from sound 12,12
make memblock from sound 13,13
make memblock from sound 14,14
make memblock from sound 15,15
make memblock from sound 16,16
make memblock from sound 17,17
make memblock from sound 18,18
make memblock from sound 19,19
make memblock from sound 20,20
for x=11 to 20
write memblock 1,x
next x
close file 1
cd ".."
return
record:
global win
global cancel
win=0
cancel=0
ed2=0
but1=0
but2=0
but3=0
but4=0
but5=0
but6=0
but7=0
but8=0
but9=0
but10=0
mkf=0
lbl1=0
lbl2=0
lbl3=0
lbl4=0
lbl5=0
lbl6=0
lbl7=0
lbl8=0
lbl9=0
lbl0=0
win=createWindow(350,350,550,350,"Record Music To WAV File",0,0,0,win)
cancel=createbutton(300,250,200,30,"Done/Exit",0,win)
ed2=createedit(100,20,100,20,0,win)
mkf=createlabel(210,20,100,20,"Estimated file size",win)
cb1=createedit(100,50,100,20,0,win)
mkf=createlabel(210,50,150,20,"Times to Repeat music",win)
mkf2=createlabel(30,210,470,40,"Note: When recording make sure that you do not move the mouse too much and distract windows from recording. Moving this window around or selecting another one will cause you to Re-Record it from the start again. If its not recording anything refer to the help files on setting up the sound card.",win)
global prog
prog=createProgressBar(50,100,450,20,win)
setProgressBarRange prog,0,100
setProgressBarPos prog,0
rem cb2=createedit(100,80,100,20,0,win)
rem mkf=createlabel(210,80,150,20,"Fade Music at end Notes",win)
but3=createbutton(100,130,100,20,"(mono)Recording",0,win)
but4=createbutton(100,160,100,20,"No Recorded Data",0,win)
but5=createbutton(100,190,100,20,"Save Recording",0,win)
global altrecord
altrecord=createbutton(40,130,50,20,"SD REC",0,win)
but6=createbutton(210,130,100,20,"Cancel",0,win)
but7=createbutton(210,160,100,20,"Cancel",0,win)
setgadgetenabled but6,0
setgadgetenabled but7,0
setgadgetenabled but4,0
setgadgetenabled but5,0
setgadgettext ed2,"500000"
setgadgettext cb1,"3"
show mouse
do
getevent
if sound exist(600)=1 and getgadgetenabled(but4)=0 then setgadgetenabled but4,1:setgadgettext but4,"Play Recording":setgadgetenabled but5,1
if eventtype()=mouse_click and eventsource()=cancel then deletegadget win:note=0:setscrollbarposition sbar,note:return
if eventtype()=mouse_click and eventsource()=but3 then gosub recordmusic
if eventtype()=mouse_click and eventsource()=but4 then gosub replaymusic
if eventtype()=mouse_click and eventsource()=but5 then bob$=savedialog("Save Wav File","Wav File... [*.wav]|*.wav","music"):gosub savewav
if eventtype()=mouse_click and eventsource()=altrecord then gosub recordmusic2
setProgressBarRange prog,0,100
setProgressBarPos prog,0
progress=0
sync rate 0
fastsync
loop
savewav:
if bob$="" then return
if sound exist(600)=0 then message "No recorded data":return
if file exist(bob$)=1 then delete file bob$
save sound bob$,600:
message "Done :)"
return
recordmusic:
bob$=getgadgettext(cb1)
cnt=val(bob$)
note=0
playing=1:rep=1
v1=gettrackbarposition(vol1)
v2=gettrackbarposition(vol2)
v3=gettrackbarposition(vol3)
v4=gettrackbarposition(vol4)
v5=gettrackbarposition(vol5)
n1=gettrackbarposition(vol1)
n2=gettrackbarposition(vol2)
n3=gettrackbarposition(vol3)
n4=gettrackbarposition(vol4)
n5=gettrackbarposition(vol5)
bba$=getgadgettext(ed2)
bba=val(bba$)
setgadgetenabled but6,1
gg$=getgadgettext(size)
gg=val(gg$)
setProgressBarRange prog,0,gg*(cnt+1)
setProgressBarPos prog,0
progress=0
delay_start=0:
record sound 600,bba
do
getevent
if eventtype()=mouse_click and eventsource()=but6 then playing=0:setgadgetenabled but6,0:gosub offnotes
if playing=0 then stop recording sound:setgadgetenabled but6,0:return
gosub playnotes2
sync
loop
return
playnotes2:
if delay_start=0 then delay_start=timer()
boo$=getgadgettext(delayedit)
if val(boo$)>255 then boo=255:setgadgettext delayedit,"255"
if val(boo$)=<1 then boo=1
boo=255-val(boo$)
if timer()-delay_start<=boo*2 then return
rem delay_start=0
rem delay_start=timer()
left_over=timer()-delay_start-(boo*2)
delay_start=timer()-left_over
gg$=getgadgettext(size)
gg=val(gg$)
if note>gg then playing=0:delay=1000
if playing=0 and cnt>0 then playing=1:cnt=cnt-1:delay=0:note=0:rem setscrollbarposition sbar,note
if playing=0 then gosub offnotes:return
for x=1 to 10
for y=1 to 5
if y=1 then pan=gettrackbarposition(pan1):vol=gettrackbarposition(vol1):
if y=2 then pan=gettrackbarposition(pan2):vol=gettrackbarposition(vol2)
if y=3 then pan=gettrackbarposition(pan3):vol=gettrackbarposition(vol3)
if y=4 then pan=gettrackbarposition(pan4):vol=gettrackbarposition(vol4)
if y=5 then pan=gettrackbarposition(pan5):vol=gettrackbarposition(vol5)
if music(note,x,y)=1 and sound exist((y*100)+x)=1 then gosub lsound
if music(note,x,y)=2 and sound exist((y*100)+x)=1 then gosub psound
if music(note,x,y)=0 and sound exist((y*100)+x)=1 then gosub ssound
next y
next x
note=note+1:
progress=progress+1
setProgressBarPos prog,progress
boo$=getgadgettext(size)
boo=val(boo$)
rem if note=>60 and boo>note+20 then setscrollbarposition sbar,note-58
return
replaymusic:
if sound exist(600)=0 then return
play sound 600
setgadgetenabled but7,1
do
getevent
if eventtype()=mouse_click and eventsource()=but7 then playing=0:setgadgetenabled but7,0:stop sound 600:return
if sound playing(600)=0 then setgadgetenabled but7,0:return
sync
loop
recordmusic2:
bob$=getgadgettext(cb1)
cnt=val(bob$)
note=0
playing=1:rep=1
setgadgetenabled but3,0
v1=gettrackbarposition(vol1)
v2=gettrackbarposition(vol2)
v3=gettrackbarposition(vol3)
v4=gettrackbarposition(vol4)
v5=gettrackbarposition(vol5)
n1=gettrackbarposition(vol1)
n2=gettrackbarposition(vol2)
n3=gettrackbarposition(vol3)
n4=gettrackbarposition(vol4)
n5=gettrackbarposition(vol5)
bba$=getgadgettext(ed2)
bba=val(bba$)
setgadgetenabled but6,1
gg$=getgadgettext(size)
gg=val(gg$)
setProgressBarRange prog,0,gg*(cnt+1)
setProgressBarPos prog,0
progress=0
delay_start=0:
`record sound 600,bba
do
getevent
if eventtype()=mouse_click and eventsource()=but6 then playing=0:setgadgetenabled but6,0:gosub offnotes
if playing=0 then setgadgetenabled but6,0:setgadgetenabled but3,1:return
gosub playnotes2
sync
loop