yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Software Development] beemerTPPC:
Only two questions before you go to your vacations ;)

The driver cannot have windows, then it cannot receive WM_FMNOTIFICATION. Could you think on doing another call back or event based version?

If you can't, please make a version of the previous callback based api with the long time to close issue solved.

And the second thing. I've seen in your APITEST code the following lines:

{// reset volume

DWORD dwVol =0;

::FMGetProp(hFM, FMPROP_VOLUME, &dwVol);

::FMSetProp(hFM, FMPROP_VOLUME, dwVol);

}

Is this a bug or there is a reason to pass the volume twice, as the address and value?
[Windows Mobile Software Development] flywhc:
Added event based notification. Hopefully it doesn't have any bug.

FMS driver set Volume to maximum value and ignore current system volume after initialization.

I had to get system volume from system API and set it again in order to reverse to normal volume.
[Windows Mobile Software Development] mhemart:
Have a good holiday

Hello Flywhc,

Enjoy your 2 weeks without us... And come back relax and ready for all our boring questions and requests.

Regards.
[Windows Mobile Software Development] beemerTPPC:
Thanks a lot!

I've releases a beta 2 of the driver with some issues solved but with the old API. No I can start implementing this one.

If the FM_close is enought fast I0ll move it to the COM_Close section and this will allow using the FM radio to hear music even with the driver loaded !!!
[Windows Mobile Software Development] auxaux:
<removed by author>
[Windows Mobile Software Development] beemerTPPC:
@flywhc

I'm having problems with 1.2 and 1.2b APIs. previously I received an

OnFMRDSGroupReceived(...) callback for each RDS group message received, but in this version I only receive one for each 16 messages.

As long as nRDSCount came as 16, I thought that now lpRDSGroup could point to an array of FM_RDS_GROUP structures, but it didn't work. For example this is a modification of your APITest that shows the problem:

// when receive a RDS data group
void CALLBACK OnFMRDSGroupReceived(HFMRADIO hFMDevice, DWORD dwTimestamp, LPFM_RDS_GROUP lpRDSGroup, UINT nRDSCount)
{
TCHAR buf[200];
static int nCount = 0;
nCount+=nRDSCount;
_stprintf(buf, L"RDS count=%d", nCount);
LogEx(L"RDS count=%d\r\n", nCount);
TCHAR szLog[256];
for (uint i=0; i < nRDSCount; i++)
{
wsprintf(szLog,_T("RDS:%04X,%04X,%04X,%04X\r\n"),lpRDSGroup->wChunk1,lpRDSGroup->wChunk2,lpRDSGroup->wChunk3,lpRDSGroup->wChunk4);
LogEx(szLog);
lpRDSGroup = lpRDSGroup + lpRDSGroup->dwSize;
}
::SetDlgItemText(g_hDlg, IDC_RDSSTATUS, buf);
}

¿What am I doing badly?
[Windows Mobile Software Development] fibula:
Hello and many thanks for your developing!

I`ve one question: when I start application, I can`t see these gray lines/parts with RDS and status informations ("Now playing...; [Music][TP]...).

Can you help me!?

Many thanks

fibula
[Windows Mobile Software Development] flywhc:
lpRDSGroup is an array:

wsprintf(szLog,_T("RDS:%04X,%04X,%04X,%04X\r\n"),lpRDSGroup.wChunk1,lpRDSGroup.wChunk2,lpRDSGroup.wChunk3,lpRDSGroup.wChunk4);

LogEx(szLog);

maybe there is a bug in the api? Sorry I didn't have time to fully test it.
[Windows Mobile Software Development] beemerTPPC:
Thanks! I don't understand why my way of doing it didn't work, Maybe I thought that dwSize was initialized in your API and it wasent, but doing it in your way works like a charm on your API Test. :)

In the driver i lose some RDS groups, but I've not investigated way at this moment.
[Windows Mobile Software Development] vrowdy:
Beta2 not working on X1

I want to delete this post.

