Skip to content

Create LICENSE #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "audio_mixer/src/main/cpp/oboe"]
path = audio_mixer/src/main/cpp/oboe
url = https://github.com/google/oboe
5 changes: 2 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Rakibul Hasan Rajib

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
13 changes: 6 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileSdkVersion 32

defaultConfig {
applicationId "zeroonezero.android.audiomixer"
Expand All @@ -29,11 +28,11 @@ android {

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation project(":audio_mixer")

Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
android:supportsRtl="true"
android:requestLegacyExternalStorage="true"
android:theme="@style/AppTheme">
<activity android:name="zeroonezero.android.audiomixer.MainActivity">
<activity android:name="zeroonezero.android.audiomixer.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
36 changes: 34 additions & 2 deletions app/src/main/java/zeroonezero/android/audiomixer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.media.AudioManager;
import android.media.MediaMetadataRetriever;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
Expand All @@ -18,6 +20,7 @@
import android.view.View;
import android.widget.Toast;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -53,6 +56,13 @@ public void onClick(View v) {
}
});

findViewById(R.id.add_video_audio_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
openVideoChooser();
}
});

findViewById(R.id.mix_btn).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Expand All @@ -76,6 +86,19 @@ public void onClick(View v) {
}
});

findViewById(R.id.play_btn).setOnClickListener(v -> {
File file=new File(outputPath);
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
try {
mediaPlayer.setDataSource(getApplicationContext(), Uri.fromFile(file));
mediaPlayer.prepare();
mediaPlayer.start();
} catch (IOException e) {
e.printStackTrace();
}
});

checkPermission();
}

Expand Down Expand Up @@ -109,7 +132,7 @@ private void startMixing(){
}catch (Exception e){
e.printStackTrace();
}
//audioMixer.setSampleRate(44100); // optional
audioMixer.setSampleRate(48000); // optional
//audioMixer.setBitRate(128000); // optional
//audioMixer.setChannelCount(2); // 1 or 2 // optional
//audioMixer.setLoopingEnabled(true); // Only works for parallel mixing
Expand Down Expand Up @@ -163,6 +186,14 @@ public void openChooser(){
startActivityForResult(intent, AUDIO_CHOOSE_REQUEST_CODE);
}

public void openVideoChooser(){
Intent intent = new Intent();
intent.setType("video/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivityForResult(intent, AUDIO_CHOOSE_REQUEST_CODE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Expand Down Expand Up @@ -207,9 +238,10 @@ private boolean checkPermission() {

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
switch (requestCode) {
case PERMISSION_REQUEST_CODE:
if ( grantResults.length > 1
if (grantResults.length > 1
&& grantResults[0] == PackageManager.PERMISSION_GRANTED
&& grantResults[1] == PackageManager.PERMISSION_GRANTED) {

Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
android:orientation="vertical"
android:layout_centerInParent="true">

<Button
android:id="@+id/add_video_audio_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add video audio"/>

<Button
android:id="@+id/add_audio_btn"
android:layout_width="wrap_content"
Expand All @@ -29,6 +35,12 @@
android:layout_height="wrap_content"
android:text="Mix"/>

<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/play_btn"
android:text="Play Audio File"/>

</LinearLayout>

</RelativeLayout>
64 changes: 52 additions & 12 deletions audio_mixer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,37 +1,77 @@
apply plugin: 'com.android.library'

plugins {
id 'com.android.library'
id 'maven-publish'
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileSdkVersion 32

defaultConfig {
minSdkVersion 18
targetSdkVersion 29
targetSdkVersion 32
versionCode 1
versionName "1.0"

versionName "1.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
externalNativeBuild {
cmake {
cppFlags ""
arguments "-DRESAMPLER_OUTER_NAMESPACE=zeroonezero.android.audio_mixer -Wc++17-extensions"
}
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
}
}

compileOptions{
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.18.1'
}
}
publishing {
singleVariant('release') {
}
singleVariant('debug') {
}
}
}

dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.appcompat:appcompat:1.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

}

repositories {
mavenLocal()
}

}
apply from: '../maven-publish-helper.gradle'

publishing {
publications {
release(MavenPublication) {
groupId 'zeroonezero.android.audio_mixer'
artifactId = 'android_audio_mixer'
}
debug(MavenPublication) {
groupId 'zeroonezero.android.audio_mixer'
artifactId = 'android_audio_mixer-debug'
}
}
}
Loading