-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
225 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package org.recompile.mobile; | ||
|
||
import android.util.Log; | ||
|
||
import java.security.MessageDigest; | ||
|
||
public abstract class AudioPlayer { | ||
static public final String TAG = AudioPlayer.class.getSimpleName(); | ||
|
||
protected long mediaTime = 0; | ||
protected int loops = 1; | ||
protected boolean running = false; | ||
|
||
public abstract void start(); | ||
|
||
public abstract void stop(); | ||
|
||
public void setLoopCount(int count) { | ||
loops = count; | ||
} | ||
|
||
public long setMediaTime(long now) { | ||
mediaTime = now; | ||
return mediaTime; | ||
} | ||
|
||
public long getMediaTime() { | ||
return mediaTime; | ||
} | ||
|
||
public boolean isRunning() { | ||
return running; | ||
} | ||
|
||
public abstract void deallocate(); | ||
|
||
final public String encodeMD5String(byte[] data) { | ||
StringBuilder sb = new StringBuilder(); | ||
try { | ||
MessageDigest sha256 = MessageDigest.getInstance("MD5"); | ||
byte[] hashed = sha256.digest(data); | ||
|
||
for (byte b : hashed) { | ||
sb.append(String.format("%02x", b)); | ||
} | ||
} catch (Exception e) { | ||
Log.d(TAG, "Error encodeMD5String:" + e.getMessage()); | ||
} | ||
return sb.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.recompile.mobile; | ||
|
||
public class FakeAudioPlayer extends AudioPlayer { | ||
@Override | ||
public void start() { | ||
|
||
} | ||
|
||
@Override | ||
public void stop() { | ||
|
||
} | ||
|
||
@Override | ||
public void deallocate() { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.