Win a copy of Rust Web Development this week in the Other Languages forum!

Ayden Kim

Greenhorn
+ Follow
since Feb 10, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ayden Kim

I'm porting Java project to Android.

As you know, the Android does not have javax.sound package.

I need to calculate frameLength.

My sound file size is 283KB. And frame size is 4 and frame rate is 44100 and sample size in bits is 16.

The frame length was 69632 when I used just pure Java.

Do you know any equation to get this?

Thank you.
10 years ago
Hi. I'm trying to porting a java project to Android.

But I found that Android does not support javax.sound.

Does anyone know the way to use AudioInputStream in Android?

Thank you.

-- Java code --
private AudioInputStream audioInputStream; -- Android does not have AudioInputStream class
private int[][] samplesContainer;
private AudioFormat audioFormat; -- Android has AudioFormat class, but I don't know it is exactly same as Java

//cached values
protected int sampleMax = 0;
protected int sampleMin = 0;
protected double biggestSample;

public AudioInfo(AudioInputStream aiStream) {
this.audioInputStream = aiStream;
this.audioFormat = audioInputStream.getFormat();
createSampleArrayCollection();
}
10 years ago
Thank you for your reply.

I'm sorry but can you give me an example how to use beforeExecute() or afterExecute()??

The ArrayList<ActionListener> actions is come from another java file.

Could you give me an more concerete example???

res.addActionListener(al);

Using this method in ScheduledExecutorService class is key fact.

I'm really appreciate your reply.

Thanks.

Hi all. I'm trying to change my code(Timer class -> ScheduledExecutorService class) because of performance issue.

I used Timer class like this.

private Timer makeTimer(int initialDelay, ArrayList<ActionListener> actions) {
.................
.................
final Timer res = new Timer(initialDelay, temp);
if (actions!=null) {
for (ActionListener al : actions)
res.addActionListener(al);
}


But, as you know, there is no addActionListener method in ScheduledExecutorService.

It just use runnable class.

Is there any way to add actionListener to ScheduledExecutorService?