Pouvez-vous s'il vous plaît, expliquez-moi (en mots) ce que fait ce code? mercicode de forme d'onde .. ..J'ai besoin d'aide ... s'il vous plaît
Mes préoccupations sont en fait ces deux parties: 1)
double y_new = (double) (h * (128 - my_byte)/256);
lines.add(new Line2D.Double(x, y_last, x, y_new));
y_last = y_new;
2) la boucle, je dont'understand ... c'est 32768? my_byte?
int numChannels = format.getChannels();
for (double x = 0; x < w && audioData != null; x++) {
int idx = (int) (frames_per_pixel * numChannels * x);
// se a 8 bit è immediato
if (format.getSampleSizeInBits() == 8) {
my_byte = (byte) audioData[idx];
} else {
my_byte = (byte) (128 * audioData[idx]/32768);
Voici le code. Elle a été prise à partir d'ici: http://www.koders.com/java/fid3508156A13C80A263E7CE65C4C9D6F5D8651AF5D.aspx?s=%22David+Anderson%22 (classe d'échantillonnage Graphique)
int frames_per_pixel = audioBytes.size()/format.getFrameSize()/w;
byte my_byte = 0;
double y_last = 0;
int numChannels = format.getChannels();
for (double x = 0; x < w && audioData != null; x++) {
// scegli quale byte visualizzare
int idx = (int) (frames_per_pixel * numChannels * x);
// se a 8 bit è immediato
if (format.getSampleSizeInBits() == 8) {
my_byte = (byte) audioData[idx];
} else {
my_byte = (byte) (128 * audioData[idx]/32768);
}
double y_new = (double) (h * (128 - my_byte)/256);
lines.add(new Line2D.Double(x, y_last, x, y_new));
y_last = y_new;
}
repaint();
Pourriez-vous s'il vous plaît modifier le titre de votre question dans un sens plus significatif? Merci. –
http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=32768+in+hex – TJB