Skip to content

Commit

Permalink
Add Boost Function
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffshee committed Jun 1, 2019
1 parent d32197e commit 7cdcb7e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import android.os.Bundle
import android.support.v4.app.ActivityCompat
import android.support.v4.content.ContextCompat
import android.support.v7.app.AppCompatActivity
import io.github.jeffshee.visualizer.painters.fft.FftBar
import io.github.jeffshee.visualizer.painters.fft.FftWave
import io.github.jeffshee.visualizer.painters.fft.FftWaveRgb
import io.github.jeffshee.visualizer.painters.misc.SimpleIcon
import io.github.jeffshee.visualizer.utils.Preset
import io.github.jeffshee.visualizer.utils.VisualizerHelper
Expand Down Expand Up @@ -42,8 +45,8 @@ class MainActivity : AppCompatActivity() {
helper = VisualizerHelper(0)
visual.setPainterList(
helper, listOf(
Preset.getPresetWithIcon("cWaveRgbIcon", bitmap)
//Preset.getPresetWithIcon("cIcon", bitmap)
//Preset.getPresetWithIcon("cWaveRgbIcon", bitmap)
Preset.getPresetWithIcon("cIcon", bitmap)
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ class FftBar(
var yR: Float = 1f,
var wR: Float = 1f,
var gapX: Float = 0f,
var ampR: Float = 1f
var ampR: Float = 1f,
var enableBoost: Boolean = false
) : Painter() {

private var points = Array(0) { GravityModel() }

override fun draw(canvas: Canvas, helper: VisualizerHelper) {
val fft = helper.getFftMagnitudeRange(startHz, endHz)
var fft = helper.getFftMagnitudeRange(startHz, endHz)
if (isQuiet(fft)) return

val width = canvas.width.toFloat() * wR
if(enableBoost) fft = boost(fft)

when (mode) {
"mirror" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,18 @@ class FftLine(
var xR: Float = 0f,
var yR: Float = 1f,
var wR: Float = 1f,
var ampR: Float = 1f
var ampR: Float = 1f,
var enableBoost: Boolean = false
) : Painter() {

private var points = Array(0) { GravityModel() }

override fun draw(canvas: Canvas, helper: VisualizerHelper) {
val fft = helper.getFftMagnitudeRange(startHz, endHz)
var fft = helper.getFftMagnitudeRange(startHz, endHz)
if (isQuiet(fft)) return

val width = canvas.width.toFloat() * wR
if(enableBoost) fft = boost(fft)

when (mode) {
"mirror" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,19 @@ class FftWave(
var xR: Float = 0f,
var yR: Float = 1f,
var wR: Float = 1f,
var ampR: Float = 1f
var ampR: Float = 1f,
var enableBoost: Boolean = false
) : Painter() {

private val path = Path()
private var points = Array(0) { GravityModel() }

override fun draw(canvas: Canvas, helper: VisualizerHelper) {
val fft = helper.getFftMagnitudeRange(startHz, endHz)
var fft = helper.getFftMagnitudeRange(startHz, endHz)
if (isQuiet(fft)) return

val width = canvas.width.toFloat() * wR
if(enableBoost) fft = boost(fft)

when (mode) {
"mirror" -> {
Expand Down

0 comments on commit 7cdcb7e

Please sign in to comment.