Symbian OS programming Basic Multimedia Audio Tony Torp
Symbian OS -programming Basic Multimedia: Audio Tony Torp (tony. torp@tamk. fi)
Using audio files in Symbian applications n n n Symbian. OS has support (in-built codecs) for the most common audio formats. Tones (a beep or simple melody of certain frequencies) Advanced audio formats: –. wav –. mp 3 –. au The basic classes for playing audio files are: – CMda. Audio. Tone. Utility for tones – CMda. Audio. Player. Utility for advanced audio formats You need to implement an adapter class for those utility classes. The adapter class must implement the listener interface.
The headef file for CPlayer. Adapter class #include <Mda. Audio. Sample. Player. h> class CPlayer. Adapter : public CBase, public MMda. Audio. Player. Callback { public: static CPlayer. Adapter* New. L(); ~CPlayer. Adapter(); void Play. L(); void Stop. L(); public: void Mapc. Init. Complete(TInt a. Error, const TTime. Interval. Micro. Seconds & a. Duration); void Mapc. Play. Complete(TInt a. Error); private: CPlayer. Adapter(); void Construct. L(); TBool i. Free. To. Prepare; TBool i. Free. To. Play; CMda. Audio. Player. Utility* i. Mda. Audio. Player. Utility; };
The implementation of CPlayer. Adapter (a part of) #include "Player. Adapter. h" _LIT(KSound. Sample. File, "c: \system\Apps\hitchcock. wav"); // Tätä ennen rakentaja, purkaja ja New. L. Toteutus löytyy kurssin kansiosta. void CPlayer. Adapter: : Construct. L() { i. Mda. Audio. Player. Utility = CMda. Audio. Player. Utility: : New. File. Player. L(KSound. Sample. File, *this); } void CPlayer. Adapter: : Play. L() { if(i. Free. To. Play) { i. Free. To. Play = FALSE; i. Mda. Audio. Player. Utility->Play(); } } void CPlayer. Adapter: : Stop. L() { i. Mda. Audio. Player. Utility->Stop(); } void CPlayer. Adapter: : Mapc. Init. Complete(TInt /*a. Error*/, const TTime. Interval. Micro. Seconds& /*a. Duration*/) { i. Free. To. Play = TRUE; } void CPlayer. Adapter: : Mapc. Play. Complete(TInt /*a. Error*/) { i. Free. To. Play = TRUE; }
Other considerations n Save your audio file, e. g. carcrash. wav, for wins emulator in the path: D: Symbian8. 0 aSeries 60Epoc 32WinscsystemappsCAR n In code, you find the audio file in the following path: _LIT(KSound. Sample. File, "c: \system\CAR\carcrash. wav"); n Let´s try it now…
How to include audio and bitmap files to. SIS? n The idea: make sure the following rows can be found from the. pkg file: ". . dataMy. Bitmap. File. mbm“ - "!: systemappsMy. AppMy. Bitmap. File. mbm“ ”. . dataMy. Audio. wav” – ”c: \system\My. App\My. Audio. wav”
- Slides: 6