Ignore:
Timestamp:
2008-02-23T23:12:18+01:00 (17 years ago)
Author:
david
Message:

fix problem where it wasn't jumping as far ahead in the audio as I had thought; and adjust buffer size to match common frequency

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java

    r553 r556  
    3535        private double position; // seconds
    3636        private double bytesPerSecond;
     37        private static long chunk = 8000; /* bytes */
    3738
    3839        /**
     
    192193                SourceDataLine audioOutputLine = null;
    193194                AudioFormat     audioFormat = null;
    194                 byte[] abData = new byte[8192];
     195                byte[] abData = new byte[(int)chunk];
    195196               
    196197                for (;;) {
     
    257258                                                                 */
    258259                                                                // audioInputStream.skip(bytesToSkip);
    259                                                                 int skipsize = 8192;
    260                                                                 while (bytesToSkip > skipsize) {
    261                                                                         audioInputStream.skip(skipsize);
    262                                                                         bytesToSkip -= skipsize;
     260                                                                while (bytesToSkip > chunk) {
     261                                                                        bytesToSkip -= audioInputStream.skip(chunk);
    263262                                                                }
    264                                                                 audioInputStream.skip(bytesToSkip);
     263                                                                if (bytesToSkip > 0)
     264                                                                        audioInputStream.skip(bytesToSkip);
    265265                                                                position = adjustedOffset;
    266266                                                        }
Note: See TracChangeset for help on using the changeset viewer.