diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 20:41:34 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-06-07 20:41:34 +0200 |
| commit | 34df2ca203ea934537edb490b8cb632cee650f65 (patch) | |
| tree | 1e05e2758c1c41abd13a82e62ff509d93a208173 /public/bundle.js | |
| parent | f9ad8a4c20554bafaa5961ff44af0cec3f65fdb0 (diff) | |
send as png
Diffstat (limited to 'public/bundle.js')
| -rw-r--r-- | public/bundle.js | 60 |
1 files changed, 56 insertions, 4 deletions
diff --git a/public/bundle.js b/public/bundle.js index e292bc6..495ae78 100644 --- a/public/bundle.js +++ b/public/bundle.js @@ -5663,6 +5663,8 @@ exports.default = liveReducer; Object.defineProperty(exports, "__esModule", { value: true }); +exports.startSynthesizing = startSynthesizing; +exports.stopSynthesizing = stopSynthesizing; exports.startRecording = startRecording; exports.stopRecording = stopRecording; exports.saveFrame = saveFrame; @@ -5680,16 +5682,26 @@ var _types2 = _interopRequireDefault(_types); var _pix2wav = __webpack_require__(/*! ../audio/pix2wav */ "./app/client/audio/pix2wav.js"); -var _pix2wav2 = _interopRequireDefault(_pix2wav); +var pix2wav = _interopRequireWildcard(_pix2wav); + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var fps = 0, last_frame = void 0; var recording = false, - saving = false; + saving = false, + synthesizing = false; var videoWriter = void 0; +function startSynthesizing() { + synthesizing = true; +} +function stopSynthesizing() { + synthesizing = false; +} + function startRecording() { videoWriter = new _whammy2.default.Video(10); recording = true; @@ -5729,6 +5741,10 @@ function onFrame(data) { URL.revokeObjectURL(url); var ctx = canvas.getContext('2d-lodpi'); ctx.drawImage(img, 0, 0, canvas.width, canvas.height); + if (synthesizing) { + var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); + pix2wav.play({ imageData: imageData }); + } if (recording) { console.log('record frame'); videoWriter.add(canvas); @@ -7994,7 +8010,7 @@ var live_task = exports.live_task = function live_task(sequence, checkpoint) { dataset: sequence, checkpoint: checkpoint, opt: { - poll_delay: 1.0 + poll_delay: 0.2 } }; console.log(task); @@ -8031,6 +8047,8 @@ var _common = __webpack_require__(/*! ../../../common/ */ "./app/client/common/i var _player = __webpack_require__(/*! ../../../live/player */ "./app/client/live/player.js"); +var playerActions = _interopRequireWildcard(_player); + var _live = __webpack_require__(/*! ../../../live/live.actions */ "./app/client/live/live.actions.js"); var liveActions = _interopRequireWildcard(_live); @@ -8154,7 +8172,41 @@ var Pix2WavLive = function (_Component) { return (0, _preact.h)( 'div', { className: 'app pix2wav centered' }, - (0, _preact.h)(_common.Player, { width: 256, height: 256 }), + (0, _preact.h)( + 'div', + { className: 'row' }, + (0, _preact.h)( + 'div', + { className: 'column' }, + (0, _preact.h)(_common.Player, { width: 256, height: 256 }) + ), + (0, _preact.h)( + 'div', + { className: 'params column audioParams' }, + (0, _preact.h)( + _common.Group, + { title: 'Audio playback' }, + (0, _preact.h)( + _common.Button, + { title: 'Start playback', + onClick: function onClick() { + return playerActions.startSynthesizing(); + } + }, + 'Start' + ), + (0, _preact.h)( + _common.Button, + { title: 'Stop playback', + onClick: function onClick() { + return playerActions.stopSynthesizing(); + } + }, + 'Stop' + ) + ) + ) + ), (0, _preact.h)( 'div', { className: 'params row' }, |
