diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-06 15:36:03 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-06 15:36:03 +0200 |
| commit | fc1c3835501b97e5d15ac33bd812cd87b20aabad (patch) | |
| tree | 31f3a97d274d9236a4332c903acb3622395e73ca /app/client/modules/pix2wav | |
| parent | 87c606ed3b8c9867418e412044af871fe6447700 (diff) | |
compute number of frames that will be generated
Diffstat (limited to 'app/client/modules/pix2wav')
| -rw-r--r-- | app/client/modules/pix2wav/pix2wav.reducer.js | 10 | ||||
| -rw-r--r-- | app/client/modules/pix2wav/views/spectrogram.upload.js | 10 |
2 files changed, 13 insertions, 7 deletions
diff --git a/app/client/modules/pix2wav/pix2wav.reducer.js b/app/client/modules/pix2wav/pix2wav.reducer.js index c1ae51c..18caad7 100644 --- a/app/client/modules/pix2wav/pix2wav.reducer.js +++ b/app/client/modules/pix2wav/pix2wav.reducer.js @@ -17,22 +17,22 @@ const pix2wavReducer = (state = pix2wavInitialState, action) => { } switch (action.type) { - case types.wav2pix.loaded_buffer: + case types.wav2pix.load: return { ...state, status: 'Loaded buffer', } - case types.wav2pix.draw_progress: + case types.wav2pix.progress: return { ...state, status: 'Rendering frame ' + action.count, } - case types.wav2pix.draw_finish: + case types.wav2pix.finish: return { ...state, - status: 'Render complete', + status: action.message || 'Render complete', } - case types.wav2pix.load_zip: + case types.wav2pix.zip: return { ...state, status: 'Built zip file', diff --git a/app/client/modules/pix2wav/views/spectrogram.upload.js b/app/client/modules/pix2wav/views/spectrogram.upload.js index 7d2be1f..40e6159 100644 --- a/app/client/modules/pix2wav/views/spectrogram.upload.js +++ b/app/client/modules/pix2wav/views/spectrogram.upload.js @@ -96,6 +96,9 @@ class SpectrogramUpload extends Component { renderMetadata(file){ const { duration } = this.state const size = util.hush_size(file.size) + const total_frame_count = (duration * 44100 - wav2pixActions.FRAME_LENGTH) / this.state.frame_step + const frame_size = Math.round(wav2pixActions.FRAME_LENGTH / 44100 * 1000) + ' ms.' + const frame_step = Math.round(this.state.frame_step / 44100 * 1000) + ' ms.' return ( <div className='fileMetadata'> {file.size > 2 << 20 && @@ -108,6 +111,9 @@ class SpectrogramUpload extends Component { <Param title='Size'><span className={size[0]}>{size[1]}</span></Param> <Param title='Date'>{moment(file.lastModifiedDate).format("YYYY-MM-DD h:mm a")}</Param> <Param title='Duration'>{Math.floor(duration) + ' s.'}</Param> + <Param title='Frames'>{Math.floor(total_frame_count)}</Param> + <Param title='Frame Size'>{frame_size}</Param> + <Param title='Frame Step'>{frame_step}</Param> <br /> <Param title='Status'>{this.props.pix2wav.status}</Param> <br /> @@ -119,8 +125,8 @@ class SpectrogramUpload extends Component { value={this.state.name} /> <Slider - name='max frame count' - min={10} max={500} type='int' + name='Frame cutoff' + min={10} max={1000} type='int' value={this.state.max} onChange={max => this.setState({ max })} /> |
