Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added buffering to temp file writing.
  • Loading branch information
finnkuusisto committed Aug 13, 2012
1 parent 5122fac commit fb8330b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/kuusisto/tinysound/TinySound.java
Expand Up @@ -26,6 +26,7 @@
*/ */
package kuusisto.tinysound; package kuusisto.tinysound;


import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
Expand Down Expand Up @@ -290,8 +291,6 @@ public static Music loadMusic(URL url, boolean streamFromFile) {
if (info == null) { if (info == null) {
return null; return null;
} }
System.out.println("stream info acquired");//XXX
System.out.println("creating music object"); //XXX
return new StreamMusic(info.URL, info.NUM_BYTES_PER_CHANNEL, return new StreamMusic(info.URL, info.NUM_BYTES_PER_CHANNEL,
TinySound.mixer); TinySound.mixer);
} }
Expand Down Expand Up @@ -730,7 +729,8 @@ private static StreamInfo createFileStream(byte[][] data) {
//we have the file, now we want to be able to write to it //we have the file, now we want to be able to write to it
OutputStream out = null; OutputStream out = null;
try { try {
out = new FileOutputStream(temp); out = new BufferedOutputStream(new FileOutputStream(temp),
(512 * 1024)); //buffer 512kb
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
System.err.println("Failed to open stream file for writing!"); System.err.println("Failed to open stream file for writing!");
return null; return null;
Expand Down
Binary file modified tinysound.zip
Binary file not shown.

0 comments on commit fb8330b

Please sign in to comment.