Skip to content

Commit 25b53d1

Browse files
committed
v0.2.8: allow background play + more
added background play added some help test update travis tools version added animated gif ... fdroid fix: use 28.0.2 instead of 28.0.3
1 parent debd0e7 commit 25b53d1

File tree

16 files changed

+179
-48
lines changed

16 files changed

+179
-48
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: android
22
android:
33
components:
4-
- build-tools-26.0.2
5-
- android-26
4+
- build-tools-28.0.3
5+
- android-28
66
- tools
77
- platform-tools
88
licenses:

README.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ DRUM ON
77
This is a FOSS drum app for Android.
88

99
.. raw:: html
10-
10+
1111
<a href="https://f-droid.org/app/se.tube42.drum.android"><img src="https://f-droid.org/badge/get-it-on.png" alt="Get it on F-Droid" height="100"></a>
1212

13-
Screenshot
14-
----------
1513

16-
.. image:: extra/screenshot/img00.png
14+
.. image:: extra/screenshot/demo.gif
15+
1716

1817
Building
1918
--------
@@ -53,4 +52,3 @@ To build the assets, you should do
5352
.. code:: shell
5453
5554
make
56-

android/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
android {
2-
buildToolsVersion "26.0.2"
3-
compileSdkVersion 26
2+
buildToolsVersion "28.0.2"
3+
compileSdkVersion 28
44
sourceSets {
55
main {
66
manifest.srcFile 'AndroidManifest.xml'
@@ -20,11 +20,11 @@ android {
2020
defaultConfig {
2121
applicationId "se.tube42.drum.android"
2222
minSdkVersion 17
23-
targetSdkVersion 26
23+
targetSdkVersion 28
2424

2525
// app version
26-
versionCode 27
27-
versionName "0.2.7"
26+
versionCode 28
27+
versionName "0.2.8"
2828

2929
}
3030
}

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ allprojects {
1616

1717
ext {
1818
appName = "Drum On"
19-
gdxVersion = '1.9.6'
19+
gdxVersion = '1.9.7'
2020
roboVMVersion = '2.3.1'
2121
box2DLightsVersion = '1.4'
2222
ashleyVersion = '1.7.0'
@@ -76,7 +76,7 @@ project(":core") {
7676

7777
compile "se.tube42.tweeny:tweeny:0.3.1"
7878
compile "se.tube42.ks:ks:0.3.1"
79-
compile "se.tube42.base42:base42:0.3.4"
79+
compile "se.tube42.base42:base42:0.3.5"
8080
}
8181
}
8282

core/src/se/tube42/drum/DrumApp.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ private void load_assets()
129129

130130
@Override public void pause()
131131
{
132-
ServiceProvider.autoSave();
133-
World.mgr.onPause();
134-
World.mixer.stop();
132+
ServiceProvider.autoSave();
133+
if(!Settings.bg_play) {
134+
World.mgr.onPause();
135+
World.mixer.stop();
136+
}
135137
super.pause();
136138
}
137139

@@ -146,7 +148,12 @@ private void load_assets()
146148

147149
public void dispose()
148150
{
149-
System.out.println("Disposing...\n");
151+
System.out.println("Disposing...\n");
152+
153+
// assuming we allowed bg-play, we might need to update stop music now
154+
World.mgr.onPause();
155+
World.mixer.stop();
156+
150157
World.mixer.dispose();
151158
super.dispose();
152159
}

core/src/se/tube42/drum/audio/EffectChain.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ public boolean isEnabled(int n)
6666
return (enabled & (1 << n)) != 0;
6767
}
6868

69-
public void toggle(int n)
69+
public boolean toggle(int n)
7070
{
71-
enabled ^= 1 << n;
71+
enabled ^= 1 << n;
72+
return isEnabled(n);
7273
}
7374

74-
7575
public void process(float [] data, int offset, int size)
7676
{
7777
for(int i = 0; i < effects.length; i++) {

core/src/se/tube42/drum/data/Constants.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ public final class Constants
157157
TOOL_FX_LOFI = 8,
158158
TOOL_FX_FILTER = 9,
159159
TOOL_FX_DELAY = 10,
160-
TOOL_FX_COMP = 11,
160+
TOOL_FX_COMP = 11,
161+
TOOL_MISC_BACKGROUND = 12,
161162
TOOL_MISC_PAUSE = 14,
162163
TOOL_MISC_SAVE = 15
163164
;
@@ -173,7 +174,7 @@ public final class Constants
173174
ICON_LOFI, ICON_FILTER, ICON_DELAY, ICON_COMPRESS,
174175

175176
// settings
176-
-1, -1, ICON_PAUSE, ICON_SAVE
177+
ICON_BG_STOP, -1, ICON_PAUSE, ICON_SAVE
177178
};
178179

179180
// ---------------------------------------
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
package se.tube42.drum.data;
3+
4+
/**
5+
* App overall settings
6+
*/
7+
public class Settings
8+
{
9+
public static boolean bg_play = false;
10+
11+
}

core/src/se/tube42/drum/logic/ServiceProvider.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ public class ServiceProvider
2323

2424
public static void init()
2525
{
26-
StorageService.init("drum.0");
26+
StorageService.init("drum.0");
27+
SettingsService.load();
2728
}
2829

2930

@@ -33,14 +34,16 @@ public static void init()
3334

3435
public static void autoLoad()
3536
{
37+
SettingsService.load();
3638
if(World.prog != null)
3739
SaveService.load(-1);
3840
}
3941

4042
public static void autoSave()
4143
{
4244
if(World.prog != null)
43-
SaveService.save(-1);
45+
SaveService.save(-1);
46+
SettingsService.save();
4447
}
4548

4649

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
2+
package se.tube42.drum.logic;
3+
4+
import java.io.*;
5+
import java.util.Set;
6+
7+
import se.tube42.lib.service.*;
8+
9+
import se.tube42.drum.audio.*;
10+
import se.tube42.drum.data.*;
11+
12+
import static se.tube42.drum.data.Constants.*;
13+
14+
15+
public final class SettingsService
16+
{
17+
private final static String
18+
HEADER = "drumon-settings",
19+
SETTINGS_NAME = "DrumonSettings"
20+
;
21+
22+
private final static int
23+
VERSION = 1
24+
;
25+
26+
// -----------------------------------------------------------
27+
// load / save
28+
// -----------------------------------------------------------
29+
30+
public static void save()
31+
{
32+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
33+
DataOutputStream dos = new DataOutputStream(baos);
34+
try {
35+
// format
36+
dos.writeByte(VERSION);
37+
38+
// format flags
39+
int fileflags = 0;
40+
dos.writeInt(fileflags);
41+
42+
dos.writeBoolean(Settings.bg_play);
43+
44+
// reserved for future
45+
dos.writeBoolean(false);
46+
dos.writeBoolean(false);
47+
dos.writeInt(0);
48+
dos.writeInt(0);
49+
dos.writeUTF("");
50+
dos.writeUTF("");
51+
52+
final String str = HEADER + EncodingService.encode64( baos.toByteArray());
53+
StorageService.save(SETTINGS_NAME, str);
54+
StorageService.flush();
55+
} catch(IOException e) {
56+
System.err.println("ERROR: could not save settings: " + e);
57+
}
58+
}
59+
60+
// load from a save
61+
public static boolean load()
62+
{
63+
String str = StorageService.load(SETTINGS_NAME, null);
64+
if(str == null)
65+
return false;
66+
67+
// check header
68+
if(!str.startsWith(HEADER))
69+
return false;
70+
str = str.substring(HEADER.length());
71+
72+
byte [] bytes = EncodingService.decode64(str);
73+
if(bytes == null) {
74+
System.err.println("ERROR: could not decode settings string: " + str);
75+
return false;
76+
}
77+
78+
try {
79+
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
80+
DataInputStream dis = new DataInputStream(bais);
81+
82+
final byte version = dis.readByte();
83+
final int fileflags = dis.readInt();
84+
Settings.bg_play = dis.readBoolean();
85+
86+
} catch(IOException e) {
87+
System.err.println("Could not load settings: " + e);
88+
return false;
89+
}
90+
return true;
91+
}
92+
}

0 commit comments

Comments
 (0)