Subscribe

Multi-processor support

  1. 2007-10-09 08:30:07 PDT
    Hi there,
    any chance of adding multi-processor support so that it would run better on dual/triple/quad-core systems?
    Thanks.
  2. 2008-09-16 17:22:12 PDT
    Not sure which operating system are you using but I wrote this for windows xp and up. (xp home need tasklist.exe)

    Just change _file_locations to where your mp3s are and _max_processes to be just higher then your number of cores.

    save as .cmd
    http://dl.getdropbox.com/u/151504/mp3gain.cmd.txt
    <code>
    rem I, xiegeo@gmail.com release it under http://creativecommons.org/licenses/by/2.5/ca/
    @echo off & setlocal enableextensions enabledelayedexpansion

    set _file_locations= "C:\Documents and Settings\user\桌面\*.mp3"
    set _mp3gain_Location= "C:\Program Files\MP3Gain\mp3gain.exe"
    set /A _max_processes=3
    set /A _first_wait=4
    set /A _add_wait=1

    set /A _passed=0
    set /A _gains=0
    for /f "delims=" %%f in (
    'dir /a:-d /b %_file_locations% /S') do (
    echo "%%~ff"
    echo.
    %_mp3gain_Location% /s c "%%~ff"|find "mp3 gain change: 0"
    if !errorlevel! NEQ 0 (
    echo run mp3 gain
    rem /B -> Start application without creating a new window. Erase /B for multi window view, more clear exit, and easier debuging.
    START /low "%%~nf" /B %_mp3gain_Location% /r /c "%%~ff"
    call :wait_for_free_core %_first_wait%
    set /A _gains+=1
    ) else (
    set /A _passed+=1
    )
    echo ---------- Test next mp3 file -----------
    )
    DEL _temp 2>nul
    echo ++++++++++++++++++++++++++++++++++++++++++++
    echo Done seaching.
    echo Exit in 30s and when all jobs are done.
    echo Passed !_passed!, gains !_gains!.
    echo ++++++++++++++++++++++++++++++++++++++++++++
    PING -n 30 127.0.0.1>nul
    ENDLOCAL
    goto :EOF

    rem wait_for_free_core int-wait
    :wait_for_free_core
    @echo off & setlocal enableextensions enabledelayedexpansion
    tasklist|find "mp3gain.exe" /C > _temp
    SET /P _running=<_temp
    del _temp
    echo Running !_running! processes.
    if !_running! GEQ %_max_processes% (
    echo waiting for free core... test again in %1s
    PING -n %1 127.0.0.1>nul
    set /A _wait_time="%1"+ %_add_wait%
    call :wait_for_free_core !_wait_time!
    )
    ENDLOCAL
    goto :EOF
    </code>
    http://creativecommons.org/licenses/by/2.5/ca/
Jump To:
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.