3
interface RESAMPLERInterface {
4
function Resample($data, $flags = 0);
7
abstract class RESAMPLER implements RESAMPLERInterface {
10
function __construct(REQUEST $req = NULL, array $options = NULL , $sampling = false) {
11
$this->options = $options?$options:array();
14
function GetOption($opt, $default = false) {
15
if (isset($this->options[$opt])) return $this->options[$opt];
19
function GetNumberOfChannels($data) {
20
// We can compute later
21
return $data['info']['n_channels'];
24
static function IsApplicable($sampling = false) {
31
static function GetResampler(REQUEST $req = NULL, $resampler, $sampling = false) {
32
global $ADEI_RESAMPLERS;
34
$cfg = $ADEI_RESAMPLERS[$resampler];
35
if (!$cfg) throw new ADEIException(translate("Unsupported resampler (%s) is configured", $resampler));
37
ADEI::RequireClass("resamplers/" . strtolower($cfg['handler']), true);
38
$r = new $cfg['handler']($req, $cfg['opts'], $sampling);
42
static function GetSelectList($sampling = false) {
44
global $ADEI_RESAMPLERS;
47
foreach ($ADEI_RESAMPLERS as $name => $cfg) {
48
ADEI::RequireClass("resamplers/" . strtolower($cfg['handler']), true);
50
if ($cfg['handler']::IsApplicable($sampling)) {
51
array_push($res, array(
53
'label' => $cfg['title'],
61
static function GetMethods() {
62
global $ADEI_RESAMPLERS;
64
$root = ADEI::GetRootDir();
65
$setup = ADEI::GetSetupDir();
67
$names = array_merge(glob("$setup/classes/resamplers/*.php"), glob("$root/classes/resamplers/*.php"));
68
foreach ($names as &$name) {
69
$name = basename($name, ".php");
71
$names = array_uniq($names);
73
foreach $names as $name {
74
ADEI::RequireClass("resamplers/$name");
b'\\ No newline at end of file'