API Guide Home
(Online version only)

PalmSoundMgrExt.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  * Copyright (c) 2004 palmOne, Inc. or its subsidiaries.
00003  * All rights reserved.
00004  *****************************************************************************/
00005 /**
00006  * @ingroup Sound
00007  *
00008  */
00009 
00010 /**
00011  * @file    PalmSoundMgrExt.h
00012  *
00013  * @brief   Public 68K include file for the Extended Sound Manager.
00014  *
00015  * Notes:
00016  * You should check to see if you are using a version of Palm OS SDK that
00017  * implements the Extended Sound API.  For lack of a better check,
00018  * look for the earlier of the system traps and hope that the rest is
00019  * likewise defined.
00020  *
00021  * The calling application should always load this library with
00022  * SysLibLoad() before use, even if it is already open by another
00023  * application(ie, SysLibFind() returns a valid refnum). When
00024  * the application is done with the library, it should be
00025  * unloaded with SysLibRemove(). We do this because there is
00026  * no good way to synchronize loading and unloading of libraries
00027  * among multiple applications. It also greatly simplifies internal
00028  * synchronization.
00029  */
00030 
00031 
00032 #ifndef __SOUNDMGREXT_H__
00033 #define __SOUNDMGREXT_H__
00034 
00035 /***********************************************************************
00036  * Palm OS common definitions
00037  ***********************************************************************/
00038 #include <SoundMgr.h>
00039 
00040 #ifndef sysTrapSndStreamCreateExtended
00041 
00042 /**
00043  * @name Extended Sound library traps
00044  *
00045  */
00046 /*@{*/
00047 #ifndef sysTrapSndStreamCreateExtended
00048 #define sysTrapSndStreamCreateExtended              0xA466
00049 #endif
00050 
00051 #ifndef sysTrapSndStreamDeviceControl
00052 #define sysTrapSndStreamDeviceControl               0xA467
00053 #endif
00054 /*@}*/
00055 
00056 /**
00057  * Sound format type
00058  */
00059 enum {
00060     sndFormatPCM        = 0,            /**<Raw PCM (Pulse Code Modulation), (attributes defined by type parameter). */
00061     sndFormatIMA_ADPCM  = 'APCM',       /**<IMA ADPCM (Interactive Multimedia Association Adaptive Differential PCM). */
00062     sndFormatDVI_ADPCM  = 'DPCM',       /**<Intel/MS/DVI ADPCM. */
00063     sndFormatMP3        = 'MPG3',       /**<Moving Picture Experts Group, Audio Layer III (MPEG-1 and MPEG-2 depending on bit-rate). */
00064     sndFormatAAC        = 'DAAC',       /**<Dolby Advanced Audio Coding. */
00065     sndFormatOGG        = 'OGGV'        /**<Ogg Vorbis. */
00066 };
00067 
00068 /** Holds sound format type. */
00069 typedef UInt32 SndFormatType;
00070 
00071 
00072 /// Extended Sound Manager callback.
00073 ///
00074 /// @param userDataP:   IN: Pointer to the user data passed in SndStreamCreateExtended.
00075 /// @param streamRef:   IN: Opaque reference to the stream returned by SndStreamCreateExtended.
00076 /// @param bufferP:     IN: Data buffer.
00077 /// @param bufferSizeP: IN: Pointer to the buffer size in bytes. This MUST be set before returning to the number of bytes read or written.
00078 /// @retval Err Error code.
00079 typedef Err (*SndStreamVariableBufferCallback) (
00080     void            *userDataP,
00081     SndStreamRef    streamRef,
00082     void            *bufferP,
00083     UInt32          *bufferSizeP
00084 );
00085 
00086 
00087 #ifdef __cplusplus
00088 extern "C" {
00089 #endif
00090 
00091 /// Creates a sound stream using the Extended Sound API.
00092 ///
00093 /// @param streamP:     IN: Receives the opaque reference to the stream.
00094 /// @param mode:        IN: Direction of the sream, either sndInput or sndOutput.
00095 /// @param format:      IN: Sound format. (sndFormatPCM...)
00096 /// @param sampleRate:  IN: Sampling rate, in frames-per-second. (8000, 44100,...)
00097 /// @param sampleType:  IN: Sample size and endianness of the data. (sndInt16...)
00098 /// @param width:       IN: The number of channels: sndMono for one channel, sndStrereo for two.
00099 /// @param sndCallback: IN: A callback function that gets called when another buffer for sound is needed.
00100 /// @param userDataP:   IN: Caller-defined data that gets passed to SndStreamVariableBufferCallback.
00101 /// @param bufferSize:  IN: Preferred size in bytes for the buffers that are passed to sndCallback.
00102 /// @param armNative:   IN: Pass true if the callback function is written in ARM-native code. If it’s 68K, pass false.
00103 /// @retval Err Error code.
00104 extern Err SndStreamCreateExtended(
00105         SndStreamRef                    *streamP,
00106         SndStreamMode                   mode,
00107         SndFormatType                   format,
00108         UInt32                          sampleRate,
00109         SndSampleType                   sampleType,
00110         SndStreamWidth                  width,
00111         SndStreamVariableBufferCallback sndCallback,
00112         void                            *userDataP,
00113         UInt32                          bufferSize,
00114         Boolean                         armNative)
00115             SYS_TRAP(sysTrapSndStreamCreateExtended);
00116 
00117 /// An extended function to handle new or device specific custom sound controls.
00118 ///
00119 /// @param stream:  IN: Opaque reference to the stream returned by SndStreamCreateExtended.
00120 /// @param cmd:     IN: One of the defined custom control enums, such as sndControlCodecCustomControl.
00121 /// @param paramP:  IN: Pointer to data specific to the specific custom control defined by cmd.
00122 /// @param size:    IN: Size in bytes of the structure passed in paramP.
00123 /// @retval Err Error code.
00124 extern Err SndStreamDeviceControl(SndStreamRef stream, Int32 cmd, void *paramP, Int32 size)
00125                             SYS_TRAP(sysTrapSndStreamDeviceControl);
00126 
00127 #ifdef __cplusplus
00128 }
00129 #endif
00130 
00131 #endif /* sysTrapSndStreamCreateExtended - 20 aug 2003 */
00132 
00133 #endif /* __SOUNDMGREXT_H__ */

Top Palm Developer Network
© 2004-2008, Palm, Inc. All rights reserved.
Generated on Fri Jun 13 10:06:54 2008 for Palm API Guide