processing / processing-sound

Audio library for Processing built with JSyn
https://processing.org/reference/libraries/sound/
GNU Lesser General Public License v2.1
149 stars 50 forks source link

app crashes when trying to pause/play a sound file in onPause() or onResume() functions #101

Open AniManOtaku opened 9 months ago

AniManOtaku commented 9 months ago

here is the code:

import processing.sound.*;

SoundFile menuTheme;

void setup(){
  menuTheme=new SoundFile(this, "s8.wav");
  menuTheme.loop();
}

void draw(){
  background(255);
}

@Override
public void onBackPressed(){
  println("on back pressed");
  menuTheme.stop();
  super.onBackPressed();
}

@Override
public void onPause(){
  println("on pause");
  menuTheme.pause();
  super.onPause();
}

@Override
public void onResume(){
  println("on resume");
  menuTheme.loop();
  super.onResume();
}

here is the error:

Initializing build sequence…
Deleted old build folder
Detected architecture armeabi-v7a
java.io.FileNotFoundException: /data/user/0/com.calsignlabs.apde/files/tmp/aapt (Text file busy)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:287)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:223)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1941)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1932)
    at com.calsignlabs.apde.build.Build.build(Build.java:732)
    at com.calsignlabs.apde.build.Build.build(Build.java:287)
    at com.calsignlabs.apde.EditorActivity.lambda$runApplication$15(EditorActivity.java:3395)
    at com.calsignlabs.apde.EditorActivity.$r8$lambda$yRcQupdy0sH1fAylZELq0DvnNtA(Unknown Source:0)
    at com.calsignlabs.apde.EditorActivity$$ExternalSyntheticLambda28.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)

Packaging resources with AAPT…
Compiling with ECJ…

Dexing with DX Dexer…
Launching sketch preview…
Finished in 9050ms

Failed to delete file: /data/user/0/com.calsignlabs.apde/app_build/support-res
Failed to delete file: /data/user/0/com.calsignlabs.apde/app_build/assets
Failed to delete file: /data/user/0/com.calsignlabs.apde/app_build
java.io.FileNotFoundException: /data/user/0/com.calsignlabs.apde/app_build/assets/s8.mp3 (No such file or directory)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:287)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:223)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at com.calsignlabs.apde.build.Build.copyFile(Build.java:1987)
    at com.calsignlabs.apde.build.Build.copyDir(Build.java:2019)
    at com.calsignlabs.apde.build.Build.build(Build.java:646)
    at com.calsignlabs.apde.EditorActivity.lambda$autoCompile$9(EditorActivity.java:2087)
    at com.calsignlabs.apde.EditorActivity.$r8$lambda$K0CTn2EuOMUNHNIuNlGXHlxgPxw(Unknown Source:0)
    at com.calsignlabs.apde.EditorActivity$$ExternalSyntheticLambda27.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
java.io.FileNotFoundException: /data/user/0/com.calsignlabs.apde/files/tmp/aapt (Text file busy)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:287)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:223)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1941)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1932)
    at com.calsignlabs.apde.build.Build.build(Build.java:732)
    at com.calsignlabs.apde.EditorActivity.lambda$autoCompile$9(EditorActivity.java:2087)
    at com.calsignlabs.apde.EditorActivity.$r8$lambda$K0CTn2EuOMUNHNIuNlGXHlxgPxw(Unknown Source:0)
    at com.calsignlabs.apde.EditorActivity$$ExternalSyntheticLambda27.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
AAPT failed with error code 1
java.io.FileNotFoundException: /data/user/0/com.calsignlabs.apde/files/tmp/aapt (Text file busy)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:287)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:223)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1941)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1932)
    at com.calsignlabs.apde.build.Build.build(Build.java:732)
    at com.calsignlabs.apde.EditorActivity.lambda$autoCompile$9(EditorActivity.java:2087)
    at com.calsignlabs.apde.EditorActivity.$r8$lambda$K0CTn2EuOMUNHNIuNlGXHlxgPxw(Unknown Source:0)
    at com.calsignlabs.apde.EditorActivity$$ExternalSyntheticLambda27.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
java.io.FileNotFoundException: /data/user/0/com.calsignlabs.apde/files/tmp/aapt (Text file busy)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:287)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:223)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1941)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1932)
    at com.calsignlabs.apde.build.Build.build(Build.java:732)
    at com.calsignlabs.apde.EditorActivity.lambda$autoCompile$9(EditorActivity.java:2087)
    at com.calsignlabs.apde.EditorActivity.$r8$lambda$K0CTn2EuOMUNHNIuNlGXHlxgPxw(Unknown Source:0)
    at com.calsignlabs.apde.EditorActivity$$ExternalSyntheticLambda27.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
java.io.FileNotFoundException: /data/user/0/com.calsignlabs.apde/files/tmp/aapt (Text file busy)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:287)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:223)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1941)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1932)
    at com.calsignlabs.apde.build.Build.build(Build.java:732)
    at com.calsignlabs.apde.EditorActivity.lambda$autoCompile$9(EditorActivity.java:2087)
    at com.calsignlabs.apde.EditorActivity.$r8$lambda$K0CTn2EuOMUNHNIuNlGXHlxgPxw(Unknown Source:0)
    at com.calsignlabs.apde.EditorActivity$$ExternalSyntheticLambda27.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)
java.io.FileNotFoundException: /data/user/0/com.calsignlabs.apde/files/tmp/aapt (Text file busy)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:287)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:223)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1941)
    at com.calsignlabs.apde.build.Build.createFileFromInputStream(Build.java:1932)
    at com.calsignlabs.apde.build.Build.build(Build.java:732)
    at com.calsignlabs.apde.EditorActivity.lambda$autoCompile$9(EditorActivity.java:2087)
    at com.calsignlabs.apde.EditorActivity.$r8$lambda$K0CTn2EuOMUNHNIuNlGXHlxgPxw(Unknown Source:0)
    at com.calsignlabs.apde.EditorActivity$$ExternalSyntheticLambda27.run(Unknown Source:4)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
    at java.lang.Thread.run(Thread.java:764)