Sorry for the inconvenience, I posted wrong.
[Windows Mobile Software Development] and2or:
TMC subscription

Beemer, would you be so kind as to answer a stupid question? :confused:

I use Axim 50v, SE2003, iG0 8.3.2 apr 3 release, GNS (FM-9) trafficbox, what I don't have is a capability to figure out the TMC subscription issue:

the screen that appeared after I hit a "subscription" button is off-centered and I cannot read the whole uuid number. The only resolutions I found working for my PPC are 240_320 (portrate) and (320_240) (landcape) (guess, because I have only them for vga). The only freaken page that looks ugly is the "subcription" one. The landscape mode works better but I am still missing 1 (!) number out of 20! I am about to use a "mirror" screen to look at the uuid. Any your thoughts will be appreciated.

Thanks.
[Windows Mobile Software Development] Captain_Throwback:
I had this exact problem. I have a VGA device.

In order to read the entire number (and I went through a LOT to do this), in the SYS.TXT, I set the [resolution_dir] to "400_240" (WQVGA), and set the vga=1 parameter to 0. The iGO screen should show up in the top corner of the screen. Its difficult to navigate, but when you get to the subscription screen, you should be able to read all 20 characters of the ID.
[Windows Mobile Software Development] and2or:
Yes, Sir! I have tried vga=0 : the screen gets black, that's it. Am I wrongdoing? For Axim, normal "landscape" resilution is 320_240, and 400_240 (at least in vga=1 mode) extends the screen horizontally instead of shrinking. I tried 240_320 in "landcape" mode: it works but then I have horisontal shrinkage acoompanied by a vertical extension and unable to get to the subscriprion screen. Resolution 240_240 doesn't work in vga=1 in "landscape" mode. At least, I get a FFUI error message:

Unknown layer referenced

Identifier=[ui_planModeR]

I also tried a "square" mode ([rawdisplay] class="square"): 240_240 is working but the iGo screen orientation is always portrate-like (regardless of PDA screen orientation), thus, I have no gain in horizontal direction.

