Skip to content

Commit

Permalink
Downgrade to P3 for export
Browse files Browse the repository at this point in the history
  • Loading branch information
vlcoo committed Feb 16, 2023
1 parent b82b56f commit 7bc8839
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
3 changes: 1 addition & 2 deletions Channel.pde
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ public class ChannelOsc {

void create_display(int x, int y, int id) {
ChannelDisplay d;
if (demo_ui) d = new ChannelDisplayDemo(x, y, id, this);
else d = new ChannelDisplay(x, y, id, this);
d = new ChannelDisplay(x, y, id, this);
this.disp = d;
this.id = id;
}
Expand Down
3 changes: 1 addition & 2 deletions Player.pde
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ class Player {

void create_display(int x, int y) {
PlayerDisplay d;
if (demo_ui) d = new PlayerDisplayDemo(x, y, this);
else d = new PlayerDisplay(x, y, this);
d = new PlayerDisplay(x, y, this);
this.disp = d;
}

Expand Down
31 changes: 21 additions & 10 deletions Playlister.pde
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import java.util.stream.Stream;
import java.nio.file.*;
import java.util.Comparator;
import java.util.Collections;
import java.util.stream.Collectors;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
import java.nio.file.InvalidPathException;


public class PlaylistModule extends PApplet {
Expand Down Expand Up @@ -30,7 +34,7 @@ public class PlaylistModule extends PApplet {
this.parentFrame = f;
this.parentPApplet = parent;

items = new ArrayList<>();
items = new ArrayList<PlaylistItem>();
}


Expand Down Expand Up @@ -348,13 +352,19 @@ public class PlaylistModule extends PApplet {


ArrayList<PlaylistItem> add_folder_to_list(boolean recursive, File folder) {
ArrayList<PlaylistItem> aux = new ArrayList<>();
ArrayList<PlaylistItem> aux = new ArrayList<PlaylistItem>();

try (Stream<Path> stream = recursive ? Files.walk(folder.toPath(), 2) : Files.list(folder.toPath())) {
stream.filter(Files::isRegularFile).forEach( (k) -> {
try {
Stream<Path> stream = recursive ? Files.walk(folder.toPath(), 2) : Files.list(folder.toPath());
for (Object path : stream.collect(Collectors.toList())) {
PlaylistItem i = new PlaylistItem((Path) path);
if (i.file != null && is_valid_midi(i.file)) aux.add(i);
};
/*stream.filter(Files::isRegularFile).forEach( (k) -> {
PlaylistItem i = new PlaylistItem(k);
if (i.file != null && is_valid_midi(i.file)) aux.add(i);
});
});*/
stream.close();
}
catch (IOException ioe) {
println("ioe on recursive folder");
Expand Down Expand Up @@ -446,15 +456,16 @@ public class PlaylistModule extends PApplet {

String load_m3u(File in) {
if (in == null) return "";
ArrayList<PlaylistItem> aux = new ArrayList<>();
ArrayList<PlaylistItem> aux = new ArrayList<PlaylistItem>();

try {
BufferedReader reader = new BufferedReader(new FileReader(in.getAbsolutePath()));
String l = reader.readLine();

while (l != null) {
try { Paths.get(l); }
catch (InvalidPathException | NullPointerException pex) { break; }
catch (InvalidPathException ipe) { break; }
catch (NullPointerException npe) { break; }

File f = new File(l);
if (f.exists() && is_valid_midi(f)) {
Expand Down Expand Up @@ -537,7 +548,7 @@ class PlaylistItem implements Comparator<PlaylistItem> {


PlaylistItem(File f) {
if (f == null) return;
if (f == null || !f.isFile()) return;

file = f;
//filename = check_and_shrink_string(f.getName().replaceFirst("[.][^.]+$", ""), 18);
Expand All @@ -547,7 +558,7 @@ class PlaylistItem implements Comparator<PlaylistItem> {


PlaylistItem(Path p) {
if (p == null) return;
if (p == null || !p.toFile().isFile()) return;

file = p.toFile();
//filename = check_and_shrink_string(p.getFileName().toString().replaceFirst("[.][^.]+$", ""), 18);
Expand Down

0 comments on commit 7bc8839

Please sign in to comment.