Class: MusicMaster::Launcher

Inherits:
Object
  • Object
show all
Includes:
FilesNamer, RakeProcesses, Utils
Defined in:
lib/MusicMaster/Launcher.rb

Constant Summary

Constants included from Utils

Utils::OPTIM_DEBUG, Utils::OPTIM_GROUPS

Instance Method Summary collapse

Methods included from RakeProcesses

#displayRakeTasks, #generateRakeFor_CalibrateRecordings, #generateRakeFor_CleanRecordings, #generateRakeFor_Deliver, #generateRakeFor_GenerateSourceFiles, #generateRakeFor_Mix, #generateRakeFor_ProcessSourceFiles, #initialize_RakeProcesses

Methods included from FilesNamer

#getAnalyzedRecordedDir, #getCalibratedDir, #getCalibratedFileName, #getCleanedDir, #getCutFileName, #getDCRemovedFileName, #getDeliverDir, #getFinalMixDir, #getFinalMixFileName, #getMixDir, #getMixFileName, #getNoiseGateFileName, #getProcessedFileName, #getProcessesRecordDir, #getProcessesWaveDir, #getRecordedAnalysisFileName, #getRecordedCalibrationFileName, #getRecordedDir, #getRecordedFFTProfileFileName, #getRecordedFileName, #getRecordedSilenceFileName, #getSilenceRemovedFileName, #getWaveDir, #getWaveSourceFileName

Methods included from Utils

#analyzeFile, #fftProfileFile, #getAnalysis, #getDCOffsets, #getRMSValue, #getThresholds, #initialize_Utils, #optimizeProcesses, #optimizeProcessesByGroups, readStrRatio, #record, #shiftThresholdsByDCOffset, #wsk

Constructor Details

#initializeLauncher

Constructor



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/MusicMaster/Launcher.rb', line 21

def initialize
  parsePlugins
  @DisplayHelp = false
  @Debug = false

  require 'optparse'
  @Options = OptionParser.new
  @Options.banner = "#{$0} [--help] [--debug] #{getOptionsBanner} <ConfigFile>"
  @Options.on( '--help',
    'Display help') do
    @DisplayHelp = true
  end
  @Options.on( '--debug',
    'Activate debug logs') do
    @Debug = true
  end
  completeOptionParser(@Options)
end

Instance Method Details

#execute(iArgs) ⇒ Object

Execute the process

Parameters
  • iArgs (list<String>): The list of arguments

Return
  • Integer: The error code



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/MusicMaster/Launcher.rb', line 46

def execute(iArgs)
  rErrorCode = 0

  lError = nil
  lConfFileName = nil
  begin
    lRemainingArgs = @Options.parse(iArgs)
    if ((lRemainingArgs.size != 1) and
        (!@DisplayHelp))
      lError = RuntimeError.new("Please specify 1 config file (specified: \"#{lRemainingArgs.join(' ')}\")")
    end
    lConfFileName = lRemainingArgs.first
  rescue Exception
    lError = $!
  end
  if (lError == nil)
    if (@DisplayHelp)
      puts @Options
    else
      if (@Debug)
        activate_log_debug(true)
      end
      # Read the MusicMaster configuration
      begin
        @MusicMasterConf = get_musicmaster_conf
      rescue Exception
        lError = $!
      end
      if (lError == nil)
        # Read configuration
        lError, lRecordConf = readConf(lConfFileName)
        if (lError == nil)
          # Check the conf. This is dependent on the process
          lError = checkConf(lRecordConf)
          if (lError == nil)
            @RecordConf = lRecordConf
            initialize_Utils
            begin
              lRakeTarget = getRakeTarget
            rescue
              lError = $!
            end
            if (lError == nil)
              if debug_activated?
                Rake::application.options.trace = true
                displayRakeTasks
              end
              begin
                Rake::Task[lRakeTarget].invoke
              rescue
                lError = $!
              end
              log_info 'Processed finished successfully.' if (lError == nil)
            end
          end
        end
      end
    end
  end
  if (lError != nil)
    log_err "#{lError}#{(debug_activated? and lError.backtrace) ? "\n#{lError.backtrace.join("\n")}" : ''}"
    rErrorCode = 1
  end

  return rErrorCode
end