Would you mind posting your branding.zip?
[Windows Mobile Software Development] and2or:
Update: I was able to make iGo working in "landscape" 240_240 with a default skin (I was using diMka's WertVRV before). Still the "subscription" page is shifted way to the right and I am unable to read the freaken UUID number.

Should I use a different PDA to read the FM-9 GNS UUID and then enter it for subscription? Seniors, step forward, please!
[Windows Mobile Software Development] torpie13:
Hi,

Now that a good API exists, Is there anyone working on a good remplacement for HTC FM player ?

Cheers
[Windows Mobile Software Development] flywhc:
Hello everyone. I am just back from vacation.

This morning i found my headset only plays stereo music when usb cable is pressed to a certain angle. I guess frequently plugin/unplug headset finally damaged the headset plug or usb port :(

I hope O2 can fix it under warranty policy.

I am working on a driver loader so that it will support more than one FM tuner.

It is a big task to write a finger friendly FM player. It would take some times.
[Windows Mobile Software Development] rvdgeer:
EDIT: dno't know how/why, but I ended up posting in the wrong thread...

Sorry!
[Windows Mobile Software Development] kzd76:
C# way

Hello!

Maybe a noob question, but I'm usually using c# to write small applications. As I can see, this FMRadioAPI is in C++. Is there any way to use your API in C#? E.g. a compiled dll with a short description how to call the functions?

I tried to understand the cpp and h files but it is too difficult for me to make a c# version.

Thanks for any help!

Regards,

KZD
[Windows Mobile Software Development] flywhc:
google "Calling C Library DLLs from C sharp"

I haven't tried using c# to call GFMAPI but should work. the API has a C interface, not C++.
[Windows Mobile Software Development] timmey:
i have written a c# class for the FMRadioAPI using dllimports. i can turn the radio on/off, set volume, do fmseeks etc. but i can´t get the notification system to work, as i can´t figure out how to import them correctly. so i´m unable to catch events like "OnFMFequencyChanged" or "OnFMRDSGroupReceived". i´m nearly out of ideas how to fix this, but i will keep trying ;)
[Windows Mobile Software Development] flywhc:
google "c sharp wndproc".

version 1.2b support both windows message and event.

I believe the easiest way is overriding wndproc.

you can also create a new thread and call waitforsingleobject/waitformultiobject.
[Windows Mobile Software Development] DomZ:
This is a great application

Thanks
[Windows Mobile Software Development] 6Fg8:
First of all, this is really a great effort to get the max out of our neat devices, so thanks a bunch to flywhc.

I played around with APITest to check how things are going and maybe write a neat little FM Player.

Everything seems to work out fine, but i'm unable to unmute the radio. After PowerOn, the logwindows shows this:

FMGetNumDevs = 1
FMOpen(0) = 30545808
Status: cmd: power on, status: successed, value: 255 .
Status: cmd: set band, status: successed, value: 255 .
FMPowerOn: On Success
Status: cmd: set rds, status: successed, value: 1 .
Status: cmd: set mute, status: successed, value: 255 .
Status: cmd: set volume, status: successed, value: 255 .
Status: cmd: seek, status: Seek successed, value: 89900 .

While execution i notice some clicks in the earpiece and then it stays mute. GetProp MUTE shows:

Status: cmd: get mute mode, status: successed, value: 2 .
FMGetProp(MUTE) = Success, val = 1

Now i do a SetProp MUTE=0 and get this:

Status: cmd: set mute, status: successed, value: 255 .
FMSetProp(MUTE) = Success
Status: cmd: set mute, status: successed, value: 255 .

There's a short click and sound in the earpiece for a fraction of a second, after that it stays mute again. Checking MUTE again reveals:

Status: cmd: get mute mode, status: successed, value: 2 .
FMGetProp(MUTE) = Success, val = 1

Seems "someone" secretly mutes the radio immediately after i unmute it. Am i doing something wrong?

My device is a Touch HD running Daviduck's HP6.1 HP ROM.
[Windows Mobile Software Development] HonzaBouma:
Is possible to use something simillar on HP iPAQ 614c? Has got the chipset of iPAQ 614c FM module?

Thanks for reply
[Windows Mobile Software Development] flywhc:
I tested on my raphael with attached api test and xFMRadio.

Mute/Unmute work fine except return error code 87.
[Windows Mobile Software Development] and2or:
TMC subscription problem-solved

All right, Gents: I'd like to share the UUID screen solution.

It's possible to modify tmc_320_240.ui (if you're using a different resolution, choose the proper file) file within data.zip to shift all writings to the left:

; **** Clear Channel ****

<layer ui_tmc_enter_code z=30>

<SPRITE xxx template=xinputfield>

<INPUTTEXT input_tmccode template=xinput MAXLENGTH=20 fp=99 CAPITALIZE=3 dontshowfocus emptytitle="<Enter TMC subscription code>">

</layer>

<layer ui_tmc_subscribe_status z=30>

<SPRITE xxx bmp="xhtml_bg.bmp" x=1 y=21 z=2>

<TEXT txt_tmc_expiration_text template=xtxt3 x=100 y=40 w=280 text="">

<TEXT xxx template=xtxt3 y=100 align="LEFT" w=300 text="To purchase 1 year TMC subscription go to\nhttp://...com\nand enter:">

<TEXT txt_tmc_subscriber_id template=xtxt3 x=105 y=150 align="LEFT" text="" replacetags>

<BUTTON btn_tmc_enter_code template=btn_5a y=180 align="CENTER" text="Activate" onrelease='NEXTSTATE STF_TMC_ENTER_CODE'>

</layer>

Then, use a standard skin and you'll see the whole number.

I enjoy reading traffic events now: driving car is a real danger! :eek:
[Windows Mobile Software Development] 6Fg8:
I tried with your version but got the same results - i assume thats compiled from the apitest you added to the FMAPI package. Neither xfmradio nor apitest allows me to unmute the radio. In my first attempt i opened the source with Visual Studio and stepped through, no ovious errors but no luck though.

After exiting xfmradio/apitest the radio is somewhat confused; when i start HTC-fmradio afterwards, there's no sound initially but tuning works fine, when i change volume with the rockers sound comes back. Tried that while running xfmradio/apitest too but no luck either. Interestingly data transmissions work fine, both RDS and TMC messages decode perfect. Also beemers TMC driver gives perfect results, ok dont miss the sound there :)

Anything i can do to trace that sound thingie?
[Windows Mobile Software Development] flywhc:
I made a special version of xFMRadio.

Enter number on the top left input box and select menu Mute.

It calls HTC FM mute function.

On Raphael: 0: mute, 2: unmute. other value is undefined.

what you said reminder me that volume should be re-initialized after power on.

can you try get the current volume and set volume to same value before set mute state?
[Windows Mobile Software Development] HonzaBouma:
I am sorry but it is important for me.
[Windows Mobile Software Development] 6Fg8:
Thanks, success! On start i had sound immediately :)

