Skip to content

Commit 816f029

Browse files
committedApr 13, 2017
Updated demo app, APK, as well as README.
1 parent 3e8d2ba commit 816f029

File tree

34 files changed

+178
-142
lines changed

34 files changed

+178
-142
lines changed
 

‎README.md

+35-17
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,55 @@
1-
HX Game Sound Engine
2-
====================
1+
HX Audio Player
2+
===============
33

44
DEVELOPER: huhx0015
55

66
## Description
77

8-
The HX Game Sound Engine is a custom audio wrapper library for Android 2.3 - Android 7.0. This is an sound and music library that is focused on providing audio for Android game-related apps. This audio library was utilized in apps such as Dragon Geo, Cid's Aerial Tours, Chrono Maps, and StepBOT.
8+
The HX Audio Player is a custom audio wrapper library for Android 2.3 - Android 7.0. It is designed to be an easy-to-use, alternative approach to implementing music and sound playback into Android applications. This audio library was utilized in apps such as Dragon Geo, Cid's Aerial Tours, Chrono Maps, and StepBOT.
99

10-
The demo activity provided with the project provides an example how the HXGSE library works.
10+
The demo activity provided with the project provides an example how the HX Audio Player library works.
1111

1212
## Instructions
1313

14-
1. Define your song and sound effect names and resources in HXGSEMusicList and HXGSESoundList classes.
14+
### Music Playback
1515

16-
2. Declare HXGSEMusicEngine / HXGSESoundHander objects as universal variables.
17-
18-
3. Initialize HXGSEMusic / HXGSESound objects in the onCreate() function of the first activity / fragment of your app that requires sound playback.
19-
- hxgse_music.getInstance().initializeAudio(getContext());
20-
- hxgse_sound.getInstance().initializeAudio(getContext(), 2);
21-
22-
4. Status of the music and sound engines will be outputted to logcat. Once fully initialized, all methods of HXGSEMusicEngine and HXGSESoundHandler are available to use.
16+
To load and play music files, simply declare the following in your code:
2317

24-
## Notes
18+
```
19+
HXMusic.music()
20+
.load(R.raw.my_song_name) // Sets the resource of the song. [REQUIRED]
21+
.title("My Awesome Song") // Sets the title of the song. [OPTIONAL]
22+
.artist("Mr. Anonymous") // Sets the artist of the song. [OPTIONAL]
23+
.date("January 1, 1998") // Sets the date of the song. [OPTIONAL]
24+
.at(5) // Sets the position for where the song should start. [OPTIONAL]
25+
.looped(true) // Sets the song to be looped. [OPTIONAL]
26+
.play(this); // Plays the song. [REQUIRED]
27+
```
28+
29+
It's just that simple! No need to write complicated code to initialize MediaPlayer, HX Audio Player handles all of this!
30+
31+
### Sound Playback
32+
33+
As for loading and playing sound effects, declare the following in your code:
2534

26-
- INITIALIZATION: Intialize the HXGSEMusicEngine / HXGSESoundHander objects once, in the first activity of your app that requires sound playback. No need to re-initialize these objects in other activity instances (unless releaseAudio()/releaseMedia() is called, which is not recommended until the end of app life), as a single instance is active until releaseAudio()/releaseMedia() is called. Initializing HXGSEMusicEngine / HXGSESoundHandler more than once may result in more than one audio streams running at once.
35+
```
36+
HXSound.sound()
37+
.load(R.raw.my_sound_effect) // Sets the resource of the sound effect. [REQUIRED]
38+
.looped(true) // Sets the sound effect to be looped. [OPTIONAL]
39+
.play(this); // Plays the sound effect. [REQUIRED]
40+
```
41+
42+
Voilà! Also very simple! No need to deal with SoundPool!
43+
44+
## Notes
2745

