#define EVENT_PULSE 0
+namespace TK80 {
+
void CMT::initialize()
{
mic = ear = pulse = false;
#define STATE_VERSION 2
-#include "../../statesub.h"
-
-void CMT::decl_state()
-{
- enter_decl_state(STATE_VERSION);
-
- DECL_STATE_ENTRY_BOOL(mic);
- DECL_STATE_ENTRY_BOOL(ear);
- DECL_STATE_ENTRY_BOOL(pulse);
- DECL_STATE_ENTRY_INT32(pulse_count);
-#if defined(_TK80BS)
- DECL_STATE_ENTRY_BOOL(play);
- DECL_STATE_ENTRY_BOOL(rec);
- DECL_STATE_ENTRY_STRING(rec_file_path, sizeof(rec_file_path) / sizeof(_TCHAR));
-
- DECL_STATE_ENTRY_CMT_RECORDING(fio, rec, rec_file_path);
-
- DECL_STATE_ENTRY_INT32(bufcnt);
- DECL_STATE_ENTRY_1D_ARRAY(buffer, sizeof(buffer));
-#endif
- leave_decl_state();
-}
-
-void CMT::save_state(FILEIO* state_fio)
-{
- if(state_entry != NULL) {
- state_entry->save_state(state_fio);
- }
-// state_fio->FputUint32(STATE_VERSION);
-// state_fio->FputInt32(this_device_id);
-
-// state_fio->FputBool(mic);
-// state_fio->FputBool(ear);
-// state_fio->FputBool(pulse);
-// state_fio->FputInt32(pulse_count);
-#if defined(_TK80BS)
-// state_fio->FputBool(play);
-// state_fio->FputBool(rec);
-// state_fio->Fwrite(rec_file_path, sizeof(rec_file_path), 1);
-// if(rec && fio->IsOpened()) {
-// int length_tmp = (int)fio->Ftell();
-// fio->Fseek(0, FILEIO_SEEK_SET);
-// state_fio->FputInt32(length_tmp);
-// while(length_tmp != 0) {
-// uint8_t buffer_tmp[1024];
-// int length_rw = min(length_tmp, (int)sizeof(buffer_tmp));
-// fio->Fread(buffer_tmp, length_rw, 1);
-// state_fio->Fwrite(buffer_tmp, length_rw, 1);
-// length_tmp -= length_rw;
-// }
-// } else {
-// state_fio->FputInt32(0);
-// }
-// state_fio->FputInt32(bufcnt);
-// state_fio->Fwrite(buffer, sizeof(buffer), 1);
-#endif
-}
-
-bool CMT::load_state(FILEIO* state_fio)
-{
- release_tape();
-
- bool mb = false;
- if(state_entry != NULL) {
- mb = state_entry->load_state(state_fio);
- }
- if(!mb) {
- return false;
- }
-// if(state_fio->FgetUint32() != STATE_VERSION) {
-// return false;
-// }
-// if(state_fio->FgetInt32() != this_device_id) {
-// return false;
-// }
-// mic = state_fio->FgetBool();
-// ear = state_fio->FgetBool();
-// pulse = state_fio->FgetBool();
-// pulse_count = state_fio->FgetInt32();
-//#if defined(_TK80BS)
-// play = state_fio->FgetBool();
-// rec = state_fio->FgetBool();
-// state_fio->Fread(rec_file_path, sizeof(rec_file_path), 1);
-// int length_tmp = state_fio->FgetInt32();
-// if(rec) {
-// fio->Fopen(rec_file_path, FILEIO_READ_WRITE_NEW_BINARY);
-// while(length_tmp != 0) {
-// uint8_t buffer_tmp[1024];
-// int length_rw = min(length_tmp, (int)sizeof(buffer_tmp));
-// state_fio->Fread(buffer_tmp, length_rw, 1);
-// if(fio->IsOpened()) {
-// fio->Fwrite(buffer_tmp, length_rw, 1);
-// }
-// length_tmp -= length_rw;
-// }
-// }
-// bufcnt = state_fio->FgetInt32();
-// state_fio->Fread(buffer, sizeof(buffer), 1);
-//#endif
- return true;
-}
-
bool CMT::process_state(FILEIO* state_fio, bool loading)
{
if(!state_fio->StateCheckUint32(STATE_VERSION)) {
#endif
return true;
}
+
+}