[DEV] add previous remover in recorder
This commit is contained in:
parent
6bbe793e3f
commit
f186689fb6
@ -81,6 +81,11 @@ void appl::Windows::init() {
|
||||
composition += " Next\n";
|
||||
composition += " </label>\n";
|
||||
composition += " </button>\n";
|
||||
composition += " <button name='bt-remove' expand='false,true' fill='true'>\n";
|
||||
composition += " <label>\n";
|
||||
composition += " Remove previous\n";
|
||||
composition += " </label>\n";
|
||||
composition += " </button>\n";
|
||||
composition += " </sizer>\n";
|
||||
composition += " <label name='text-to-say' expand='true' fill='true' font-size='75'>\n";
|
||||
composition += " Text to say ...\n";
|
||||
@ -101,6 +106,7 @@ void appl::Windows::init() {
|
||||
subBind(ewol::widget::Button, "bt-reset", signalPressed, sharedFromThis(), &appl::Windows::onCallbackGenerate);
|
||||
subBind(ewol::widget::Button, "bt-next", signalPressed, sharedFromThis(), &appl::Windows::resetCount);
|
||||
subBind(ewol::widget::Button, "bt-next", signalPressed, sharedFromThis(), &appl::Windows::next);
|
||||
subBind(ewol::widget::Button, "bt-remove", signalPressed, sharedFromThis(), &appl::Windows::remove);
|
||||
subBind(appl::widget::DataViewer, "displayer", signalFinished, sharedFromThis(), &appl::Windows::onCallbackFinished);
|
||||
|
||||
}
|
||||
@ -109,7 +115,7 @@ void appl::Windows::onCallbackFinished() {
|
||||
APPL_INFO("Recording is finished");
|
||||
ememory::SharedPtr<appl::widget::DataViewer> tmpDisp = ememory::dynamicPointerCast<appl::widget::DataViewer>(getSubObjectNamed("displayer"));
|
||||
if (tmpDisp != null) {
|
||||
tmpDisp->store(propertyCorpusPath.get(), propertyUserName.get(), propertyUserBirthYear.get(), m_textToSay, "FR_fr");
|
||||
m_previousFiles = tmpDisp->store(propertyCorpusPath.get(), propertyUserName.get(), propertyUserBirthYear.get(), m_textToSay, "FR_fr");
|
||||
m_count++;
|
||||
if (m_count >= propertyCount.get()) {
|
||||
m_count = 0;
|
||||
@ -150,6 +156,14 @@ void appl::Windows::onCallbackGenerate() {
|
||||
}
|
||||
}
|
||||
|
||||
void appl::Windows::remove() {
|
||||
for (auto& elem: m_previousFiles) {
|
||||
APPL_INFO("Remove file " << elem);
|
||||
etk::uri::remove(elem);
|
||||
}
|
||||
m_previousFiles.clear();
|
||||
}
|
||||
|
||||
void appl::Windows::next() {
|
||||
m_total++;
|
||||
m_listPos++;
|
||||
|
@ -37,6 +37,7 @@ namespace appl {
|
||||
void onCallbackFinished();
|
||||
void resetCount();
|
||||
void stop();
|
||||
void remove();
|
||||
etk::String m_textToSay;
|
||||
int32_t m_listPos = 0;
|
||||
int32_t m_count = 0;
|
||||
@ -45,6 +46,7 @@ namespace appl {
|
||||
void next();
|
||||
void updateCurentLabel();
|
||||
void inputChangeValue();
|
||||
etk::Vector<etk::Uri> m_previousFiles;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -313,9 +313,10 @@ bool appl::widget::DataViewer::onEventInput(const ewol::event::Input& _event) {
|
||||
}
|
||||
|
||||
|
||||
void appl::widget::DataViewer::store(const etk::Uri& _baseUri, const etk::String& _userName, int32_t _userYearBirth, const etk::String& _value, const etk::String& _language) {
|
||||
etk::Vector<etk::Uri> appl::widget::DataViewer::store(const etk::Uri& _baseUri, const etk::String& _userName, int32_t _userYearBirth, const etk::String& _value, const etk::String& _language) {
|
||||
etk::Vector<etk::Uri> out;
|
||||
if (m_data16.size() == 0) {
|
||||
return;
|
||||
return out;
|
||||
}
|
||||
etk::String baseName = _language + "_" + _userName + "_" + etk::toString(m_time.get());
|
||||
// create the buffer
|
||||
@ -338,9 +339,11 @@ void appl::widget::DataViewer::store(const etk::Uri& _baseUri, const etk::String
|
||||
uriMetaData.setPath(_baseUri.getPath() / (baseName + ".json"));
|
||||
doc.storeSafe(uriMetaData);
|
||||
APPL_WARNING("store: " << uriMetaData);
|
||||
out.pushBack(uriMetaData);
|
||||
|
||||
etk::Uri uriAudioFile = _baseUri;
|
||||
uriAudioFile.setPath(_baseUri.getPath() / (baseName + ".raw"));
|
||||
out.pushBack(uriAudioFile);
|
||||
|
||||
int64_t posStart = int64_t(m_detectStartPosition)-nbSecondPreviousPost*m_sampleRate;
|
||||
posStart = etk::avg(int64_t(0), posStart, int64_t(m_data.size()));
|
||||
@ -349,12 +352,13 @@ void appl::widget::DataViewer::store(const etk::Uri& _baseUri, const etk::String
|
||||
{
|
||||
ememory::SharedPtr<etk::io::Interface> fileIO = etk::uri::get(uriAudioFile);
|
||||
if (fileIO->open(etk::io::OpenMode::Write) == false) {
|
||||
return;
|
||||
return out;
|
||||
}
|
||||
fileIO->write(&m_data16[posStart], 1*audio::getFormatBytes(audio::format_int16), (posStop-posStart));
|
||||
fileIO->close();
|
||||
}
|
||||
APPL_WARNING("store: " << uriAudioFile);
|
||||
reset();
|
||||
return out;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace appl {
|
||||
public:
|
||||
void onDraw() override;
|
||||
void onRegenerateDisplay() override;
|
||||
void store(const etk::Uri& _baseUri, const etk::String& _userName, int32_t _userYearBirth, const etk::String& _value, const etk::String& _language);
|
||||
etk::Vector<etk::Uri> store(const etk::Uri& _baseUri, const etk::String& _userName, int32_t _userYearBirth, const etk::String& _value, const etk::String& _language);
|
||||
protected:
|
||||
esignal::Connection m_PCH; //!< Periodic Call Handle to remove it when needed
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user