-
-
Notifications
You must be signed in to change notification settings - Fork 385
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
1 parent
c922f7e
commit ad1a6bb
Showing
11 changed files
with
149 additions
and
39 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
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
17 changes: 17 additions & 0 deletions
17
app/src/main/java/cafe/adriel/androidaudiorecorder/example/Util.java
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,17 @@ | ||
package cafe.adriel.androidaudiorecorder.example; | ||
|
||
import android.app.Activity; | ||
import android.content.pm.PackageManager; | ||
import android.support.v4.app.ActivityCompat; | ||
import android.support.v4.content.ContextCompat; | ||
|
||
public class Util { | ||
|
||
public static void requestPermission(Activity activity, String permission) { | ||
if (ContextCompat.checkSelfPermission(activity, permission) | ||
!= PackageManager.PERMISSION_GRANTED) { | ||
ActivityCompat.requestPermissions(activity, new String[]{permission}, 0); | ||
} | ||
} | ||
|
||
} |
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
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
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
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
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
17 changes: 17 additions & 0 deletions
17
lib/src/main/java/cafe/adriel/androidaudiorecorder/model/AudioChannel.java
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,17 @@ | ||
package cafe.adriel.androidaudiorecorder.model; | ||
|
||
import android.media.AudioFormat; | ||
|
||
public enum AudioChannel { | ||
STEREO, | ||
MONO; | ||
|
||
public int getChannel(){ | ||
switch (this){ | ||
case MONO: | ||
return AudioFormat.CHANNEL_IN_MONO; | ||
default: | ||
return AudioFormat.CHANNEL_IN_STEREO; | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
lib/src/main/java/cafe/adriel/androidaudiorecorder/model/AudioSampleRate.java
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,15 @@ | ||
package cafe.adriel.androidaudiorecorder.model; | ||
|
||
public enum AudioSampleRate { | ||
HZ_48000, | ||
HZ_44100, | ||
HZ_32000, | ||
HZ_22050, | ||
HZ_16000, | ||
HZ_11025, | ||
HZ_8000; | ||
|
||
public int getSampleRate(){ | ||
return Integer.parseInt(name().replace("HZ_", "")); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
lib/src/main/java/cafe/adriel/androidaudiorecorder/model/AudioSource.java
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,17 @@ | ||
package cafe.adriel.androidaudiorecorder.model; | ||
|
||
import android.media.MediaRecorder; | ||
|
||
public enum AudioSource { | ||
MIC, | ||
CAMCORDER; | ||
|
||
public int getSource(){ | ||
switch (this){ | ||
case CAMCORDER: | ||
return MediaRecorder.AudioSource.CAMCORDER; | ||
default: | ||
return MediaRecorder.AudioSource.MIC; | ||
} | ||
} | ||
} |