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) |