home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
QBAS
/
QPAKWIN.ZIP
/
INSTALL.EXE
/
PLAY.DOC
< prev
next >
Wrap
Text File
|
1991-10-30
|
3KB
|
90 lines
Play uses the same script strings supported by the PLAY statement
in regular Microsoft BASIC.
Play supports the following basic notation:
Letter notes "A" through "G" in upper or lower case
Optional "+" or "#" suffix to indicate a musical Sharp
Optional "-" suffix to indicate a musical Flat
Optional numeric suffix to override a note's duration
Example: "c#16 g- c"
Tempo in the range of 32 through 255
Example: "t155 bbb8 bbb8"
Default: "t120"
Length of each note in the range of 1 through 64
Example: "l16 bbb8 bbb8"
Default: "l4"
Octave in the range of 0 through 6
Example: "o2 ggg P32 e-4"
Default: "o4"
Octave Up and Down "<" and ">" symbols
Example: "cdefgab<c c>bagfedc"
Music Normal, Staccato, Legato modifiers
Example: "mn c ms d ml l32ef"
Default: "mn"
Note: BASIC's "MF" and "MB" have no effect and are ignored.
Pause (rest) for a duration 1 through 64
Example: "l8 ggg p32 e-4"
Numeric notes in the range of 0 through 84
Example: "n55 n56 n57 n0 n58"
Note that a note value of zero ("n0") is a rest.
The following statements play "On top of old smokey". Note that these
multiple statements should be combined into a single long string for
code efficiency. This example is shown in portions for ease of commenting.
Also note that extra spaces are ignored by the Play function and are used
here solely for clarity.
Status = Play%("t180 l4") 'tempo = 180, note length = 4
Status = Play%("o3 ms") 'octave = 3, music = staccato
Status = Play%("cceg") 'the first four notes
Status = Play%("> c2") 'up an octave, play C as a half note
Status = Play%("< a2") 'octave back down, A is a half note
Status = Play%("afgag1") 'the last note here is a whole note
Comments:
This function requires that the Windows sound driver SOUND.DRV
supplied with QuickPak Professional for Windows be installed in
your Windows system directory. The driver supplied with this
package is an updated version of the one supplied with Windows 3.0,
and you may distribute it with your applications.
Since the Windows sound driver cannot accept a new Play string when
it is busy executing a previous script, you must create code to check
the driver's status as follows:
Do Until Play%(Tune$)
Dummy% = DoEvents%()
Loop
This example continually tries to execute the script contained in
Tune$ until the Play function returns a non-zero result. A return
status other than zero indicates that the music was accepted by the
sound driver, or an error occured preventing any music from being
played. The DoEvents%() statement ensures that other Windows tasks
are able to execute while you are waiting for the sound driver to
complete the script.