calling mute with various numbers:

1 = unmute (loud)

2 = mute

other values: silent

How can i get the volume within xfmradio?

FMSetVolume has no effect whatsoever

SysSetVolume seems to set values out of range for the waveOutdevice:

0 = mute, all other numbers seem to somehow replicate on waveOutGetVolume and set volume to 1 (very silent):

3 => waveOutGetVolume: 0x33333333

6 => waveOutGetVolume: 0x66666666

9 => waveOutGetVolume: 0x99999999

12 => waveOutGetVolume: 0xCCCCCCCC

14 => waveOutGetVolume: 0xEEEEEEEE

15 => waveOutGetVolume: 0xFFFFFFFF

To me it looks like the audio device has a range of 0-15, providing other values lead to confusion on the device.

is that the WINAPI WaveOutSetVolume?

I tried the other functions too:

- Mono: no effect

- Headset: works fine

- DeEmphasis: some effect, hardly noticeable

- Stereo Blend: no effect
[Windows Mobile Software Development] flywhc:
I guess it is unlikely supported.

It is not supported if you tried and didn't work.

Then somehow you need to find FM radio API on this device, by reverse engineering like I did, or by asking HP.

The API should supports all basic tuning features and provide RDS data.

Once I get this API, I can make an adapter/driver so that you can use xFMRadio and Beember's TMC driver.

Troublemaker HTC, I have to make an another driver for your HD.

It gives me motivation that I must make a driver loader that support different devices.

Can you click on About menu and tell me what is version of your FM driver?

use APITest to get volume.

Not simply WaveOutSetVolume but also FM_SetVolume and registry setting. HTC volume control made things complicated. I discussed this issue before in this thread. They are all wrapped in the GFMAPI now. hopefully it works for you (with APITest)

mono - I guess I misunderstood usage of Mono. I guess it indicates stereo sub-carrier. In another word, it should be read only.

De-emphasis, it is hardly noticeable as expected :)

Stereo Blend: I thought it didn't work until testing a station with very strong stereo signal. I hope it is not same as Mute setting.
[Windows Mobile Software Development] 6Fg8:
FMS API v20001 / 30000

ok will try in the evening and report :)

I see, will try with a couple of other stations and see how it goes.

Thanks so far, really appreciate your expertise.
[Windows Mobile Software Development] flywhc:
Correction: in my post #553 and old version of xFMRadio has a bug that Stereo Blend setting didn't work. in the post 550 and GFMAPI this bug was fixed.
[Windows Mobile Software Development] 6Fg8:
I got some success with APITest:

To get sound after PowerOn, i have to do this:

- set mute 0

- set mute 2

- tap volume rocker once (doesnt change volume)

Volume isn't full after that though, its kinda quiet (~50% when setvolume=100%). When setting mute to 0 or 2 sound becomes really full for a short period then mutes (or gets quiet depending on 0/2).