28-
- ANDROID API 9 - 11: HXGSESoundHandler class creates multiple instances of HXGSESoundEngine, based on the second parameter inputted for the initializeAudio method. This is to help minimize the SoundPool out of memory issue that is present in older versions of Android. As a suggestion to help minimize the issue, make sure that loaded sound effects are small in size and bitrate (recommended to be less than 100 KB and 64kbps or less). Please note that for devices running Android API 12 or greater, only a single instance of HXGSESoundEngine is used, as the 1 MB sound buffer limit issue is not present on newer versions of Android.
46+
- ANDROID API 9 - 10: HXSound class creates multiple instances of HXSoundEngine. This is to help minimize the SoundPool out of memory issue that is present in older versions of Android. As a suggestion to help minimize the issue, make sure that loaded sound effects are small in size and bitrate (recommended to be less than 100 KB and 64kbps or less). Please note that for devices running Android API 11 or greater, only a single instance of HXGSESoundEngine is used, as the 1 MB sound buffer limit issue is not present on newer versions of Android.
2947

30-
- RELEASE: It is recommended not to call releaseAudio()/releaseMedia() in HXGSESoundHandler and HXGSEMusicEngine unless your application is about to be terminated. If releaseAudio()/releaseMedia() is called and sound or music functionality is needed after such calls have been made, a new instance of HXGSESoundHandler / HXGSEMusicEngine must be initialized before audio is able to function.
48+
- RELEASE: As HXMusic and HXSound are singleton objects, it is recommended to call HXMusic.clear() & HXSound.clear() when audio playback is no longer needed. It is recommended to call these in the onDestroy() method of your activity or fragment.
3149

3250
## License
3351

34-
Copyright 2016 Michael Huh
52+
Copyright 2017 Michael Huh
3553

3654
Licensed under the Apache License, Version 2.0 (the "License");
3755
you may not use this file except in compliance with the License.

‎apk/HXAudioPlayer_Demo.apk

1.8 MB
Binary file not shown.

‎apk/hxgse_demo.apk

-1.63 MB
Binary file not shown.

‎app/app.iml

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@
104104
<orderEntry type="library" exported="" name="support-core-utils-25.3.1" level="project" />
105105
<orderEntry type="library" exported="" name="support-fragment-25.3.1" level="project" />
106106
<orderEntry type="library" exported="" name="animated-vector-drawable-25.3.1" level="project" />
107-
<orderEntry type="module" module-name="hxgse" exported="" />
107+
<orderEntry type="module" module-name="hxaudio" exported="" />
108108
</component>
109109
</module>

