New update:
I've changed a few things and made the editor play alot smoother as well as the include file for dbpro:
1. Delay is now tempo ranging from 1-255....255 being the fastest play back
2. I also replaced the code that cycles to the next note. Instead of relying on frame rate and delay... It now uses the clock timer.
(this produces a very smooth sounding song with less distractions)
3. I've locked out the tabs control since too many drops the frame rate...16 is now standard
4. setting sync rate doesnt matter...its all based on tempo speed
Heres the updates----->
Rem Project: Q-music_include update #1
Rem Created: 12/12/2007 9:41:34 AM
Rem ***** Main Source File *****
function qsetup()
global dim Qmusic(10000,22,5)
global dim Qgraph(10,5)
global dim q_vol(5,1)
global dim q_pan(5,1)
global qnote=0
global qlay=0
global qdelay=0
global qplaying=0
global qrepeat=0
global qexists=0
global qendnote=0
global qsync=0
global qsong$="[]"
global qins1$="Instrument 1"
global qins2$="Instrument 2"
global qins3$="Instrument 3"
global qins4$="Instrument 4"
global qins5$="Instrument 5"
endfunction
function Qloadsong(q_name$)
if right$(q_name$,4)<>".3qn" then q_name$=q_name$+".3qn"
if file exist(q_name$)=1 then qexists=1 else qexists=0:exitfunction
open to read 1,q_name$
read string 1,dumby$
if dumby$="q-music vr2.0" then gosub q_standard:exitfunction
qexists=0
exitfunction
q_standard:
qnote=0
qplaying=0
for q_x=0 to 10000
for q_y=0 to 22
for q_z=0 to 5
qmusic(q_x,q_y,q_z)=0
next q_z
next q_y
next q_x
read string 1,dump$:qdelay=val(dump$)
read string 1,dump$:qsync=val(dump$)
read string 1,dump$:qendnote=val(dump$)
read string 1,qsong$
for q_x=0 to qendnote
for q_y=0 to 10
for q_z=0 to 5
read long 1,qmusic(q_x,q_y,q_z)
next q_z
next q_y
next q_x
read string 1,qins1$
read string 1,qins2$
read string 1,qins3$
read string 1,qins4$
read string 1,qins5$
read string 1,dumby$`tab size n/a
if qins1$<>"Instrument 1" then gosub readins1
if qins2$<>"Instrument 2" then gosub readins2
if qins3$<>"Instrument 3" then gosub readins3
if qins4$<>"Instrument 4" then gosub readins4
if qins5$<>"Instrument 5" then gosub readins5
for q_y=1 to 5
read long 1,q_vol(q_y,0)
read long 1,q_pan(q_y,0)
next q_y
close file 1
qexists=1
return
readins1:
for q_x=1001 to 1010
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock q_x,100
next q_x
return
readins2:
for q_x=1011 to 1020
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock q_x,100
next q_x
return
readins3:
for q_x=1021 to 1030
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock q_x,100
next q_x
return
readins4:
for q_x=1031 to 1040
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock q_x,100
next q_x
return
readins5:
for q_x=1041 to 1050
if memblock exist(100)=1 then delete memblock 100
read memblock 1,100
make sound from memblock q_x,100
next q_x
return
endfunction
function Qloop()
qnote=0
qplaying=1
qrepeat=1
qlay=timer()
endfunction
function qplay()
qnote=0
qplaying=1
qrepeat=1
qlay=timer()
endfunction
function qstop()
qplaying=0:qrepeat=0:qlay=0
for q_x=1000 to 1050
if sound exist(q_x)=1 then gosub checkandkillsound
next q_x
exitfunction
checkandkillsound:
if sound playing(q_x)=1 then set sound volume q_x,0:stop sound q_x
return
endfunction
function qresume()
qplaying=1:qrepeat=1:qlay=timer()
endfunction
function qspeedup()
qdelay=qdelay-1:if qdelay=<0 then qdelay=0
endfunction
function qslowdown()
qdelay=qdelay+1
if qdelay=>255 then qdelay=255
endfunction
function qupdate()
playnotes2:
if qlay=0 then qlay=timer()
boo$=str$(qdelay)
if val(boo$)>255 then boo=255
if val(boo$)=<1 then boo=1
boo=255-val(boo$)
if timer()-qlay<=boo then exitfunction
qlay=timer()
if qnote>qendnote then qplaying=0:qlay=1000
if qplaying=0 and qrepeat=1 then qplaying=1:qlay=0:qnote=0:
if qplaying=0 then qstop():exitfunction
for q_x=1 to 10
for q_y=1 to 5
pan=q_pan(q_y,0):vol=q_vol(q_y,0)
if qmusic(qnote,q_x,q_y)=1 and sound exist((q_y*10)+q_x+990)=1 then gosub qlsound:Qgraph(q_x,q_y)=1
if qmusic(qnote,q_x,q_y)=2 and sound exist((q_y*10)+q_x+990)=1 then gosub qpsound:Qgraph(q_x,q_y)=2
if qmusic(qnote,q_x,q_y)=0 and sound exist((q_y*10)+q_x+990)=1 then gosub qssound:Qgraph(q_x,q_y)=0
next q_y
next q_x
qnote=qnote+1
exitfunction
qlsound:
if sound playing((q_y*10)+q_x+990)=1 then return
set sound volume (q_y*10)+q_x+990,0
loop sound (q_y*10)+q_x+990
set sound volume (q_y*10)+q_x+990,(vol*6)+40
if pan=1 then set sound pan (q_y*10)+q_x+990,-10000
if pan=2 then set sound pan (q_y*10)+q_x+990,-5000
if pan=3 then set sound pan (q_y*10)+q_x+990,0
if pan=4 then set sound pan (q_y*10)+q_x+990,5000
if pan=5 then set sound pan (q_y*10)+q_x+990,10000
return
qpsound:
stop sound (q_y*10)+q_x+990
set sound volume (q_y*10)+q_x+990,0
play sound (q_y*10)+q_x+990
set sound volume (q_y*10)+q_x+990,(vol*6)+40
if pan=1 then set sound pan (q_y*10)+q_x+990,-10000
if pan=2 then set sound pan (q_y*10)+q_x+990,-5000
if pan=3 then set sound pan (q_y*10)+q_x+990,0
if pan=4 then set sound pan (q_y*10)+q_x+990,5000
if pan=5 then set sound pan (q_y*10)+q_x+990,10000
return
qssound:
if sound playing((q_y*10)+q_x+990)=1 then set sound volume (q_y*10)+q_x+990,0:stop sound (q_y*10)+q_x+990
return
endfunction
its nice cause now it doesnt matter what frame rate your program
is set to. It will always play the right speed.(at least try to)
here is the qmusic editor update 1: just replace the old exe
make sure you fix the song speeds in the editor befor you try to run them with this new include file.
Any questions or thoughts?