"Play All Songs" in WMP ? - Windows Mobile Development and Hacking General

Hi,
I'm making a script to launch WMP when my A2DP headphones are connecting to my phone, but I'd like to play all my songs too. In Titanium, there's the Music panel with the "Play all songs" button, and I'd like to know if it is possible to create a shortcut making the same thing.
Thanks

u could maybe make a playlist (.asx) with Mortscript and launch it...

nop, it's not what I'd like, and this for a good reason : launching WMP with a huge playlist (more than 500 songs) and you'll have to kill it... But launch WMP with the "Play All songs" button, and it works fine everytime
That's why I insist on the "play all songs" thing

ah.
well u could use mortscript to detect that the player is idle and then queue up the next track...

howdykeith said:
ah.
well u could use mortscript to detect that the player is idle and then queue up the next track...
Click to expand...
Click to collapse
Well, yeah... But it is just 1000x longer than just finding the good parameter for WMP or the right way to launch it playing all the songs ^^
But if I don't find a thing, maybe I'll make this like you said

Code:
#If Nitrogen running
If ( ProcExists( "Nitrogen.exe" ) )
#WHAT's PlayStatus??
#Paused
If ( PlayStatus <2 )
TickerDatum = "Nitrogen is Paused"
Else
#Playing song
SongTitle = RegRead( HKLM,"\System\State\Nitrogen\","SongTitle" )
SongArtist = RegRead( HKLM,"\System\State\Nitrogen\","SongArtist" )
TickerDatum = ( SongTitle eq "(none)") ? "Nitrogen is Playing" : SongTitle & " by " & SongArtist
#vol
EndIf
SongVol = RegRead( HKLM,"\System\State\Nitrogen\WM_NTG_GETVOLUME","WM_USER+3005" )
TickerDatum = (SongVol) ? "Nitrogen is Mute" : " Nitrogen Volume is at " & SongVol & "%"
#TimeElapsed - secs
#TimeTotal - secs
SongElaS = RegRead( HKLM,"\System\State\Nitrogen\","TimeElapsed" )
SongTotS = RegRead( HKLM,"\System\State\Nitrogen\","TimeTotal" )
TickerDatum = "At: " & (SongElaS / SongTotS) & "% of the Track... " & SongElaS & " Seconds" & " of " & SongTotS & " Seconds"
Call("PostStatus", TickerDatum, Delay, Icon)
Else
#wmp
If (RegKeyExists( HKCU,"System\State\MediaPlayer" ))
Icon = "CD1"
SongTitle = RegRead( HKCU,"System\State\MediaPlayer\","Title" )
SongArtist = RegRead( HKCU,"System\State\MediaPlayer\","WM/OriginalArtist" )
SongTrack = RegRead( HKCU,"System\State\MediaPlayer\","WM/TrackNumber" )
SongElapsed = "T" & RegRead( HKCU,"System\State\MediaPlayer\","Elapsed" )
sleep(Tick)
If (not SongElapsed eq ("T" & RegRead( HKCU,"System\State\MediaPlayer\","Elapsed")) )
TickerDatum = SongTitle & " by " & SongArtist
EndIf
EndIf
EndIf
Here is some code that doesn't look like i ever tested (PlayStatus?)...

Back to my script project, and can't find the simple code to just launch WMP and play all the files in the library...

Related

phoneOpen, phoneGetVolume (TAPI)

Hello,
I try to retrieve (then set) the volume, ring type ... of my XDA using TAPI
I call phoneInitializeEx, phoneOpen, phoneGetVolume but I always get the same value for the volume (even if I chnage it of course)
Does anybody knows why ?
Does anybody have and can post a sample code source showing how to unse these functiuns (phoneInitializeEx, phoneOpen, phoneGetVolume, phoneGetStatus ...)
Regards.
To set the phone volume (in mono) try:
Code:
set(DWORD dwVolume)
{
if (dwVolume > 0xFFFF) dwVolume = 0xFFFF;
dwVolume += dwVolume * 0x10000;
DWORD ret;
switch ((ret = waveOutSetVolume(0, dwVolume))) {
case MMSYSERR_NOERROR:
break;
case MMSYSERR_ERROR:
break;
case (etc....)
}
To get the volume, try:
Code:
DWORD get()
{
DWORD dwVolume;
DWORD ret;
switch ((ret = waveOutGetVolume(0, &dwVolume))) {
case MMSYSERR_NOERROR:
break;
case MMSYSERR_ERROR:
break;
case (etc...)
}
// Return average of left and right:
if (dwVolume > 0xFFFF) {
dwVolume = ((dwVolume & 0xFFFF) + (dwVolume / 0xFFFF)) / 2;
}
return dwVolume;
}
This is code for XDA I. I have not tried this on XDA II which as we know, has two volume channels.....
Ben.
I upgraded my XDA1 with WM2003 and I have 2 channels for the volume too.
I will try your code but I think this will change only the system volume (I will need to do that too so thanks) but not the phone volume.
First I want to pilot the phone settings (ring, volume...) from an application.
And it seems that only TAPI can do it... but it is not working for the moment
Glad the code will be useful.
If you find the correct method for XDA II, please let me know, I'll need it my self soon.
Ben
Your code works well to set/get the sytem volume
I just modifed it a little as the output is mono
Code:
//**********************************************************************
//Set The System Volume
//Steps (0,13107,26214,39321,52428,65535)
DWORD setVolume(DWORD dwVolume)
{
if (dwVolume > 0xFFFF)
dwVolume = 0xFFFF;
if (dwVolume < 0x0000)
dwVolume = 0x0000;
DWORD ret;
switch ((ret = waveOutSetVolume(0, dwVolume)))
{
case MMSYSERR_NOERROR:
break;
case MMSYSERR_ERROR:
break;
default :
break;
}
return 0;
}
//**********************************************************************
//Get The System Volume
DWORD getVolume()
{
DWORD dwVolume;
DWORD ret;
switch ((ret = waveOutGetVolume(0, &dwVolume)))
{
case MMSYSERR_NOERROR:
break;
case MMSYSERR_ERROR:
break;
default :
break;
}
dwVolume = (dwVolume & 0xFFFF);
return dwVolume;
}
But the phoneGetVolume still gives incoherent results
Someone see something wrong in the code below ?
I set the phone volume to 0 on the device but PhoneGetvolume send me 40092 ???
Code:
LONG result;
HPHONE hPhone;
DWORD dwVolume;
DWORD dwRingMode;
DWORD dwNumDevs= 01;
DWORD dwAPIVersion=0x00020002;
PHONESTATUS PhoneStatus;
HPHONEAPP hPhoneApp = 0;
PHONEINITIALIZEEXPARAMS PhoneInitializeExParams;
PhoneInitializeExParams.dwTotalSize = 2 * sizeof(PHONEINITIALIZEEXPARAMS);
PhoneInitializeExParams.dwOptions = PHONEINITIALIZEEXOPTION_USEEVENT;
// PhoneInitializeExParams.dwOptions = PHONEINITIALIZEEXOPTION_USEHIDDENWINDOW;
result = phoneInitializeEx(&hPhoneApp,NULL,NULL,NULL,&dwNumDevs,&dwAPIVersion,&PhoneInitializeExParams);
result = phoneOpen(hPhoneApp, 0, &hPhone, dwAPIVersion, 0, 0,PHONEPRIVILEGE_OWNER);
result = phoneGetVolume(hPhone,PHONEHOOKSWITCHDEV_SPEAKER,&dwVolume); //range 0x00000000 to 0x0000FFFF (65535)
In fact when I set the phone volume using
PocketSetVolume the vlaue is well saved because I get it when I use after PocketGetVolume.
But the phone volume is not really changed ?
Nobody has a sample that uses these functions ?
Or not obligatory these functions but others functions that change the phone volume ?
zendrui said:
In fact when I set the phone volume using
PocketSetVolume the vlaue is well saved because I get it when I use after PocketGetVolume.
But the phone volume is not really changed ?
Nobody has a sample that uses these functions ?
Or not obligatory these functions but others functions that change the phone volume ?
Click to expand...
Click to collapse
I have found that by changing the following registry keys, I can change the volume of the Phone
[HKEY_CURRENT_USER\ControlPanel\Volume]
"Ringer"=dword:00000000
Use hex 00000000, 33333333, 66666666, 99999999, cccccccc, ffffffff
[HKEY_CURRENT_USER\ControlPanel\SoundCategories\Ring]
"InitVol"=dword:00000000
Use hex 0, 1, 2, 3, 4, 5
This work beautifully for my Qtek running WM2003, but I have tried the same approach for the system-volume by changing
[HKEY_CURRENT_USER\ControlPanel\Volume]
"Volume"=dword:00000000
Use hex 00000000, 33333333, 66666666, 99999999, cccccccc, ffffffff
But this does not work! I have checked the registry and the value goes in correctely (The in-system volum control stores the same values in the same key).
How can I use the above code-snippets from the .Net Compact Framework? (I'm guessing a P/Invoke but what DLL is the call hidden in)
Cato
I am trying to make it works, but fail...please let me know if you know how to use the registry to update it...my email is
[email protected]
Thanks
I used the P/Invoke sample from Microsoft to get a working sample that read and updated the registry, and simply tried all possible combo's of a 4byte-array to see what would produce the correct result
Cato
I found a article mention it !!!
http://www.cegadgets.com/winceregfaq.htm#2.8 Where are volume and sound settings stored?
Not sure it works or not !!!
Please let me know if you know how to use the AudioUpdateFromRegistry, defined in coredll
Thanks :wink:
One more acticle !!!
http://www.pocketpcdn.com/forum/viewtopic.php?t=111
But I dunno how to make it works.
Any runnable example?
Hello,
after many tries I didn't find how to use TAPI functions ... this seems not towork ..
But you can change all the phone settings (volume, ring mode, ring tone, notifications ...) in the registry ... as I did for PocketZenPhone
See under that key HKEY_CURRENT_USER\ControlPanel
For the system volume I use the functions I posted upper
Hey, any example to do it?
Thanks zendrui
If you use EVC
Simply open the registry key
HKEY Key;
RegOpenKeyEx(HKEY_CURRENT_USER,_T("\\ControlPanel\\Volume"),0,0,&Key);
Then use RegQueryValueEx to retrieve the value/setting you want
Hi zendrui,
I am able to update the registry, but I am not able to call AudioUpdateFromRegistry to notify the system to update the status from registry.
Could you able to exeute this API?
Thanks,
Paul
Sorry for the last post didn't have the keys in my mind
So to change the phone volume here are the keys needed
Code:
//dwPhoneVolumeLevel between 0 and 0xFFFFFFFF
res = RegOpenKeyEx(HKEY_CURRENT_USER,_T("\\ControlPanel\\Volume"),0,0,&Key);
if (res == ERROR_SUCCESS)
{
res = RegSetValueEx(Key,_T("Ringer"),0,REG_DWORD,(LPBYTE)&dwPhoneVolumeLevel,sizeof(DWORD));
if (res != ERROR_SUCCESS)
{
RegCloseKey(Key);
return -1;
}
}
RegCloseKey(Key);
//dwInitVol between 1 and 5
res = RegOpenKeyEx(HKEY_CURRENT_USER,_T("\\ControlPanel\\SoundCategories\\Ring"),0,0,&Key);
if (res == ERROR_SUCCESS)
{
res = RegSetValueEx(Key,_T("InitVol"),0,REG_DWORD,(LPBYTE)&dwInitVol,sizeof(DWORD));
if (res != ERROR_SUCCESS)
{
RegCloseKey(Key);
return -1;
}
}
RegCloseKey(Key);
It changes the phone volume and the display
PS : I post this code hoping is to help people to develop freewares (or low low cost software :wink
COOL !!! Thanks zendrui !!!!
Now I can set the Ringer volume !!!
How about set the system sound volume?
Fot the system volume see upper of this thread I posted the code I use. It works perfect
O yes...It works under eVC++
Let me try to implement it in VS.NET
Thanks
bong99 said:
O yes...It works under eVC++
Let me try to implement it in VS.NET
Thanks
Click to expand...
Click to collapse
Please tell me if you make it, as I have tried various P/Invoke calls that all result in a No Supported Exception.
Cato
PS: Sorry that I could not get you a working code before but I was under with the flu last week

volume setting

I am trying to set the volume to my needs then put it back after. I have use the code from ppc developer network and when that did not set the correct volume I also did the registry as well. Don't worry about "reg", its my registry class and it works fine.
DWORD oldReg=0;
oldReg=reg->readDWORDfromReg(name,path);
reg->saveDWORDtoRegistry(name,path,0xffffffff);
WAVEFORMATEX wf;
wf.wFormatTag = WAVE_FORMAT_PCM;
wf.nChannels = 1;
wf.nSamplesPerSec = 8000 * 1000;
wf.wBitsPerSample = 8;
wf.nBlockAlign = wf.nChannels * wf.wBitsPerSample / 8;
wf.nAvgBytesPerSec = wf.nSamplesPerSec * wf.nBlockAlign;
wf.cbSize = 0;
HWAVEOUT hwo;
DWORD dwVolume=0xffffffff;
DWORD oldVolume=0;
int waveDevice=-1;
UINT numberOfDevices=waveOutGetNumDevs();
for(UINT id=0;id<numberOfDevices;id++)
{
if (waveOutOpen(&hwo,id,&wf,0,0,CALLBACK_NULL)==MMSYSERR_NOERROR)
{
waveDevice=id;
waveOutGetVolume(hwo,&oldVolume);
waveOutSetVolume(hwo,dwVolume);
waveOutClose(hwo);
break;
}
}
.........playing sound here all ok....
//put the volume back
if(waveDevice!=-1)
{
if (waveOutOpen(&hwo, waveDevice, &wf, 0, 0, CALLBACK_NULL) == MMSYSERR_NOERROR)
{
waveOutSetVolume(hwo, oldVolume);
waveOutClose(hwo);
}
}
reg->saveDWORDtoRegistry(name,path,oldReg);
I can set the volume to any value below the origional volume but any attempt to set a volume higher just dose nothing. There are no errors (checking left out here), just the same level. I did not seriously expect the registry part to work as I guess there is some event to trigger that change, but others seem to get results from waveOutSetVolume.
Well, I never tried changing volume by code, but I know TCPMP player does it well and it's open source so might be worth taking a look at.
Thanks levenum, I will give it a look.
Before I got a chance to look at that code I got a result. I have been using PlaySound to play a resource with no volume change working. When I use waveOutWrite to play a buffer containing the same data I can get the volume change I am after. There is still something wrong with my code because the sound gets garbled but I think I will figure that part out. I also want to next test playsound with a file instead of a resource.
<edit>
using playsound with the same file plays clear sound but the volume change is not working. Its a pity because to get the waveoutwrite to work properly i had to fill in the WAVEFORMATEX with the CORRECT values. This means that if I am allowing the user to specify files to play I will have to find out the samples per second and bits per sample info before I can use the file.

Turning BT off/on w/ mortscript

I am trying to create a script that checks the BT state and then turn on/keeps on the BT then start a program (landscaper-->google maps) and then when the program terminates it returns the BT state that it was before starting the script...
the programs are
Program Files\BlindLemon\BTToggle.exe
Program Files\Landscaper.exe or \Windows\Start Menu\Programs\Landscaper.exe
Program Files\Googlemaps\googlemaps.exe
I have part of the script but I need the BT part. Here is what I have
Rotate(90)
Run( "\Window\Start Menu\Programs\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\GoogleMaps\GoogleMaps.exe" )
Close( "Landscaper" )
Rotate(0)
And This portion Works fine.. just looking for the BT component
If anyone has experience with this or has a similar script let me know
Thanks..
__________________
You couldn't fool your mother on the foolingest day of your life even if you had an electrified fooling machine!
I saw him once. Sure I'm blind in one eye, and my other eye was infected that day from picking at it, and I was tired, and I'd been swimming in a pool with too much chlorine, and that was the hour my glasses were at Lenscrafters but I seen that fish!
bluetooth toggle
i just found this little app that toggles BT state when called. i mapped it to an icon in my program launcher/today screen to toggle BT on and off with the push of a button. I believe I found it on the forums here, but can't remember - it was late. Hope this helps.
Thanks, but I already have a BT Toggler app, (BlindLemon\BTToggle.exe) What I need to know is how to read the BT status, and then either turn the BT on or execute the program.
I need to know how to have Mortscript read the BT status also I cannot figure out the if/then part
Figured It out...
This script is for
1. Check the BT state and turn on if off (using a simple BT toggler program located HERE....and turn off when program is exited
2. Rotating the screen to 90º (So Keyboard will be Functional)
3. Keeping the screen rotated at 90º even if switched to portrait (this is achived with the program called Landscaper)
4. Running Google Maps
5. Returning everything (BT Status/Rotation) to state prior to executing the script
Of course you can change any of the programs to suite your needs..
Here is the Script I used
B = RegRead ("HKLM", "Software\oem\bluetooth\" , "BTcomstatus" )
If ( B = 0 )
Run( "\Program Files\BlindLemon\BTToggle.exe" )
Rotate(90)
Run( "\windows\Start Menu\programs\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\GoogleMaps\GoogleMaps.exe" )
Close( "Landscaper" )
Run( "\Program Files\BlindLemon\BTToggle.exe" )
Rotate(0)
Else
If ( B = 1 )
Rotate(90)
Run( "\windows\Start Menu\programs\Landscaper.exe" )
WaitForActive( "Landscaper", 05 )
SendDown ( "Landscaper" )
Runwait( "\Program Files\GoogleMaps\GoogleMaps.exe" )
Close( "Landscaper" )
Rotate(0)
Here is the BT monitoring part
0 is BT off
1 is BT on
B = RegRead ("HKLM", "Software\oem\bluetooth\" , "BTcomstatus" )
If ( B = 0 )
run( "Prorgam path for BT toggler such as BlindLemon's BTTolgger" )
runwait( "Insert your program path here" )
run( "Prorgam path for BT toggler such as BlindLemon's BTTolgger" )
Else
If ( B = 1 )
run( "Insert your program path here" )

HTC - 6 Tab Home PlugIn & Customization

Again the idea was to have all the registry setting ready after a Hard-Reset or a ROM-Flash. The last two months I have made my Cruise a ROM lab testing every ROM I found to this FANTASTIC Forum.
And I'm very happy that I have a PDA that can be customizable.
So here is the cab ...
http://www.turboupload.com/download/00pEcIE03vrj/HTC_6TabHomePlugIn.cab
It contains:
- HTC Home PlugIn Setting/Customization (Start / Settings / Today / HTC Home)
- HTC 6 Tab Home PlugIn
HKLM\Software\HTC\HTCHome
New string "Tabsetting = 1,2,3,4,5,6"
1 = Clock tab
2 = Favorite People tab
3 = Weather tab
4 = Launcher tab
5 = Music tab
6 = Profiles tab
Removed "HKLM\Software\OEM\MASD\Quickdial"
- dd/MM/yy Format
HKLM\nls\overrides\SSDte = "dd/MM/yy"
- HH:mm:ss Format
HKLM\nls\overrides\STFmt = "HH:mm:ss"
- Speedup Touchflo By increasing Frames Per Second
HKLM\Software\HTC\Biotouch\Biotouch\DownFPS = "30"
HKLM\Software\HTC\Biotouch\Biotouch\LightFPS = "30"
HKLM\Software\HTC\Biotouch\Biotouch\UpFPS = "30"
- Activate GPS Photo in Camera
HKLM\SOFTWARE\HTC\Camera\P9\Enable = "1"
- No ActiveSync if Phone is Disconnected
HKLM\Software\Microsoft\Windows CE Services\AllowLSP = "0"
Again the THANKS and the Gredits goes to people who discovered these.

How to use setNextMediaPlayer with videos?

Hi all.
I'm trying to use setNextMediaPlayer function with 2 video files:
http://developer.android.com/refere...setNextMediaPlayer(android.media.MediaPlayer)
Code:
mp0 = new MediaPlayer();
mp1 = new MediaPlayer();
mp0.setDataSource("/mnt/sdcard/video1.mp4");
mp0.setDisplay(holder); // surface holder set
mp0.prepare();
mp1.setDataSource("/mnt/sdcard/video2.mp4");
//mp1.setDisplay(holder); // surface holder NOT set because I get an error (width 0, height 0) in video size changed event
mp1.prepare();
mp0.setNextMediaPlayer( mp1 );
mp0.start();
It this way I see the first video, it finishes and then I can only listen the audio track of the second video...
I tried also to call "setNextMediaPlayer" in "onPrepared" event listener, same result.
Any idea?

Categories

Resources