ech0s
30-04-2008, 20:12
Ho una maledetta eccezione che mi tira questo codice, ma non riesco gestirla.
Ho provato a riscriverlo miliardi di volte:
Thread transmit = new Thread() {
public void run() {
try {
rc1 = Manager.createPlayer("capture://audio?rate=8000&bits=16");
rc1.realize();
rc1.prefetch();
control1 = (RecordControl) rc1.getControl("RecordControl");
control1.setRecordStream(aout1);
control1.setRecordSizeLimit(512);
rc2 = Manager.createPlayer("capture://audio?rate=8000&bits=16");
rc2.realize();
rc2.prefetch();
control2 = (RecordControl) rc2.getControl("RecordControl");
control2.setRecordStream(aout2);
control2.setRecordSizeLimit(512);
} catch (IOException ioe) {
try {
discardResources();
} catch (IOException e) {
midlet.displayAlert("Errore rilascio risorse"
+ e.getMessage());
}
midlet.displayAlert("Eccezione IO" + ioe.getMessage());
} catch (MediaException me) {
try {
discardResources();
} catch (IOException e) {
midlet.displayAlert("Errore rilascio risorse"
+ e.getMessage());
}
midlet.displayAlert("Eccezione Media" + me.getMessage());
}
while (!stopCall) {
try {
rc1.start();
control1.startRecord();
Thread.sleep(500);
control1.stopRecord();
control1.commit();
out.write(aout1.toByteArray());
out.flush();
rc2.start();
control2.startRecord();
Thread.sleep(500);
control2.stopRecord();
control2.commit();
out.write(aout2.toByteArray());
out.flush();
} catch (Exception e) {
midlet.displayAlert("Errore registrazione");
}
}
}
};
Quando avvio il thread mi dà errore. Potete aiutarmi? :help:
Grazie in anticipo!
Ho provato a riscriverlo miliardi di volte:
Thread transmit = new Thread() {
public void run() {
try {
rc1 = Manager.createPlayer("capture://audio?rate=8000&bits=16");
rc1.realize();
rc1.prefetch();
control1 = (RecordControl) rc1.getControl("RecordControl");
control1.setRecordStream(aout1);
control1.setRecordSizeLimit(512);
rc2 = Manager.createPlayer("capture://audio?rate=8000&bits=16");
rc2.realize();
rc2.prefetch();
control2 = (RecordControl) rc2.getControl("RecordControl");
control2.setRecordStream(aout2);
control2.setRecordSizeLimit(512);
} catch (IOException ioe) {
try {
discardResources();
} catch (IOException e) {
midlet.displayAlert("Errore rilascio risorse"
+ e.getMessage());
}
midlet.displayAlert("Eccezione IO" + ioe.getMessage());
} catch (MediaException me) {
try {
discardResources();
} catch (IOException e) {
midlet.displayAlert("Errore rilascio risorse"
+ e.getMessage());
}
midlet.displayAlert("Eccezione Media" + me.getMessage());
}
while (!stopCall) {
try {
rc1.start();
control1.startRecord();
Thread.sleep(500);
control1.stopRecord();
control1.commit();
out.write(aout1.toByteArray());
out.flush();
rc2.start();
control2.startRecord();
Thread.sleep(500);
control2.stopRecord();
control2.commit();
out.write(aout2.toByteArray());
out.flush();
} catch (Exception e) {
midlet.displayAlert("Errore registrazione");
}
}
}
};
Quando avvio il thread mi dà errore. Potete aiutarmi? :help:
Grazie in anticipo!