Related
Hi,
I'm trying to port some OpenGL software to the Leo (HD2) and everything is working OK apart from the screen is dimming.
Looking at the MSDN info I should be able to do
SetPowerRequirement("BKL1:", D0, POWER_FORCE | POWER_NAME, NULL, 0);
but this doesn't work.
Reading the current value using GetDevicePower() returns an error.
Does anyone know how to stop the screen from going dim?
Jim
This thread is mainly intended for developers - it's a proof-of-concept to show a new approach to the classic background for all tabs mod.
This is only a proof-of-concept and I won't develop it further because I don't use BG4all myself. But my hope is that the basic concept will be helpful to others, and that it will develop from there.
Traditionally the mod is made by moving the "HomeBackgroud" instance from home.mode9 to manila.mode9. The problem with this is that those are 2 of the most important mode9 files in manila, so they are also needed for a lot of other manila mods.
The result of this is that other mods now have to be made in 2 version: one with bg4all and one without. Also, if a new manila build changes one of the mode9s, the bg4all mod needs to be remade.
A different way of doing it is thought the lua scripts. Specifically only one script needs to be modified to make bg4all: homebackground.luac.
This way no mode9 files are modified so bg4all can be compatible with a lot of other mods. This way mods don't have to be redone to include bg4all.
I've included the lua source of the modified homebackground.luac for manila 2.5 with comments about what’s been changed, but you can also compare it to the original to get a better idea. At the bottom is a ready-made cab with bg4all for manila 2.5.
Here's the lua code:
Code:
-- Decompiled using luadec 3.2
-- File name: 090a4ee8_manila -- \windows\htc\home\scripts\HomeBackground.luac
require("asyncimageloader")
require("shell_svc")
CachedImagePath = "\\Windows\\HomeBackground.img"
HomeBackground.Opacity.value = 0
-- Home Background is not needed at all, so it should be made invisible
-- and we can forget about it from here on
-- from this point on anything that operated on HomeBackground is replaced with BackGroundLevel0
-- compare with the original 090a4ee8_manila to see the differences
-- BackGroundLevel0 is the default manila background that appears on all tabs
InterpolateOpacity = function(l_1_0, l_1_1)
l_1_1.Opacity:Interpolate(l_1_0, 20, 0, Interpolate_EaseOutQuad)
end
BackgroundWidth = 480
BackgroundHeight = 696
LoadDefaultBackground = function()
InterpolateOpacity(0, BackGroundLevel0)
if HomeTitleBar ~= nil then
HomeTitleBar.Opacity.value = 0
_application.Navigation.TabTrayOpacity = 100
end
end
BackgroundImageLoaded = function(l_3_0, l_3_1)
if l_3_0 then
if l_3_1 == 1 then
BackGroundLevel0.TextureCoords.width = l_3_0.TextureCoords.width
BackGroundLevel0.TextureCoords.height = l_3_0.TextureCoords.height
local l_3_2 = l_3_0.TextureCoords.width * l_3_0.Image.Width
local l_3_3 = l_3_0.TextureCoords.height * l_3_0.Image.Height
_StoreImageWidth = l_3_2
_StoreImageHeight = l_3_3
local l_3_4 = l_3_2 / BackgroundWidth
local l_3_5 = l_3_3 / BackgroundHeight
if l_3_4 < l_3_5 then
BackGroundLevel0.Size.height = l_3_3 / l_3_2 * BackgroundWidth
BackGroundLevel0.Size.width = BackgroundWidth
else
BackGroundLevel0.Size.width = l_3_2 / l_3_3 * BackgroundHeight
BackGroundLevel0.Size.height = BackgroundHeight
end
BackGroundLevel0.Position.x = (BackgroundWidth - BackGroundLevel0.Size.width) / 2
BackGroundLevel0.Position.y = 696 - (BackgroundHeight - BackGroundLevel0.Size.height) / 2 -- +696 is added here because the BG0's camera y-axis is set at the bottom, while Home's camera was set at the top
BackGroundLevel0:SetTexture(l_3_0.Image)
InterpolateOpacity(100, BackGroundLevel0)
if HomeTitleBar ~= nil then
local l_3_6 = _application.Store:GetIntValue(Lifetime_Application, "ShowCacheHomePage")
if l_3_6 == 1 then
HomeTitleBar.Opacity.value = 60
_application.Navigation.TabTrayOpacity = 60
end
end
else
LoadDefaultBackground()
end
collectgarbage("collect")
BackgroundAsyncImageLoader = nil
elseif _StoreImageWidth and _StoreImageHeight then
local l_3_7 = _StoreImageWidth / BackgroundWidth
local l_3_8 = _StoreImageHeight / BackgroundHeight
if l_3_7 < l_3_8 then
BackGroundLevel0.Size.height = _StoreImageHeight / _StoreImageWidth * BackgroundWidth
BackGroundLevel0.Size.width = BackgroundWidth
else
BackGroundLevel0.Size.width = _StoreImageWidth / _StoreImageHeight * BackgroundHeight
BackGroundLevel0.Size.height = BackgroundHeight
end
BackGroundLevel0.Position.x = (BackgroundWidth - BackGroundLevel0.Size.width) / 2
BackGroundLevel0.Position.y = 696 - (BackgroundHeight - BackGroundLevel0.Size.height) / 2 -- +696 same as before
end
end
BeginLoadBackgroundImage = function(l_4_0)
if Shell_HaveDRMRightsToFile(machineStatus.HomeBackgroundPath.Value, false) then
BackgroundAsyncImageLoader = AsyncImageLoader()
BackgroundAsyncImageLoader.Priority = TaskPriority_Normal
BackgroundAsyncImageLoader.OnComplete:connect(BackgroundImageLoaded)
BackgroundAsyncImageLoader:BeginLoadFile(l_4_0, false, true)
else
machineStatus.HomeBackgroundPath.Value = ""
machineStatus.CachedBackgroundPath.Value = ""
LoadDefaultBackground()
end
end
BackgroundImageResized = function(l_5_0, l_5_1)
if l_5_1 == 1 and machineStatus.HomeBackgroundPath.Value ~= "" then
machineStatus.CachedBackgroundPath.Value = machineStatus.HomeBackgroundPath.Value
BeginLoadBackgroundImage(CachedImagePath)
else
LoadDefaultBackground()
BackgroundAsyncImageLoader = nil
end
collectgarbage("collect")
end
machineStatus_OnCustomBackgroundUpdate = function()
if _config_os == "windowsmobile" then
local l_6_0 = machineStatus.HomeBackgroundPath.Value
local l_6_1 = machineStatus.CachedBackgroundPath.Value
if l_6_0 ~= l_6_1 then
if BackgroundAsyncImageFactoryLoader ~= nil and BackgroundAsyncImageFactoryLoader:IsRunning() then
BackgroundAsyncImageFactoryLoader = nil
collectgarbage("collect")
end
if BackgroundAsyncImageLoader ~= nil and BackgroundAsyncImageLoader:IsRunning() then
BackgroundAsyncImageLoader = nil
collectgarbage("collect")
end
if l_6_0 == "" then
machineStatus.CachedBackgroundPath.Value = machineStatus.HomeBackgroundPath.Value
LoadDefaultBackground()
else
BackgroundAsyncImageFactoryLoader = AsyncImageFactoryLoader()
BackgroundAsyncImageFactoryLoader.Priority = TaskPriority_BelowNormal
BackgroundAsyncImageFactoryLoader.Quality = 100
BackgroundAsyncImageFactoryLoader.OnComplete:connect(BackgroundImageResized)
BackgroundAsyncImageFactoryLoader:ResizeImage(machineStatus.HomeBackgroundPath.Value, CachedImagePath, EncoderType_JPEG, 512, 512, true, false)
end
elseif l_6_1 ~= "" then
BeginLoadBackgroundImage(CachedImagePath)
else
LoadDefaultBackground()
end
else
LoadDefaultBackground()
end
end
if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
require("RotationTemplate")
HomeBackground_ScreenRotation = class(RotationTemplate)
HomeBackground_ScreenRotation.__init = function(l_7_0)
RotationTemplate.__init(l_7_0)
trace("+++++++[HomeBackground] : __init")
end
HomeBackground_ScreenRotation.OnScreenRotation = function(l_8_0)
trace("+++++++[HomeBackground] : OnScreenRotation")
if _application.Orientation == ScreenOrientation_Portrait then
BackgroundWidth = 480
BackgroundHeight = 696
elseif _application.Orientation == ScreenOrientation_Landscape then
BackgroundWidth = 805
BackgroundHeight = 376
end
BackgroundImageLoaded(nil, nil)
end
end
if _config_os == "windowsmobile" then
if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
_HomeBackground_ScreenRotation = HomeBackground_ScreenRotation()
end
machineStatus.HomeBackgroundPath.OnValueChanged:connect(machineStatus_OnCustomBackgroundUpdate)
_application.OnOrientationChanged:connect(machineStatus_OnCustomBackgroundUpdate) -- needed for correct rotation
machineStatus_OnCustomBackgroundUpdate()
end
I just wanted to say THANKS! for all you work on the community and tell you what a great find you did "it looks so obvious to do it that way now" also THANKS! on your work on the decompiler many mods would not have been made without it.
By the way THANKS! again
nice, thank you
Perfect, once again a fantastic mod from you!
Thanks a million
Thanks a lot cookiemonster. Any plans to do one that also works to assign landscape wallpaper?
edit* Just tried it on landscape manila and doesnt work at all. Just get plain black background in portrait and landscape.
Awesome. So does this method keep the animated weather on sense 2.1? Could you cab that up PLEASE!!!!!
Superboy007 said:
I just wanted to say THANKS! for all you work on the community and tell you what a great find you did "it looks so obvious to do it that way now" also THANKS! on your work on the decompiler many mods would not have been made without it.
By the way THANKS! again
Click to expand...
Click to collapse
Wow, that's 3 very big thanks' I'm very glad I can contribute to the community.
kwill said:
Thanks a lot cookiemonster. Any plans to do one that also works to assign landscape wallpaper?
edit* Just tried it on landscape manila and doesnt work at all. Just get plain black background in portrait and landscape.
Click to expand...
Click to collapse
You're referring to manila 2.5.1922.2911, right?
That one also needs the manila.mode9 to work, but that's only because it has a built in bug in it's original manila.mode9. (I've made a cab for it here: http://forum.xda-developers.com/showpost.php?p=5499189&postcount=47)
Now, it might seem a little contradictory, that in the first post I say "no need to modify the mode9s", and now I'm saying 2.5.1922.2911 needs a mode9. But, believe me 2.5.1922.2911 is an exception rather than the rule. That version is bugged, and it's the only reason it needs the mode9 to work.
rjmjr69 said:
Awesome. So does this method keep the animated weather on sense 2.1? Could you cab that up PLEASE!!!!!
Click to expand...
Click to collapse
I've made some cabs here: http://forum.xda-developers.com/showpost.php?p=5499189&postcount=47
I haven't tested the animated wallpaper, only the regular. This is only a proof-of-concept and I won't develop it further because I don't use BG4all tabs myself (I prefer making better quality wallpaper with HDWall).
But my hope is that the basic concept will be helpful to others, and that it will develop from there.
Thanks Man,
A great new applicaiton. It also works for me Many Thanks
Co0kieMonster said:
Wow, that's 3 very big thanks' I'm very glad I can contribute to the community.
You're referring to manila 2.5.1922.2911, right?
That one also needs the manila.mode9 to work, but that's only because it has a built in bug in it's original manila.mode9. (I've made a cab for it here: http://forum.xda-developers.com/showpost.php?p=5499189&postcount=47)
Click to expand...
Click to collapse
Thanks much cookiemonster! I'm actually getting used to not using bg4all too. Manila runs much smoother without. Maybe I'll make some high quality walls with hdwalls also. But, it doesnt work on manila 2.5.1922 does it?
edit** Ok, now this was kind of weird. Installed the cab and all was fine, til I switched to landscape and back. My wallpaper disappeared after that, never to return Naw, after soft reset, it came back. But, same thing keeps happening.
If not here, i dont know a better place to get capable people that could MAYBE help me on this matter.
I am Using the "old" Tf3d (not leo) on my X1 and i came across a pretty sad thing.
TF3D scales down the Wallpaper and makes it look worse. I made a mod for a self changing wallpaper for tf3d so i got into the lua files quite a bit half a year ago.
So my questions are:
Do you have any idea where the image is scaled down in the lua code?
can you think of any workaround to get a better image quality?
I think this would make it SO SO SO much better, as the images in full quality look just stunning..and on tf3d they look just blurry.
And another brief question, did the lua decompilers got better?..half a year ago almost any big lua file could not be decompiled properly..and so could not be changed at all.
thank you in advance,
Daranus
kwill said:
Thanks much cookiemonster! I'm actually getting used to not using bg4all too. Manila runs much smoother without. Maybe I'll make some high quality walls with hdwalls also. But, it doesnt work on manila 2.5.1922 does it?
edit** Ok, now this was kind of weird. Installed the cab and all was fine, til I switched to landscape and back. My wallpaper disappeared after that, never to return Naw, after soft reset, it came back. But, same thing keeps happening.
Click to expand...
Click to collapse
HDWall works with 1922, but my patch for that version needs to be applied.
The landscape problem: As I've said, it's just a proof-of-concept and I won't develop it further. Anyone who wishes to do so: In order to fix the landscape problem, the BackGroungLevel0 texture needs to be reapplied in the rotation function.
Daranus said:
If not here, i dont know a better place to get capable people that could MAYBE help me on this matter.
I am Using the "old" Tf3d (not leo) on my X1 and i came across a pretty sad thing.
TF3D scales down the Wallpaper and makes it look worse. I made a mod for a self changing wallpaper for tf3d so i got into the lua files quite a bit half a year ago.
So my questions are:
Do you have any idea where the image is scaled down in the lua code?
can you think of any workaround to get a better image quality?
I think this would make it SO SO SO much better, as the images in full quality look just stunning..and on tf3d they look just blurry.
Click to expand...
Click to collapse
It's scaled down to 512X512 in the homebackground.lua script.
One workaround is to make it use 480x800 jpegs or pngs, but that still isn't optimal because Manila displays those formats with some kind of dot artifacts.
The best quality solution is to use Manila's native QTC format, but you have to make your wallpapers with HDWall: http://forum.xda-developers.com/showthread.php?t=503511
Daranus said:
And another brief question, did the lua decompilers got better?..half a year ago almost any big lua file could not be decompiled properly..and so could not be changed at all.
thank you in advance,
Daranus
Click to expand...
Click to collapse
I've been developing LuaDec recently and made a lot of improvements - it can decompile more than 90% of all Manila script. The link to the tool is in my signature.
very goog , thanks.
hej Co0kie!
does this one work with your 16-20 Quicklinks/Appointments beta_1.5?
the QL app is a sure nomination for some HTC price. I'm getting used to not having a B4all, but would be sooo nice to have this working too
dXsL said:
hej Co0kie!
does this one work with your 16-20 Quicklinks/Appointments beta_1.5?
the QL app is a sure nomination for some HTC price. I'm getting used to not having a B4all, but would be sooo nice to have this working too
Click to expand...
Click to collapse
I just checked it and it's working fine with v1.5beta2. (on Manila 2.5.1922.3829)
And I really don't see why it should be causing any problems. The two mods use different files.
Co0kieMonster said:
The landscape problem: As I've said, it's just a proof-of-concept and I won't develop it further. Anyone who wishes to do so: In order to fix the landscape problem, the BackGroungLevel0 texture needs to be reapplied in the rotation function.
Click to expand...
Click to collapse
Anyone have done this?
I have tried doing it myself. I have modified
Code:
HomeBackground_ScreenRotation.OnScreenRotation = function(l_8_0)
trace("+++++++[HomeBackground] : OnScreenRotation")
if _application.Orientation == ScreenOrientation_Portrait then
BackgroundWidth = 480
BackgroundHeight = 696
elseif _application.Orientation == ScreenOrientation_Landscape then
BackgroundWidth = 805
BackgroundHeight = 376
end
[B]BeginLoadBackgroundImage(CachedImagePath)[/B]
end
Whithout luck... any hints why this is not working?
Thank you for your answer!
That doesnt sound good..i personally use S2U2 now, as the wallpapers there look just stunning..it's a shame that we cannot get it to work properly within manila...do you know if it is the same issue with version 2.5 cookiemonster?
Wow thats awesome..when i was developing a bit stuff it was just a pain in the ass because almost every big manila file couldnt be edited..
Big props to you mate, great great work, greatly appreciated!!!..maybe i will take a look at it again nuw...as making wallpapers like that sucks..and i think it wouldnt work with my bg changer mod....anyways, thank you man!!!!!!!!!!!!!!!!!!!
Edit: Yup, i will definitely try to figure something out there..is there any "comfortable" way to work with your new luatool thingy?..i only saw 12's kitchen and that is not using a new version and is not that easy configurable to use your new thing there...
atm i search for the asyncimageloader but didnt find a way to properly search for it *laughs*..i have to get into this stuff again for real..
mac_es said:
Anyone have done this?
I have tried doing it myself. I have modified
Code:
HomeBackground_ScreenRotation.OnScreenRotation = function(l_8_0)
trace("+++++++[HomeBackground] : OnScreenRotation")
if _application.Orientation == ScreenOrientation_Portrait then
BackgroundWidth = 480
BackgroundHeight = 696
elseif _application.Orientation == ScreenOrientation_Landscape then
BackgroundWidth = 805
BackgroundHeight = 376
end
[B]BeginLoadBackgroundImage(CachedImagePath)[/B]
end
Whithout luck... any hints why this is not working?
Click to expand...
Click to collapse
Not sure why that doesn't work. I'll do some testing this weekend to try to find out.
Daranus said:
Thank you for your answer!
That doesnt sound good..i personally use S2U2 now, as the wallpapers there look just stunning..it's a shame that we cannot get it to work properly within manila...do you know if it is the same issue with version 2.5 cookiemonster?
Click to expand...
Click to collapse
It's the same thing on 2.5 as previous versions.
Daranus said:
Wow thats awesome..when i was developing a bit stuff it was just a pain in the ass because almost every big manila file couldnt be edited..
Big props to you mate, great great work, greatly appreciated!!!..maybe i will take a look at it again nuw...as making wallpapers like that sucks..and i think it wouldnt work with my bg changer mod....anyways, thank you man!!!!!!!!!!!!!!!!!!!
Edit: Yup, i will definitely try to figure something out there..is there any "comfortable" way to work with your new luatool thingy?..i only saw 12's kitchen and that is not using a new version and is not that easy configurable to use your new thing there...
atm i search for the asyncimageloader but didnt find a way to properly search for it *laughs*..i have to get into this stuff again for real..
Click to expand...
Click to collapse
12aon and hilaireg are working on an updated kitchen. It should be easier to get things done once it's out.
Co0kieMonster said:
Not sure why that doesn't work. I'll do some testing this weekend to try to find out.
Click to expand...
Click to collapse
Great! Thank you very much!
Hi there, I still cannot find the cab to make M2.5.2011303 to work for background-for-all. Can somebody have a hint there ? Thanks
This one works
http://forum.xda-developers.com/attachment.php?attachmentid=274664&d=1264873157
Hello
I code some games with opengl es for my winmo device. BUT: My apps won't startup after running several times (about 7 or 8 times) and I don't why.
And sometimes they just mess up my device - so I need to do a softreset by removing the accu of the phone...
Does anyone else have the same issue and already solved it?????
Thanks
Chabun
Hey guys
I really need help...
It's very strange, glGetError reports everything's running OK..
EGL does report any error, too.
And it must be OpenGLES or EGL cause on the device emulator (with vincent3D) everything's running...
Does anyone have a tip where I have to search for the fault?
Thanks
People having this problem 'solved' it by removing the call to eglTerminate.
What device/rom are you using?
Yeah, that's an bug of the egl on SnapDragon platforms (I'm using a HTC HD2 with the original Rom).
Now my app starts every time, but it crashes (and freezes the whole device) suddenly without reasons...
I'm not sure if this is a bug in the drivers as my apps work fine on HD2. Do you have this bug with my OpenGLES test apps (1.x, 2.0)?
No, you're apps run perfectly... (1.x and 2.0)
Is there sany source code avaible?
So I could compare my engine with yours to find out what's my problem.
But that my app runs perfectly (but slow ;-)) on the emulator is still a mystery...
The 1.x thread has a VS2005 project with an early version of the test. These sources are build for 1.x devices.
Try the following (maybe first in your project):
For OpengGL ES 1.x on 2.0 devices:
in egl.cs replace "libgles_cm.dll" by "libEGL.dll"
(if that's not enough try also to replace "libgles_cm.dll" by "libGLESv1.dll" in gl.cs)
In case your project is using OpenGL ES 2.0:
link/load libEGL.dll for egl and libGLESv2.dll for gl
After these changes you can't run it on the emulator anymore. But you can connect to your device. Just be sure to save everything before starting the debugger!
Hey
If I change the dll in the wrapper classes, I get a black screen with some render artefacts or other strange things....
I've downloaded your source but I can't see any difference between my engine and yours.
I'll send you a PM with my source code... (I don't want to publish my game now)
Please test it on your device, thank
Hey
sorry, I can't attach files zo a PM?!
Could you give me a mail-address where I'm able to send it to you?
I really don't want to publish it 'cause it's still not stable and finished...
chabun
Thanks..
Now everything is working...
And I will post my game as soon as I finish it, Thanks to heliosdev!!!
Chabun
A never ending fight
I thought all my issues were solved by changing the dlls...
But I was wrong, my app still freezes my device...
My game is based on a square field of tiles and it dynamically draws the field in different sizes - meaning that exactly the same code is executing. Depending on the size of the field, the draw method of the tiles is executed more times...
If it freezes my phone or not is depending on the field size, but it does not mean that more tiles (bigger field size) cause the freezing - the biggest field size works and the smallest not...
So I think I do not draw the tiles properly, cause that's the only thing that changes beetwen the field sizes.
Here is my code for drawing an image:
Code:
// Enable Alphablending
OpenGLES.Enable(OpenGLES.GL_BLEND);
OpenGLES.BlendFunc(OpenGLES.GL_SRC_ALPHA, OpenGLES.GL_ONE_MINUS_SRC_ALPHA);
// Reset the world (MODELVIEW);
OpenGLES.MatrixMode(OpenGLES.GL_MODELVIEW);
OpenGLES.LoadIdentity();
OpenGLES.Rotatef(90f, 0f, 0f, 1f);
OpenGLES.Translatef(0f, -480f, 0f);
// Set the Position
OpenGLES.Translatef(bounds.X, bounds.Y, ZIndex);
//Enable texturing and set current texture as the active one
OpenGLES.Enable(OpenGLES.GL_TEXTURE_2D);
OpenGLES.BindTexture(OpenGLES.GL_TEXTURE_2D, texture.Name);
//Aply the Color value to colorizing the active texture
OpenGLES.Color4f(Color.Rf, Color.Gf, Color.Bf, Color.Af);
//Enable the vertices array
OpenGLES.EnableClientState(OpenGLES.GL_VERTEX_ARRAY);
OpenGLES.VertexPointer(3, OpenGLES.GL_SHORT, 0, vertices);
//Enable the texCoords
OpenGLES.EnableClientState(OpenGLES.GL_TEXTURE_COORD_ARRAY);
OpenGLES.TexCoordPointer(2, OpenGLES.GL_FLOAT, 0, texCords);
// Draw the sprite.
OpenGLES.DrawArrays(OpenGLES.GL_TRIANGLES, 0, 6);
// Disable the vertices and the texCoords
OpenGLES.DisableClientState(OpenGLES.GL_VERTEX_ARRAY);
OpenGLES.DisableClientState(OpenGLES.GL_TEXTURE_COORD_ARRAY);
// Diesable texturing
OpenGLES.Disable(OpenGLES.GL_TEXTURE_2D);
OpenGLES.Disable(OpenGLES.GL_BLEND);
The vertex data and texcoords are the following ones:
Code:
static short[] vertices = { 0, 0, 0, 0, 1, 0, 1, 0, 0 ,
1, 1, 0, 0, 1, 0, 1, 0, 0 };
float[] texCoords = { 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0}
This code is executed once per frame and per image I draw... Do I simply miss calling an OpenGl-Method or is there any other fault?
Thanks for your help
Hope the never ending fight against opengl is goning to en...
Does changing short to float of the vertices and VertexPointer crash too?
Hi,
I developped a dictaphone on android that records mp3, ogg, wav files ...
It works on HTC, nexus, ... but I have some problems with Galaxy S compatibility.
I saw that some other developper using AudiRecord faced the same problem too and resolved it, but I found nothing on internet on there solution.
As I can't afford to buy a Galaxy, I ask your help here
Here is a piece of my code :
int bufferSize = AudioRecord.getMinBufferSize(f, c, e);
AudioRecord recordInstance = new AudioRecord(MediaRecorder.AudioSource.MIC, f, c, e, bufferSize);
byte[] tempBuffer = new byte[bufferSize];
recordInstance.startRecording();
while (...)
{ buffer = recordInstance.read(tempBuffer, 0, bufferSize);
}
recordInstance.stop();
recordInstance.release();
I tried all these values :
for f : 8000, 11025, 22050, 44100
for c : AudioFormat.CHANNEL_IN_MONO, AudioFormat.CHANNEL_IN_STEREO
for e : AudioFormat.ENCODING_PCM_16BIT
I ve seen, that getMinBufferSize (on Galaxy) always return 640 and that Stereo isn't used.
I don't know where my code fails. Did someone had the same problem ?
Did you reslve it ?
Thanks in advance,
Dje073.
Since audio recorded with the SGS is just a piece of crap, nobody is going to use it anyway
But of course, if you really want your application to work on the SGS I don't think I have to complain.
Is there a way to fix the audio quality? It is really awful.
You may not be wrong, but as Galaxy users ruins my stats rating my apps 1 star on 5, I have to do something
If not recording in 3gp format, the sound may be correct, no ?
I'd like to provide you an app to demonstrate it, but I don't want to buy a SGS for it ^^
I don't think that will make a difference. As a temporary solution you can edit the description of your app and tell the SGS-owners you are working on a solution. If they still keep ruining your stats they're just assholes
Already done, but not very effective for the moment
I'm sure audio quality is not as bad if you record in raw pcm.
Why Samsung did there own implementation of AudioRecord ? :/
japperrrr said:
I don't think that will make a difference. As a temporary solution you can edit the description of your app and tell the SGS-owners you are working on a solution. If they still keep ruining your stats they're just assholes
Click to expand...
Click to collapse
I don't think this kind of comments will encourage the programmers working for a specific device voluntarily.
I've use TapeMachine on my SGS and the recording quality is excellent. It does ogg,wav but no longer does mp3 due to a licensing issue. I don't understand where this idea comes from that the SGS audio quality is poor. For info, I'm a musician, I use it for recording guitar/voice demos and I find it astoundly good for a phone.
You may want to check out TapeMachine.
dje073 said:
Hi,
I developped a dictaphone on android that records mp3, ogg, wav files ...
It works on HTC, nexus, ... but I have some problems with Galaxy S compatibility.
I saw that some other developper using AudiRecord faced the same problem too and resolved it, but I found nothing on internet on there solution.
As I can't afford to buy a Galaxy, I ask your help here
Here is a piece of my code :
int bufferSize = AudioRecord.getMinBufferSize(f, c, e);
AudioRecord recordInstance = new AudioRecord(MediaRecorder.AudioSource.MIC, f, c, e, bufferSize);
byte[] tempBuffer = new byte[bufferSize];
recordInstance.startRecording();
while (...)
{ buffer = recordInstance.read(tempBuffer, 0, bufferSize);
}
recordInstance.stop();
recordInstance.release();
I tried all these values :
for f : 8000, 11025, 22050, 44100
for c : AudioFormat.CHANNEL_IN_MONO, AudioFormat.CHANNEL_IN_STEREO
for e : AudioFormat.ENCODING_PCM_16BIT
I ve seen, that getMinBufferSize (on Galaxy) always return 640 and that Stereo isn't used.
I don't know where my code fails. Did someone had the same problem ?
Did you reslve it ?
Thanks in advance,
Dje073.
Click to expand...
Click to collapse
Hey Mate, has you released your apps?
Whats the name? I would love to buy one. Mine is Samsung galaxy SPICA
doc_v15 said:
Hey Mate, has you released your apps?
Whats the name? I would love to buy one. Mine is Samsung galaxy SPICA
Click to expand...
Click to collapse
You can find my application on the market making a search on "AudioRecorder"
Well I'm not a developer, but I do have Galaxy S, so if help needed from user side, drop me a pm.
Thank you Soniboy
I tried with some friend, but not very effective without being in debug mode on the device.
More, It seems that this bug does not exist any more on Samsung Galaxy S with Froyo.
Thank you very much for your help
dje073 said:
Hi,
I developped a dictaphone on android that records mp3, ogg, wav files ...
It works on HTC, nexus, ... but I have some problems with Galaxy S compatibility.
I saw that some other developper using AudiRecord faced the same problem too and resolved it, but I found nothing on internet on there solution.
As I can't afford to buy a Galaxy, I ask your help here
Here is a piece of my code :
int bufferSize = AudioRecord.getMinBufferSize(f, c, e);
AudioRecord recordInstance = new AudioRecord(MediaRecorder.AudioSource.MIC, f, c, e, bufferSize);
byte[] tempBuffer = new byte[bufferSize];
recordInstance.startRecording();
while (...)
{ buffer = recordInstance.read(tempBuffer, 0, bufferSize);
}
recordInstance.stop();
recordInstance.release();
I tried all these values :
for f : 8000, 11025, 22050, 44100
for c : AudioFormat.CHANNEL_IN_MONO, AudioFormat.CHANNEL_IN_STEREO
for e : AudioFormat.ENCODING_PCM_16BIT
I ve seen, that getMinBufferSize (on Galaxy) always return 640 and that Stereo isn't used.
I don't know where my code fails. Did someone had the same problem ?
Did you reslve it ?
Thanks in advance,
Dje073.
Click to expand...
Click to collapse
I have same problem. I think it is the problem of read method. If your problem is solved than help me.
Hello, Im starting a new project. The concept is simple.
Send ip packages to wp7, and a background task translate it into keyboards inputs. so it will works like a bluetooth keyboard or something.
I already able to simulate keyboard inputs. but it only works with special keys such back, home, search, volume, play, lock... when i send a `A` key,, it doesnt make any effect.
but my goal is to send char keys inputs.. im trying to somehow enable the "hardware keyboard". like when we press PgUp into the simlator and type text into it.
I calling the WM6 method EnableHardwareKeyboard(TRUE). but it has no effect also.
Im also sending my current project. The vs2008 for the native dll (for sending keys) and the vs2010 for the silverlight app..
Please, anyone can help me this simulated hardware keyboard works?
Thanks
and... for testing purposes.. the 177 is a Volume Key.
Maybe the problem is exist because there are no GWES keyboard driver inside system.
You should try to test it on HTC Gold or on another device with built-in QWERTY keyboard. It may work there . . .
What kind of inputs u tired already?
unfortunately i dont have any device with hardware keyboard.
I just tried keyboards inputs, with sndKbd_event() function.
If you guys have a device with built in hardware keyboard, i would like to send a app to you.. that prints all inputs detected... I want to see if there are any specifc behavior when a user "opens" the hardware keyboard.
why not. upload fully working XAP
Im uploading xap and source for it.
Its log into text box ant key event... So please. open app, and open and close the hardware keyboard. Let us see if something appears in there ! =)
I installed it on Gold. well, UI is not really clear so my observations:
1)when I slide keyboard out it seems no effect on the program.
2)when I press 'a' on the hardware keyboard "65down" and "65up" appear (0x41 is 'a' symbol) as well 'a' appear as text.
3)if I enter at the right edit box "65" and press "Send key" I see 65down and 65up, but no 'a'
the same thing happens to me too. Maybe i should make more research in wm6..
Or maybe try to simulate the inputs via "mouse pointer".. Tring to artificially press the soft keyboard.
For now I don't know how to simulate those keys .... Unfortunately.. I have no clue after all..
Thank you very much cottula. .. This means that the hardware keyboard does not send any key event when opened..
I will try to study a little more the wm6 core.
Best regards.
I've got this somewhat working, just need to figure out all the keycodes
Edit. And hiding the virtual keyboard on device would be nice too
Edit2. So I can send volume keys and such and they work, still have to get qwerty keys working so I don't have it any more working than you guys have...
For some reason.. the qwerty Keys does not works...
All KeyCodes for Windows Mobile are decribed here at this post.
http://msdn.microsoft.com/en-us/library/bb431750.aspx
Note. you must convert the HexaDecimal values in this post to a normal decimal values in order to interact with this app.
My goal here is to simulate a Hardware Keyboard.. that means, hide the softKeyboard too...
artsjedi said:
For some reason.. the qwerty Keys does not works...
All KeyCodes for Windows Mobile are decribed here at this post.
http://msdn.microsoft.com/en-us/library/bb431750.aspx
Note. you must convert the HexaDecimal values in this post to a normal decimal values in order to interact with this app.
My goal here is to simulate a Hardware Keyboard.. that means, hide the softKeyboard too...
Click to expand...
Click to collapse
Yeah, I made a new app myself, completely in C# that runs in the background and hosts a server and I sent the keycodes from my laptop via wlan. I could use volume keys, also delete key worked and enter key worked too. Tried those in word. Figured out the key code of the back button too. So, no idea why qwerty keys won't work. Maybe we need to get the phone think that it has a external keyboard (like pageup does in the emulator)? Could cotulla get a registry dump with hardware keyboard open and closed and compare them?
We tryed using this with a phone with hardware keyboard. And this is the result.
1)when I slide keyboard out it seems no effect on the program.
2)when I press 'a' on the hardware keyboard "65down" and "65up" appear (0x41 is 'a' symbol) as well 'a' appear as text.
3)if I enter at the right edit box "65" and press "Send key" I see 65down and 65up, but no 'a'
Click to expand...
Click to collapse
It seems that the presence of hardware keyboard has no effect after all on app behavior. there must be another configurarion that send the correct key to the form, but i didnt know it yet.
I made a litte research on WM6.5 and there is another C++ native method to send Keys, maybe i will try them soon..
Plase. can you send me you app that already runs with background task??
Thank you !
artsjedi said:
We tryed using this with a phone with hardware keyboard. And this is the result.
It seems that the presence of hardware keyboard has no effect after all on app behavior. there must be another configurarion that send the correct key to the form, but i didnt know it yet.
I made a litte research on WM6.5 and there is another C++ native method to send Keys, maybe i will try them soon..
Plase. can you send me you app that already runs with background task??
Thank you !
Click to expand...
Click to collapse
I'll put it on github so everyone can help us figuring this out. It's pretty basic, done in Visual Studio 2008.
Ok, so the solution will be here: https://github.com/jessenic/RemoteKeyboardWP7 as soon as I've got Git extensions installed on my laptop. You can fork that and submit pull requests. I could also add you to the admins of the project if you want. I started working on toast notifications, but they need an int32 appid and I haven't figured one out yet.
Edit. Committed. Maybe the keyboard ID is wrong? WinCE7's keybd_eventEx's last argument is the keyboard ID.
Is the time between the sending and the receiving of the enter, or del key, big? Or is it quick?
Sent from my LG-E900 using Board Express
davide136 said:
Is the time between the sending and the receiving of the enter, or del key, big? Or is it quick?
Sent from my LG-E900 using Board Express
Click to expand...
Click to collapse
Instant (at least on n-series wlan)
jessenic said:
I'll put it on github so everyone can help us figuring this out. It's pretty basic, done in Visual Studio 2008.
Maybe the keyboard ID is wrong? WinCE7's keybd_eventEx's last argument is the keyboard ID.
Click to expand...
Click to collapse
I 've tried all IDs from -1000 to 1000.. .. without sucess...
I have no ideas left...
Code:
#define KeyStateDownFlag 0x0080
#define HWND_GLOBAL (HWND)0xFFFFFFFF
void EmulateKey(BYTE bKeyCode, BOOL up)
{
keybd_event(bKeyCode, 0, KEYEVENTF_SILENT | (up ? KEYEVENTF_KEYUP : 0), 0);
}
void EmulateWchar(wchar_t wSymbol, BOOL up)
{
UINT uKeyFlags = up ? 0 : KeyStateDownFlag;
UINT uKeyCode = (UINT)wSymbol;
PostKeybdMessage(HWND_GLOBAL, 0, uKeyFlags, 1, &uKeyFlags, &uKeyCode);
}
// example
int _tmain(int argc, _TCHAR* argv[])
{
EmulateWchar(L'T', FALSE);
EmulateWchar(L'T', TRUE);
...
}
ultrashot said:
Code:
#define KeyStateDownFlag 0x0080
#define HWND_GLOBAL (HWND)0xFFFFFFFF
void EmulateKey(BYTE bKeyCode, BOOL up)
{
keybd_event(bKeyCode, 0, KEYEVENTF_SILENT | (up ? KEYEVENTF_KEYUP : 0), 0);
}
void EmulateWchar(wchar_t wSymbol, BOOL up)
{
UINT uKeyFlags = up ? 0 : KeyStateDownFlag;
UINT uKeyCode = (UINT)wSymbol;
PostKeybdMessage(HWND_GLOBAL, 0, uKeyFlags, 1, &uKeyFlags, &uKeyCode);
}
// example
int _tmain(int argc, _TCHAR* argv[])
{
EmulateWchar(L'T', FALSE);
EmulateWchar(L'T', TRUE);
...
}
Click to expand...
Click to collapse
Thanks, but still can't get it working Could you have a look at it here: https://github.com/jessenic/RemoteKeyboardWP7/blob/master/RemoteKeyboard/Program.cs
the SendKeyboardKey(byte) works fine, but the SendKeyboardString(string) does not
Btw, have you noticed what code 122 does to the virtual keyboard! (Symbol (SYM) key.)
Edit: I get Invalid pointer error message from PostKeybdMessage :/
Works perfectly ! Thanks !!!
jessenic .. i cannot open your server project.. What i should do ?
I have vs 2008 but i cannot open this... And it doesnt seems to be any wp7 app... what it is exataly?