Page 15 of 18 FirstFirst ... 56789101112131415161718 LastLast
Results 141 to 150 of 179

Thread: Wanted: Programmer who wants to play with DAB+ option

  1. #141
    Newbie
    Join Date
    Nov 2011
    Posts
    21

  2. #142
    Newbie
    Join Date
    May 2006
    Posts
    38
    Hmm.. Some progress here. I have literally just now got the FM side working using a quite basic C# application talking to their RTKFM.DLL. Baby steps at first and quite a number of blue screen crashes along the way. The FM part looked easier so given I'm new to DirectShow, Filter Graphs etc. Only a few lines of code to actually get a basic single station tune to work.

    I will probably implement the FM side for my car. The factory FM BMW tuner has a software bug causing it to drop in and out of stereo. Also it would allow recording of FM radio if you hear a tune you liked...

  3. #143
    Newbie
    Join Date
    Feb 2010
    Posts
    16
    I've got FM mostly working (including RDS and all the other bits) in a purely C# application (a learning curve for me on some of the interop bits). I've been struggling with the DAB stuff for a couple of days ... mostly getting wierd errors such as 'out of memory' exceptions. For anyone else trying a 'managed code' solution then it seems the STAThreadAttribute is your friend when it comes to creating the radio COM objects. Anyway, hopefully that is solved now and I can actually get on with writing something useful.

  4. #144
    Newbie
    Join Date
    May 2006
    Posts
    38
    Quote Originally Posted by alnicol View Post
    I've got FM mostly working (including RDS and all the other bits) in a purely C# application (a learning curve for me on some of the interop bits). I've been struggling with the DAB stuff for a couple of days ... mostly getting wierd errors such as 'out of memory' exceptions. For anyone else trying a 'managed code' solution then it seems the STAThreadAttribute is your friend when it comes to creating the radio COM objects. Anyway, hopefully that is solved now and I can actually get on with writing something useful.
    Sounds like you are a fair bit further along than I. I'm an embedded guy so the Windows stuff is all a bit new to me. Once I proved the concept of FM and setting up the filters etc I moved on to DAB rather than worry about RDS and the like but it's significantly more complex particularly with the FIC data and I'm struggling a bit with C# and its structs, pointers etc.

    Perhaps if you were prepared to share what you had, a few extra eyes might be able to help? I was getting wierd Out Of Memory errors too when I was using the OpenDevice function I found in the FM DLL. My code is a complete hack at the moment trying to prove the concept with various different methods tried and then commented out etc so not really any use to anyone. Perhaps I could tidy it up and make a basic app but really it's the DAB stuff we're here for rather than FM.

    On a separate note: Something I have not actually tried is reception in a moving vehicle. Has anyone here tried that?

  5. #145
    FreeDrive Creator CdRsKuLL's Avatar
    Join Date
    Feb 2004
    Location
    Manchester
    Posts
    3,469
    Quote Originally Posted by alnicol View Post
    I've got FM mostly working (including RDS and all the other bits) in a purely C# application (a learning curve for me on some of the interop bits). I've been struggling with the DAB stuff for a couple of days ... mostly getting wierd errors such as 'out of memory' exceptions. For anyone else trying a 'managed code' solution then it seems the STAThreadAttribute is your friend when it comes to creating the radio COM objects. Anyway, hopefully that is solved now and I can actually get on with writing something useful.
    Hi fella,

    Would love to have a look at your C# source. I want to try to at least get FM working within FreeICE to start with and I already have the stick. :-)

    thanks,

    Steve

  6. #146
    Newbie
    Join Date
    May 2006
    Posts
    38
    Ok. Here's my poor man's version of getting FM working. I'm not going to paste my whole project in because it's a bit embarrassing... Yes there is no error checking but I threw it together very quickly and was just stepping it in Visual Studio Express so didn't care too much for that. There needs to be some checking of the hr return values as well as looking for a null coming back from the CreateFilter function. Edit: Bugger I was editing this in a external text editor and lost a bit.

    1) Don't know how this handles more than 1 device
    2) Requires DirectShowLib
    3) Gives me the out of memory error in the CreateFilter function when the device is not connected.
    4) There's no shutdown/teardown code to close things nicely

    So here goes.

    I found this piece of code in my googling to create the IBaseFilter for the various modules needed:

    Code:
    private IBaseFilter CreateFilter(Guid category, string friendlyname)
    {
        object source = null;
        Guid iid = typeof(IBaseFilter).GUID;
        foreach (DsDevice device in DsDevice.GetDevicesOfCat(category))
        {
    	if (device.Name.CompareTo(friendlyname) == 0)
    	{
    	    device.Mon.BindToObject(null, null, ref iid, out source);
    	    break;
    	}
        }
    
        return (IBaseFilter)source;
    }
    Code to give access to the RTKFM.DLL

    Code:
    class RTKFM
    {
    	[DllImport("RTKFM", EntryPoint = "RTFM_SetFrequency", CallingConvention = CallingConvention.Cdecl)]
    	public static extern int RTFM_SetFrequency(int nFrequencyKHz);
    
    	[DllImport("RTKFM", EntryPoint = "RTFM_SetAudioSampleRate", CallingConvention = CallingConvention.Cdecl)]
    	public static extern int RTFM_SetAudioSampleRate(int nSampleFreqHz);
    
    	// Unused currently
    	[DllImport("RTKFM.DLL", EntryPoint = "RTFM_GetTunerRange", CallingConvention = CallingConvention.Cdecl)]
    	public static extern int RTFM_GetTunerRange(ref int pnLowRange, ref int pnUpperRange);
    
    	[DllImport("RTKFM.DLL", EntryPoint = "RTFM_GetPCMInfo", CallingConvention = CallingConvention.Cdecl)]
    	public static extern int RTFM_GetPCMInfo(ref byte pnType, ref int pnSamplePerSec, ref int pnBitPerSample);
    }
    Then some code to create the filter chain and do a basic tune to a known frequency:

    Code:
    private void button3_Click(object sender, EventArgs e)
    {
    	IMediaControl mediaControl = null;
    	IGraphBuilder graphBuilder = null;
    	IBaseFilter theDevice = null;
    	IBaseFilter theRenderer = null;
    	int hr;
    
    	//Create the Graph
    	graphBuilder = (IGraphBuilder)new FilterGraph();
    
    	//Create the media control for controlling the graph
    	mediaControl = (IMediaControl)graphBuilder;
    
    	// Get the source filter and add to the graph
    	theDevice = CreateFilter(FilterCategory.LegacyAmFilterCategory, (string)"RTKFMSourceFilter");
    	hr = graphBuilder.AddFilter(theDevice, "source filter");
    
    	// Output pin from the source filter
    	IPin SourceOut = DsFindPin.ByDirection(theDevice, PinDirection.Output, 0);
    
    	// Open Audio Renderer
    	theRenderer = CreateFilter(FilterCategory.AudioRendererCategory, (string)"Default DirectSound Device");
    	hr = graphBuilder.AddFilter(theRenderer, "audio render");
    
    	// Input pin for the Renderer
    	IPin RenderIn = DsFindPin.ByDirection(theRenderer, PinDirection.Input, 0);
    
    	hr = graphBuilder.Connect(SourceOut, RenderIn);
    
    	hr = RTKFM.RTFM_SetAudioSampleRate(48000);
    
    	hr = RTKFM.RTFM_SetFrequency(105300);
    
    	mediaControl.Run();
    Last edited by Shonky*; 02-28-2012 at 04:25 AM.

  7. #147
    Newbie
    Join Date
    May 2006
    Posts
    38
    After the previous post, I took my code, created a whole new project attached here. VS Studio 2010 Express c#.
    Attached Files Attached Files

  8. #148
    FreeDrive Creator CdRsKuLL's Avatar
    Join Date
    Feb 2004
    Location
    Manchester
    Posts
    3,469
    Top man :-)

    I will have a play when I get home. Have you dumped a reference of what commands the RTKFM.DLL supports ?

  9. #149
    Newbie
    Join Date
    May 2006
    Posts
    38
    Yes. There are some discrepancies here between the documentation and the DLL (I think) and more when you get to the DAB DLL(s).

    The DLL export just gives the function names. I then used the document to get the parameters required.

    ==================================================
    Function Name : RTFM_CloseDevice
    Address : 0x100112dc
    Relative Address : 0x000112dc
    Ordinal : 1 (0x1)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_DebugCMD
    Address : 0x10012b0c
    Relative Address : 0x00012b0c
    Ordinal : 2 (0x2)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_GetPCMInfo
    Address : 0x10012514
    Relative Address : 0x00012514
    Ordinal : 3 (0x3)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_GetRDSCtr
    Address : 0x10014c38
    Relative Address : 0x00014c38
    Ordinal : 4 (0x4)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_GetRDSQuality
    Address : 0x10014aa8
    Relative Address : 0x00014aa8
    Ordinal : 5 (0x5)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_GetRDSSync
    Address : 0x10014a6c
    Relative Address : 0x00014a6c
    Ordinal : 6 (0x6)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_GetSignalLock
    Address : 0x10012494
    Relative Address : 0x00012494
    Ordinal : 7 (0x7)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_GetSignalQuality
    Address : 0x100124fc
    Relative Address : 0x000124fc
    Ordinal : 8 (0x8)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_GetSignalQualityCtr
    Address : 0x10001000
    Relative Address : 0x00001000
    Ordinal : 9 (0x9)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_GetTunerRange
    Address : 0x1001303c
    Relative Address : 0x0001303c
    Ordinal : 10 (0xa)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_OpenDevice
    Address : 0x10010924
    Relative Address : 0x00010924
    Ordinal : 11 (0xb)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_ScanNextProg
    Address : 0x100116a0
    Relative Address : 0x000116a0
    Ordinal : 12 (0xc)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_SetAudioSampleRate
    Address : 0x1000117c
    Relative Address : 0x0000117c
    Ordinal : 13 (0xd)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_SetDeemphasisTC
    Address : 0x100010e4
    Relative Address : 0x000010e4
    Ordinal : 14 (0xe)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_SetFrequency
    Address : 0x10011470
    Relative Address : 0x00011470
    Ordinal : 15 (0xf)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_SetPCMCallBack
    Address : 0x1001090c
    Relative Address : 0x0001090c
    Ordinal : 16 (0x10)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_SetRDSCallBack
    Address : 0x10014a54
    Relative Address : 0x00014a54
    Ordinal : 17 (0x11)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_SetRDSCtr
    Address : 0x10014c4c
    Relative Address : 0x00014c4c
    Ordinal : 18 (0x12)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_SetScanStopQuality
    Address : 0x100107f0
    Relative Address : 0x000107f0
    Ordinal : 19 (0x13)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_SetSignalQualityCtr
    Address : 0x10001014
    Relative Address : 0x00001014
    Ordinal : 20 (0x14)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_Start
    Address : 0x100124b4
    Relative Address : 0x000124b4
    Ordinal : 21 (0x15)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_StartRDS
    Address : 0x10014bec
    Relative Address : 0x00014bec
    Ordinal : 22 (0x16)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_Stop
    Address : 0x100130c8
    Relative Address : 0x000130c8
    Ordinal : 23 (0x17)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

    ==================================================
    Function Name : RTFM_StopRDS
    Address : 0x10018544
    Relative Address : 0x00018544
    Ordinal : 24 (0x18)
    Filename : RTKFM.dll
    Full Path : C:\Program Files (x86)\Realtek\REALTEK DTV USB DEVICE\RTKFM.dll
    Type : Exported Function
    ==================================================

  10. #150
    FreeDrive Creator CdRsKuLL's Avatar
    Join Date
    Feb 2004
    Location
    Manchester
    Posts
    3,469
    Thanks again. I'm coding in vb.net so it wont be hard at all to convert your sample over. :-) I will have a little play tonight to see if I can get a basic app working, then move onto a plugin for FreeICE. At least I will have FM working and can test it in the car.

    Steve

Similar Threads

  1. M4-ATX Programmer
    By phrasius in forum Newbie
    Replies: 0
    Last Post: 06-29-2008, 02:57 PM
  2. PIC Programmer
    By meddler in forum General Hardware Discussion
    Replies: 6
    Last Post: 04-26-2008, 10:45 PM
  3. WANTED - PHIDGITS Programmer / Hacker
    By SEGgeek in forum MacCar
    Replies: 1
    Last Post: 12-06-2006, 02:52 PM
  4. WTD: USB pic programmer
    By lez in forum Classified Archive
    Replies: 0
    Last Post: 07-07-2006, 06:23 AM
  5. Pic Programmer
    By KyleYankan in forum Hardware Development
    Replies: 7
    Last Post: 05-02-2005, 12:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •