Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Building FM Radio with RDS Support

, 8 Jan 2009 Ms-PL
This article explains how to build a simple FM radio player with RDS support by using WPF and USBFM library
RadioPlayer.zip
RadioPlayer
RadioPlayer.suo
RadioPlayer
3rdParty
RotaryControl.dll
RotaryControl.pdb
USBFM.dll
USBFM.pdb
Properties
Settings.settings
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>USBFM</name>
    </assembly>
    <members>
        <member name="T:USBFM.DirectSoundMethods">
            <summary>
            Extension methods to work with Direct Sound
            </summary>
        </member>
        <member name="M:USBFM.DirectSoundMethods.InitEchoService(System.String)">
            <summary>
            Initializes Direct Sound echo service
            </summary>
            <param name="captureDescriptor">Name of device to seek and use within DS. Usually it is something like "Mic" or "Fm". Descriptor is case insensitive.</param>
        </member>
        <member name="M:USBFM.DirectSoundMethods.StopEchoService">
            <summary>
            Stops Direct Sound echo service and releases working thread
            </summary>
        </member>
        <member name="P:USBFM.DirectSoundMethods.IsReady">
            <summary>Static flag signaling whether Direct Sound interfaces are ready and fully functional</summary>
        </member>
        <member name="P:USBFM.DirectSoundMethods.Volume">
            <summary>Gets and sets current output volume</summary>
        </member>
        <member name="T:USBFM.Helper">
            <summary>
            Static helper for quick and efficient work
            </summary>
        </member>
        <member name="M:USBFM.Helper.IsInDefaultValue``1(``0)">
            <summary>
            Returns true if requested class is in it's default value
            </summary>
            <typeparam name="T">Type of target object to test with</typeparam>
            <param name="obj">Target instance of target object</param>
            <returns>True if target object within its default value</returns>
        </member>
        <member name="M:USBFM.Helper.Apply``1(System.Collections.Generic.IEnumerable{``0},System.Action{``0})">
            <summary>
            Applies predefined action to target object
            </summary>
            <typeparam name="T">Type of the target object</typeparam>
            <param name="obj">The instance of the target object</param>
            <param name="action">Action to apply to the target object</param>
        </member>
        <member name="T:USBFM.Pair`2">
            <summary>
            Class defines the pair of values
            </summary>
            <typeparam name="T1">Type of the first member</typeparam>
            <typeparam name="T2">Type of the second member</typeparam>
        </member>
        <member name="P:USBFM.Pair`2.Value1">
            <summary>First member of the pair</summary>
        </member>
        <member name="P:USBFM.Pair`2.Value2">
            <summary>Second member of the pair</summary>
        </member>
        <member name="T:USBFM.Triple`3">
            <summary>
            Class defines the pair of values
            </summary>
            <typeparam name="T1">Type of the first member</typeparam>
            <typeparam name="T2">Type of the second member</typeparam>
            <typeparam name="T3">Type of the third member</typeparam>
        </member>
        <member name="P:USBFM.Triple`3.Value1">
            <summary>First member of the pair</summary>
        </member>
        <member name="P:USBFM.Triple`3.Value2">
            <summary>Second member of the pair</summary>
        </member>
        <member name="P:USBFM.Triple`3.Value3">
            <summary>Third member of the pair</summary>
        </member>
        <member name="T:USBFM.USBRDSDeviceMethods">
            <summary>Extension methods to work with <see cref="T:USBFM.USBDevice"/> and <see cref="T:USBFM.USBRadioDevice"/> devices</summary>
        </member>
        <member name="M:USBFM.USBRDSDeviceMethods.Tune(USBFM.USBRadioDevice,System.Double)">
            <summary>Tunes <see cref="T:USBFM.USBRadioDevice"/> to <see cref="T:System.Double"/>frequency</summary>
            <param name="device"><see cref="T:USBFM.USBRadioDevice"/> to tune</param>
            <param name="frequency">Frequency to tune to</param>
            <returns>True if operation was performed</returns>
        </member>
        <member name="M:USBFM.USBRDSDeviceMethods.Tune(USBFM.USBRadioDevice,System.Boolean)">
            <summary>Tunes <see cref="T:USBFM.USBRadioDevice"/> up or down</summary>
            <param name="device"><see cref="T:USBFM.USBRadioDevice"/> to tune</param>
            <param name="tuneUp">True if tune up, else down</param>
            <returns>True if operation was performed</returns>
        </member>
        <member name="M:USBFM.USBRDSDeviceMethods.Seek(USBFM.USBRadioDevice,System.Boolean)">
            <summary>Seeks <see cref="T:USBFM.USBRadioDevice"/> for good frequency</summary>
            <param name="device"><see cref="T:USBFM.USBRadioDevice"/> to seek</param>
            <param name="seekUp">True if seek up, else down</param>
            <returns>True if operation was performed</returns>
        </member>
        <member name="M:USBFM.USBRDSDeviceMethods.InitAudio(USBFM.USBRadioDevice)">
            <summary>Initializes Direct Sound echo thread on given <see cref="T:USBFM.USBRadioDevice"/></summary>
            <param name="device"><see cref="T:USBFM.USBRadioDevice"/> to init sound</param>
        </member>
        <member name="M:USBFM.USBRDSDeviceMethods.StopAudio(USBFM.USBRadioDevice)">
            <summary>Stops Direct Sound echo thread on given <see cref="T:USBFM.USBRadioDevice"/></summary>
            <param name="device"><see cref="T:USBFM.USBRadioDevice"/> to stop sound</param>
        </member>
        <member name="M:USBFM.USBRDSDeviceMethods.Mute(USBFM.USBRadioDevice,System.Boolean)">
            <summary>Mutes and unmutes sound on given <see cref="T:USBFM.USBRadioDevice"/></summary>
            <param name="device"><see cref="T:USBFM.USBRadioDevice"/> to mute</param>
            <param name="mute">True to mute, False to unmue</param>
        </member>
        <member name="T:USBFM.ReportType">
            <summary>RDS report type</summary>
        </member>
        <member name="T:USBFM.RDSReportMethods">
            <summary>Extension methods to work with RDS reports of audio device</summary>
        </member>
        <member name="M:USBFM.RDSReportMethods.InitRDSReports(USBFM.USBRadioDevice)">
            <summary>Initializes RDS reporting services</summary>
            <param name="device"><see cref="T:USBFM.USBRadioDevice"/> for reporting</param>
        </member>
        <member name="M:USBFM.RDSReportMethods.StopRDSReports(USBFM.USBRadioDevice)">
            <summary>Stops RDS reporting service and releases working thread</summary>
            <param name="device"><see cref="T:USBFM.USBRadioDevice"/> for reporting</param>
        </member>
        <member name="P:USBFM.RDSReportMethods.IsReady">
            <summary>Static flag signaling whether Radio Data Service interfaces are ready and fully functional</summary>
        </member>
        <member name="T:USBFM.USBDevice">
            <summary>General interfaces for Human Input Device</summary>
            <example>
            <code>
            using (var device = USBDevice.FindDevice(0x0000, 0x1111)) {
             if(!device.IsInvalid) Console.WriteLine("Device {0} was found!",device);
             else Console.WriteLine("Device was not found");
            }
            </code>
            </example>
        </member>
        <member name="M:USBFM.USBDevice.FindDevice(System.UInt32,System.UInt32)">
            <summary>Method to seek and find <see cref="T:USBFM.USBDevice"/> in the operation system</summary>
            <param name="pid">Product ID of <see cref="T:USBFM.USBDevice"/> to find</param>
            <param name="vid">Vendor ID of <see cref="T:USBFM.USBDevice"/> to find</param>
            <returns>Fully initialized and ready to work instance of <see cref="T:USBFM.USBDevice"/></returns>
        </member>
        <member name="M:USBFM.USBDevice.ToString">
            <summary>Converts all significant properties of <see cref="T:USBFM.USBDevice"/> to human readble string</summary>
            <returns>Human readble string</returns>
        </member>
        <member name="M:USBFM.USBDevice.ReleaseHandle">
            <summary>Releases currently active handler to <see cref="T:USBFM.USBDevice"/></summary>
            <returns>True if the operation was sucsessful</returns>
        </member>
        <member name="M:USBFM.USBDevice.Dispose">
            <summary>Disposes currently active <see cref="T:USBFM.USBDevice"/> and supresses GC</summary>
        </member>
        <member name="P:USBFM.USBDevice.ProductID">
            <summary>Product Id of <see cref="T:USBFM.USBDevice"/></summary>
        </member>
        <member name="P:USBFM.USBDevice.VendorID">
            <summary>Vendor Id of <see cref="T:USBFM.USBDevice"/></summary>
        </member>
        <member name="P:USBFM.USBDevice.VersionNumber">
            <summary>Firmware version number installed on <see cref="T:USBFM.USBDevice"/></summary>
        </member>
        <member name="P:USBFM.USBDevice.Name">
            <summary>Name of <see cref="T:USBFM.USBDevice"/></summary>
        </member>
        <member name="P:USBFM.USBDevice.SerialNumber">
            <summary>Serial number of <see cref="T:USBFM.USBDevice"/></summary>
        </member>
        <member name="P:USBFM.USBDevice.IsInvalid">
            <summary>Flag to detect the current state of <see cref="T:USBFM.USBDevice"/></summary>
        </member>
        <member name="T:USBFM.USBRadioDevice">
            <summary>General interfaces for Radio Device</summary>
            <example>
            <code>
            using (var device = USBRadioDevice.FindDevice(0x0000, 0x1111)) {
             if(!device.IsInvalid) Console.WriteLine("FM USB Device {0} was found!",device);
             else Console.WriteLine("Device was not found");
            }
            </code>
            </example>
        </member>
        <member name="M:USBFM.USBRadioDevice.FindDevice(System.UInt32,System.UInt32)">
            <summary>Method to seek and find <see cref="T:USBFM.USBRadioDevice"/> in the operation system</summary>
            <param name="pid">Product ID of <see cref="T:USBFM.USBRadioDevice"/> to find</param>
            <param name="vid">Vendor ID of <see cref="T:USBFM.USBRadioDevice"/> to find</param>
            <returns>Fully initialized and ready to work instance of <see cref="T:USBFM.USBRadioDevice"/></returns>      
        </member>
        <member name="P:USBFM.USBRadioDevice.Capabilities">
            <summary>Radio data capabilities (<see cref="T:USBFM.RadioData"/>) of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.USBRadioDevice.Presets">
            <summary>Radio station frequencies presets on <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.USBRadioDevice.CurrentStation">
            <summary>Current station <see cref="T:USBFM.USBRadioDevice"/> tuned to</summary>
        </member>
        <member name="P:USBFM.USBRadioDevice.IsStereo">
            <summary>True if current station of <see cref="T:USBFM.USBRadioDevice"/> transmittes in stereo mode</summary>
        </member>
        <member name="P:USBFM.USBRadioDevice.CurrentFrequency">
            <summary>Current frequency <see cref="T:USBFM.USBRadioDevice"/> tuned to</summary>
        </member>
        <member name="P:USBFM.USBRadioDevice.IsTuning">
            <summary>True if <see cref="T:USBFM.USBRadioDevice"/> currently in tuning mode and cannot be used</summary>
        </member>
        <member name="P:USBFM.USBRadioDevice.IsMuted">
            <summary>True if all sounds of <see cref="T:USBFM.USBRadioDevice"/> are currently muted</summary>
        </member>
        <member name="P:USBFM.USBRadioDevice.RDS">
            <summary>Current RDS information (<see cref="T:USBFM.RDSData"/>) recieved by <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="T:USBFM.RadioData">
            <summary>Radio data for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.SoftwareVersion">
            <summary>Software version of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.HardwareVersion">
            <summary>Hardware version of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.PartNumber">
            <summary>Part number of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.ManufacturerID">
            <summary>Manufacturer ID of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.ChipVersion">
            <summary>FM chip version version of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.DeviceVersion">
            <summary>Device version of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.FirmwareVersion">
            <summary>Firmware version of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.SeekThreshold">
            <summary>Station seek treshold of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.MinFreq">
            <summary>Minimal frequency of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.MaxFreq">
            <summary>Maximum frequency of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.Spacing">
            <summary>Tune treshold spacing of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.Deemphasis">
            <summary>Deemphasis value of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RadioData.ExFlags">
            <summary>Special capabilities and extension flags for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="T:USBFM.RDSData">
            <summary>Radio data system information for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="M:USBFM.RDSData.ToString">
            <summary>Converts all significant properties of <see cref="T:USBFM.USBRadioDevice"/> to human readble string</summary>
            <returns>Human readble string</returns>
        </member>
        <member name="P:USBFM.RDSData.CurrentStation">
            <summary>Station <see cref="T:USBFM.USBRadioDevice"/> tuned to</summary>
        </member>
        <member name="P:USBFM.RDSData.SignalStrength">
            <summary>Signal strength of <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.IsStereo">
            <summary>True if <see cref="T:USBFM.USBRadioDevice"/> recieves stereo sound</summary>
        </member>
        <member name="P:USBFM.RDSData.PS">
            <summary>Program service info for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.PI">
            <summary>Program information info for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.PTY">
            <summary>Program type info for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.HasTA">
            <summary>True if current radio data contains traffic anouncement information for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.HasTP">
            <summary>True if current radio data contains traffic program information for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.HasMS">
            <summary>True if current radio data contains music speech information for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.PTYString">
            <summary>Program type string for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.AF">
            <summary>List of alternative frequencines for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.TrafficPI">
            <summary>Traffic program info code for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.PICountry">
            <summary>Country program info string for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.PIRegion">
            <summary>Region program info string for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="P:USBFM.RDSData.TMC">
            <summary>Traffic message channel string for <see cref="T:USBFM.USBRadioDevice"/></summary>
        </member>
        <member name="T:USBFM.RDSGroupType">
            <summary>RDS group types for <see cref="T:USBFM.RDSData"/></summary>
        </member>
        <member name="T:USBFM.PIAreas">
            <summary>Program information areas lookup table for <see cref="T:USBFM.RDSData"/></summary>
        </member>
        <member name="F:USBFM.PIAreas.Areas">
            <summary>Get all predefined <see cref="T:USBFM.PIAreas"/>s</summary>
        </member>
        <member name="M:USBFM.PIAreas.DecodeName(System.Byte)">
            <summary>Decodes byte country code and extended country code in <see cref="T:USBFM.PIAreas"/> value</summary>
            <param name="code">Byte country code</param>
            <returns>String value of <see cref="T:USBFM.PIAreas"/></returns>
        </member>
        <member name="T:USBFM.PIArea">
            <summary>Program information area lookup item for <see cref="T:USBFM.RDSData"/></summary>
        </member>
        <member name="F:USBFM.PIArea.Unknown">
            <summary>Undefined PI area code value</summary>
        </member>
        <member name="P:USBFM.PIArea.Code">
            <summary>PI Area Code</summary>
        </member>
        <member name="P:USBFM.PIArea.Name">
            <summary>PI Area String Value</summary>
        </member>
        <member name="T:USBFM.PICountries">
            <summary>Program information countries lookup table for <see cref="T:USBFM.RDSData"/></summary>
        </member>
        <member name="F:USBFM.PICountries.Countries">
            <summary>Get all predefined <see cref="T:USBFM.PICountry"/>s</summary>
        </member>
        <member name="M:USBFM.PICountries.DecodeName(System.Byte,System.Byte)">
            <summary>Decodes byte country code and extended country code in <see cref="T:USBFM.PICountry"/> value</summary>
            <param name="countryCode">Byte country code</param>
            <param name="extendedCountryCode">Byte extended country code -1 if unused</param>
            <returns>String value of <see cref="T:USBFM.PICountry"/></returns>
        </member>
        <member name="T:USBFM.PICountry">
            <summary>Program information country lookup item for <see cref="T:USBFM.RDSData"/></summary>
        </member>
        <member name="F:USBFM.PICountry.Unknown">
            <summary>Undefined PI country code</summary>
        </member>
        <member name="P:USBFM.PICountry.CountryCode">
            <summary>PI Country Code</summary>
        </member>
        <member name="P:USBFM.PICountry.ExtendedCountryCode">
            <summary>PI Country Extended Code</summary>
        </member>
        <member name="P:USBFM.PICountry.Name">
            <summary>PI Country string value</summary>
        </member>
        <member name="T:USBFM.PTYTexts">
            <summary>Program type lookup table for <see cref="T:USBFM.RDSData"/></summary>
        </member>
        <member name="T:USBFM.PTYText">
            <summary>Program type lookup item for <see cref="T:USBFM.RDSData"/></summary>
        </member>
        <member name="P:USBFM.PTYText.Code">
            <summary>PTY Code</summary>
        </member>
        <member name="P:USBFM.PTYText.Text">
            <summary>PTY value string</summary>
        </member>
    </members>
</doc>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Share

About the Author

Tamir Khason
Architect Better Place
Israel Israel
Hello! My name is Tamir Khason, and I am software architect, project manager, system analyst and [of course] programmer. In addition to writing big amount of documentation, I also write code, a lot of code. I used to work as a freelance architect, project manager, trainer, and consultant here, in Israel, but recently join the company with extremely persuasive idea - to make a world better place. I have very pretty wife and 3 charming kids, but unfortunately almost no time for them.
 
To be updated within articles, I publishing, visit my blog or subscribe RSS feed. Also you can follow me on Twitter to be up to date about my everyday life.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.141223.1 | Last Updated 8 Jan 2009
Article Copyright 2009 by Tamir Khason
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid