CC-4754: Replay gain modifier

- Initial commit
This commit is contained in:
james 2012-12-27 00:36:11 -05:00
parent b78fa5129f
commit c0665e4748
6 changed files with 61 additions and 2 deletions

View file

@ -66,6 +66,7 @@ class PreferenceController extends Zend_Controller_Action
Application_Model_Preference::SetSoundCloudGenre($values["SoundCloudGenre"]); Application_Model_Preference::SetSoundCloudGenre($values["SoundCloudGenre"]);
Application_Model_Preference::SetSoundCloudTrackType($values["SoundCloudTrackType"]); Application_Model_Preference::SetSoundCloudTrackType($values["SoundCloudTrackType"]);
Application_Model_Preference::SetSoundCloudLicense($values["SoundCloudLicense"]); Application_Model_Preference::SetSoundCloudLicense($values["SoundCloudLicense"]);
Application_Model_Preference::setReplayGainModifier($values["replayGainModifier"]);
$this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>"; $this->view->statusMsg = "<div class='success'>". _("Preferences updated.")."</div>";
$this->view->form = $form; $this->view->form = $form;

View file

@ -74,6 +74,13 @@ class Application_Form_GeneralPreferences extends Zend_Form_SubForm
$week_start_day->setValue(Application_Model_Preference::GetWeekStartDay()); $week_start_day->setValue(Application_Model_Preference::GetWeekStartDay());
$week_start_day->setDecorators(array('ViewHelper')); $week_start_day->setDecorators(array('ViewHelper'));
$this->addElement($week_start_day); $this->addElement($week_start_day);
$replay_gain = new Zend_Form_Element_Hidden("replayGainModifier");
$replay_gain->setLabel(_("Replay Gain Modifier"))
->setValue(Application_Model_Preference::getReplayGainModifier())
->setAttribs(array('style' => "border: 0; color: #f6931f; font-weight: bold;"))
->setDecorators(array('ViewHelper'));
$this->addElement($replay_gain);
} }
private function getTimezones() private function getTimezones()

View file

@ -1183,4 +1183,19 @@ class Application_Model_Preference
$data = self::getValue("nowplaying_screen", true); $data = self::getValue("nowplaying_screen", true);
return ($data != "") ? unserialize($data) : null; return ($data != "") ? unserialize($data) : null;
} }
public static function getReplayGainModifier(){
$rg_modifier = self::getValue("replay_gain_modifier");
if ($rg_modifier === "") {
return "0";
}
return $rg_modifier;
}
public static function setReplayGainModifier($rg_modifier)
{
self::setValue("replay_gain_modifier", $rg_modifier, true);
}
} }

View file

@ -679,6 +679,8 @@ SQL;
$same_hour = $start_hour == $end_hour; $same_hour = $start_hour == $end_hour;
$independent_event = !$same_hour; $independent_event = !$same_hour;
$replay_gain = is_null($item["replay_gain"]) ? "0": $item["replay_gain"];
$replay_gain += Application_Model_Preference::getReplayGainModifier();
$schedule_item = array( $schedule_item = array(
'id' => $media_id, 'id' => $media_id,
@ -692,7 +694,7 @@ SQL;
'start' => $start, 'start' => $start,
'end' => $end, 'end' => $end,
'show_name' => $item["show_name"], 'show_name' => $item["show_name"],
'replay_gain' => is_null($item["replay_gain"]) ? "0": $item["replay_gain"], 'replay_gain' => $replay_gain,
'independent_event' => $independent_event, 'independent_event' => $independent_event,
); );
self::appendScheduleItem($data, $start, $schedule_item); self::appendScheduleItem($data, $start, $schedule_item);

View file

@ -108,6 +108,23 @@
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </dd>
<dt id="replayGainModifier-label" class="block-display">
<label><?php echo $this->element->getElement('replayGainModifier')->getLabel() ?>:
</label>
<span id="rg_modifier_value" style="border: 0; color: #f6931f; font-weight: bold;">
<?php echo $this->element->getElement('replayGainModifier')->getValue() ?>
</span>
</dt>
<dd id="replayGainModifier-element" class="block-display">
<?php echo $this->element->getElement('replayGainModifier') ?>
<?php if($this->element->getElement('replayGainModifier')->hasErrors()) : ?>
<ul class='errors'>
<?php foreach($this->element->getElement('replayGainModifier')->getMessages() as $error): ?>
<li><?php echo $error; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<div id="slider-range-max"></div>
</dd>
</dl> </dl>
</fieldset> </fieldset>

View file

@ -80,6 +80,20 @@ function setMsAuthenticationFieldsReadonly(ele) {
} }
} }
function setSliderForReplayGain(){
$( "#slider-range-max" ).slider({
range: "max",
min: 0,
max: 10,
value: $("#rg_modifier_value").html(),
slide: function( event, ui ) {
$( "#replayGainModifier" ).val( ui.value );
$("#rg_modifier_value").html(ui.value);
}
});
$( "#replayGainModifier" ).val( $( "#slider-range-max" ).slider( "value" ) );
}
$(document).ready(function() { $(document).ready(function() {
$('.collapsible-header').live('click',function() { $('.collapsible-header').live('click',function() {
@ -97,6 +111,7 @@ $(document).ready(function() {
$('#content').empty().append(json.html); $('#content').empty().append(json.html);
setTimeout(removeSuccessMsg, 5000); setTimeout(removeSuccessMsg, 5000);
showErrorSections(); showErrorSections();
setSliderForReplayGain();
}); });
}); });
@ -106,4 +121,6 @@ $(document).ready(function() {
setSystemFromEmailReadonly(); setSystemFromEmailReadonly();
setConfigureMailServerListener(); setConfigureMailServerListener();
setEnableSystemEmailsListener(); setEnableSystemEmailsListener();
setSliderForReplayGain();
}); });