Wiley.Games.on.Symbian.OS.A.Handbook.for.Mobile.Development.Apr.2008 (779888), страница 30
Текст из файла (страница 30)
In the quest for building convergence devices,the booming MP3 player market also attracted the attention of devicemakers. Because of the limited amount of processing power and memoryavailable in the devices, audio support for games had been traditionallyconstrained to synthesized audio generation (i.e., MIDI), not unlike thefirst days of PC games.124ADDING AUDIO TO GAMES ON SYMBIAN OS4.2 Multimedia Framework (MMF)The need to have better audio support in Symbian OS increased with theadvancement of audio hardware, the availability of processors that aremore powerful and the increased battery life of devices. This led to thedevelopment of the multimedia framework (MMF), which supports videorecording and playback as well as audio.The multimedia framework, shown in Figure 4.1, is an extendableframework allowing phone manufacturers and third parties to add plug-insto provide support for more audio and video formats.
For the application developer, it provides APIs that abstract away from the underlyinghardware, thereby simplifying the code needed to record and play thesupported formats. It also supports streaming APIs, which bypass largeparts of the MMF to provide a lower-level interface that allows streamingof audio data to and from the audio hardware.The most important part of the MMF for the game developer is theclient API. This API consists of several interfaces and is used to accessmost audio functionality provided by a Symbian OS device.
Figure 4.1shows a representation of how the MMF client API interfaces interactwith the multimedia controller framework and other components.The MMF requires a compatible audio controller plug-in to be presenton a Symbian OS device in order to support audio operations on audiodata of a certain type. The controller resides in a separate thread that theMMF creates, and all the audio processing is performed in this thread. InMMF Client APIAudio InterfaceVideo InterfaceRecord, play & convertRecord & playTone PlayerInterfaceAudio StreamingInterfaceTones and DTMF Streaming audio in & outMMF Controller FrameworkThread BoundaryAudio controllerplug-insVideo controllerplug-insDevSoundCodecplug-insFigure 4.1The Multimedia FrameworkMULTIMEDIA FRAMEWORK (MMF)125order to load an audio file using the MMF, the audio controller has tosupport the audio file format to be able to extract the audio data from thefile.
Moreover, in order to play the audio data, the correct audio codecplug-in needs to be present in the device.Codec support for a particular audio type in a device is usuallyprovided at the DevSound level as a HW device plug-in. The codecs willhave low-level access to the hardware and the codec software will runon the application processor and not on a dedicated piece of hardware.Codec support can also be provided at the MMF level as an MMF codecplug-in, but this is more of a legacy use and is no longer recommendedby Symbian. The main difference between an MMF codec plug-in anda DevSound plug-in is audio streaming support.
Only DevSound levelplug-ins can support audio streaming.Because of the fragmented nature of mobile devices and the multilicensee business model of Symbian OS, it is very important for a gamedeveloper to know the technical specifications of the devices targeted. Forthe purposes of audio development, this means knowing which SymbianOS devices support which audio codecs, so that the audio developercan create compatible audio assets for the game.
It may also be requiredto know what specialized custom interfaces (if any) are used to initialize or configure the codec parameters because these can also vary bymanufacturer.4.2.1 Supported Codecs in Specific DevicesAlthough the default Symbian OS MMF implementation comes with anaudio controller that supports basic audio formats (for example, WAV) andcodecs (for example, PCM), most Symbian OS phones provide supportfor playback of many popular formats such as MP3, advanced audio coding (AAC), and AMR. Phone manufacturers supply additional controllerplug-ins only to selected devices because of dependencies on specificaccelerated hardware components, licensing issues, DRM requirements,or other business factors.
Manufacturers select audio support as one of thedifferentiating factors between the devices of different licensees. Thereare different levels of support even between different devices from thesame manufacturer, which causes audio to be one of the areas mostaffected by device fragmentation.Usually these advanced formats are more useful to game developersbecause they are compressed and usually have hardware accelerateddecoders. The reduced audio file sizes and increased processor time forother game engine tasks are a requirement for advanced games.Although it is possible to have audio plug-ins for a particular codecinstalled with the game itself, these codecs will be software-only and willnot be able to use accelerated hardware.
Therefore, in order to selectthe most appropriate audio format for a game project’s audio assets, thedeveloper needs to evaluate the available options.126ADDING AUDIO TO GAMES ON SYMBIAN OSBy default, Symbian OS provides the ‘Symbian Audio Controller’ tosupport playback and recording of uncompressed pulse code modulation(PCM) data. It provides playback and recording support for PCM datacontained in WAV, Au, and Raw files. It supports 8- and 16-bit PCMformats and IMA-ADPCM (Adaptive Differential PCM), Mu-law, A-law,and GSM 610 PCM variants.On top of the default codecs provided by Symbian, both S60 and UIQphones have their own sets of supported codecs, as shown in Table 4.1.1Table 4.1 Codecs supported in some current S60 and UIQ devicesPlatformS60 3rdEditionS60 3rdEditionS60 3rdEditionS60 3rdEdition FP1S60 3rdEdition FP1UIQ 3PhonesNokiaN71, N72,N73, N75,N80, N91,N92, E60,E61, E70Nokia3250, 5500,E50, E62NokiaN93Nokia6290NokiaN95Sony EricssonM600i, P1i,P990i, W950i,W960iAMR-WBtruetonesH/WSoftwareH/WSoftwareH/W–RealAudio 1, 7H/W–––––RealAudio 9–––––SoftwareRealAudio 10H/W–––––MP3H/WSoftwareH/WSoftwareH/WH/WAAC – LCH/WSoftwareH/WSoftwareH/WH/WAAC – LTPH/WSoftwareH/WSoftwareH/W–AAC+, eAAC+SoftwareSoftwareSoftwareSoftwareSoftwareH/WWMASoftware(except E60,E61, E70)Software(except E62)SoftwareSoftwareSoftwareSoftware(WMA9 – onlyW950)AMR-NBH/WSoftwareH/WSoftwareH/WH/WG.711, iLBC,G729H/W–H/W–H/W–1For up-to-date audio codec information on recent phones, check www.forum.nokia.com/main/resources/technologies/audiovideo/av features/FN API audio codec tables.html for Nokia and developer.sonyericsson.com/site/global/docstools/multimedia/p multimedia.jsp for Sony Ericsson.MULTIMEDIA FRAMEWORK (MMF)127A game developer should choose a format supported by both platformsin order to maintain compatibility with the widest possible range of phones.AAC-LC and MP3 are good candidates for game audio needs.
They havea wide enough bit-rate support for good quality music and sound effectsand they have good compression for keeping the SIS file size manageable.4.2.2 Audio Priority and Audio Policy in Symbian OSPrior to going into the details of the audio APIs, it is useful to point toone other important feature. Symbian OS considers audio resources aslimited, and access to these resources is constrained and prioritized.Symbian OS is an operating system designed for voice-centric devices,and audio recording and playing are the primary functions of thesedevices.
They are extremely important for the device’s main use (as aphone); also, their immediate availability is mandatory for system criticalapplications. The system design provides certain applications immediateaccess to these resources whenever they request them. The obviousexample is a phone call. If the phone OS cannot get access to the speakerto play a ringtone (i.e., to ‘ring’ the phone), the user will not be able toanswer a call (unless they’re staring at the tiny phone screen all the time,which is not a desirable ‘feature’, as you might imagine).As well as certain system applications having priority access to phoneaudio hardware, certain licensee-provided applications (for example,built-in media players) have higher priorities too. With the introduction ofplatform security, even third party applications can have certain priorities,provided Symbian Signed assigns multimedia capabilities to them.Symbian OS sorts out the access rights to audio hardware and determines which application accesses the audio resource when there areconflicting requests.