Mercurial > hg > dmlib
diff edmain.cpp @ 391:28a74940f2b6
More work on the editor.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 19 Oct 2012 04:30:24 +0300 |
parents | e5220ff48bc8 |
children | 5137db55f00b |
line wrap: on
line diff
--- a/edmain.cpp Fri Oct 19 04:30:01 2012 +0300 +++ b/edmain.cpp Fri Oct 19 04:30:24 2012 +0300 @@ -246,11 +246,48 @@ } +// Return audio track duration in milliseconds +int DemoEditor::getAudioTrackDuration() +{ + return timelineAudioTrack->getDuration(); +} + + +int DemoEditor::getTimelineDuration() +{ + return getAudioTrackDuration(); +} + + void DemoEditor::updateTimelineView() { - timelineWaveform->setOffset(20000); - timelineWaveform->setScale(10); - timelineWaveform->setTime(200010); + timelineAudioTrack->setOffset(currViewOffset); + timelineAudioTrack->setScale(currViewScale); +// timelineAudioTrack->setTime(currFrameTime); + + timelineScrollBar->setRange(0, getTimelineDuration() - timelineAudioTrack->getScaledWidth()); + timelineScrollBar->setValue(currViewOffset); +} + + +void DemoEditor::actionTimelineScrollChanged(int value) +{ + currViewOffset = value; + updateTimelineView(); +} + + +void DemoEditor::actionOffsetChanged(float value) +{ + currViewOffset = value; + updateTimelineView(); +} + + +void DemoEditor::actionTimeChanged(float value) +{ + currFrameTime = value; + updateTimelineView(); } @@ -258,6 +295,10 @@ { int err; + currViewOffset = 0; + currFrameTime = 0; + currViewScale = 1.0f; + // Initialize resource subsystem statusMsg("Initializing resources subsystem."); if ((err = reopenResources()) != DMERR_OK) @@ -291,7 +332,8 @@ } // Etc. - timelineWaveform->setWaveform( + demoView->setEngineData(&engine); + timelineAudioTrack->setWaveform( engine.audioRes->rdata, engine.audioRes->rdataSize, engine.optAfmt.format, engine.optAfmt.channels, engine.optAfmt.freq);