Specifications
3 ENHANCED SOUND OUTPUT
3-3
Example
#include <p_std.h>
#include <p_file.h>
#include <epoc.h>
GLDEF_C INT main(VOID)
{
INT ret;
VOID *mcb;
UWORD buf[10];
UWORD len;
WORD musstat;
ret=p_loadldd("SNDFRC.LDD");
if (ret && ret!=E_FILE_EXIST)
return(ret);
ret=p_open(&mcb,"MUS:",-1);
if (ret)
return(ret);
buf[0]=0x30+(40<<8);
buf[1]=0x32+(100<<8);
buf[2]=0x34+(40<<8)+(1<<6);
buf[3]=0x35+(100<<8)+(1<<6);
buf[4]=0x37+(40<<8)+(2<<6);
buf[5]=0x39+(100<<8)+(2<<6);
buf[6]=0x29+(40<<8)+(3<<6);
buf[7]=0x3b+(100<<8)+(3<<6);
len=8;
p_ioa5(mcb,P_FWRITE,&musstat,&buf[0],&len);
p_iowait();
return(0);
}
This plays a scale of eight notes, with notes having wavering length and increasing loudness.
Possible tones
There are three types of tones that the Series 3 loudspeaker hardware can emit: DTMF tones, modem
tones, and musical tones.
For standard dual DTMF tones, set the
tone
part of the
UWORD
to:
0x10
for DTMF digit
0
,
0x11
for digit
1
,
...,
0x19
for digit
9
,
0x1a
for "digit"
a
, ...,
0x1d
for "digit"
d
,
0x1e
for
*
, and
0x1f
for
#
.
For modem tones,
0x24
gives
1300 Hz
,
0x25
gives
2100 Hz
, then
1200
,
2200
,
980
,
1180
,
1070
,
1270
,
1650
,
1850
,
2025
, and
0x2f
gives
2225 Hz
.
As for musical tones, twenty five notes are possible, incrementing by semi-tones over a 2-octave interval
from
D#5
to
D#7
. The corresponding tone values are
0x30
,
0x31
,
0x32
,
0x33
,
0x34
,
0x35
,
0x36
,
0x37
,
0x38
,
0x39
,
0x3a
,
0x29
,
0x3b
,
0x3c
,
0x3d
,
0x0e
,
0x3e
,
0x2c
,
0x3f
,
0x04
,
0x05
,
0x25
,
0x2f
,
0x06
, and
0x07
.
Pauses
In order to pause, in the middle of a buffer of notes, set the tone value to
0
for one note.
When to open and close MUS:
An application that makes use of
MUS:
services from time to time ought to call
p_close
to free the sound
channel whenever it is not immediately needed. This allows other applications to make temporary use of
the sound channel - eg for alarms or for standard DTMF dialling dialogs.
If you wrote a game which opened
MUS:
at its beginning, and only made sounds from time to time, and left
this game in background while you went to the
Data
application to look up a telephone number, you
would find the DTMF dialler would be unable to emit any sounds, and would report "Sound system in
use" - even though the game is silent at the time.
Far better in these situations for a program to open
MUS:
just before it needs to use this channel, and then
close it again immediately afterwards.