‎app/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies {
2323

2424
// INTEGRATED LIBRARIES:
2525
compile fileTree(dir: 'libs', include: ['*.jar'])
26-
compile project(':hxgse')
26+
compile project(':hxaudio')
2727

2828
// ANDROID SUPPORT LIBRARIES:
2929
compile 'com.android.support:appcompat-v7:25.3.1'

‎hxgse/src/androidTest/java/com/huhx0015/hxgselib/ApplicationTest.java ‎app/src/androidTest/java/com/huhx0015/hxaudiodemo/ApplicationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.huhx0015.hxgselib;
1+
package com.huhx0015.hxaudiodemo;
22

33
import android.app.Application;
44
import android.test.ApplicationTestCase;

‎app/src/main/AndroidManifest.xml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="com.huhx0015.huhxagse"
3+
package="com.huhx0015.hxaudiodemo"
44
android:installLocation="auto">
55

66
<application
@@ -10,13 +10,15 @@
1010
android:theme="@style/AppTheme" >
1111

1212
<activity
13-
android:name=".activity.HXGSEDemoActivity"
14-
android:label="HX Game Sound Engine Demo"
13+
android:name="com.huhx0015.hxaudiodemo.activity.HXAudioPlayerDemoActivity"
14+
android:label="@string/app_name"
1515
android:configChanges="orientation|screenSize|keyboardHidden">
16+
1617
<intent-filter>
1718
<action android:name="android.intent.action.MAIN" />
1819
<category android:name="android.intent.category.LAUNCHER" />
1920
</intent-filter>
21+
2022
</activity>
2123

2224
</application>

‎app/src/main/java/com/huhx0015/huhxagse/activity/HXGSEDemoActivity.java ‎app/src/main/java/com/huhx0015/hxaudiodemo/activity/HXAudioPlayerDemoActivity.java

+33-39
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.huhx0015.huhxagse.activity;
1+
package com.huhx0015.hxaudiodemo.activity;
22

33
import android.content.SharedPreferences;
44
import android.content.res.Configuration;
@@ -10,13 +10,13 @@
1010
import android.widget.ImageButton;
1111
import android.widget.ImageView;
1212
import android.widget.LinearLayout;
13-
import com.huhx0015.huhxagse.R;
14-
import com.huhx0015.huhxagse.preferences.HXGSEPreferences;
15-
import com.huhx0015.hxgselib.audio.HXMusic;
16-
import com.huhx0015.hxgselib.audio.HXSound;
17-
import com.huhx0015.hxgselib.utils.HXAudioPlayerUtils;
13+
import com.huhx0015.hxaudiodemo.R;
14+
import com.huhx0015.hxaudiodemo.preferences.HXAudioPreferences;
15+
import com.huhx0015.hxaudio.audio.HXMusic;
16+
import com.huhx0015.hxaudio.audio.HXSound;
17+
import com.huhx0015.hxaudio.utils.HXAudioPlayerUtils;
1818

19-
public class HXGSEDemoActivity extends AppCompatActivity {
19+
public class HXAudioPlayerDemoActivity extends AppCompatActivity {
2020

2121
/** CLASS VARIABLES ________________________________________________________________________ **/
2222

@@ -29,7 +29,7 @@ public class HXGSEDemoActivity extends AppCompatActivity {
2929
private int currentStar = 0; // Used to determine which star is currently toggled.
3030

3131
// PREFERENCE VARIABLES
32-
private SharedPreferences HXGSE_prefs; // SharedPreferences object for storing app data.
32+
private SharedPreferences hxAudioPreferences; // SharedPreferences object for storing app data.
3333

3434
/** ACTIVITY LIFECYCLE FUNCTIONALITY _______________________________________________________ **/
3535

@@ -38,7 +38,7 @@ protected void onCreate(Bundle savedInstanceState) {
3838
super.onCreate(savedInstanceState);
3939

4040
loadPreferences(); // Loads the settings values from the main SharedPreferences object.
41-
setUpLayout(); // Sets up layout for the activity.
41+
initView(); // Sets up layout for the activity.
4242
}
4343

4444
// onResume(): This function runs immediately after onCreate() finishes and is always re-run
@@ -91,7 +91,7 @@ protected void onDestroy() {
9191
public void onConfigurationChanged(Configuration newConfig) {
9292
super.onConfigurationChanged(newConfig);
9393

94-
setUpLayout(); // The layout is re-created for the screen orientation change.
94+
initView(); // The layout is re-created for the screen orientation change.
9595
toggleStar(currentStar); // Sets the toggled star for the song that was last selected.
9696
}
9797

@@ -105,7 +105,7 @@ public void onBackPressed() {
105105
// Plays the sound effect.
106106
HXSound.sound()
107107
.load(R.raw.sfx_3_digital_life_1)
108-
.play(HXGSEDemoActivity.this);
108+
.play(HXAudioPlayerDemoActivity.this);
109109

110110
finish(); // Finishes the activity.
111111
}
@@ -132,17 +132,17 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
132132

133133
/** LAYOUT FUNCTIONALITY ___________________________________________________________________ **/
134134

135-
// setUpLayout(): Sets up the layout for the activity.
136-
public void setUpLayout() {
135+
// initView(): Sets up the layout for the activity.
136+
public void initView() {
137137

138138
// Sets the XML layout for the activity.
139-
setContentView(R.layout.hxgse_main_activity);
139+
setContentView(R.layout.activity_hx_audio_player_demo);
140140

141-
setUpButtons(); // Sets up the button listeners for the activity.
141+
initButtons(); // Sets up the button listeners for the activity.
142142
}
143143

144-
// setUpButtons(): Sets up the button listeners for the activity.
145-
public void setUpButtons() {
144+
// initButtons(): Sets up the button listeners for the activity.
145+
public void initButtons() {
146146

147147
// References the Button and LinearLayout objects.
148148
final Button musicEnableButton = (Button) findViewById(R.id.music_enable_button);
@@ -158,10 +158,10 @@ public void setUpButtons() {
158158
final LinearLayout thirdFxContainer = (LinearLayout) findViewById(R.id.third_fx_container);
159159

160160
// Updates the text on the OPTIONS buttons, depending on their current state.
161-
if (musicOn) { musicEnableButton.setText("MUSIC ON"); }
162-
else { musicEnableButton.setText("MUSIC OFF"); }
163-
if (soundOn) { soundEnableButton.setText("SOUND ON"); }
164-
else { soundEnableButton.setText("SOUND OFF"); }
161+
if (musicOn) { musicEnableButton.setText(getString(R.string.music_on)); }
162+
else { musicEnableButton.setText(getString(R.string.music_off)); }
163+
if (soundOn) { soundEnableButton.setText(getString(R.string.sound_on)); }
164+
else { soundEnableButton.setText(getString(R.string.sound_off)); }
165165

166166
// SONG LIST BUTTONS:
167167
// -----------------------------------------------------------------------------------------
@@ -179,9 +179,7 @@ public void onClick(View v) {
179179
.load(R.raw.song_1_gamerstep_bass_triplets)
180180
.title(currentSong)
181181
.looped(true)
182-
.play(HXGSEDemoActivity.this);
183-
184-
//HXMusic.instance().playSongName(currentSong, true, HXGSEDemoActivity.this);
182+
.play(HXAudioPlayerDemoActivity.this);
185183

186184
toggleStar(1); // Toggles the star for the first song.
187185
}
@@ -202,9 +200,7 @@ public void onClick(View v) {
202200
.load(R.raw.song_2_ts_drums)
203201
.title(currentSong)
204202
.looped(true)
205-
.play(HXGSEDemoActivity.this);
206-
207-
//HXMusic.instance().playSongName(currentSong, true, HXGSEDemoActivity.this);
203+
.play(HXAudioPlayerDemoActivity.this);
208204

209205
toggleStar(2); // Toggles the star for the second song.
210206
}
@@ -225,9 +221,7 @@ public void onClick(View v) {
225221
.load(R.raw.song_3_ts_digi_lead_2)
226222
.title(currentSong)
227223
.looped(false)
228-
.play(HXGSEDemoActivity.this);
229-
230-
//HXMusic.instance().playSongName(currentSong, true, HXGSEDemoActivity.this);
224+
.play(HXAudioPlayerDemoActivity.this);
231225

232226
toggleStar(3); // Toggles the star for the third song.
233227
}
@@ -246,7 +240,7 @@ public void onClick(View v) {
246240
// Plays the sound effect.
247241
HXSound.sound()
248242
.load(R.raw.sfx_1_sci_fi_5)
249-
.play(HXGSEDemoActivity.this);
243+
.play(HXAudioPlayerDemoActivity.this);
250244
}
251245
});
252246

@@ -259,7 +253,7 @@ public void onClick(View v) {
259253
// Plays the sound effect.
260254
HXSound.sound()
261255
.load(R.raw.sfx_2_machine)
262-
.play(HXGSEDemoActivity.this);
256+
.play(HXAudioPlayerDemoActivity.this);
263257
}
264258
});
265259

@@ -272,7 +266,7 @@ public void onClick(View v) {
272266
// Plays the sound effect.
273267
HXSound.sound()
274268
.load(R.raw.sfx_3_digital_life_1)
275-
.play(HXGSEDemoActivity.this);
269+
.play(HXAudioPlayerDemoActivity.this);
276270
}
277271
});
278272

@@ -292,7 +286,7 @@ public void onClick(View v) {
292286

293287
// Plays the last selected song.
294288
else {
295-
HXMusic.resumeMusic(HXGSEDemoActivity.this);
289+
HXMusic.resumeMusic(HXAudioPlayerDemoActivity.this);
296290
}
297291
}
298292
});
@@ -355,7 +349,7 @@ public void onClick(View v) {
355349
}
356350

357351
// Sets the updated music value in SharedPreferences.
358-
HXGSEPreferences.setMusicOn(musicOn, HXGSE_prefs);
352+
HXAudioPreferences.setMusicOn(musicOn, hxAudioPreferences);
359353

360354
// Sets the musicOn value in the HXGSEMusic class.
361355
HXMusic.enableMusic(musicOn);
@@ -385,7 +379,7 @@ public void onClick(View v) {
385379
}
386380

387381
// Sets the updated sound value in SharedPreferences.
388-
HXGSEPreferences.setSoundOn(soundOn, HXGSE_prefs);
382+
HXAudioPreferences.setSoundOn(soundOn, hxAudioPreferences);
389383

390384
// Sets the soundOn value in the HXGSEMusic class.
391385
HXSound.enableSound(soundOn);
@@ -448,9 +442,9 @@ private void toggleStar(int starNo) {
448442
private void loadPreferences() {
449443

450444
// PREFERENCES: Retrieves all values from the main SharedPreferences object.
451-
HXGSE_prefs = HXGSEPreferences.initializePreferences(this);
452-
musicOn = HXGSEPreferences.getMusicOn(HXGSE_prefs);
453-
soundOn = HXGSEPreferences.getSoundOn(HXGSE_prefs);
445+
hxAudioPreferences = HXAudioPreferences.initializePreferences(this);
446+
musicOn = HXAudioPreferences.getMusicOn(hxAudioPreferences);
447+
soundOn = HXAudioPreferences.getSoundOn(hxAudioPreferences);
454448

455449
// Assigns the retrieved preference values to the class objects.
456450
HXMusic.enableMusic(musicOn);
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
1-
package com.huhx0015.huhxagse.preferences;
1+
package com.huhx0015.hxaudiodemo.preferences;
22

33
import android.content.Context;
44
import android.content.SharedPreferences;
55

66
/** -----------------------------------------------------------------------------------------------
7-
* [HXGSEPreferences] CLASS
8-
* DESCRIPTION: HXGSEPreferences is a class that contains functionality that pertains to the use
7+
* [HXAudioPreferences] CLASS
8+
* DESCRIPTION: HXAudioPreferences is a class that contains functionality that pertains to the use
99
* and manipulation of shared preferences data.
1010
* -----------------------------------------------------------------------------------------------
1111
*/
1212

13-
public class HXGSEPreferences {
13+
public class HXAudioPreferences {
1414

1515
/** SHARED PREFERENCES FUNCTIONALITY _______________________________________________________ **/
1616

1717
// initializePreferences(): Initializes and returns the SharedPreferences object.
1818
public static SharedPreferences initializePreferences(Context context) {
19-
return context.getSharedPreferences("hxgse_preferences", Context.MODE_PRIVATE);
19+
return context.getSharedPreferences("hx_audio_preferences", Context.MODE_PRIVATE);
2020
}
2121

2222
/** GET PREFERENCES FUNCTIONALITY __________________________________________________________ **/
2323

24-
// getMusicOn(): Retrieves the "hxgse_music_on" value from preferences.
24+
// getMusicOn(): Retrieves the "hx_audio_music_on" value from preferences.
2525
public static boolean getMusicOn(SharedPreferences preferences) {
26-
return preferences.getBoolean("hxgse_music_on", true); // Retrieves the music option setting.
26+
return preferences.getBoolean("hx_audio_music_on", true); // Retrieves the music option setting.
2727
}
2828

29-
// getSoundOn(): Retrieves the "hxgse_sound_on" value from preferences.
29+
// getSoundOn(): Retrieves the "hx_audio_sound_on" value from preferences.
3030
public static boolean getSoundOn(SharedPreferences preferences) {
31-
return preferences.getBoolean("hxgse_sound_on", true); // Retrieves the sound option setting.
31+
return preferences.getBoolean("hx_audio_sound_on", true); // Retrieves the sound option setting.
3232
}
3333

3434
/** SET PREFERENCES FUNCTIONALITY __________________________________________________________ **/
3535

36-
// setMusicOn(): Sets the "hxgse_music_on" value to preferences.
36+
// setMusicOn(): Sets the "hx_audio_music_on" value to preferences.
3737
public static void setMusicOn(boolean isOn, SharedPreferences preferences) {
3838

3939
// Prepares the SharedPreferences object for editing.
4040
SharedPreferences.Editor prefEdit = preferences.edit();
4141

42-
prefEdit.putBoolean("hxgse_music_on", isOn); // Sets the music option value to preferences.
42+
prefEdit.putBoolean("hx_audio_music_on", isOn); // Sets the music option value to preferences.
4343
prefEdit.apply(); // Applies the changes to SharedPreferences.
4444
}
4545

46-
// setSoundOn(): Sets the "hxgse_sound_on" value to preferences.
46+
// setSoundOn(): Sets the "hx_audio_sound_on" value to preferences.
4747
public static void setSoundOn(boolean isOn, SharedPreferences preferences) {
4848

4949
// Prepares the SharedPreferences object for editing.
5050
SharedPreferences.Editor prefEdit = preferences.edit();
5151

52-
prefEdit.putBoolean("hxgse_sound_on", isOn); // Sets the sound option value to preferences.
52+
prefEdit.putBoolean("hx_audio_sound_on", isOn); // Sets the sound option value to preferences.
5353
prefEdit.apply(); // Applies the changes to SharedPreferences.
5454
}
5555
}

‎app/src/main/res/layout-land/hxgse_main_activity.xml ‎app/src/main/res/layout-land/activity_hx_audio_player_demo.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
3-
android:layout_height="match_parent" tools:context=".HXGSEMainActivity"
2+
android:layout_width="match_parent"
3+
android:layout_height="match_parent"
44
android:background="@android:color/background_dark"
55
android:padding="5dp"
66
android:id="@+id/hxgse_demo_layout"

‎app/src/main/res/layout/hxgse_main_activity.xml ‎app/src/main/res/layout/activity_hx_audio_player_demo.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
2-
xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent"
3-
android:layout_height="fill_parent" tools:context=".HXGSEMainActivity"
2+
android:layout_width="fill_parent"
3+
android:layout_height="fill_parent"
44
android:background="@android:color/background_dark"
55
android:padding="10dp"
66
android:id="@+id/hxgse_demo_layout"
4.86 KB
Loading
2.06 KB
Loading
7.1 KB
Loading
15.1 KB
Loading
33.9 KB
Loading

‎app/src/main/res/values/strings.xml

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
<resources>
2-
<string name="app_name">HX GSE Demo</string>
2+
3+
<!--APPLICATION STRINGS-->
4+
<string name="app_name">HX Audio Player Demo</string>
5+
6+
<!--BUTTON STRINGS-->
7+
<string name="music_on">MUSIC ON</string>
8+
<string name="music_off">MUSIC OFF</string>
9+
<string name="sound_on">SOUND ON</string>
10+
<string name="sound_off">SOUND OFF</string>
311
</resources>
File renamed without changes.

‎hxgse/build.gradle ‎hxaudio/build.gradle

+1-8
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,4 @@ android {
1616
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1717
}
1818
}
19-
}
20-
21-
dependencies {
22-
23-
// INTEGRATED LIBRARIES:
24-
compile fileTree(include: ['*.jar'], dir: 'libs')
25-
compile 'com.android.support:support-annotations:25.3.1'
26-
}
19+
}

‎hxgse/hxgse.iml ‎hxaudio/hxaudio.iml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id=":hxgse" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="HX_Game_Sound_Engine" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id=":hxaudio" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="HX_Game_Sound_Engine" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>
6-
<option name="GRADLE_PROJECT_PATH" value=":hxgse" />
6+
<option name="GRADLE_PROJECT_PATH" value=":hxaudio" />
77
</configuration>
88
</facet>
99
<facet type="android" name="Android">
@@ -77,7 +77,6 @@
7777
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
7878
<sourceFolder url="file://$MODULE_DIR$/src/test/rs" isTestSource="true" />
7979
<sourceFolder url="file://$MODULE_DIR$/src/test/shaders" isTestSource="true" />
80-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/annotations" />
8180
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
8281
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/bundles" />
8382
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
@@ -96,6 +95,5 @@
9695
</content>
9796
<orderEntry type="jdk" jdkName="Android API 25 Platform" jdkType="Android SDK" />
9897
<orderEntry type="sourceFolder" forTests="false" />
99-
<orderEntry type="library" exported="" name="support-annotations-25.3.1" level="project" />
10098
</component>
10199
</module>
File renamed without changes.

‎app/src/androidTest/java/com/huhx0015/huhxagse/ApplicationTest.java ‎hxaudio/src/androidTest/java/com/huhx0015/hxaudio/ApplicationTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.huhx0015.huhxagse;
1+
package com.huhx0015.hxaudio;
22

33
import android.app.Application;
44
import android.test.ApplicationTestCase;

‎hxgse/src/main/AndroidManifest.xml ‎hxaudio/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.huhx0015.hxgselib">
2+
package="com.huhx0015.hxaudio">
33

44
<application android:allowBackup="true"
55
android:label="@string/app_name">

‎hxgse/src/main/java/com/huhx0015/hxgselib/audio/HXMusic.java ‎hxaudio/src/main/java/com/huhx0015/hxaudio/audio/HXMusic.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package com.huhx0015.hxgselib.audio;
1+
package com.huhx0015.hxaudio.audio;
22

33
import android.content.Context;
44
import android.media.AudioManager;
55
import android.media.MediaPlayer;
66
import android.util.Log;
7-
import com.huhx0015.hxgselib.builder.HXMusicBuilder;
8-
import com.huhx0015.hxgselib.model.HXMusicItem;
7+
import com.huhx0015.hxaudio.builder.HXMusicBuilder;
8+
import com.huhx0015.hxaudio.model.HXMusicItem;
99

1010
/** -----------------------------------------------------------------------------------------------
1111
* [HXMusic] CLASS

‎hxgse/src/main/java/com/huhx0015/hxgselib/audio/HXSound.java ‎hxaudio/src/main/java/com/huhx0015/hxaudio/audio/HXSound.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package com.huhx0015.hxgselib.audio;
1+
package com.huhx0015.hxaudio.audio;
22

33
import android.content.Context;
44
import android.os.Build;
55
import android.util.Log;
6-
import com.huhx0015.hxgselib.builder.HXSoundBuilder;
6+
import com.huhx0015.hxaudio.builder.HXSoundBuilder;
77
import java.util.LinkedList;
88

99
/** -----------------------------------------------------------------------------------------------

‎hxgse/src/main/java/com/huhx0015/hxgselib/audio/HXSoundEngine.java ‎hxaudio/src/main/java/com/huhx0015/hxaudio/audio/HXSoundEngine.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.huhx0015.hxgselib.audio;
1+
package com.huhx0015.hxaudio.audio;
22

33
import android.annotation.TargetApi;
44
import android.content.Context;

‎hxgse/src/main/java/com/huhx0015/hxgselib/builder/HXMusicBuilder.java ‎hxaudio/src/main/java/com/huhx0015/hxaudio/builder/HXMusicBuilder.java

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package com.huhx0015.hxgselib.builder;
1+
package com.huhx0015.hxaudio.builder;
22

33
import android.content.Context;
44
import android.util.Log;
5-
import com.huhx0015.hxgselib.audio.HXMusic;
6-
import com.huhx0015.hxgselib.model.HXMusicItem;
5+
import com.huhx0015.hxaudio.audio.HXMusic;
6+
import com.huhx0015.hxaudio.model.HXMusicItem;
77

88
/** -----------------------------------------------------------------------------------------------
99
* [HXMusicBuilder] CLASS
@@ -51,6 +51,18 @@ public HXMusicBuilder title(String title) {
5151
return this;
5252
}
5353

54+
// artist(): Sets the artist for this music.
55+
public HXMusicBuilder artist(String artist) {
56+
this.musicItem.setMusicArtist(artist);
57+
return this;
58+
}
59+
60+
// date(): Sets the date for this music.
61+
public HXMusicBuilder date(String date) {
62+
this.musicItem.setMusicDate(date);
63+
return this;
64+
}
65+
5466
// at(): Sets the starting position of the music.
5567
public HXMusicBuilder at(int position) {
5668
this.musicPosition = position;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package com.huhx0015.hxaudio.builder;
2+
3+
import android.content.Context;
4+
import android.util.Log;
5+
import com.huhx0015.hxaudio.audio.HXSound;
6+
7+
/** -----------------------------------------------------------------------------------------------
8+
* [HXSoundBuilder] CLASS
9+
* DEVELOPER: Michael Yoon Huh (Huh X0015)
10+
* DESCRIPTION: HXSoundBuilder class is a builder class for the HXSound object and is used to
11+
* prepare a specified sound resource for sound playback in HXSound.
12+
* -----------------------------------------------------------------------------------------------
13+
*/
14+
public class HXSoundBuilder {
15+
16+
/** CLASS VARIABLES ________________________________________________________________________ **/
17+
18+
// ATTRIBUTE VARIABLES:
19+
private int soundResource;
20+
private boolean isLooped;
21+
22+
// LOGGING VARIABLES:
23+
private static final String LOG_TAG = HXSoundBuilder.class.getSimpleName();
24+
25+
/** BUILDER METHODS ________________________________________________________________________ **/
26+
27+
// load(): Sets the resource ID for this sound effect.
28+
public HXSoundBuilder load(int resource) {
29+
this.soundResource = resource;
30+
return this;
31+
}
32+
33+
// looped(): Specifies whether this sound effect should be looped or not.
34+
public HXSoundBuilder looped(boolean isLooped) {
35+
this.isLooped = isLooped;
36+
return this;
37+
}
38+
39+
// play(): Calls the HXSound playSoundFx() method to attempt to play the specified sound effect.
40+
public void play(Context context) {
41+
if (context == null || context.getApplicationContext() == null) {
42+
Log.e(LOG_TAG, "ERROR: play(): Context cannot be null.");
43+
} else {
44+
HXSound.instance().playSoundFx(soundResource, isLooped, context.getApplicationContext());
45+
}
46+
}
47+
}

‎hxgse/src/main/java/com/huhx0015/hxgselib/model/HXMusicItem.java ‎hxaudio/src/main/java/com/huhx0015/hxaudio/model/HXMusicItem.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.huhx0015.hxgselib.model;
1+
package com.huhx0015.hxaudio.model;
22

33
/** -----------------------------------------------------------------------------------------------
44
* [HXMusicItem] CLASS

‎hxgse/src/main/java/com/huhx0015/hxgselib/utils/HXAudioPlayerUtils.java ‎hxaudio/src/main/java/com/huhx0015/hxaudio/utils/HXAudioPlayerUtils.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.huhx0015.hxgselib.utils;
1+
package com.huhx0015.hxaudio.utils;
22

33
import android.content.Context;
44
import android.media.AudioManager;
File renamed without changes.

‎hxgse/src/main/java/com/huhx0015/hxgselib/builder/HXSoundBuilder.java

-36
This file was deleted.

‎settings.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include ':app', ':hxgse'
1+
include ':app', ':hxaudio'

0 commit comments

Comments
 (0)
Please sign in to comment.