SetVolume mutes, when i tap the volume rocker once comes back (same as after PowerOn)

stereoblend: 0=active, 1=inactive, if i can trust my ears

mono: definitely works, where 0=active(mono), and 1=inactive(stereo)

exit time: w/ phones 75 secs, w/o 10 secs.
[Windows Mobile Software Development] flywhc:
6Fg8, can you please try attached gfmapi with APITest or Beember's TMC driver?

I modified Mute/Unmute argument value according to your testing.

it should be signed with development certificate if use with TMC driver.

It shouldn't take long time to exit unless running in debug mode.
[Windows Mobile Software Development] 6Fg8:
flywhc thanks for the update. Did some quick tests with APITest:

mute/unmute works perfect :)

exit time varying, takes between 15 and 60 secs ... i've some suspicion but need to test a bit deeper

setvolume makes the most trouble ATM, whenever i call it renders sound to nearly silence. I modified APITest to get waveOutGetVolume which reports plausible values but doesnt reflect earpice volume. Also implemented waveOutSetVolume which doesnt seem to have any effect :confused:
[Windows Mobile Software Development] flywhc:
I spent a lot of time on SetVolume problem before make working on my Raphael.

first of all should make sure it is unmute and tune to a channel.

In the xFMRadio, FM SetVolume menu is calling FM driver,

Valid value from 0-65536

Sys SetVolume is calling waveOutSetVolume + ControlPanel\\Volume registry.

Valid value shall be 0x0000 0000, 0x33333333, 0x66666666... 0xFFFFFFFF

It seems on my Raphael only Sys SetVolume is working. Older device shall use FM driver. I don't know which way should be used on your Blackstone.

About exit delay, I found it is very short only if FMClose or FM_Disable/FM_Destroy was called very fast. Debugger or other thread may cause the API call running slow and have deadlock somewhere. It is a bug in the HTC FM driver.

Thank for everyone who sent me donations to supporting my work. I just update the donation list.
[Windows Mobile Software Development] 6Fg8:
I found a working solution, looking back it's pretty simple:

- waveOutSetVolume sets the volume display(!) only, but doesnt actually change the volume

- writing to HKCU\ControlPanel\Volume\Volume sets the volume only, but doesnt change the volume display

When waveOutSetVolume value <> registry value, next time the volume rockers are used the waveOutSetVolume value is written to registry and thus suddenly changes volume.

Both value ranges are identical - at least on HD - and range from 0-0xFFFFFFFF in 0x11111111 increments.

Regarding GFMAPI, it seems you write values 0 to 0xF to registry, and 0 to 0xFFFFFFFF to waveOutSetVolume. Thats why sound was always very low as its interpreted as 0x11111111 on HD (lowest volume setting), and changed rapidly when i used the rockers.

Anyway thanks for helping and commenting on my humble attempts :)
[Windows Mobile Software Development] flywhc:
Thanks a lot for testing and detailed results.

Can you test attached DLL with API test again?

It shall fix volume problem on your HD.

If it does fix the problem, I should modify the driver to do different thing according to device model. Because your FMS driver returns same version number.

Device Model can be found from Settings->Device infomation->Identity

My Touch pro has a name "HTC Touch Pro T7272"

What is the device model of your HD?

My worry is if customized ROM may change this model name so I have to keep a long list of different names.
[Windows Mobile Software Development] 6Fg8:
Does not work. I checked the values written and they have a range 0-0xF, but should have 0-0xFFFFFFFF, for both waveOutSetVolume and registry.

The device model on my HD reads "HTC Touch HD T8282". Maybe you could grep for "Txxxx", this shouldnt be changed by any serious romcooker.

Another idea might be to check for the devicename returned from FMGetDevInfo. Mine is "HTC_BRF6350_1", not sure though if Touch Pro has the same chip/devicename.
[Windows Mobile Software Development] flywhc:
Thanks for your info. I know what shall be done now.

