SONY Developers

developers Top
Getting Started
Program Information
Calendar
Developer's Spotlight
Yamada's Programming Tips
Obtain Development Tools
Development Information
Developer Forum
FAQ
Link to Palm, Inc.
Developer's Spotlight

This section of our Web site is dedicated to our developers. It will feature developers who have created applications specifically for the Sony CLIÉ Handheld. This section focuses on tips, tricks, and other comments straight from our developer's experiences working with the Sony CLIÉ Handheld.

This first article, in a five part series, is by Brian Friedkin of Kinoma, Inc. Brian Friedkin is one of the Founders of Kinoma, Inc - a top-notch Palm OS digital media player developer. Brian discusses his recent experience developing applications to support playback of video, audio, animation, VR objects, VR panoramas, and still images synchronized with audio on the 480x320 screen available on higher end models, like the PEG-NX70V.








Tips from Kinoma Engineering

Since its introduction in June 2002, the Kinoma Player has enjoyed great success as the first comprehensive digital media player for the Palm OS. It was recently awarded Handheld Computing's "Best of 2002 Award." Kinoma Player supports playback of video, audio, animation, VR objects, VR panoramas, and still images synchronized with audio. Coupled with the multimedia-rich Sony CLIÉ devices, the Kinoma Player provides playback of full screen video with high quality stereo audio, with integrated support for Memory Stick media, Jog-Dial navigator, Remote Commander, and the 480 x 320 screen available on higher end models. While this site does provide many useful SDK's, here are a few additional tips which can hopefully save you time in developing killer apps for CLIÉ Handheld.


Listed below are the topics of the five part series programming tips from Brian:

PART 1: HIGH DENSITY BITMAPS
Part 2: Yamaha ADPCM audio
Part 3: CLIÉ Handheld Launcher Application Categories
Part 4: Calling ARMlets from shared libraries
Part 5: That Wacky Virtual Silkscreen


PART 1: HIGH DENSITY BITMAPS - First in a series of five

        As discussed in the previous Developer Spotlight article, one of the most common challenges in supporting the CLIÉ Handheld high resolution display, is the creation of the back buffer bitmap. Calling MemPtrNew() to allocate the bits will generally fail on allocation requests > 64K. Using Feature Memory for large allocations certainly works on Palm OS versions 3.5 or newer. To avoid having to write to that memory using the Data Manager function DmWrite() you could grab the memory semaphore and write to that feature memory directly:


// Allocate a full screen 320 x 320, 16 bits per pixel buffer

char * baseAddr = NULL;

UInt32 bufferSize = 320L * 320L * 2;

FtrPtrNew(�ABCD�, 320L * 320L * 2, &baseAddr;);



// Clear out the buffer

If (NULL != baseAddr) {

	UInt32 nLongs = bufferSize / 4;

	UInt32 *bufferPtr = (UInt32*)baseAddr;

	MemSemaphoreReserve(true);

	While (nLongs--)

		*bufferPtr++ = 0;

	MemSemaphoreRelease(true);

}



While this memory semaphore trick does work on Palm OS 5, there is a better way to allocate large buffers on Palm OS 5, which doesn't require using Feature Memory. The undocumented call you want to use is MemChunkNew(). Despite being undocumented, Palm developer support does recommend using this technique, and so there shouldn't be any risk:


SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP)

      SYS_TRAP(sysTrapSysGetAppInfo);

#define memNewChunkFlagAllowLarge	0x1000	// allow >64K allocations




// Allocate a full screen 320 x 320, 16 bpp buffer

char * baseAddr = NULL;

UInt32 bufferSize = 320L * 320L * 2;

SysAppInfoPtr appInfoP;

UInt16 currentOwnerID = SysGetAppInfo(&unusedAppInfoP;, & appInfoP)->memOwnerID;

baseAddr = MemChunkNew(0, bufferSize,

      currentOwnerID | memNewChunkFlagNonMovable |memNewChunkFlagAllowLarge);



// Clear out the buffer

If (NULL != baseAddr) {

	UInt32 nLongs = bufferSize / 4;

	UInt32 *bufferPtr = (UInt32*)baseAddr;

	While (nLongs--)

		*bufferPtr++ = 0;

}



There is one caveat with allocating memory via MemChunkNew(): you must not forget to free this memory via MemPtrFree() before your application terminates. Otherwise a memory leak may occur, since the system doesn't necessarily reclaim the memory when your app shuts down.


Stay tuned for the next part in this five part series: Part 2: Yamaha ADPCM audio


Programatically Launching Kinoma Player

Many of you developers want to further enhance your CLIÉ Handheld applications with video playback. Hence I wanted to close out this article by letting you know that the Kinoma Player can be launched to play back a video via the Palm OS call SysUIAppSwitch(). Once the video is dismissed, your application is re-launched and resumes control. The video can be played back from either internal storage or from Memory Stick media. A Kinoma tech-note and sample code are available upon request to support@kinoma.com.


About the Author and Kinoma Inc.:

When not playing movies on his CLIÉ Handheld, Brian can be found running and biking up and down the coast in Del Mar, CA. He can also occasionally be spotted playing disc golf and even sometimes snowboarding at Big Bear.

Kinoma, Inc. is a privately held company dedicated to bringing outstanding digital media capabilities to handheld and mobile devices. Founded in 2002 by Peter Hoddie, former Chief Architect of QuickTime at Apple Computer, together with Elizabeth Dykstra-Erickson, Brian Friedkin, and Michael Kellner, the Kinoma team has over 40 years combined experience designing and building industry leading digital media solutions and standards. For additional information visit Kinoma's Web site at www.kinoma.com.

Kinoma is a trademark of Kinoma, Inc. Other company and product names may be trademarks of their respective owners.


For more developer Spotlight archive, click here.

For our Developer Spotlight of the month, click here.


Image
© 2002 Sony Electronics Inc. All rights reserved.
Privacy PolicyPrivacy Policy