Skip to content

Commit

Permalink
added secs_t type to global
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov committed Oct 23, 2024
1 parent 4cf9dfd commit 5a75567
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/framework/audio/audiotypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@
#include <string>

#include "global/types/number.h"
#include "global/types/secs.h"
#include "global/types/ratio.h"
#include "global/realfn.h"
#include "global/types/string.h"
#include "global/realfn.h"
#include "global/async/channel.h"
#include "global/io/iodevice.h"

#include "mpe/events.h"

namespace muse::audio {
using msecs_t = int64_t;
using secs_t = number_t<double>;
using secs_t = muse::secs_t;

inline secs_t milisecsToSecs(msecs_t ms) { return secs_t(ms / 1000.0); }
inline secs_t microsecsToSecs(msecs_t us) { return secs_t(us / 1000000.0); }
Expand Down
6 changes: 6 additions & 0 deletions src/framework/global/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/types/number.h
${CMAKE_CURRENT_LIST_DIR}/types/config.h
${CMAKE_CURRENT_LIST_DIR}/types/ratio.h
${CMAKE_CURRENT_LIST_DIR}/types/secs.h

${CMAKE_CURRENT_LIST_DIR}/io/ioenums.h
${CMAKE_CURRENT_LIST_DIR}/io/path.cpp
Expand Down Expand Up @@ -264,6 +265,11 @@ endif()

if (MUSE_MODULE_GLOBAL_MULTI_IOC)
set(MODULE_DEF ${MODULE_DEF} -DMUSE_MODULE_GLOBAL_MULTI_IOC)

target_sources(muse_global
PRIVATE
types/secs.h
)
endif()

setup_module()
Expand Down
3 changes: 3 additions & 0 deletions src/framework/global/types/ratio.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,7 @@ inline db_t linear_to_db(ratio_t v)
{
return muse::linear_to_db(v.raw());
}

//! NOTE Percent
using percent_t = number_t<float>;
}
28 changes: 28 additions & 0 deletions src/framework/global/types/secs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2024 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once

#include "number.h"

namespace muse {
using secs_t = number_t<double>;
}

0 comments on commit 5a75567

Please sign in to comment.