示例#1
0
 ares( convertCommand, true, function() {         
     console.log( "DEFAULT" );
     console.log( convertCommand );   
     ares( originalConvertCommand, true, function() {
         console.log( "ORIGINAL" );
         console.log( originalConvertCommand );
         console.log( "FINISHED" );
         res.json( 200, successData );
     });
 });
示例#2
0
Router.prototype.upload = function( req, res ) {
    
    var file = req.body,
    	uploadID = uuid.v1(),
    	fileExtension = file.name.split('.').pop(),
        fileBuffer;

    var outputPath = config.upload_dir + '/' + uploadID + "." + fileExtension;

    // If the upload folder doesn't exist already, create it
    if( !fs.existsSync(config.upload_dir) ) {
        fs.mkdirSync( config.upload_dir );
    }
    
    // Load the file contents and write it to disk in our uploads folder
    file.contents = file.contents.split(',').pop();
    fileBuffer = new Buffer( file.contents, "base64" );
    fs.writeFileSync( outputPath, fileBuffer );

    var successData = {
    	guid: uploadID
    };

    if( dspModules[file.dsp].path != undefined ) {
        var fullName = uploadID + "." + file.dsp + "." + "default",
            inPath = "D:/Projects/MrsFaust/uploads/" + uploadID + ".wav",
            outPath = "D:/Projects/MrsFaust/processed/" + fullName + ".wav";

        tdsp.processFile( dspModules[file.dsp].path, inPath, outPath, dspModules[file.dsp].iInstance, dspModules[file.dsp].defaultPreset, dspModules[file.dsp] );

        var convertInputPath = "D:/Projects/MrsFaust/processed/" + fullName + ".wav",
            convertOutputPath = "D:/Projects/MrsFaust/processed/" + fullName + ".mp3",
            originalInputPath = "D:/Projects/MrsFaust/uploads/" + uploadID + ".wav",
            originalOutputPath = "D:/Projects/MrsFaust/processed/" + uploadID + ".original.mp3",
            convertCommand = 'C:/lame/lame.exe "' + convertInputPath + '" "' + convertOutputPath + '"',
            originalConvertCommand = 'C:/lame/lame.exe "' + originalInputPath + '" "' + originalOutputPath + '"';

        // Convert the 
        ares( convertCommand, true, function() {         
            console.log( "DEFAULT" );
            console.log( convertCommand );   
            ares( originalConvertCommand, true, function() {
                console.log( "ORIGINAL" );
                console.log( originalConvertCommand );
                console.log( "FINISHED" );
                res.json( 200, successData );
            });
        });
    } else {
    	console.log( "TRYING TO PROCESS WITH DSP THAT DOESN'T EXIST!");
    	console.log( file.dsp );
    	console.log( dspPaths );
    }    
}
示例#3
0
文件: spawner.js 项目: ZECTBynmo/leto
		return function( cb ) {
			// Change the current working directory if that setting is used
			if( step.workingdir != undefined ) {
				var oldCWD = process.cwd(),
					isRelative = step.isRelative || true,
					newCWD = isRelative ? leto_setup.__source + "/" + step.workingdir : step.workingdir;

				process.chdir( newCWD );
			}

			ares( step.command, true, cb );

			// Change the working directory back to what it was
			if( step.workingdir != undefined ) {
				process.chdir( oldCWD );
			}
		}
示例#4
0
        var onClose = function() {
            if( presetsFound.length == 0 ) {
                console.log( "No presets found matching key" );
                res.json( 500, {error:"No presets found matching key"} );
            } else {
                var preset = JSONB.parse(presetsFound[0].value);

                console.log( "PROCESSING PRESET" );
                console.log( preset );

                tdsp.processFile( dspModules[dspName].path, inPath, outPath, dspModules[dspName].iInstance, preset, dspModules[dspName] );

                var convertInputPath = "D:/Projects/MrsFaust/processed/" + fullName + ".wav",
                    convertOutputPath = "D:/Projects/MrsFaust/processed/" + fullName + ".mp3",
                    convertCommand = 'C:/lame/lame.exe "' + convertInputPath + '" "' + convertOutputPath + '"';

                console.log( convertCommand );

                ares( convertCommand, true, function() {
                    console.log( "FINISHED" );
                    res.json( 200, successData );
                });
            }
        }