advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Partners & Affiliates
advertisement
advertisement
advertisement
Rate this item | 0 users have rated this item.
Email this articleEmail this article
Using the Smart Device Framework for Windows Mobile Development (cont'd)
Recording Sound
The ability to record sound is very useful in situations where you need to say, record a phone conversation. To use the sound recording capability in the SDF, add a reference to the OpenNETCF.dll library in your project. Declare the following variables:

    '---for audio recording---
    Private audioRecorder As OpenNETCF.Media.WaveAudio.Recorder

    '---duration to record (in seconds)---
    Const RECORD_DURATION As Integer = 10000
advertisement
To record voice, first open a file for voice recording and then use the RecordFor() method available in the Recorder class:

        '---save the recording to storage---
        Dim audioStream As IO.Stream
        audioStream = System.IO.File.OpenWrite("\My Documents\Record1.wav")
        audioRecorder = New OpenNETCF.Media.WaveAudio.Recorder

        '---save the audio to stream---
        audioRecorder.RecordFor( _
           audioStream, _
           RECORD_DURATION, _
           OpenNETCF.Media.WaveAudio.SoundFormats.Mono16bit11kHz)
The OpenNETCF.Media.WaveAudio.SoundFormats enumerations contain the various sound qualities that you can use for recording. Also, you can specify the duration of the recording via the second parameter (in seconds). Alternatively, to stop the recording prematurely simply call the Stop() method:

        '---stop recording---
        audioRecorder.Stop()
Once you have finished recording, you'll be able to find the Record1.wav file stored in the \My Documents\ folder (see Figure 1).

Figure 1. Record1.wav: Locating the sound file.

Vibrating Your Windows Mobile Device
Almost all devices sold in the market today supports silent alert (by spinning a miniature motor inside the device, thereby vibrating the phone). Unfortunately, the .NET Compact Framework does not provide any library for you to vibrate your phone.

For this purpose, you can use the OpenNETCF.WindowsMobile.dll library. If you are using a Windows Mobile 6 Standard device (a.k.a Smartphone), use the Play() method in the Vibrate class to vibrate your phone:


        OpenNETCF.WindowsMobile.Vibrate.Play()
To stop the vibration, use the Stop() method:

        OpenNETCF.WindowsMobile.Vibrate.Stop()
Unfortunately, the above lines of code do not work for Pocket PC devices (now known as Windows Mobile 6 Professional and Classic devices). For Pocket PCs, you need to use the OpenNETCF.WindowsCE.dll library. You will use the notification led to emulate vibration.

The following code shows how to cause your Pocket PC to vibrate for half a second:


        Dim vib As New OpenNETCF.WindowsCE.Notification.Led

        '---start vibration---
        vib.SetLedStatus(1, OpenNETCF.WindowsCE.Notification.Led.LedState.On)
        System.Threading.Thread.Sleep(500)

        '---stop vibration---
        vib.SetLedStatus(1, _









           OpenNETCF.WindowsCE.Notification.Led.LedState.Off)
The first parameter of the SetLedStatus() method takes in an integer representing the led number. You may need to trial-and-error to find the number that works correctly on your device.

Previous Page: Introduction Next Page: Retrieving SIM Card Information
Page 1: IntroductionPage 3: Retrieving SIM Card Information
Page 2: Recording SoundPage 4: Detecting the Status of Removable Storage Devices
Untitled
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Intel PDF: Virtualization Delivers Data Center Efficiency
Intel eBook: Managing the Evolving Data Center
Microsoft Article: BitLocker Brings Encryption to Windows Server 2008
Symantec eBook: The Guide to E-Mail Archiving and Management
Microsoft Article: RODCs Transform Branch Office Security
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
Avaya Article: Advancing the State of the Art in Customer Service
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Avaya Article: Avaya AE Services Provide Rapid Telephony Integration with Facebook
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Seminar: Efficiencies in Hardware/Software Virtualization
HP Webcast: Disaster Recovery Planning
Go Parallel Video: Performance and Threading Tools for Game Developers
HP Video: StorageWorks EVA4400 and Oracle
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
IBM TCO eKIT: Your IT Budget is Under Attack, Get in Control
IBM Energy Efficiency eKIT: Learn How to Reduce Costs
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt and free High-Performance SQL Code eBook
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
Microsoft Article: Silverlight Streaming--Free Video Hosting for All
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
HP Demo: StorageWorks EVA4400
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES