CC-2301 : working on creating a crossfade method for waveforms.

This commit is contained in:
Naomi 2013-04-29 18:09:12 -04:00
parent 58957cc919
commit b2a490ac47
2 changed files with 56 additions and 2 deletions

View File

@ -417,6 +417,33 @@ class PlaylistController extends Zend_Controller_Action
$this->playlistUnknownError($e);
}
}
public function setCrossFadeAction()
{
$id = $this->_getParam('id');
$fadeIn = $this->_getParam('fadeIn', 0);
$fadeOut = $this->_getParam('fadeOut', 0);
$type = $this->_getParam('type');
$offset = $this->_getParam('offset', 0);
try {
$obj = $this->getPlaylist($type);
$response = $obj->changeFadeInfo($id, $fadeIn, $fadeOut);
if (!isset($response["error"])) {
$this->createUpdateResponse($obj);
$this->view->response = $response;
} else {
$this->view->fade_error = $response["error"];
}
} catch (PlaylistOutDatedException $e) {
$this->playlistOutdated($e);
} catch (PlaylistNotFoundException $e) {
$this->playlistNotFound($type);
} catch (Exception $e) {
$this->playlistUnknownError($e);
}
}
public function getPlaylistFadesAction()
{

View File

@ -645,12 +645,39 @@ SQL;
return array($fadeIn, $fadeOut);
}
/*
* create a crossfade from item in cc_playlist_contents with $id1 to item $id2.
*
* $fadeOut length of fade out in seconds if $id1
* $fadeIn length of fade in in seconds of $id2
* $offset time in seconds from end of $id1 that $id2 will begin to play.
*/
public function createCrossfade($id1, $id2, $fadeIn, $fadeOut, $offset)
{
$this->con->beginTransaction();
try {
$this->changeFadeInfo($id1, null, $fadeOut);
$this->changeFadeInfo($id2, $fadeIn, null);
$item = CcPlaylistcontentsQuery::create()->findPK($id2);
$item->setDbOffset($offset);
$item->save($this->con);
$this->con->commit();
} catch (Exception $e) {
$this->con->rollback();
throw $e;
}
}
/**
* Change fadeIn and fadeOut values for playlist Element
*
* @param int $pos
* position of audioclip in playlist
* @param int $id
* id of audioclip in playlist contents table.
* @param string $fadeIn
* new value in ss.ssssss or extent format
* @param string $fadeOut