/[svn]/linuxsampler/trunk/src/scriptvm/CoreVMFunctions.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/CoreVMFunctions.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2598 by schoenebeck, Fri Jun 6 12:38:54 2014 UTC revision 2619 by schoenebeck, Wed Jun 11 13:24:32 2014 UTC
# Line 10  Line 10 
10  #include "CoreVMFunctions.h"  #include "CoreVMFunctions.h"
11    
12  #include <iostream>  #include <iostream>
13    #include <math.h>
14    #include <stdlib.h>
15  #include "tree.h"  #include "tree.h"
16  #include "ScriptVM.h"  #include "ScriptVM.h"
17    
# Line 84  VMFnResult* CoreVMFunction_wait::exec(VM Line 86  VMFnResult* CoreVMFunction_wait::exec(VM
86      return &result;      return &result;
87  }  }
88    
89    bool CoreVMFunction_abs::acceptsArgType(int iArg, ExprType_t type) const {
90        return type == INT_EXPR;
91    }
92    
93    VMFnResult* CoreVMFunction_abs::exec(VMFnArgs* args) {
94        return successResult( ::abs(args->arg(0)->asInt()->evalInt()) );
95    }
96    
97    bool CoreVMFunction_random::acceptsArgType(int iArg, ExprType_t type) const {
98        return type == INT_EXPR;
99    }
100    
101    VMFnResult* CoreVMFunction_random::exec(VMFnArgs* args) {
102        int iMin = args->arg(0)->asInt()->evalInt();
103        int iMax = args->arg(1)->asInt()->evalInt();
104        float f = float(::random()) / float(RAND_MAX);
105        return successResult(
106            iMin + roundf( f * float(iMax - iMin) )
107        );
108    }
109    
110    bool CoreVMFunction_num_elements::acceptsArgType(int iArg, ExprType_t type) const {
111        return type == INT_ARR_EXPR;
112    }
113    
114    VMFnResult* CoreVMFunction_num_elements::exec(VMFnArgs* args) {
115        return successResult( args->arg(0)->asIntArray()->arraySize() );
116    }
117    
118  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2598  
changed lines
  Added in v.2619

  ViewVC Help
Powered by ViewVC