Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmsc436-student
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andrej Rasevic
cmsc436-student
Commits
140e9a6e
Commit
140e9a6e
authored
7 years ago
by
Andrej Rasevic
Browse files
Options
Downloads
Patches
Plain Diff
removed SoundPools todos
parent
8864ee16
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Lab8_GraphicsLab/app/src/main/java/course/labs/graphicslab/BubbleActivity.java
+17
-14
17 additions, 14 deletions
...src/main/java/course/labs/graphicslab/BubbleActivity.java
with
17 additions
and
14 deletions
Lab8_GraphicsLab/app/src/main/java/course/labs/graphicslab/BubbleActivity.java
+
17
−
14
View file @
140e9a6e
...
...
@@ -81,9 +81,9 @@ public class BubbleActivity extends Activity {
.
getStreamVolume
(
AudioManager
.
STREAM_MUSIC
)
/
mAudioManager
.
getStreamMaxVolume
(
AudioManager
.
STREAM_MUSIC
);
// TODO - make a new SoundPool, allowing up to 10 streams
mSoundPool
=
new
SoundPool
(
10
,
AudioManager
.
STREAM_MUSIC
,
0
);
// TODO -
load
th
e sound from res/
raw
/
bubble_pop
.wav
mSoundID
=
mSoundPool
.
load
(
th
is
,
R
.
raw
.
bubble_pop
,
1
);
}
...
...
@@ -101,10 +101,9 @@ public class BubbleActivity extends Activity {
@Override
protected
void
onPause
()
{
// TODO - unload the sound resource and release the sound pool
//TODO - set the sound pool to null
mSoundPool
.
unload
(
mSoundID
);
mSoundPool
.
release
();
mSoundPool
=
null
;
super
.
onPause
();
}
...
...
@@ -139,7 +138,7 @@ public class BubbleActivity extends Activity {
// Radius of the Bitmap
mRadius
=
mScaledBitmapWidth
/
2
;
mRadiusSquared
=
mRadius
*
mRadius
;
// Adjust position to center the bubble under user's finger
mXPos
=
x
-
mRadius
;
mYPos
=
y
-
mRadius
;
...
...
@@ -162,9 +161,9 @@ public class BubbleActivity extends Activity {
mDRotate
=
0
;
}
else
{
mDRotate
=
0
;
}
}
...
...
@@ -256,9 +255,13 @@ public class BubbleActivity extends Activity {
// TODO - Remove the BubbleView from mFrame
// TODO - If the bubble was popped by user,
// play the popping sound
// If the bubble was popped by user,
// play the popping sound and Log that pop was performed
if
(
wasPopped
)
{
Log
.
i
(
TAG
,
"Pop!"
);
mSoundPool
.
play
(
mSoundID
,
mStreamVolume
,
mStreamVolume
,
1
,
0
,
1.0f
);
}
Log
.
i
(
TAG
,
"Bubble removed from view!"
);
}
});
...
...
@@ -327,8 +330,8 @@ public class BubbleActivity extends Activity {
// Added bubbles should be given random locations.
// The bubble to delete is the most recently added bubble
// that is still in the frame.
// Hint: You can get all Views in mFrame using the
// Hint: You can get all Views in mFrame using the
// ViewGroup.getChildCount() method
switch
(
item
.
getItemId
())
{
case
R
.
id
.
menu_add_bubble
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment