Ejemplo n.º 1
0
/**
 * record audio from the Androids input channel, this stores only the incoming audio
 * not the remaining audio processed / generated by the engine
 *
 * aRecording        {bool} toggles the recording state
 * aMaxBuffers        {int} the total recorded buffer size to store in memory
 *                          before writing the recorded contents as .WAV file into
 *                          the given output directory.
 * aOutputDirectory {char*} name of the folder to write each snippet into
 */
void SequencerController::setRecordingFromDeviceState( bool aRecording, int aMaxBuffers, char* aOutputFile )
{
    // in case Sequencer was recording its output, halt recording of output
    if ( AudioEngine::recordOutputToDisk )
        setRecordingState( false, 0, ( char* ) "\0" );

    bool wasRecording              = AudioEngine::recordInputToDisk;
    AudioEngine::recordInputToDisk = aRecording;

    if ( AudioEngine::recordInputToDisk )
    {
        DiskWriter::prepare(
            std::string( aOutputFile ), roundTo( aMaxBuffers, AudioEngineProps::BUFFER_SIZE ),
            AudioEngineProps::INPUT_CHANNELS
        );
    }
    else if ( wasRecording )
    {
        // recording halted, write currently recording snippet into file
        // and concatenate all recorded snippets into the requested output file name
        // we can do this synchronously as this method is called from outside the
        // rendering thread and thus won't lead to buffer under runs

        DiskWriter::writeBufferToFile( DiskWriter::currentBufferIndex, false );

        if ( DiskWriter::finish())
            Notifier::broadcast( Notifications::RECORDING_COMPLETED );
    }
}
Ejemplo n.º 2
0
/**
 * when bouncing, the writing of buffers into the hardware is omitted
 * for an increase in bouncing speed (otherwise its real time)
 */
void SequencerController::setBounceState( bool aIsBouncing, int aMaxBuffers, char* aOutputFile )
{
    AudioEngine::bouncing = aIsBouncing;

    if ( AudioEngine::bouncing )
    {
        AudioEngine::bufferPosition = 0;
        AudioEngine::stepPosition   = 0;
    }
    setRecordingState( aIsBouncing, aMaxBuffers, aOutputFile );
}
Ejemplo n.º 3
0
void TvrUiWidget::stopMedia(){


    if(getRecordingState() || getRecordingPausedState()){
        tvr_stop_recorder_pipeline(rd);
        if(rd){
            g_free(rd);
            rd = NULL;
        }
        setRecordingState(false);
        setRecordingPausedState(false);
        setLastRecording(true);
    }

    if(getPlayingState() || getPlayingPausedState()){
        tvr_stop_player_pipeline(pd);
        if(pd){
            g_free(pd);
            pd = NULL;
        }

        if(playButtonClicked){
            playButtonClicked = false;
        }
        setPlayingState(false);
        setPlayingPausedState(false);
    }
        // Stop Timer
        t->stop();

        // Values need to be reset
        progBarValue = 0;
        retValue = 100;
        count = 0;
        seconds = 0;

        // Progress Bar needs to be reset
        tvrProgressBar->setValue(0);
        lengthFieldEditLabel->setText("0");

        // Close all states
        setFileOpenedState(false);
        setFileSaveState(false);

        // Set Buttons Status
        setButtonStatus(true, true, false, false, true, true);

        statusLabelEdit->setText("Stopped");


}
Ejemplo n.º 4
0
void TvrUiWidget::on_actionPaused_triggered(){

        if(getRecordingState()){
                setRecordingState(false);
                setRecordingPausedState(true);
                statusLabelEdit->setText("Recording : Paused");
                setButtonStatus(true, false, false, true, true, true);
                tvr_pause_recorder_pipeline(rd);
        }

        if(getPlayingState()){
                setPlayingState(false);
                setPlayingPausedState(true);
                statusLabelEdit->setText("Playing : Paused");
                setButtonStatus(false, true, false, true, true, true);
                tvr_pause_player_pipeline(pd);
        }

}
Ejemplo n.º 5
0
void TvrUiWidget::on_actionRecord_triggered(){

        if(!getRecordingState() && !getRecordingPausedState()){
                if(!getFileSavedState()){
                        if(isLRAvailable()) {
                                showSaveFileDlg();
                        }
                }
                setButtonStatus(false, false, true, true, true, true);
                rd = g_new0(recorder_data, 1);
                tvr_init_recorder(rd, tFile.toStdString().c_str());
                seconds = 0;
        }
        statusLabelEdit->setText("Recording ...");
        setRecordingState(true);
        setFileOpenedState(false);
        setButtonStatus(false, false, true, true, true, true);
        t->start(1000);
        tvr_play_recorder_pipeline(rd);
}