DTMF Library for CLIE 1.0

(c) 2002 Hiroyuki Okamoto
All Rights Reserved.
http://hokamoto.tripod.com/

This is a library to make a DTMF sound for Sony CLIE.
DTMF Library supports only Sony CLIE models which supports PCM sound.

1. Usage
Put "DTMFLib.h" in your Palm application project and include it in your source.
Install "DTMFLib for CLIE.prc" on Sony CLIE device.

2. API Reference

DTMFLibOpen

Purpose:
Open DTMFLib. Creates the library context.

Prototype:
Err DTMFLibOpen(UInt16 refNum, UInt32 * ctxP);

Parameters:
refNum - Library reference number
ctxP - Pointer to Library Context. Pass this value to each DTMF API.

Result:
0 on success. otherwise, error code

DTMFLibClose

Purpose:
Close DTMFLib. Release the library context.

Prototype:
Err DTMFLibClose(UInt16 refNum, UInt32 ctx);

Parameters:
refNum - Library reference number
ctx - Library Context.

Result:
0 on success. otherwise, error code

DTMFLibPlayChar

Purpose:
Play the ASCII character as a DTMF tone.

Prototype:
Err DTMFLibPlayChar(UInt16 refNum, UInt32 ctx, char ascChar, Int16 toneLength, UInt16 amplitude);

Parameters:
refNum - Library reference number
ctx - Library Context. Input the value returned from DTMFLibOpen().
ascChar - ASCII char to play. Valid character is one of 0123456789*#ABCD
amplitude - Specifies relative volume of the tone (1 - sndMax(64))

Result:
0 on success. otherwise, error code

DTMFLibPlayStr

Purpose:
Play the ASCII string as DTMF tones sequentially.

Prototype:
Err DTMFLibPlayStr(UInt16 refNum, UInt32 ctx, char *ascStr, Int16 toneLength, Int16 toneGap, UInt16 amplitude);

Parameters:
refNum - Library reference number
ascStr - ASCII string to play. Valid chars are 0123456789*#ABCD
toneLength - Length of each tone in msec (1 - 1000 msec)
toneGap - Time to delay between each tone in msec (1 - 1000 msec)
amplitude - Specifies relative volume of the tone (1 - sndMax(64))

Result:
0 on success. otherwise, error code

DTMFLibGetLibAPIVersion

Purpose:
Get the DTMF Libary version

Prototype:
Err DTMFLibGetLibAPIVersion(UInt16 refNum, UInt32 * dwVerP);

Parameters:
refNum - Library reference number
dwVerP - Pointer to the version number

Result:
0 on success. otherwise, error code

3. Sample

#include<PalmOS.h>
#include"DTMFLib.h"

static Err PlayDTMF()
{
UInt16 refNum;
UInt32 ctx;
Err err;

// Find DTMFlib, otherwise load it.
err = SysLibFind(DTMFLibName, &refNum);
if (err == sysErrLibNotFound)
err = SysLibLoad('libr', dtmfLibCreatorID, &refNum);
if (err)
return err;

// Open DTMFLib and get ctx
err = DTMFLibOpen(refNum, &ctx);
if (err)
return err;

// Play '#" tone
err = DTMFLibPlayChar(refNum, ctx, '#', 50, 32);
if (err)
goto done;

// Play "01234567890abcd#*" tones
err = DTMFLibPlayStr(refNum, ctx, "01234567890abcd#*", 50, 50, 32);

if (err)
goto done;

done:
DTMFLibClose(refNum, ctx);
return err;
}

 

This software ("DTMF Library for CLIE") is provided "AS IS" without warranty, representation,
promise or guarantee of any kind, either express or implied, statutory or
otherwise, including warranties as to quality, performance, merchantability,
or fitness for a particular purpose, or any warranty against infringement.
Your use of this product is entirely at your own risk.

This software is copyright (C) 2002 Hiroyuki Okamoto.
All Rights Reserved.

If this software is distributed as part of the other software,
permision to distrebute this software is granted only for your freeware release,
also, the accompanying documentation must state
that this software is based in part on the work of the author "Hiroyuki Okamoto",
and the author's web site, http://hokamoto.tripod.com/

Permission for use of this software is granted only if the user accepts
full responsibility for any undesirable consequences; the authors accept
NO LIABILITY for damages of any kind.