Reputation: 4968
I have a java project which is been created in netbeans, now i am trying to change it to be an android project in eclipse but it shows lots of errors. Can an one pls help me in debing the errors
public abstract class BaseOutputAudioDevice extends AudioDeviceBase {
private Logger log = Logger.getLogger(BaseOutputAudioDevice.class.getName());
protected int position = 0;
protected int freq;
protected int channels;
protected int samplesPerMillisecond;
protected boolean init = false;
protected SampleProcessor processor;
public BaseOutputAudioDevice(SampleProcessor processor) {
this.processor = processor;
}
@Override
protected void openImpl() throws JavaLayerException {
super.openImpl();
}
@Override
protected void writeImpl(short[] samples, int offs, int len) throws JavaLayerException {
if(!init)
{
log.log(Level.INFO, "number of channels: " + getDecoder().getOutputChannels());
log.log(Level.INFO, "number of samples: " + getDecoder().getOutputFrequency());
freq = getDecoder().getOutputFrequency();
channels = getDecoder().getOutputChannels();
samplesPerMillisecond = (freq * channels)/1000;
log.log(Level.INFO, "samples/ms: " + samplesPerMillisecond);
log.log(Level.INFO, "buffer length: " + len);
if(processor != null)
processor.init(freq, channels);
init = true;
}
position += len/samplesPerMillisecond;
outputImpl(samples, offs, len);
}
protected abstract void outputImpl(short[] samples, int offs, int len) throws JavaLayerException;
/**
* Retrieves the current playback position in milliseconds.
*/
public int getPosition() {
log.log(Level.FINE, "position: " + position + "ms");
return position;
}
public SampleProcessor getProcessor() {
return processor;
}
public void setProcessor(SampleProcessor processor) {
this.processor = processor;
}
}
Edit
It shows errors in following lines
log.log(Level.INFO, "number of channels: " + getDecoder().getOutputChannels());
log.log(Level.INFO, "number of samples: " + getDecoder().getOutputFrequency());
freq = getDecoder().getOutputFrequency();
channels = getDecoder().getOutputChannels();
Upvotes: 0
Views: 115
Reputation: 2758
You're trying to work with libraries that do not exist on Android. For example, your log.log lines look suspiciously like a Log4J call. You need to isolate these lines and work with their Android equivalent. In the Log4J example - try working with the Android logger instead.
Upvotes: 3