/[svn]/linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/engines/common/InstrumentScriptVMFunctions.cpp

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

revision 3253 by schoenebeck, Tue May 30 12:08:45 2017 UTC revision 3255 by schoenebeck, Tue May 30 15:43:39 2017 UTC
# Line 1805  namespace LinuxSampler { Line 1805  namespace LinuxSampler {
1805          return successResult();          return successResult();
1806      }      }
1807    
1808        // change_play_pos() function
1809    
1810        InstrumentScriptVMFunction_change_play_pos::InstrumentScriptVMFunction_change_play_pos(InstrumentScriptVM* parent)
1811        : m_vm(parent)
1812        {
1813        }
1814    
1815        VMFnResult* InstrumentScriptVMFunction_change_play_pos::exec(VMFnArgs* args) {
1816            const ScriptID id = args->arg(0)->asInt()->evalInt();
1817            if (!id) {
1818                wrnMsg("change_play_pos(): note ID for argument 1 may not be zero");
1819                return successResult();
1820            }
1821            if (!id.isNoteID()) {
1822                wrnMsg("change_play_pos(): argument 1 is not a note ID");
1823                return successResult();
1824            }
1825    
1826            const int pos = args->arg(1)->asInt()->evalInt();
1827            if (pos < 0) {
1828                wrnMsg("change_play_pos(): playback position of argument 2 may not be negative");
1829                return successResult();
1830            }
1831    
1832            AbstractEngineChannel* pEngineChannel =
1833                static_cast<AbstractEngineChannel*>(m_vm->m_event->cause.pEngineChannel);
1834    
1835            NoteBase* pNote = pEngineChannel->pEngine->NoteByID( id.noteID() );
1836            if (!pNote) return successResult();
1837    
1838            pNote->Override.SampleOffset = pos;
1839    
1840            return successResult();
1841        }
1842    
1843      // event_status() function      // event_status() function
1844    
1845      InstrumentScriptVMFunction_event_status::InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent)      InstrumentScriptVMFunction_event_status::InstrumentScriptVMFunction_event_status(InstrumentScriptVM* parent)

Legend:
Removed from v.3253  
changed lines
  Added in v.3255

  ViewVC Help
Powered by ViewVC