That "HTC_BRF6350_1" is hardcoded in GFMAPI.

I remember my O2 Serra had a model name "Serra" without "Txxxx". After burnt a customized ROM it changed.
[Windows Mobile Software Development] 6Fg8:
Maybe it's not the best idea, but what do you think of using registry keys? At least it would remove the hassle from checking models within GFMAPI, and adapting other models could be done easily.
[Windows Mobile Software Development] flywhc:
6Fg8, The GFMAPI attached should fix both mute and volume issue on Blackstone.

It works on all devices. It detects "T8285" and "T8282" for Blackstone

Can you please try that special version of xFMRadio and tell me the version please?

http://xdaforums.com/attachment.php?attachmentid=192517&d=1244155104

I just realized that the version you told me wasn't I need.

It should be like "1.2", not "20001"

thanks
[Windows Mobile Software Development] flywhc:
Hi, I noticed that 4 people have downloaded above plugin. can somebody give me test results?

If it solved mute and volume issues on Touch HD, I can officially release them.

Thanks.
[Windows Mobile Software Development] L_o_k_i:
Hi,

I don't know excatly what I have to check with the new gfmapi, but here what I've found:

- on first launch of xfmradio, the volume is not at the same level as the slider, but after a volume up or down it's OK. EDIT: I got this once. It was OK during my next tests.

- when the volume is set to 0, I can still here statics

- the mute button does not work. When I first press it, the volume gets low and I can still hear the radio. After unmuting, I have no sound and I cannot manage to have it back
[Windows Mobile Software Development] 6Fg8:
flywhc thanks for this update. It works great overall, but found a few flaws:

xFMRadio

- version reported is v1.2, as expected

-after launch, volume is at 100% but isn't sync with display when checking with volume rockers (still shows last chosen level), after changing volume its synced.

- mute on first click after launch doesnt mute but reduces volume, second click mutes, subsequent clicks do nothing obvious, sound still mute.

GFMAPI

- mute works perfectly

- volume works great, though values are kinda confusing, see table with SetProp values and GetProp returns. Sure it's a rounding issue and could workaround that in the app.

Set Get

100 100

99-94 93

93-87 86

86-80 80

79-74 73

73-67 66

66-60 60

59-54 53

53-47 46

46-40 40

39-34 33

33-27 26

26-20 20

19-14 13

13-7 6

6-0 0

- mono: 0=mono, 1=stereo, description reversed

- stereoblend: 0=enable, 1=disable, description reversed

- carrierdetect returns Err 50
[Windows Mobile Software Development] flywhc:
L_o_k_i, that XFMRadio doesn't use GFMAPI. It is for testing raw HTC FM API

Thanks 6Fg8.

I changed equation for calculating volume. It should have a correct value now.

I used FM transmitter to test mono/stereo properties.

Mono value was reversed as you found. I fixed this error.

Stereo Blend is hard to test. I couldn't find difference when test with transmitter.

However when I test it with a radio with poor signal (17), I can hear less noise when StereoBlend=1. So I believe this property was correctly defined since stereoblend improves sound quality.

Carrierdetect is not supported by design.

It only takes 3 seconds to close APITest after I clicked on Exit.
[Windows Mobile Software Development] 6Fg8:
thanks a bunch flywhc for your update, geez you're quick!

Volume works perfect now! No need to write a workaround :D

Mono switching works as expected.

I tested stereo blend again and again. When i set it to 1 and listen to a stereo station, it sounds like the HTC FM player, so nothing special. Set to 0 it sounds like a stereo base expander, widening up the stereo effect, which is really cool to listen :) I got the most significant effect when setting stereo blend to 0 and switching mono back and forth - the difference is incredible!

Exit time is hard to determine as i'm running the debugger all the time, i'll see once the C++ part is finished and i'll concentrate on the GUI (plan to build that in C# or VB).

Anyway, thanks for your continued support.
[Windows Mobile Software Development] L_o_k_i:
sorry for the misunderstanding :o