Learn how to write the code to calculate an adjustment to the volume and frequency based on the move movement since the mouse button was pressed.
- [Instructor] Okay, now let's try and calculate…a value for the volume based on the position…of the mouse and offset, change…the value as the mouse is moved.…First, we've calculate a dX, a numerical value…that tells us how far the mouse has moved…since the button was pressed,…and so this will be the volume on the horizontal axis.…And so player.Volume is the variable,…the value that we would like to affect.…So we're going to read the current value and modify it,…add to it, the change, dX, but the change…on the horizontal axis is going to be…based on the resolution, sensitivity…of your mouse, and so forth.…
And so you're going to have to play…with this number a little bit.…On this machine, let's start with 1,000.…So I'm assuming there's a lot of pixels on screen,…and as I move the cursor from left to right,…I'll take the number of pixels we move across,…the number of points, divide by 1,000,…and change the volume on that basis.…This is just a guess, you can divide by 10,…you can divide by 10,000, you'd have to see…
Skill Level Intermediate
1. Problem 1: Pond Oreille
2. Problem 2: Where Am I?
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Facial Recognition
6. Problem 6: Real-Time Information Dashboard
Next steps2m 46s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.