mirror of
https://github.com/radio95-rnt/rds95.git
synced 2026-02-26 20:33:53 +01:00
on_state
This commit is contained in:
@@ -24,6 +24,10 @@ function on_init() end
|
|||||||
---It should be defined by the user in the script.
|
---It should be defined by the user in the script.
|
||||||
---@return nil
|
---@return nil
|
||||||
function on_start() end
|
function on_start() end
|
||||||
|
---This function is called every time when the state resets, register your odas here
|
||||||
|
---It should be defined by the user in the script.
|
||||||
|
---@return nil
|
||||||
|
function on_state() end
|
||||||
---This function is called every second
|
---This function is called every second
|
||||||
---It should be defined by the user in the script.
|
---It should be defined by the user in the script.
|
||||||
---@return nil
|
---@return nil
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ int lua_set_rds_program_defaults(lua_State *localL) {
|
|||||||
unload_refs[0] = 0;
|
unload_refs[0] = 0;
|
||||||
set_rds_defaults(mod->enc, mod->enc->program);
|
set_rds_defaults(mod->enc, mod->enc->program);
|
||||||
lua_call_function("on_init");
|
lua_call_function("on_init");
|
||||||
|
lua_call_function("on_state");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ int lua_reset_rds(lua_State *localL) {
|
|||||||
encoder_loadFromFile(mod->enc);
|
encoder_loadFromFile(mod->enc);
|
||||||
for(int i = 0; i < PROGRAMS; i++) reset_rds_state(mod->enc, i);
|
for(int i = 0; i < PROGRAMS; i++) reset_rds_state(mod->enc, i);
|
||||||
Modulator_loadFromFile(&mod->params);
|
Modulator_loadFromFile(&mod->params);
|
||||||
|
lua_call_function("on_state");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -414,5 +414,6 @@ void init_rds_encoder(RDSEncoder* enc) {
|
|||||||
}
|
}
|
||||||
for(int i = 0; i < PROGRAMS; i++) reset_rds_state(enc, i);
|
for(int i = 0; i < PROGRAMS; i++) reset_rds_state(enc, i);
|
||||||
lua_call_function("on_start");
|
lua_call_function("on_start");
|
||||||
|
lua_call_function("on_state");
|
||||||
encoder_saveToFile(enc);
|
encoder_saveToFile(enc);
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user