Intuz-production / Audio-Trimmer-Android

MIT License
49 stars 18 forks source link

I need to set min or max audio trimming concept. #4

Open avik-capitalnumbers opened 4 years ago

avik-capitalnumbers commented 4 years ago

Hi Intuz-production ,

Thanks Intuz-production, this is really awesome product for audio trimming. This is not regarding issue. I want to implement a new feature for audio trimmer. so i need to set max and min time set for both ends. like minimum audio time set must be 10 sec and maximum time set must be like 30 sec.

This is my idea. also i am trying to implement that, if you kindly help me out , it will be helpful for me as well as for this product.

Thanks, Avik

blazingdevil44 commented 4 years ago

did u find how to limit marker?

avik-capitalnumbers commented 4 years ago

Yes its possible. currently i am working with it.

venkat6666 commented 4 years ago

Hi Intuz-production ,

Thanks Intuz-production, this is really awesome product for audio trimming. This is not regarding issue. I want to implement a new feature for audio trimmer. so i need to set max and min time set for both ends. like minimum audio time set must be 10 sec and maximum time set must be like 30 sec.

This is my idea. also i am trying to implement that, if you kindly help me out , it will be helpful for me as well as for this product.

Thanks, Avik

Hii, i to have same requirement will you please help me to do that.

avik-capitalnumbers commented 4 years ago

Yes sure. Already I have done this feature. let me check from my end, Because I forget right now. I will send code or file to you.

Thanks man Don't worry.

iharshb commented 4 years ago

Thanks for this amazing demo. Want to set minimum audio time to 20 sec. Waiting for your reply @avik-capitalnumbers .

avik-capitalnumbers commented 4 years ago

***Your own class change the method:-

private void resetPositions() { mStartPos = audioWaveform.secondsToPixels(0.0); mEndPos = audioWaveform.secondsToPixels(30.0); }

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

*** You have to handle you code here.

@Override public void markerTouchMove(MarkerView marker, float x) {

    float delta = x - registrationView2.mTouchStart;
    Log.d("delta","::::::::::::::::::::::::"+delta);

    if (marker == registrationView2.markerStart) {

        Log.d("markerEnd.mStartPos",":::"+registrationView2.mStartPos);
        Log.d("markerEnd.mEndPos",":::"+registrationView2.mEndPos);

        Log.d("DISTANCE",":::"+(Float.parseFloat(registrationView2.formatTime(registrationView2.mEndPos)) -
                (Float.parseFloat(registrationView2.formatTime(registrationView2.mStartPos)))));

        if(delta>=0){
            registrationView2.mStartPos = registrationView2.trap((int) (registrationView2.mTouchInitialStartPos + delta));
        }

        if (Float.parseFloat(registrationView2.formatTime(registrationView2.mEndPos)) -
                (Float.parseFloat(registrationView2.formatTime(registrationView2.mStartPos)))<=30.00) {
            registrationView2.mStartPos = registrationView2.trap((int) (registrationView2.mTouchInitialStartPos + delta));
            //registrationView2.mEndPos = registrationView2.trap((int) (registrationView2.mTouchInitialEndPos + delta));
        }

    } else {

        Log.d("markerEnd.mStartPos",":::"+registrationView2.mStartPos);
        Log.d("markerEnd.mEndPos",":::"+registrationView2.mEndPos);

        Log.d("DISTANCE",":::"+(Float.parseFloat(registrationView2.formatTime(registrationView2.mEndPos)) -
                (Float.parseFloat(registrationView2.formatTime(registrationView2.mStartPos)))));

        if(delta<-1){
            registrationView2.mEndPos = registrationView2.trap((int) (registrationView2.mTouchInitialEndPos + delta));
        }

        Log.d("CHECK",":::"+(Float.parseFloat(registrationView2.formatTime(registrationView2.mEndPos)))+"|||"+(Float.parseFloat(registrationView2.formatTime(registrationView2.mStartPos))));

        if ((Float.parseFloat(registrationView2.formatTime(registrationView2.mEndPos)) -
                (Float.parseFloat(registrationView2.formatTime(registrationView2.mStartPos))))<=30.00) {

            registrationView2.mEndPos = registrationView2.trap((int) (registrationView2.mTouchInitialEndPos + delta));
            if (registrationView2.mEndPos < registrationView2.mStartPos)
                registrationView2.mEndPos = registrationView2.mStartPos;

        }else {
            Log.d("markerEnd.mEndPos",":::::::::::WRONG");

            /*if((Float.parseFloat(registrationView2.formatTime(registrationView2.mEndPos)) -
                    (Float.parseFloat(registrationView2.formatTime(registrationView2.mStartPos))))>30.00){
                registrationView2.mEndPos = registrationView2.mEndPos
                        -registrationView2.audioWaveform.secondsToPixels((Float.parseFloat(registrationView2.formatTime(registrationView2.mEndPos)) -
                        (Float.parseFloat(registrationView2.formatTime(registrationView2.mStartPos))))-30);

            }*/

        }

    }

    registrationView2.updateDisplay();
}
faisalnaeem7000 commented 2 years ago

Hi, thanks for this wonderful help. But after saving wav file its empty. Could you please help that out?