Ignore:
Timestamp:
10/11/06 00:55:36 (6 years ago)
Author:
sys
Message:

ModelingSound...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Jav_Audio/com/scenari/s/audio/transform/TransformerSox.java

    r6850 r6853  
    9595                ArrayList vCmds = new ArrayList(32); 
    9696            vCmds.add(new File(sUrlExe).getCanonicalPath()); 
     97                if(pVolume>=0 && pVolume < 1) { 
     98                        vCmds.add("-v"); 
     99                        vCmds.add(Float.toString(pVolume)); 
     100                } 
    97101            vCmds.add(pSrc.getCanonicalPath()); 
    98102            vTmp = setParamDst(vCmds, vEncod, pDst); 
     103             
     104            if(pStart > 0 || pEnd >= 0) { 
     105                vCmds.add("trim"); 
     106                vCmds.add(serializeSoxTc(pStart)); 
     107                if(pEnd >= pStart) vCmds.add(serializeSoxTc(pEnd - pStart)); 
     108            } 
     109             
     110            if(pFadeIn>0 || (pFadeOut > 0 && pEnd >= 0) ) { 
     111                vCmds.add("fade"); 
     112                vCmds.add("q"); 
     113                vCmds.add(serializeSoxTc(pFadeIn)); 
     114                if(pFadeOut > 0) { 
     115                        vCmds.add(serializeSoxTc(pEnd - pStart)); 
     116                        vCmds.add(serializeSoxTc(pFadeOut)); 
     117                } 
     118            } 
     119             
    99120             
    100121            String[] vCommands = (String[])vCmds.toArray(new String[vCmds.size()]); 
     
    114135                        } 
    115136        } 
     137        } 
     138         
     139 
     140        /** 
     141         * Sérialize d'un timeCode. 
     142         */ 
     143        public static String serializeSoxTc(float pTc){ 
     144                if(pTc == 0) return "0"; 
     145                String vH = null; 
     146                if(pTc>3600){ 
     147                        vH = Integer.toString((int) (pTc / 3600)); 
     148                        pTc = pTc % 3600; 
     149                } 
     150                String vM = null; 
     151                if(pTc>60){ 
     152                        vM = Integer.toString((int) (pTc / 60)); 
     153                        pTc = pTc % 60; 
     154                } 
     155                if(vH == null && vM == null) return Float.toString(pTc); 
     156                StringBuffer vBuf = new StringBuffer(12); 
     157                if(vH != null) { 
     158                        vBuf.append(vH); 
     159                        vBuf.append(':'); 
     160                } 
     161                if(vM != null) { 
     162                        vBuf.append(vM); 
     163                        vBuf.append(':'); 
     164                } 
     165                vBuf.append(Float.toString(pTc)); 
     166                return vBuf.toString(); 
    116167        } 
    117168         
Note: See TracChangeset for help on using the changeset viewer.