m_play
This call plays musical notes in 7 octaves as well as many other options. This function takes a null (0) or <CR> terminated string, containing commands in the syntax described in the following.
- Syntax: void m_play(string_command)
- Parameters: char far *string_command - An ASCII string terminated by either a
carriage return or zero, consisting of any
legal combination of the play commands
(listed on the following page)
- Returns: None
- Related Calls: m_soundoff has no effect on sounds generated by this call.
- Comments: If a user terminates the playing of a sound string by input from
the keyboard (K command set to 1), note that the input buffer is not
flushed after terminating the sound. The keyboard input will be read
as the next input to program execution.
- Commands:
A Play musical note in current octave, length and tempo; may be
immediately followed by a + or # to indicate a sharp, or
a - to indicate a flat note
B Play musical note in current octave, length and tempo; may be
immediately followed by a + or # to indicate a sharp, or
a - to indicate a flat note
C Play musical note in current octave, length and tempo; may be
immediately followed by a + or # to indicate a sharp, or
a - to indicate a flat note
D Play musical note in current octave, length and tempo; may be
immediately followed by a + or # to indicate a sharp, or
a - to indicate a flat note
E Play musical note in current octave, length and tempo; may be
immediately followed by a + or # to indicate a sharp, or
a - to indicate a flat note
F Play musical note in current octave, length and tempo; may be
immediately followed by a + or # to indicate a sharp, or
a - to indicate a flat note
G Play musical note in current octave, length and tempo; may be
immediately followed by a + or # to indicate a sharp, or
a - to indicate a flat note
K Enable user termination if keystroke entered
The default is user termination enabled. The range is 0-1.
A value of 1 indicates user termination enabled.
L Length of note
The range is 1-64, where 64 = 1/8 note, 32 = 1/4 note, etc.
The default is 8 (whole note).
M Music play style; default = N; range:
N - Normal
L - Legato
S - Staccato
N An alternate way to play a note from the 8 octave scale.
Range 0-84. (Default = 0.) The number is divided by 12 to
determine the octave. The remainder is the note to be played:
Remainder 0 = C
1 = C# 4 = E 7 = G 10 = A#
2 = D 5 = F 8 = G# 11 = B
3 = D# 6 = F# 9 = A
O Octave; sets the current octave for all subsequent notes;
default = 4; range 0-7
P Pause; pause between notes; range 1-64
The length of pause is determined in the same manner as the length
of note (L).
T Tempo (pace of music)
A higher value indicates a faster pace. The range is 0-255.
The default is 150.
V Set speaker volume; range 0-3 (3 is loudest)
(semi-colon) Used to separate music for readability
(space) Used to separate music for readability
(comma) Used to separate music for readability
(period) Extend a note's play time by half again (e.g. 1.5)