CC-430: Audio normalization (Replaygain Support)
-some minor fixes for default value (should be 0 dB not 1dB)
This commit is contained in:
parent
5c1af49252
commit
24349e64d8
|
@ -101,7 +101,7 @@ class CcFilesTableMap extends TableMap {
|
|||
$this->addColumn('SOUNDCLOUD_ERROR_MSG', 'DbSoundcloudErrorMsg', 'VARCHAR', false, 512, null);
|
||||
$this->addColumn('SOUNDCLOUD_LINK_TO_FILE', 'DbSoundcloudLinkToFile', 'VARCHAR', false, 4096, null);
|
||||
$this->addColumn('SOUNDCLOUD_UPLOAD_TIME', 'DbSoundCloundUploadTime', 'TIMESTAMP', false, 6, null);
|
||||
$this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'VARCHAR', false, 16, null);
|
||||
$this->addColumn('REPLAY_GAIN', 'DbReplayGain', 'VARCHAR', false, 16, '0');
|
||||
// validators
|
||||
} // initialize()
|
||||
|
||||
|
|
|
@ -412,6 +412,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
|
||||
/**
|
||||
* The value for the replay_gain field.
|
||||
* Note: this column has a database default value of: '0'
|
||||
* @var string
|
||||
*/
|
||||
protected $replay_gain;
|
||||
|
@ -471,6 +472,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$this->currentlyaccessing = 0;
|
||||
$this->length = '00:00:00';
|
||||
$this->file_exists = true;
|
||||
$this->replay_gain = '0';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2611,7 +2613,7 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
$v = (string) $v;
|
||||
}
|
||||
|
||||
if ($this->replay_gain !== $v) {
|
||||
if ($this->replay_gain !== $v || $this->isNew()) {
|
||||
$this->replay_gain = $v;
|
||||
$this->modifiedColumns[] = CcFilesPeer::REPLAY_GAIN;
|
||||
}
|
||||
|
@ -2661,6 +2663,10 @@ abstract class BaseCcFiles extends BaseObject implements Persistent
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($this->replay_gain !== '0') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// otherwise, everything was equal, so return TRUE
|
||||
return true;
|
||||
} // hasOnlyDefaultValues()
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
<column name="soundcloud_error_msg" phpName="DbSoundcloudErrorMsg" type="VARCHAR" size="512" required="false"/>
|
||||
<column name="soundcloud_link_to_file" phpName="DbSoundcloudLinkToFile" type="VARCHAR" size="4096" required="false"/>
|
||||
<column name="soundcloud_upload_time" phpName="DbSoundCloundUploadTime" type="TIMESTAMP" size="6" required="false"/>
|
||||
<column name="replay_gain" phpName="DbReplayGain" type="VARCHAR" size="16" required="false"/>
|
||||
<column name="replay_gain" phpName="DbReplayGain" type="VARCHAR" size="16" required="false" defaultValue="0"/>
|
||||
<foreign-key foreignTable="cc_subjs" name="cc_files_editedby_fkey">
|
||||
<reference local="editedby" foreign="id"/>
|
||||
</foreign-key>
|
||||
|
|
|
@ -124,7 +124,7 @@ CREATE TABLE "cc_files"
|
|||
"soundcloud_error_msg" VARCHAR(512),
|
||||
"soundcloud_link_to_file" VARCHAR(4096),
|
||||
"soundcloud_upload_time" TIMESTAMP(6),
|
||||
"replay_gain" VARCHAR(16),
|
||||
"replay_gain" VARCHAR(16) default '0',
|
||||
PRIMARY KEY ("id"),
|
||||
CONSTRAINT "cc_files_gunid_idx" UNIQUE ("gunid")
|
||||
);
|
||||
|
|
|
@ -28,8 +28,8 @@ def get_mime_type(file_path):
|
|||
|
||||
def calculate_replay_gain(file_path):
|
||||
"""
|
||||
This function accepts files of type mp3/ogg/flac and returns a calculated ReplayGain value.
|
||||
If the value cannot be calculated for some reason, then we default to 1.
|
||||
This function accepts files of type mp3/ogg/flac and returns a calculated ReplayGain value in dB.
|
||||
If the value cannot be calculated for some reason, then we default to 0 (Unity Gain).
|
||||
|
||||
TODO:
|
||||
Currently some of the subprocesses called will actually insert metadata into the file itself,
|
||||
|
@ -66,7 +66,7 @@ def calculate_replay_gain(file_path):
|
|||
pass
|
||||
#Log unknown file type.
|
||||
|
||||
replay_gain = 1
|
||||
replay_gain = 0
|
||||
if search:
|
||||
matches = search.groups()
|
||||
if len(matches) == 1:
|
||||
|
|
Loading…
Reference in New Issue