Beispiel #1
0
 bool forward()
 {
     playIndex_++;
     if (playIndex_ >= playList_.size())
     {
         playIndex_ = playList_.size() - 1;
         return false;
     }
     else
     {
         return true;
     }
 }
Beispiel #2
0
 void play()
 {
     syscall_get_io();
     for (uint32_t i = playIndex_; i < playList_.size(); i++)
     {
         string path = APPLICATION_DATA_DIR"/" + playList_[i];
         scoped_ptr<SharedMemory> shm(monapi_file_read_all(path.c_str()));
         if (NULL == shm.get() || shm->size() == 0) return;
         string mml = string((char*)shm->data(), shm->size());
         statusLabel_->setText(beeper_.title(mml.c_str()).c_str());
         beeper_.play(mml.c_str());
         beeper_.rest(1000);
     }
     playIndex_ = 0;
     playButton_->revert();
 }
Beispiel #3
0
 void play()
 {
     syscall_get_io();
     for (uint32_t i = playIndex_; i < playList_.size(); i++)
     {
         string path = APPLICATION_DATA_DIR"/" + playList_[i];
         monapi_cmemoryinfo* mi = monapi_file_read_all(path.c_str());
         if (NULL == mi || mi->Size == 0) return;
         string mml = string((char*)mi->Data, mi->Size);
         statusLabel_->setText(beeper_.title(mml.c_str()).c_str());
         beeper_.play(mml.c_str());
         beeper_.rest(1000);
     }
     playIndex_ = 0;
     playButton_->revert();
 }
Beispiel #4
0
    bool readPlayList()
    {
        scoped_ptr<SharedMemory> shm(monapi_file_read_directory(APPLICATION_DATA_DIR));
        if (NULL == shm.get()) return false;
        int size = *(int*)shm->data();
        if (size == 0) return false;

        monapi_directoryinfo* p = (monapi_directoryinfo*)shm->data()[sizeof(int)];
        for (int i = 0; i < size; i++, p++)
        {
            string file = p->name;

            if (StringHelper::endsWith(file, ".MML"))
            {
                playList_.push_back(file);
            }
        }
        return playList_.size() != 0;
    }
Beispiel #5
0
    bool readPlayList()
    {
        monapi_cmemoryinfo* mi = monapi_file_read_directory(APPLICATION_DATA_DIR);
        if (NULL == mi) return false;
        int size = *(int*)mi->Data;
        if (size == 0) return false;

        monapi_directoryinfo* p = (monapi_directoryinfo*)&mi->Data[sizeof(int)];
        for (int i = 0; i < size; i++, p++)
        {
            string file = p->name;

            if (StringHelper::endsWith(file, ".MML"))
            {
                playList_.push_back(file);
            }
        }
        monapi_cmemoryinfo_dispose(mi);
        monapi_cmemoryinfo_delete(mi);
        return playList_.size() != 0;
    }