I looked all over the net and I couldn't find something that works.
First there is this:
Code:
File wave1 = new File(wavFile1);
if(!wave1.exists())
throw new Exception(wave1.getPath() + " - File Not Found");
AudioInputStream clip1 = AudioSystem.getAudioInputStream(wave1);
AudioInputStream clip2 = AudioSystem.getAudioInputStream(new File(wavFile2));
AudioInputStream emptyClip =
AudioSystem.getAudioInputStream(new File(emptyWavPath));
AudioInputStream appendedFiles =
new AudioInputStream(
new SequenceInputStream(clip1, emptyClip),
clip1.getFormat(),
clip1.getFrameLength() + 100
);
clip1 = appendedFiles;
appendedFiles =
new AudioInputStream(
new SequenceInputStream(clip1, clip2),
clip1.getFormat(),
clip1.getFrameLength() + clip2.getFrameLength()
);
but android dosen't support java.sound.sampled
there is also this:
Code:
private void merge2WavFiles(String wavFile1, String wavFile2, String newWavFilePath) {
long RECORDER_SAMPLERATE = 44100;
long RECORDER_BPP = 16;
FileInputStream in1 = null, in2 = null;
FileOutputStream out = null;
long totalAudioLen = 0;
long totalDataLen = totalAudioLen + 36;
long longSampleRate = RECORDER_SAMPLERATE;
int channels = 2;
long byteRate = RECORDER_BPP * RECORDER_SAMPLERATE * channels / 8;
byte[] data = new byte[100];
try {
in1 = new FileInputStream(wavFile1);
in2 = new FileInputStream(wavFile2);
out = new FileOutputStream(newWavFilePath);
totalAudioLen = in1.getChannel().size() + in2.getChannel().size();
totalDataLen = totalAudioLen + 36;
WriteWaveFileHeader(out, totalAudioLen, totalDataLen, longSampleRate, channels, byteRate);
while (in1.read(data) != -1) {
out.write(data);
}
while (in2.read(data) != -1) {
out.write(data);
}
out.close();
in1.close();
in2.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
private void WriteWaveFileHeader(FileOutputStream out, long totalAudioLen,
long totalDataLen, long longSampleRate, int channels, long byteRate)
throws IOException {
byte[] header = new byte[44];
header[0] = 'R';
header[1] = 'I';
header[2] = 'F';
header[3] = 'F';
header[4] = (byte)(totalDataLen & 0xff);
header[5] = (byte)((totalDataLen >> 8) & 0xff);
header[6] = (byte)((totalDataLen >> 16) & 0xff);
header[7] = (byte)((totalDataLen >> 24) & 0xff);
header[8] = 'W';
header[9] = 'A';
header[10] = 'V';
header[11] = 'E';
header[12] = 'f';
header[13] = 'm';
header[14] = 't';
header[15] = ' ';
header[16] = 16;
header[17] = 0;
header[18] = 0;
header[19] = 0;
header[20] = 1;
header[21] = 0;
header[22] = (byte) channels;
header[23] = 0;
header[24] = (byte)(longSampleRate & 0xff);
header[25] = (byte)((longSampleRate >> 8) & 0xff);
header[26] = (byte)((longSampleRate >> 16) & 0xff);
header[27] = (byte)((longSampleRate >> 24) & 0xff);
header[28] = (byte)(byteRate & 0xff);
header[29] = (byte)((byteRate >> 8) & 0xff);
header[30] = (byte)((byteRate >> 16) & 0xff);
header[31] = (byte)((byteRate >> 24) & 0xff);
header[32] = (byte)(2 * 16 / 8);
header[33] = 0;
header[34] = 16;
header[35] = 0;
header[36] = 'd';
header[37] = 'a';
header[38] = 't';
header[39] = 'a';
header[40] = (byte)(totalAudioLen & 0xff);
header[41] = (byte)((totalAudioLen >> 8) & 0xff);
header[42] = (byte)((totalAudioLen >> 16) & 0xff);
header[43] = (byte)((totalAudioLen >> 24) & 0xff);
out.write(header, 0, 44);
}
but is also dosen't work.
In all cases the result sound file is empty without sound.
How can I merge two *.wav files?
I m also searching for months like MP3 EDITOR LIKE software..which can combine two or more sound file and make one..
But all apps i found is just mp3 cutter..
There is one app in symbian os my friend have in his c6
Which do editing i forgot the name but for sure in android i have not found one since six months
we all should be polite enough to press thanks for anyone who helped US.
Related
Is it possible to customize the XDA's today screen (i.e. by using XML) as you can do with the Orange's SPV ?
Download Microsoft's Theme Generator...
http://www.microsoft.com/mobile/pocketpc/downloads/powertoys.asp
There are some other goodies on that page aswell.
Good luck!
Powertoy is not what I am looking for: the idea is not only changing the background image but to organize all the datas on the screen as and where you wish (date, time, numbers of emails received, fonts, etc.) as you can do on smarphone 2002 changing the today screen's script in XML.
For examples what you can do with Smartphone 2002:
http://www.smartphony.org/stories.php?topic=32
It's a bit more complicated with PPC 2002. Unlike smartphone, it is an API to change the contents of 'Today'. Each line is loaded as a type of 'snap in' dll.
Do you I could find some examples of that kind of work ?
It is really a pain in the ass
But this works fine... 8)
#include "stdafx.h"
#include <todaycmn.h>
#define IDI_ICON1 101
HINSTANCE Instance;
BOOL Refresh;
HICON hIcon;
LRESULT CALLBACK WindowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
{
PAINTSTRUCT ps;
RECT rect;
switch (msg) {
case WM_TODAYCUSTOM_CLEARCACHE:
break;
case WM_TODAYCUSTOM_QUERYREFRESHCACHE:
if (Refresh) {
Refresh = FALSE;
((TODAYLISTITEM *)(wparam))->cyp = 20;
return TRUE;
} else {
return FALSE;
}
case WM_ERASEBKGND:
{
TODAYDRAWWATERMARKINFO dwi;
dwi.hwnd = hwnd;
dwi.hdc = (HDC)wparam;
GetClientRect(hwnd, &(dwi.rc));
SendMessage(GetParent(hwnd), TODAYM_DRAWWATERMARK, 0, (LPARAM)&dwi);
return 1;
}
case WM_PAINT:
BeginPaint(hwnd, &ps);
GetWindowRect(hwnd, &rect);
SetBkMode(ps.hdc, TRANSPARENT);
hIcon = (HICON)LoadImage(Instance,MAKEINTRESOURCE(IDI_ICON1),IMAGE_ICON,16,16,LR_DEFAULTCOLOR );
DrawIcon(ps.hdc, 2, 0, hIcon);
DestroyIcon(hIcon);
LOGFONT lf;
HFONT hSysFont;
HFONT hFont, hFontOld;
hSysFont = (HFONT) GetStockObject(SYSTEM_FONT);
GetObject(hSysFont, sizeof(LOGFONT), &lf);
lf.lfWeight = FW_BOLD;
lf.lfHeight = (long) -((8.0 * (double)GetDeviceCaps(ps.hdc, LOGPIXELSY) / 72.0)+.5);
hFont = CreateFontIndirect(&lf);
hFontOld = (HFONT) SelectObject(ps.hdc, hFont);
SetTextColor(ps.hdc, SendMessage(GetParent(hwnd), TODAYM_GETCOLOR, (WPARAM)TODAYCOLOR_TEXT, NULL));
GetClientRect(hwnd, &rect);
DrawText(ps.hdc, TEXT("Text you want to enter"), -1, &rect, DT_LEFT | DT_TOP | DT_NOCLIP);
SelectObject(ps.hdc, hFontOld);
DeleteObject(hFont);
EndPaint(hwnd, &ps);
break;
case WM_LBUTTONUP:
// Whatever you want to occur when the button is pressed //
CreateProcess(TEXT("iexplore.exe"), NULL, NULL, NULL, FALSE, 0, NULL, NULL, NULL, NULL);
break;
default:
return DefWindowProc(hwnd, msg, wparam, lparam);
}
return 0;
}
HWND APIENTRY InitializeCustomItem(TODAYLISTITEM *tli, HWND parent)
{
if (!tli->fEnabled) {
return NULL;
}
Instance = tli->hinstDLL;
WNDCLASS wc;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = Instance;
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH)COLOR_BACKGROUND + 1;
wc.lpszMenuName = NULL;
wc.lpszClassName = TEXT("RegisterClassName");
UnregisterClass(TEXT("RegisterClassName"), Instance);
RegisterClass(&wc);
Refresh = TRUE;
return CreateWindow(TEXT("RegisterClassName"), TEXT("RegisterClassName"), WS_VISIBLE | WS_CHILD, CW_DEFAULT, CW_DEFAULT, 0, 0, parent, NULL, Instance, NULL);
}
Thank's !
Is there somewhere a technical documentation about that ?
Not sure why it crash while looping the array:
Code:
final String tname[] = getResources().getStringArray(R.array.tname);
final int tid[] = getResources().getIntArray(R.array.tid);
final int tlv[] = getResources().getIntArray(R.array.tlv);
int tlength = tname.length;
String pname[] = new String[tlength];
int pid[] = new int[tlength];
for(int i = 0; i < tlength; i++) {
if(tlv[i] <= 0) {
pname[i] = tname[i];
pid[i] = tid[i];
}
}
setListAdapter(new ArrayAdapter<String>(this, R.layout.pMenu, pname));
Thanks in advance!
My question is very simple and hopefully the great teachers in this forum can answer.
how to go and change the file in system / build.prop without activating usb debuging?
how to restore all my apps in / system / which have been erased without activating usb debuging?
<< ycusoy | http://admin-belajar.blogspot.com >>
Bonus: text mouse rotate
Code:
<style type="text/css">
/* Circle Text Styles */
#outerCircleText {
/* Optional - DO NOT SET FONT-SIZE HERE, SET IT IN THE SCRIPT */
font-style: italic;font-weight: bold;font-family: 'comic sans ms', verdana, arial;color: #000;
/* End Optional *//* Start Required - Do Not Edit*/
position: absolute;top: 0;left: 0;z-index: 3000;cursor: default;}#outerCircleText div {position: relative;}#outerCircleText div div {position: absolute;top: 0;left: 0;text-align: center;}
/* End Required *//* End Circle Text Styles */
</style>
<script type="text/javascript">
;(function(){ // Your message here (QUOTED STRING)
var msg = "http://forum.xda-developers.com/editpost.php?do=editpost&postid=26043694";
/* THE REST OF THE EDITABLE VALUES BELOW ARE ALL UNQUOTED NUMBERS */// Set font's style size for calculating dimensions// Set to number of desired pixels font size (decimal and negative numbers not allowed)
var size = 14;
// Set both to 1 for plain circle, set one of them to 2 for oval// Other numbers & decimals canhave interesting effects, keep these low (0 to 3)
var circleY = 0.75; var circleX = 2;
// The larger this divisor, the smaller the spaces between letters// (decimals allowed, not negative numbers)
var letter_spacing = 5;
// The larger this multiplier, the bigger the circle/oval// (decimals allowed, not negative numbers, some rounding is applied)
var diameter = 10; // Rotation speed, set it negative if you want it to spin clockwise (decimals allowed)
var rotation = 0.4; // This is not the rotation speed,its the reaction speed, keep low!// Set this to 1 or a decimal less than one (decimals allowed, not negative numbers)
var speed = 0.3;
////////////////////// Stop Editing //////////////////////
if (!window.addEventListener &&!window.attachEvent ||!document.createElement) return;msg = msg.split('');var n = msg.length - 1, a = Math.round(size * diameter * 0.208333), currStep = 20,ymouse = a * circleY + 20, xmouse = a * circleX + 20, y = [], x = [], Y = [], X = [],o = document.createElement('div'), oi= document.createElement('div'),b = document.compatMode && document.compatMode !="BackCompat"? document.documentElement : document.body,mouse = function(e){e = e || window.event;ymouse = !isNaN(e.pageY)? e.pageY : e.clientY;
//
y-positionxmouse = !isNaN(e.pageX)? e.pageX : e.clientX;
//
x-position},makecircle = function(){
// rotation/positioning
if(init.nopy){ o.style.top = (b || document.body).scrollTop + 'px'; o.style.left = (b || document.body).scrollLeft + 'px';};currStep -= rotation;for (var d, i = n; i > -1; --i){
// makes the circle
d = document.getElementById('iemsg'+ i).style; d.top = Math.round(y[i] + a * Math.sin((currStep + i) / letter_spacing) * circleY - 15) + 'px'; d.left = Math.round(x[i] + a * Math.cos((currStep + i) / letter_spacing) * circleX) + 'px';};},drag = function(){
// makes the resistancey
[0] = Y[0] += (ymouse - Y[0]) * speed;x[0] = X[0] += (xmouse - 20 - X[0]) * speed;for (var i = n; i > 0; --i){ y[i] = Y[i] += (y[i-1] - Y[i]) * speed; x[i] = X[i] += (x[i-1] - X[i]) * speed;};makecircle();},init = function(){
// appends message divs, & sets initial values for positioning arrays
if(!isNaN(window.pageYOffset)){ ymouse += window.pageYOffset; xmouse += window.pageXOffset;} else init.nopy = true;for (var d, i = n; i > -1; --i){ d = document.createElement('div'); d.id = 'iemsg' + i; d.style.height = d.style.width = a+ 'px'; d.appendChild(document.createTextNode(msg[i])); oi.appendChild(d); y[i] = x[i] = Y[i]= X[i] = 0;};o.appendChild(oi); document.body.appendChild(o);setInterval(drag, 25);},ascroll = function(){ymouse += window.pageYOffset;xmouse += window.pageXOffset;window.removeEventListener('scroll', ascroll, false);};o.id = 'outerCircleText'; o.style.fontSize = size + 'px';if (window.addEventListener){window.addEventListener('load', init, false);document.addEventListener('mouseover', mouse, false);document.addEventListener('mousemove', mouse, false); if (/Apple/.test(navigator.vendor)) window.addEventListener('scroll', ascroll, false);}else if (window.attachEvent){window.attachEvent('onload', init);document.attachEvent('onmousemove', mouse);};})();</script>
paste before closing tag </head>
Trying to build a kernel from source for ZTE Vec 4G(msm8226 with 4G), but I'm getting an error I don't know how to fix.
I've already fixed some, as I have quiet a bit of C/C++ knowledge, but not this one:
Code:
CC drivers/media/platform/msm/vidc/msm_venc.o
drivers/media/platform/msm/vidc/msm_venc.c: In function 'try_set_ctrl':
drivers/media/platform/msm/vidc/msm_venc.c:1331: error: unknown field 'val' specified in initializer
drivers/media/platform/msm/vidc/msm_venc.c:1405: error: unknown field 'val' specified in initializer
Case that contains the first error line:
Code:
case V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES:
{
int num_p, num_b;
[COLOR="Red"]struct v4l2_ctrl update_ctrl = {.id = 0, .val = 0};[/COLOR]
if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_I_PERIOD &&
inst->fmts[CAPTURE_PORT]->fourcc != V4L2_PIX_FMT_H264 &&
inst->fmts[CAPTURE_PORT]->fourcc !=
V4L2_PIX_FMT_H264_NO_SC) {
dprintk(VIDC_ERR, "Control 0x%x only valid for H264",
ctrl->id);
rc = -ENOTSUPP;
break;
}
temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES);
num_b = temp_ctrl->val;
temp_ctrl = TRY_GET_CTRL(V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES);
num_p = temp_ctrl->val;
/* V4L2_CID_MPEG_VIDEO_H264_I_PERIOD and _NUM_P_FRAMES are
* implicitly tied to each other. If either is adjusted,
* the other needs to be adjusted in a complementary manner.
* Ideally we adjust _NUM_B_FRAMES as well but we'll leave it
* alone for now */
if (ctrl->id == V4L2_CID_MPEG_VIDEO_H264_I_PERIOD) {
num_p = ctrl->val - 1 - num_b;
update_ctrl.id = V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES;
update_ctrl.val = num_p;
} else if (ctrl->id == V4L2_CID_MPEG_VIDC_VIDEO_NUM_P_FRAMES) {
num_p = ctrl->val;
update_ctrl.id = V4L2_CID_MPEG_VIDEO_H264_I_PERIOD;
update_ctrl.val = num_p + num_b;
} else if (ctrl->id == V4L2_CID_MPEG_VIDC_VIDEO_NUM_B_FRAMES) {
num_b = ctrl->val;
update_ctrl.id = V4L2_CID_MPEG_VIDEO_H264_I_PERIOD;
update_ctrl.val = num_p + num_b;
}
if (update_ctrl.id) {
temp_ctrl = TRY_GET_CTRL(update_ctrl.id);
temp_ctrl->val = update_ctrl.val;
}
if (num_b) {
u32 max_num_b_frames = MAX_NUM_B_FRAMES;
property_id = HAL_PARAM_VENC_MAX_NUM_B_FRAMES;
pdata = &max_num_b_frames;
rc = call_hfi_op(hdev, session_set_property,
(void *)inst->session, property_id, pdata);
if (rc) {
dprintk(VIDC_ERR,
"Failed : Setprop MAX_NUM_B_FRAMES %d",
rc);
break;
}
}
property_id = HAL_CONFIG_VENC_INTRA_PERIOD;
intra_period.pframes = num_p;
intra_period.bframes = num_b;
pdata = &intra_period;
break;
}
Code:
case V4L2_CID_MPEG_VIDEO_BITRATE_MODE:
{
int final_mode = 0;
[COLOR="Red"]struct v4l2_ctrl update_ctrl = {.id = 0, .val = 0};[/COLOR]
/* V4L2_CID_MPEG_VIDEO_BITRATE_MODE and _RATE_CONTROL
* manipulate the same thing. If one control's state
* changes, try to mirror the state in the other control's
* value */
if (ctrl->id == V4L2_CID_MPEG_VIDEO_BITRATE_MODE) {
if (ctrl->val == V4L2_MPEG_VIDEO_BITRATE_MODE_VBR) {
final_mode = HAL_RATE_CONTROL_VBR_CFR;
update_ctrl.val =
V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_CFR;
} else {/* ...if (ctrl->val == _BITRATE_MODE_CBR) */
final_mode = HAL_RATE_CONTROL_CBR_CFR;
update_ctrl.val =
V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_CFR;
}
update_ctrl.id = V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL;
} else if (ctrl->id == V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL) {
switch (ctrl->val) {
case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_OFF:
case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_VFR:
case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_VBR_CFR:
update_ctrl.val =
V4L2_MPEG_VIDEO_BITRATE_MODE_VBR;
case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_VFR:
case V4L2_CID_MPEG_VIDC_VIDEO_RATE_CONTROL_CBR_CFR:
update_ctrl.val =
V4L2_MPEG_VIDEO_BITRATE_MODE_CBR;
}
final_mode = ctrl->val;
update_ctrl.id = V4L2_CID_MPEG_VIDEO_BITRATE_MODE;
}
if (update_ctrl.id) {
temp_ctrl = TRY_GET_CTRL(update_ctrl.id);
temp_ctrl->val = update_ctrl.val;
}
property_id = HAL_PARAM_VENC_RATE_CONTROL;
property_val = final_mode;
pdata = &property_val;
break;
}
Function calls:
Code:
for (c = 0; c < ctrl->ncontrols; ++c) {
if (ctrl->cluster[c]->is_new) {
struct v4l2_ctrl *temp = ctrl->cluster[c];
[COLOR="Red"]rc = try_set_ctrl(inst, temp);[/COLOR]
if (rc) {
dprintk(VIDC_ERR, "Failed setting %s (%x)",
v4l2_ctrl_get_name(temp->id),
temp->id);
break;
}
}
}
Whole file attached.
From the error, I can tell that .val isn't declared, or something similar, but I need help from an expert to fix it.
Faced with same problem for Alcatel OT Fire E 6015X. My solution:
- Install Android NDK (ArchLinux):
Code:
pacman -S android-ndk
- Add path:
Code:
export PATH=/opt/android-ndk/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin:${PATH}
- Run build:
Code:
make CROSS_COMPILE=arm-linux-androideabi- ARCH=arm zImage
need to replace every .val for .cur.val, the problem is that the val variable is declared within a union named cur inside the v4l2_ctrl structure. So in order for the Compiler to recognize it should be addressed thru the union var
This is code for encryption of video
FileInputStream fis = new FileInputStream(extStore+"/digilearn/try.mp4");
FileOutputStream fos = new FileOutputStream(extStore+"/digilearn/enctry.mp4");
SecretKeySpec sks = new SecretKeySpec("MyDifficultPassw".getBytes(),
"AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, sks);
CipherOutputStream cos = new CipherOutputStream(fos, cipher);
int b;
byte[] d = new byte[8192];
while ((b = fis.read(d)) != -1) {
cos.write(d, 0, b);
}
// Flush and close streams.
cos.flush();
cos.close();
fis.close();
This is the code for decryption of video
File extStore = Environment.getExternalStorageDirectory();
FileInputStream fis = new FileInputStream(extStore+"/digilearn/enctry.mp4");
FileOutputStream fos = new FileOutputStream(extStore+"/digilearn/dectry.mp4");
SecretKeySpec sks = new SecretKeySpec("MyDifficultPassw".getBytes(),
"AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, sks);
CipherInputStream cis = new CipherInputStream(fis, cipher);
int b;
byte[] d = new byte[2*8192];
while ((b = cis.read(d)) != -1) {
fos.write(d, 0, b);
}
fos.flush();
fos.close();
cis.close();
with above code encryption and decryption both works but it take too much time when encrypted video file from sd card with video size is 1 GB.