GithubHelp home page GithubHelp logo

jiubadao / droid-vizu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wotomas/droid-vizu

0.0 2.0 0.0 13.63 MB

Droid-vizu aims to provide customized visualization effects by easily swapping Renderer to get cool effects

License: Apache License 2.0

Java 93.89% Shell 6.11%

droid-vizu's Introduction

Droid-vizu

API Download

About

Droid-vizu aims to provide cool visualization effects for any Android audio project. Maintainable modular design allows users to easily swap Renderer class to get corresponding effects.

Demo (click for audio)

Implement

repositories {
  jcenter()
}

dependencies {
  compile 'info.kimjihyok:droid-vizu:${droid-vizu}'
}

XML Setup

    <!-- Vizualizer -->
    <info.kimjihyok.ripplesoundplayer.RippleVisualizerView
        android:id="@+id/renderer_demo"
        android:layout_margin="16dp"
        android:layout_width="match_parent"
        android:layout_height="50dp"/>
        
    <!-- Sample Player -->
    <info.kimjihyok.ripplesoundplayer.SoundPlayerView
        android:id="@+id/sound_player_view"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"/>    

Code Usage

Simply Provide RippleVisualizerViw with an prepared Android MediaPlayer and set with a corresponding renderer

    MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), R.raw.sound_file);  // or any other way to initialize media player are prepare()
    soundPlayerView = (SoundPlayerView) findViewById(R.id.sound_player_view);
    soundPlayerView.setMediaPlayer(mediaPlayer);
    soundPlayerView.setPlayStopListener(new SoundPlayerView.OnMediaControlListener() {
        @Override
        public void onPlay() {
          renderDemoView.play();
        }

        @Override
        public void onStop() {
          renderDemoView.stop();
        }
      });
      
    renderDemoView = (RippleVisualizerView) findViewById(R.id.renderer_demo);
    renderDemoView.setMediaPlayer(mediaPlayer);
    renderDemoView.setCurrentRenderer(renderer);

Renderer Information

Detailed information about parameters could be found in the source code!

ColorBarRenderer

  renderDemoView.setCurrentRenderer(new ColorfulBarRenderer(8, PaintUtil.getBarGraphPaint(Color.BLUE)
            , Color.parseColor("#FF0033")
            , Color.parseColor("#801AB3"))

BarRenderer

  new BarRenderer(16, PaintUtil.getBarGraphPaint(Color.WHITE));

LineRenderer

  new LineRenderer(PaintUtil.getLinePaint(Color.YELLOW));

Stop and Destory

// It is required to stop at onStop and to destory at onDestory to prevent memory leak and unexpected events
@Override
protected void onStop() {
  super.onStop();
  soundPlayerView.onStop();
  renderDemoView.stop();
}
 
@Override
protected void onDestroy() {
  super.onDestroy();
  soundPlayerView.onDestroy();
  renderDemoView.destroy();
}

droid-vizu's People

Contributors

dittopia-ai avatar

Watchers

James Cloos avatar gopher avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.