Compare commits
11 Commits
aae591229c
...
e6f71cfeb6
Author | SHA1 | Date | |
---|---|---|---|
e6f71cfeb6 | |||
a33fd6e0e2 | |||
ac1dc87d10 | |||
2ccae3bbf6 | |||
2d54069b71 | |||
8b3942b7d2 | |||
cae6e2da38 | |||
ad57cdfce5 | |||
564ec02467 | |||
ad6cbd0870 | |||
cec6914685 |
373
LICENSE
Normal file
373
LICENSE
Normal file
@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
@ -14,18 +14,18 @@ To compile:
|
||||
|
||||
note:
|
||||
|
||||
depend on etk library (apache 2)
|
||||
depend on etk library (MPL v2.0)
|
||||
|
||||
|
||||
License (APACHE v2.0)
|
||||
License (MPL v2.0)
|
||||
=====================
|
||||
Copyright audio Edouard DUPIN
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
Licensed under the Mozilla Public License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
https://www.mozilla.org/MPL/2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/types.hpp>
|
||||
#include <echrono/echrono.hpp>
|
||||
#include <echrono/Steady.hpp>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/channel.hpp>
|
||||
@ -63,17 +63,17 @@ static const char* listValues[] = {
|
||||
static int32_t listValuesSize = sizeof(listValues)/sizeof(char*);
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, enum audio::channel _obj) {
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, enum audio::channel _obj) {
|
||||
_os << getChannelString(_obj);
|
||||
return _os;
|
||||
}
|
||||
|
||||
std::string audio::getChannelString(enum audio::channel _value) {
|
||||
etk::String audio::getChannelString(enum audio::channel _value) {
|
||||
return listValues[_value];
|
||||
}
|
||||
|
||||
std::string audio::getChannelString(const std::vector<enum audio::channel>& _value) {
|
||||
std::string out;
|
||||
etk::String audio::getChannelString(const etk::Vector<enum audio::channel>& _value) {
|
||||
etk::String out;
|
||||
for (size_t iii=0; iii<_value.size(); ++iii) {
|
||||
if (iii != 0) {
|
||||
out += ";";
|
||||
@ -84,31 +84,31 @@ std::string audio::getChannelString(const std::vector<enum audio::channel>& _val
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const std::vector<enum audio::channel>& _obj) {
|
||||
_os << std::string("{");
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const etk::Vector<enum audio::channel>& _obj) {
|
||||
_os << etk::String("{");
|
||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
||||
if (iii!=0) {
|
||||
_os << std::string(";");
|
||||
_os << etk::String(";");
|
||||
}
|
||||
_os << _obj[iii];
|
||||
}
|
||||
_os << std::string("}");
|
||||
_os << etk::String("}");
|
||||
return _os;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const std::vector<std::vector<enum audio::channel> >& _obj) {
|
||||
_os << std::string("{");
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const etk::Vector<etk::Vector<enum audio::channel> >& _obj) {
|
||||
_os << etk::String("{");
|
||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
||||
if (iii!=0) {
|
||||
_os << std::string(";");
|
||||
_os << etk::String(";");
|
||||
}
|
||||
_os << _obj[iii];
|
||||
}
|
||||
_os << std::string("}");
|
||||
_os << etk::String("}");
|
||||
return _os;
|
||||
}
|
||||
|
||||
enum audio::channel audio::getChannelFromString(const std::string& _value) {
|
||||
enum audio::channel audio::getChannelFromString(const etk::String& _value) {
|
||||
for (int32_t iii=0; iii<listValuesSize; ++iii) {
|
||||
if (_value == listValues[iii]) {
|
||||
return static_cast<enum audio::channel>(iii);
|
||||
@ -118,20 +118,20 @@ enum audio::channel audio::getChannelFromString(const std::string& _value) {
|
||||
return audio::channel_unknow;
|
||||
}
|
||||
|
||||
std::vector<enum audio::channel> audio::getListChannelFromString(const std::string& _value) {
|
||||
std::vector<enum audio::channel> out;
|
||||
std::vector<std::string> list = etk::split(_value, ';');
|
||||
etk::Vector<enum audio::channel> audio::getListChannelFromString(const etk::String& _value) {
|
||||
etk::Vector<enum audio::channel> out;
|
||||
etk::Vector<etk::String> list = etk::split(_value, ';');
|
||||
for (size_t iii=0; iii<list.size(); ++iii) {
|
||||
out.push_back(getChannelFromString(list[iii]));
|
||||
out.pushBack(getChannelFromString(list[iii]));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
namespace etk {
|
||||
template<> std::string to_string<enum audio::channel>(const enum audio::channel& _variable) {
|
||||
template<> etk::String toString<enum audio::channel>(const enum audio::channel& _variable) {
|
||||
return listValues[_variable];
|
||||
}
|
||||
template <> bool from_string<enum audio::channel>(enum audio::channel& _variableRet, const std::string& _value) {
|
||||
template <> bool from_string<enum audio::channel>(enum audio::channel& _variableRet, const etk::String& _value) {
|
||||
for (int32_t iii=0; iii<listValuesSize; ++iii) {
|
||||
if (_value == listValues[iii]) {
|
||||
_variableRet = static_cast<enum audio::channel>(iii);
|
||||
@ -143,18 +143,18 @@ namespace etk {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> audio::convertChannel(const std::vector<enum audio::channel>& _obj) {
|
||||
std::vector<uint8_t> out;
|
||||
etk::Vector<uint8_t> audio::convertChannel(const etk::Vector<enum audio::channel>& _obj) {
|
||||
etk::Vector<uint8_t> out;
|
||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
||||
out.push_back(static_cast<uint8_t>(_obj[iii]));
|
||||
out.pushBack(static_cast<uint8_t>(_obj[iii]));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<enum audio::channel> audio::convertChannel(const std::vector<uint8_t>& _obj) {
|
||||
std::vector<enum audio::channel> out;
|
||||
etk::Vector<enum audio::channel> audio::convertChannel(const etk::Vector<uint8_t>& _obj) {
|
||||
etk::Vector<enum audio::channel> out;
|
||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
||||
out.push_back(static_cast<enum audio::channel>(_obj[iii]));
|
||||
out.pushBack(static_cast<enum audio::channel>(_obj[iii]));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -1,141 +1,80 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <etk/String.hpp>
|
||||
#include <etk/Vector.hpp>
|
||||
#include <etk/types.hpp>
|
||||
|
||||
#ifdef ETK_EXTERN_FRAMEWORK_ROS
|
||||
#include <ros/ros.h>
|
||||
#include "audio_msg/AudioBuffer.h"
|
||||
namespace audio {
|
||||
enum channel {
|
||||
channel_unknow = audio_msg::AudioBuffer::CHANNEL_UNKNOW,
|
||||
channel_frontLeft = audio_msg::AudioBuffer::CHANNEL_FRONT_LEFT,
|
||||
channel_frontCenter = audio_msg::AudioBuffer::CHANNEL_FRONT_CENTER,
|
||||
channel_frontRight = audio_msg::AudioBuffer::CHANNEL_FRONT_RIGHT,
|
||||
channel_rearLeft = audio_msg::AudioBuffer::CHANNEL_REAR_LEFT,
|
||||
channel_rearCenter = audio_msg::AudioBuffer::CHANNEL_REAR_CENTER,
|
||||
channel_rearRight = audio_msg::AudioBuffer::CHANNEL_REAR_RIGHT,
|
||||
channel_centerLeft = audio_msg::AudioBuffer::CHANNEL_CENTER_LEFT,
|
||||
channel_centerRight = audio_msg::AudioBuffer::CHANNEL_CENTER_RIGHT,
|
||||
channel_topFrontLeft = audio_msg::AudioBuffer::CHANNEL_TOP_FRONT_LEFT,
|
||||
channel_topFrontCenter = audio_msg::AudioBuffer::CHANNEL_TOP_FRONT_CENTER,
|
||||
channel_topFrontRight = audio_msg::AudioBuffer::CHANNEL_TOP_FRONT_RIGHT,
|
||||
channel_topRearLeft = audio_msg::AudioBuffer::CHANNEL_TOP_REAR_LEFT,
|
||||
channel_topRearCenter = audio_msg::AudioBuffer::CHANNEL_TOP_REAR_CENTER,
|
||||
channel_topRearRight = audio_msg::AudioBuffer::CHANNEL_TOP_REAR_RIGHT,
|
||||
channel_topCenterLeft = audio_msg::AudioBuffer::CHANNEL_TOP_CENTER_LEFT,
|
||||
channel_topCenterRight = audio_msg::AudioBuffer::CHANNEL_TOP_CENTER_RIGHT,
|
||||
channel_lfe = audio_msg::AudioBuffer::CHANNEL_LFE,
|
||||
channel_aux0 = audio_msg::AudioBuffer::CHANNEL_AUX0,
|
||||
channel_aux1 = audio_msg::AudioBuffer::CHANNEL_AUX1,
|
||||
channel_aux2 = audio_msg::AudioBuffer::CHANNEL_AUX2,
|
||||
channel_aux3 = audio_msg::AudioBuffer::CHANNEL_AUX3,
|
||||
channel_aux4 = audio_msg::AudioBuffer::CHANNEL_AUX4,
|
||||
channel_aux5 = audio_msg::AudioBuffer::CHANNEL_AUX5,
|
||||
channel_aux6 = audio_msg::AudioBuffer::CHANNEL_AUX6,
|
||||
channel_aux7 = audio_msg::AudioBuffer::CHANNEL_AUX7,
|
||||
channel_aux8 = audio_msg::AudioBuffer::CHANNEL_AUX8,
|
||||
channel_aux9 = audio_msg::AudioBuffer::CHANNEL_AUX9,
|
||||
channel_aux10 = audio_msg::AudioBuffer::CHANNEL_AUX10,
|
||||
channel_aux11 = audio_msg::AudioBuffer::CHANNEL_AUX11,
|
||||
channel_aux12 = audio_msg::AudioBuffer::CHANNEL_AUX12,
|
||||
channel_aux13 = audio_msg::AudioBuffer::CHANNEL_AUX13,
|
||||
channel_aux14 = audio_msg::AudioBuffer::CHANNEL_AUX14,
|
||||
channel_aux15 = audio_msg::AudioBuffer::CHANNEL_AUX15,
|
||||
channel_aux16 = audio_msg::AudioBuffer::CHANNEL_AUX16,
|
||||
channel_aux17 = audio_msg::AudioBuffer::CHANNEL_AUX17,
|
||||
channel_aux18 = audio_msg::AudioBuffer::CHANNEL_AUX18,
|
||||
channel_aux19 = audio_msg::AudioBuffer::CHANNEL_AUX19,
|
||||
channel_aux20 = audio_msg::AudioBuffer::CHANNEL_AUX20,
|
||||
channel_aux21 = audio_msg::AudioBuffer::CHANNEL_AUX21,
|
||||
channel_aux22 = audio_msg::AudioBuffer::CHANNEL_AUX22,
|
||||
channel_aux23 = audio_msg::AudioBuffer::CHANNEL_AUX23,
|
||||
channel_aux24 = audio_msg::AudioBuffer::CHANNEL_AUX24,
|
||||
channel_aux25 = audio_msg::AudioBuffer::CHANNEL_AUX25,
|
||||
channel_aux26 = audio_msg::AudioBuffer::CHANNEL_AUX26,
|
||||
channel_aux27 = audio_msg::AudioBuffer::CHANNEL_AUX27,
|
||||
channel_aux28 = audio_msg::AudioBuffer::CHANNEL_AUX28,
|
||||
channel_aux29 = audio_msg::AudioBuffer::CHANNEL_AUX29,
|
||||
channel_aux30 = audio_msg::AudioBuffer::CHANNEL_AUX30,
|
||||
channel_aux31 = audio_msg::AudioBuffer::CHANNEL_AUX31,
|
||||
};
|
||||
};
|
||||
#else
|
||||
namespace audio {
|
||||
enum channel {
|
||||
channel_unknow, //!< Error channel ...
|
||||
// normal level
|
||||
channel_frontLeft, //!< channel Front Left
|
||||
channel_frontCenter, //!< channel Front Center
|
||||
channel_frontRight, //!< channel Front Right
|
||||
channel_rearLeft, //!< channel rear Left
|
||||
channel_rearCenter, //!< channel rear Center
|
||||
channel_rearRight, //!< channel rear Right
|
||||
channel_centerLeft, //!< channel center Left
|
||||
channel_centerRight, //!< channel center Right
|
||||
// top level
|
||||
channel_topFrontLeft, //!< channel top front left
|
||||
channel_topFrontCenter, //!< channel top front center
|
||||
channel_topFrontRight, //!< channel top front right
|
||||
channel_topRearLeft, //!< channel top rear left
|
||||
channel_topRearCenter, //!< channel top rear center
|
||||
channel_topRearRight, //!< channel top rear Right
|
||||
channel_topCenterLeft, //!< channel top center left
|
||||
channel_topCenterRight, //!< channel top center right
|
||||
// global elements
|
||||
channel_lfe, //!< channel Low frequency
|
||||
// Some user auxyliary channel (audio mixing table)
|
||||
channel_aux0,
|
||||
channel_aux1,
|
||||
channel_aux2,
|
||||
channel_aux3,
|
||||
channel_aux4,
|
||||
channel_aux5,
|
||||
channel_aux6,
|
||||
channel_aux7,
|
||||
channel_aux8,
|
||||
channel_aux9,
|
||||
channel_aux10,
|
||||
channel_aux11,
|
||||
channel_aux12,
|
||||
channel_aux13,
|
||||
channel_aux14,
|
||||
channel_aux15,
|
||||
channel_aux16,
|
||||
channel_aux17,
|
||||
channel_aux18,
|
||||
channel_aux19,
|
||||
channel_aux20,
|
||||
channel_aux21,
|
||||
channel_aux22,
|
||||
channel_aux23,
|
||||
channel_aux24,
|
||||
channel_aux25,
|
||||
channel_aux26,
|
||||
channel_aux27,
|
||||
channel_aux28,
|
||||
channel_aux29,
|
||||
channel_aux30,
|
||||
channel_aux31,
|
||||
};
|
||||
};
|
||||
#endif
|
||||
namespace audio {
|
||||
std::string getChannelString(enum audio::channel _obj);
|
||||
std::string getChannelString(const std::vector<enum audio::channel>& _obj);
|
||||
enum audio::channel getChannelFromString(const std::string& _value);
|
||||
std::vector<enum audio::channel> getListChannelFromString(const std::string& _value);
|
||||
std::ostream& operator <<(std::ostream& _os, enum audio::channel _obj);
|
||||
std::ostream& operator <<(std::ostream& _os, const std::vector<enum audio::channel>& _obj);
|
||||
std::ostream& operator <<(std::ostream& _os, const std::vector<std::vector<enum audio::channel> >& _obj);
|
||||
enum channel {
|
||||
channel_unknow, //!< Error channel ...
|
||||
// normal level
|
||||
channel_frontLeft, //!< channel Front Left
|
||||
channel_frontCenter, //!< channel Front Center
|
||||
channel_frontRight, //!< channel Front Right
|
||||
channel_rearLeft, //!< channel rear Left
|
||||
channel_rearCenter, //!< channel rear Center
|
||||
channel_rearRight, //!< channel rear Right
|
||||
channel_centerLeft, //!< channel center Left
|
||||
channel_centerRight, //!< channel center Right
|
||||
// top level
|
||||
channel_topFrontLeft, //!< channel top front left
|
||||
channel_topFrontCenter, //!< channel top front center
|
||||
channel_topFrontRight, //!< channel top front right
|
||||
channel_topRearLeft, //!< channel top rear left
|
||||
channel_topRearCenter, //!< channel top rear center
|
||||
channel_topRearRight, //!< channel top rear Right
|
||||
channel_topCenterLeft, //!< channel top center left
|
||||
channel_topCenterRight, //!< channel top center right
|
||||
// global elements
|
||||
channel_lfe, //!< channel Low frequency
|
||||
// Some user auxyliary channel (audio mixing table)
|
||||
channel_aux0,
|
||||
channel_aux1,
|
||||
channel_aux2,
|
||||
channel_aux3,
|
||||
channel_aux4,
|
||||
channel_aux5,
|
||||
channel_aux6,
|
||||
channel_aux7,
|
||||
channel_aux8,
|
||||
channel_aux9,
|
||||
channel_aux10,
|
||||
channel_aux11,
|
||||
channel_aux12,
|
||||
channel_aux13,
|
||||
channel_aux14,
|
||||
channel_aux15,
|
||||
channel_aux16,
|
||||
channel_aux17,
|
||||
channel_aux18,
|
||||
channel_aux19,
|
||||
channel_aux20,
|
||||
channel_aux21,
|
||||
channel_aux22,
|
||||
channel_aux23,
|
||||
channel_aux24,
|
||||
channel_aux25,
|
||||
channel_aux26,
|
||||
channel_aux27,
|
||||
channel_aux28,
|
||||
channel_aux29,
|
||||
channel_aux30,
|
||||
channel_aux31,
|
||||
};
|
||||
etk::String getChannelString(enum audio::channel _obj);
|
||||
etk::String getChannelString(const etk::Vector<enum audio::channel>& _obj);
|
||||
enum audio::channel getChannelFromString(const etk::String& _value);
|
||||
etk::Vector<enum audio::channel> getListChannelFromString(const etk::String& _value);
|
||||
etk::Stream& operator <<(etk::Stream& _os, enum audio::channel _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const etk::Vector<enum audio::channel>& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const etk::Vector<etk::Vector<enum audio::channel> >& _obj);
|
||||
// For ROS Interface:
|
||||
std::vector<uint8_t> convertChannel(const std::vector<enum audio::channel>& _obj);
|
||||
std::vector<enum audio::channel> convertChannel(const std::vector<uint8_t>& _obj);
|
||||
};
|
||||
etk::Vector<uint8_t> convertChannel(const etk::Vector<enum audio::channel>& _obj);
|
||||
etk::Vector<enum audio::channel> convertChannel(const etk::Vector<uint8_t>& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
namespace audio {
|
||||
int32_t getLogId();
|
||||
};
|
||||
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
||||
// TODO : Review this problem of multiple intanciation of "etk::Stringbuf sb"
|
||||
#define AUDIO_BASE(info,data) ELOG_BASE(audio::getLogId(),info,data)
|
||||
|
||||
#define AUDIO_PRINT(data) AUDIO_BASE(-1, data)
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -172,7 +172,7 @@ audio::double_t audio::double_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::double_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":d]";
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::double_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":d]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -106,5 +106,5 @@ namespace audio {
|
||||
double_t& operator--();
|
||||
double_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::double_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::double_t& _obj);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -171,8 +171,8 @@ audio::float_t audio::float_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::float_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":f]";
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::float_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":f]";
|
||||
return _os;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
@ -107,6 +107,6 @@ namespace audio {
|
||||
float_t& operator--();
|
||||
float_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::float_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::float_t& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -24,29 +24,29 @@ static const char* listValues[] = {
|
||||
};
|
||||
static int32_t listValuesSize = sizeof(listValues)/sizeof(char*);
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, enum audio::format _obj) {
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, enum audio::format _obj) {
|
||||
_os << getFormatString(_obj);
|
||||
return _os;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const std::vector<enum audio::format>& _obj) {
|
||||
_os << std::string("{");
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const etk::Vector<enum audio::format>& _obj) {
|
||||
_os << etk::String("{");
|
||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
||||
if (iii!=0) {
|
||||
_os << std::string(";");
|
||||
_os << etk::String(";");
|
||||
}
|
||||
_os << _obj[iii];
|
||||
}
|
||||
_os << std::string("}");
|
||||
_os << etk::String("}");
|
||||
return _os;
|
||||
}
|
||||
|
||||
std::string audio::getFormatString(enum audio::format _value) {
|
||||
etk::String audio::getFormatString(enum audio::format _value) {
|
||||
return listValues[_value];
|
||||
}
|
||||
|
||||
|
||||
enum audio::format audio::getFormatFromString(const std::string& _value) {
|
||||
enum audio::format audio::getFormatFromString(const etk::String& _value) {
|
||||
for (int32_t iii=0; iii<listValuesSize; ++iii) {
|
||||
if (_value == listValues[iii]) {
|
||||
return static_cast<enum audio::format>(iii);
|
||||
@ -55,11 +55,11 @@ enum audio::format audio::getFormatFromString(const std::string& _value) {
|
||||
return format_unknow;
|
||||
}
|
||||
|
||||
std::vector<enum audio::format> audio::getListFormatFromString(const std::string& _value) {
|
||||
std::vector<enum audio::format> out;
|
||||
std::vector<std::string> list = etk::split(_value, ';');
|
||||
etk::Vector<enum audio::format> audio::getListFormatFromString(const etk::String& _value) {
|
||||
etk::Vector<enum audio::format> out;
|
||||
etk::Vector<etk::String> list = etk::split(_value, ';');
|
||||
for (size_t iii=0; iii<list.size(); ++iii) {
|
||||
out.push_back(getFormatFromString(list[iii]));
|
||||
out.pushBack(getFormatFromString(list[iii]));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
@ -93,10 +93,10 @@ uint32_t audio::getFormatBytes(audio::format _format) {
|
||||
|
||||
|
||||
namespace etk {
|
||||
template<> std::string to_string<enum audio::format>(const enum audio::format& _variable) {
|
||||
template<> etk::String toString<enum audio::format>(const enum audio::format& _variable) {
|
||||
return listValues[_variable];
|
||||
}
|
||||
template <> bool from_string<enum audio::format>(enum audio::format& _variableRet, const std::string& _value) {
|
||||
template <> bool from_string<enum audio::format>(enum audio::format& _variableRet, const etk::String& _value) {
|
||||
for (int32_t iii=0; iii<listValuesSize; ++iii) {
|
||||
if (_value == listValues[iii]) {
|
||||
_variableRet = static_cast<enum audio::format>(iii);
|
||||
@ -108,18 +108,18 @@ namespace etk {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> audio::convertFormat(const std::vector<enum audio::format>& _obj) {
|
||||
std::vector<uint8_t> out;
|
||||
etk::Vector<uint8_t> audio::convertFormat(const etk::Vector<enum audio::format>& _obj) {
|
||||
etk::Vector<uint8_t> out;
|
||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
||||
out.push_back(static_cast<uint8_t>(_obj[iii]));
|
||||
out.pushBack(static_cast<uint8_t>(_obj[iii]));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<enum audio::format> audio::convertFormat(const std::vector<uint8_t>& _obj) {
|
||||
std::vector<enum audio::format> out;
|
||||
etk::Vector<enum audio::format> audio::convertFormat(const etk::Vector<uint8_t>& _obj) {
|
||||
etk::Vector<enum audio::format> out;
|
||||
for (size_t iii=0; iii<_obj.size(); ++iii) {
|
||||
out.push_back(static_cast<enum audio::format>(_obj[iii]));
|
||||
out.pushBack(static_cast<enum audio::format>(_obj[iii]));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
@ -1,61 +1,37 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef ETK_EXTERN_FRAMEWORK_ROS
|
||||
#include <ros/ros.h>
|
||||
#include "audio_msg/AudioBuffer.h"
|
||||
namespace audio {
|
||||
enum format {
|
||||
format_unknow = audio_msg::AudioBuffer::FORMAT_UNKNOW,
|
||||
format_int8 = audio_msg::AudioBuffer::FORMAT_INT8,
|
||||
format_int8_on_int16 = audio_msg::AudioBuffer::FORMAT_INT8_ON_INT16,
|
||||
format_int16 = audio_msg::AudioBuffer::FORMAT_INT16,
|
||||
format_int16_on_int32 = audio_msg::AudioBuffer::FORMAT_INT16_ON_INT32,
|
||||
format_int24 = audio_msg::AudioBuffer::FORMAT_INT24,
|
||||
format_int24_on_int32 = audio_msg::AudioBuffer::FORMAT_INT24_ON_INT32,
|
||||
format_int32 = audio_msg::AudioBuffer::FORMAT_INT32,
|
||||
format_int32_on_int64 = audio_msg::AudioBuffer::FORMAT_INT32_ON_INT64,
|
||||
format_int64 = audio_msg::AudioBuffer::FORMAT_INT64,
|
||||
format_float = audio_msg::AudioBuffer::FORMAT_FLOAT,
|
||||
format_double = audio_msg::AudioBuffer::FORMAT_DOUBLE
|
||||
};
|
||||
};
|
||||
#else
|
||||
namespace audio {
|
||||
enum format {
|
||||
format_unknow,
|
||||
format_int8, //!< Signed 8 bits
|
||||
format_int8_on_int16, //!< Signed 8 bits on 16 bits data (8 bit fixpoint value)
|
||||
format_int16, //!< Signed 16 bits
|
||||
format_int16_on_int32, //!< Signed 16 bits on 32 bits data (16 bit fixpoint value)
|
||||
format_int24, //!< Signed 24 bits on 24 bits (lower)
|
||||
format_int24_on_int32, //!< Signed 24 bits on 32 bits (lower)
|
||||
format_int32, //!< Signed 32 bits
|
||||
format_int32_on_int64, //!< Signed 32 bits on 64 bits data (32 bit fixpoint value)
|
||||
format_int64, //!< Signed 64 bits
|
||||
format_float, //!< Floating point 32 bits (single precision)
|
||||
format_double //!< Floating point 64 bits (double precision)
|
||||
};
|
||||
};
|
||||
#endif
|
||||
#include <etk/String.hpp>
|
||||
|
||||
namespace audio {
|
||||
std::string getFormatString(enum audio::format _format);
|
||||
enum audio::format getFormatFromString(const std::string& _value);
|
||||
std::vector<enum audio::format> getListFormatFromString(const std::string& _value);
|
||||
std::ostream& operator <<(std::ostream& _os, enum audio::format _obj);
|
||||
std::ostream& operator <<(std::ostream& _os, const std::vector<enum audio::format>& _obj);
|
||||
enum format {
|
||||
format_unknow,
|
||||
format_int8, //!< Signed 8 bits
|
||||
format_int8_on_int16, //!< Signed 8 bits on 16 bits data (8 bit fixpoint value)
|
||||
format_int16, //!< Signed 16 bits
|
||||
format_int16_on_int32, //!< Signed 16 bits on 32 bits data (16 bit fixpoint value)
|
||||
format_int24, //!< Signed 24 bits on 24 bits (lower)
|
||||
format_int24_on_int32, //!< Signed 24 bits on 32 bits (lower)
|
||||
format_int32, //!< Signed 32 bits
|
||||
format_int32_on_int64, //!< Signed 32 bits on 64 bits data (32 bit fixpoint value)
|
||||
format_int64, //!< Signed 64 bits
|
||||
format_float, //!< Floating point 32 bits (single precision)
|
||||
format_double //!< Floating point 64 bits (double precision)
|
||||
};
|
||||
etk::String getFormatString(enum audio::format _format);
|
||||
enum audio::format getFormatFromString(const etk::String& _value);
|
||||
etk::Vector<enum audio::format> getListFormatFromString(const etk::String& _value);
|
||||
etk::Stream& operator <<(etk::Stream& _os, enum audio::format _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const etk::Vector<enum audio::format>& _obj);
|
||||
uint32_t getFormatBytes(enum audio::format _format);
|
||||
// For ROS Interface:
|
||||
std::vector<uint8_t> convertFormat(const std::vector<enum audio::format>& _obj);
|
||||
std::vector<enum audio::format> convertFormat(const std::vector<uint8_t>& _obj);
|
||||
etk::Vector<uint8_t> convertFormat(const etk::Vector<enum audio::format>& _obj);
|
||||
etk::Vector<enum audio::format> convertFormat(const etk::Vector<uint8_t>& _obj);
|
||||
uint8_t convertFormat(enum audio::format _obj);
|
||||
enum audio::format convertFormat(uint8_t _obj);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/int16_16_t.hpp>
|
||||
@ -12,7 +12,7 @@ audio::int16_16_t::int16_16_t(const audio::int8_8_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_16_t::int16_16_t(const audio::int8_16_t& _val) {
|
||||
m_data = std::avg(int16_t(INT8_MIN),
|
||||
m_data = etk::avg(int16_t(INT8_MIN),
|
||||
_val.get(),
|
||||
int16_t(INT8_MAX)
|
||||
) << 7;
|
||||
@ -23,7 +23,7 @@ audio::int16_16_t::int16_16_t(const audio::int16_16_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_16_t::int16_16_t(const audio::int16_32_t& _val) {
|
||||
m_data = int16_t(std::avg(int32_t(INT16_MIN),
|
||||
m_data = int16_t(etk::avg(int32_t(INT16_MIN),
|
||||
_val.get() >> 1,
|
||||
int32_t(INT16_MAX)
|
||||
)
|
||||
@ -35,7 +35,7 @@ audio::int16_16_t::int16_16_t(const audio::int24_24_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_16_t::int16_16_t(const audio::int24_32_t& _val) {
|
||||
m_data = int16_t(std::avg(int32_t(INT24_MIN),
|
||||
m_data = int16_t(etk::avg(int32_t(INT24_MIN),
|
||||
_val.get() >> 1,
|
||||
int32_t(INT24_MAX)
|
||||
) >> 8
|
||||
@ -47,7 +47,7 @@ audio::int16_16_t::int16_16_t(const audio::int32_32_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_16_t::int16_16_t(const audio::int32_64_t& _val) {
|
||||
m_data = int16_t(std::avg(int64_t(INT32_MIN),
|
||||
m_data = int16_t(etk::avg(int64_t(INT32_MIN),
|
||||
_val.get() >> 1,
|
||||
int64_t(INT32_MAX)
|
||||
) >> 16
|
||||
@ -59,7 +59,7 @@ audio::int16_16_t::int16_16_t(const audio::int64_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_16_t::int16_16_t(const audio::float_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0f,
|
||||
m_data = int16_t(etk::avg(-1.0f,
|
||||
_val.get(),
|
||||
0.999969482f
|
||||
) * (float(INT16_MAX)+1)
|
||||
@ -67,7 +67,7 @@ audio::int16_16_t::int16_16_t(const audio::float_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_16_t::int16_16_t(const audio::double_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0,
|
||||
m_data = int16_t(etk::avg(-1.0,
|
||||
_val.get(),
|
||||
0.999969482
|
||||
) * (double(INT16_MAX)+1)
|
||||
@ -80,7 +80,7 @@ audio::int16_16_t::int16_16_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
|
||||
void audio::int16_16_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (15-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT16_MIN), val, int64_t(INT16_MAX));
|
||||
m_data = etk::avg(int64_t(INT16_MIN), val, int64_t(INT16_MAX));
|
||||
}
|
||||
|
||||
void audio::int16_16_t::set(int16_t _value) {
|
||||
@ -196,9 +196,9 @@ audio::int16_16_t audio::int16_16_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int16_16_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.15=";
|
||||
_os << etk::to_string(double(_obj.get())/(double(INT16_MAX)+1));
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int16_16_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":0.15=";
|
||||
_os << etk::toString(double(_obj.get())/(double(INT16_MAX)+1));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -113,6 +113,6 @@ namespace audio {
|
||||
int16_16_t& operator--();
|
||||
int16_16_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int16_16_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int16_16_t& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -37,7 +37,7 @@ audio::int16_32_t::int16_32_t(const audio::int32_32_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::int32_64_t& _val) {
|
||||
m_data = int32_t(std::avg(int64_t(INT56_MIN),
|
||||
m_data = int32_t(etk::avg(int64_t(INT56_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT56_MAX)
|
||||
) >> 16
|
||||
@ -49,7 +49,7 @@ audio::int16_32_t::int16_32_t(const audio::int64_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::float_t& _val) {
|
||||
m_data = int32_t(std::avg(float(INT16_MIN),
|
||||
m_data = int32_t(etk::avg(float(INT16_MIN),
|
||||
_val.get(),
|
||||
float(INT16_MAX)
|
||||
) * (float(INT16_MAX) * 2.0f+1.0f)
|
||||
@ -57,7 +57,7 @@ audio::int16_32_t::int16_32_t(const audio::float_t& _val) {
|
||||
}
|
||||
|
||||
audio::int16_32_t::int16_32_t(const audio::double_t& _val) {
|
||||
m_data = int32_t(std::avg(double(INT16_MIN),
|
||||
m_data = int32_t(etk::avg(double(INT16_MIN),
|
||||
_val.get(),
|
||||
double(INT16_MAX)
|
||||
) * (double(INT16_MAX) * 2.0+1.0)
|
||||
@ -70,7 +70,7 @@ audio::int16_32_t::int16_32_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
|
||||
void audio::int16_32_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (16-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
|
||||
m_data = etk::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
|
||||
}
|
||||
|
||||
void audio::int16_32_t::set(int32_t _value) {
|
||||
@ -186,9 +186,9 @@ audio::int16_32_t audio::int16_32_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int16_32_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":7.16=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT16_MAX)*0.5);
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int16_32_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":7.16=";
|
||||
_os << etk::toString(double(_obj.get())/double(INT16_MAX)*0.5);
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -113,5 +113,5 @@ namespace audio {
|
||||
int16_32_t& operator--();
|
||||
int16_32_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int16_32_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int16_32_t& _obj);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/int24_24_t.hpp>
|
||||
@ -76,7 +76,7 @@ void audio::int24_24_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
val = _value << (23-_flotingPointPosition);
|
||||
}
|
||||
//AUDIO_INFO(" _value=" << _value << " _flotingPointPosition=" << _flotingPointPosition << " val=" << val);
|
||||
val = std::avg(int64_t(INT24_MIN), val, int64_t(INT24_MAX));
|
||||
val = etk::avg(int64_t(INT24_MIN), val, int64_t(INT24_MAX));
|
||||
m_data[0] = (val & 0x00000000000000ffLL);
|
||||
m_data[1] = (val & 0x000000000000ff00LL) >> 8;
|
||||
m_data[2] = (val & 0x0000000000ff0000LL) >> 16;
|
||||
@ -96,9 +96,9 @@ int32_t audio::int24_24_t::get() const {
|
||||
return val;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int24_24_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.23=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT24_MAX));
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int24_24_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":0.23=";
|
||||
_os << etk::toString(double(_obj.get())/double(INT24_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -40,6 +40,6 @@ namespace audio {
|
||||
void set(int32_t _value);
|
||||
int32_t get() const;
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int24_24_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int24_24_t& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -21,7 +21,7 @@ audio::int24_32_t::int24_32_t(const audio::int16_16_t& _val) {
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int16_32_t& _val) {
|
||||
m_data = int32_t(std::avg(int32_t(INT24_MIN),
|
||||
m_data = int32_t(etk::avg(int32_t(INT24_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT24_MAX)
|
||||
) << 8
|
||||
@ -41,7 +41,7 @@ audio::int24_32_t::int24_32_t(const audio::int32_32_t& _val) {
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::int32_64_t& _val) {
|
||||
m_data = int32_t(std::avg(int64_t(INT40_MIN),
|
||||
m_data = int32_t(etk::avg(int64_t(INT40_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT40_MAX)
|
||||
) >> 8
|
||||
@ -53,7 +53,7 @@ audio::int24_32_t::int24_32_t(const audio::int64_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::float_t& _val) {
|
||||
m_data = int32_t(std::avg(float(INT8_MIN),
|
||||
m_data = int32_t(etk::avg(float(INT8_MIN),
|
||||
_val.get(),
|
||||
float(INT8_MAX)
|
||||
) * (float(INT24_MAX) * 2.0f + 1.0f)
|
||||
@ -61,7 +61,7 @@ audio::int24_32_t::int24_32_t(const audio::float_t& _val) {
|
||||
}
|
||||
|
||||
audio::int24_32_t::int24_32_t(const audio::double_t& _val) {
|
||||
m_data = int32_t(std::avg(-1.0,
|
||||
m_data = int32_t(etk::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * (double(INT24_MAX) * 2.0 + 1.0)
|
||||
@ -74,7 +74,7 @@ audio::int24_32_t::int24_32_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
|
||||
void audio::int24_32_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (24-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
|
||||
m_data = etk::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
|
||||
}
|
||||
|
||||
void audio::int24_32_t::set(int32_t _value) {
|
||||
@ -190,9 +190,9 @@ audio::int24_32_t audio::int24_32_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int24_32_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":7.24=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT24_MAX)*0.5);
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int24_32_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":7.24=";
|
||||
_os << etk::toString(double(_obj.get())/double(INT24_MAX)*0.5);
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -113,6 +113,6 @@ namespace audio {
|
||||
int24_32_t& operator--();
|
||||
int24_32_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int24_32_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int24_32_t& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -12,7 +12,7 @@ audio::int32_32_t::int32_32_t(const audio::int8_8_t& _val) {
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int8_16_t& _val) {
|
||||
m_data = int32_t(std::avg(int32_t(INT8_MIN),
|
||||
m_data = int32_t(etk::avg(int32_t(INT8_MIN),
|
||||
_val.get() >> 1,
|
||||
int32_t(INT8_MAX)
|
||||
) << 24
|
||||
@ -24,7 +24,7 @@ audio::int32_32_t::int32_32_t(const audio::int16_16_t& _val) {
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int16_32_t& _val) {
|
||||
m_data = int32_t(std::avg(int32_t(INT16_MIN),
|
||||
m_data = int32_t(etk::avg(int32_t(INT16_MIN),
|
||||
_val.get() >> 1,
|
||||
int32_t(INT16_MAX)
|
||||
) << 16
|
||||
@ -36,7 +36,7 @@ audio::int32_32_t::int32_32_t(const audio::int24_24_t& _val) {
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int24_32_t& _val) {
|
||||
m_data = int32_t(std::avg(int32_t(INT24_MIN),
|
||||
m_data = int32_t(etk::avg(int32_t(INT24_MIN),
|
||||
_val.get() >> 1,
|
||||
int32_t(INT24_MAX)
|
||||
) << 8
|
||||
@ -48,7 +48,7 @@ audio::int32_32_t::int32_32_t(const audio::int32_32_t& _val) {
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::int32_64_t& _val) {
|
||||
m_data = int32_t(std::avg(int64_t(INT32_MIN),
|
||||
m_data = int32_t(etk::avg(int64_t(INT32_MIN),
|
||||
_val.get() >> 1,
|
||||
int64_t(INT32_MAX)
|
||||
)
|
||||
@ -60,7 +60,7 @@ audio::int32_32_t::int32_32_t(const audio::int64_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::float_t& _val) {
|
||||
m_data = int32_t(std::avg(-1.0f,
|
||||
m_data = int32_t(etk::avg(-1.0f,
|
||||
_val.get(),
|
||||
1.0f
|
||||
) * float(INT32_MAX)
|
||||
@ -68,7 +68,7 @@ audio::int32_32_t::int32_32_t(const audio::float_t& _val) {
|
||||
}
|
||||
|
||||
audio::int32_32_t::int32_32_t(const audio::double_t& _val) {
|
||||
m_data = int32_t(std::avg(-1.0,
|
||||
m_data = int32_t(etk::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * double(INT32_MAX)
|
||||
@ -81,7 +81,7 @@ audio::int32_32_t::int32_32_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
|
||||
void audio::int32_32_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (31-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
|
||||
m_data = etk::avg(int64_t(INT32_MIN), val, int64_t(INT32_MAX));
|
||||
}
|
||||
|
||||
void audio::int32_32_t::set(int32_t _value) {
|
||||
@ -197,9 +197,9 @@ audio::int32_32_t audio::int32_32_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int32_32_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.31=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT16_MAX));
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int32_32_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":0.31=";
|
||||
_os << etk::toString(double(_obj.get())/double(INT16_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -111,6 +111,6 @@ namespace audio {
|
||||
int32_32_t& operator--();
|
||||
int32_32_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int32_32_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int32_32_t& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -44,7 +44,7 @@ audio::int32_64_t::int32_64_t(const audio::int64_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::float_t& _val) {
|
||||
m_data = int64_t(std::avg(float(INT32_MIN),
|
||||
m_data = int64_t(etk::avg(float(INT32_MIN),
|
||||
_val.get(),
|
||||
float(INT32_MAX)
|
||||
) * (float(INT32_MAX) * 2.0f + 1.0f)
|
||||
@ -52,7 +52,7 @@ audio::int32_64_t::int32_64_t(const audio::float_t& _val) {
|
||||
}
|
||||
|
||||
audio::int32_64_t::int32_64_t(const audio::double_t& _val) {
|
||||
m_data = int64_t(std::avg(double(INT32_MIN),
|
||||
m_data = int64_t(etk::avg(double(INT32_MIN),
|
||||
_val.get(),
|
||||
double(INT32_MAX)
|
||||
) * (double(INT32_MAX) * 2.0 + 1.0)
|
||||
@ -65,7 +65,7 @@ audio::int32_64_t::int32_64_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
|
||||
void audio::int32_64_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (32-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
|
||||
m_data = etk::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
|
||||
}
|
||||
|
||||
void audio::int32_64_t::set(int64_t _value) {
|
||||
@ -181,9 +181,9 @@ audio::int32_64_t audio::int32_64_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int32_64_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":31.32=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT32_MAX)*0.5);
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int32_64_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":31.32=";
|
||||
_os << etk::toString(double(_obj.get())/double(INT32_MAX)*0.5);
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -106,6 +106,6 @@ namespace audio {
|
||||
int32_64_t& operator--();
|
||||
int32_64_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int32_64_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int32_64_t& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -12,7 +12,7 @@ audio::int64_64_t::int64_64_t(const audio::int8_8_t& _val) {
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int8_16_t& _val) {
|
||||
m_data = int64_t(std::avg(int32_t(INT8_MIN),
|
||||
m_data = int64_t(etk::avg(int32_t(INT8_MIN),
|
||||
int32_t(_val.get())>>1,
|
||||
int32_t(INT8_MAX)
|
||||
)) << 56;
|
||||
@ -23,7 +23,7 @@ audio::int64_64_t::int64_64_t(const audio::int16_16_t& _val) {
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int16_32_t& _val) {
|
||||
m_data = int64_t(std::avg(int32_t(INT16_MIN),
|
||||
m_data = int64_t(etk::avg(int32_t(INT16_MIN),
|
||||
_val.get() >> 1,
|
||||
int32_t(INT16_MAX)
|
||||
)) << 48;
|
||||
@ -34,7 +34,7 @@ audio::int64_64_t::int64_64_t(const audio::int24_24_t& _val) {
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int24_32_t& _val) {
|
||||
m_data = int64_t(std::avg(int32_t(INT24_MIN),
|
||||
m_data = int64_t(etk::avg(int32_t(INT24_MIN),
|
||||
_val.get()>>1,
|
||||
int32_t(INT24_MAX)
|
||||
)) << 40;
|
||||
@ -45,7 +45,7 @@ audio::int64_64_t::int64_64_t(const audio::int32_32_t& _val) {
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::int32_64_t& _val) {
|
||||
m_data = int64_t(std::avg(int64_t(INT32_MIN),
|
||||
m_data = int64_t(etk::avg(int64_t(INT32_MIN),
|
||||
_val.get()>>1,
|
||||
int64_t(INT32_MAX)
|
||||
)) << 32;
|
||||
@ -56,7 +56,7 @@ audio::int64_64_t::int64_64_t(const audio::int64_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::float_t& _val) {
|
||||
m_data = int64_t(std::avg(-1.0f,
|
||||
m_data = int64_t(etk::avg(-1.0f,
|
||||
_val.get(),
|
||||
1.0f
|
||||
) * (float(INT64_MAX) + 1.0f)
|
||||
@ -64,7 +64,7 @@ audio::int64_64_t::int64_64_t(const audio::float_t& _val) {
|
||||
}
|
||||
|
||||
audio::int64_64_t::int64_64_t(const audio::double_t& _val) {
|
||||
m_data = int64_t(std::avg(-1.0,
|
||||
m_data = int64_t(etk::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * (double(INT64_MAX) + 1.0f)
|
||||
@ -78,7 +78,7 @@ audio::int64_64_t::int64_64_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
void audio::int64_64_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
// TODO: do it better with int128_t elements
|
||||
int64_t val = _value << (63-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
|
||||
m_data = etk::avg(int64_t(INT64_MIN), val, int64_t(INT64_MAX));
|
||||
}
|
||||
|
||||
void audio::int64_64_t::set(int64_t _value) {
|
||||
@ -213,9 +213,9 @@ audio::int64_64_t audio::int64_64_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int64_64_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.63=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT64_MAX));
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int64_64_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":0.63=";
|
||||
_os << etk::toString(double(_obj.get())/double(INT64_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -106,6 +106,6 @@ namespace audio {
|
||||
int64_64_t& operator--();
|
||||
int64_64_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int64_64_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int64_64_t& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -21,7 +21,7 @@ audio::int8_16_t::int8_16_t(const audio::int16_16_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int16_32_t& _val) {
|
||||
m_data = int16_t(std::avg(int32_t(INT24_MIN),
|
||||
m_data = int16_t(etk::avg(int32_t(INT24_MIN),
|
||||
_val.get(),
|
||||
int32_t(INT24_MAX)
|
||||
) >> 8
|
||||
@ -41,7 +41,7 @@ audio::int8_16_t::int8_16_t(const audio::int32_32_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::int32_64_t& _val) {
|
||||
m_data = int16_t(std::avg(int64_t(INT40_MIN),
|
||||
m_data = int16_t(etk::avg(int64_t(INT40_MIN),
|
||||
_val.get(),
|
||||
int64_t(INT40_MAX)
|
||||
) >> 24
|
||||
@ -53,7 +53,7 @@ audio::int8_16_t::int8_16_t(const audio::int64_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::float_t& _val) {
|
||||
m_data = int16_t(std::avg(float(INT8_MIN),
|
||||
m_data = int16_t(etk::avg(float(INT8_MIN),
|
||||
_val.get(),
|
||||
float(INT8_MAX)
|
||||
) * (float(INT8_MAX) * 2.0f + 1.0f)
|
||||
@ -61,7 +61,7 @@ audio::int8_16_t::int8_16_t(const audio::float_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_16_t::int8_16_t(const audio::double_t& _val) {
|
||||
m_data = int16_t(std::avg(double(INT8_MIN),
|
||||
m_data = int16_t(etk::avg(double(INT8_MIN),
|
||||
_val.get(),
|
||||
double(INT8_MAX)
|
||||
) * (double(INT8_MAX) * 2.0 + 1.0)
|
||||
@ -74,7 +74,7 @@ audio::int8_16_t::int8_16_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
|
||||
void audio::int8_16_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (8-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT16_MIN), val, int64_t(INT16_MAX));
|
||||
m_data = etk::avg(int64_t(INT16_MIN), val, int64_t(INT16_MAX));
|
||||
}
|
||||
|
||||
void audio::int8_16_t::set(int16_t _value) {
|
||||
@ -190,9 +190,9 @@ audio::int8_16_t audio::int8_16_t::operator--(int _unused) {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int8_16_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":7.8=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT8_MAX)*0.5);
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int8_16_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":7.8=";
|
||||
_os << etk::toString(double(_obj.get())/double(INT8_MAX)*0.5);
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -113,6 +113,6 @@ namespace audio {
|
||||
int8_16_t& operator--();
|
||||
int8_16_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int8_16_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int8_16_t& _obj);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <audio/debug.hpp>
|
||||
@ -13,7 +13,7 @@ audio::int8_8_t::int8_8_t(const audio::int8_8_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int8_16_t& _val) {
|
||||
m_data = int8_t(std::avg(int32_t(INT8_MIN),
|
||||
m_data = int8_t(etk::avg(int32_t(INT8_MIN),
|
||||
int32_t(_val.get())>>1,
|
||||
int32_t(INT8_MAX)
|
||||
));
|
||||
@ -24,7 +24,7 @@ audio::int8_8_t::int8_8_t(const audio::int16_16_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int16_32_t& _val) {
|
||||
m_data = int8_t(std::avg(int32_t(INT16_MIN),
|
||||
m_data = int8_t(etk::avg(int32_t(INT16_MIN),
|
||||
_val.get()>>1,
|
||||
int32_t(INT16_MAX)
|
||||
) >> 8
|
||||
@ -36,7 +36,7 @@ audio::int8_8_t::int8_8_t(const audio::int24_24_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int24_32_t& _val) {
|
||||
m_data = int8_t(std::avg(int32_t(INT24_MIN),
|
||||
m_data = int8_t(etk::avg(int32_t(INT24_MIN),
|
||||
_val.get() >> 1,
|
||||
int32_t(INT24_MAX)
|
||||
) >> 16);
|
||||
@ -47,7 +47,7 @@ audio::int8_8_t::int8_8_t(const audio::int32_32_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::int32_64_t& _val) {
|
||||
m_data = int8_t(std::avg(int64_t(INT32_MIN),
|
||||
m_data = int8_t(etk::avg(int64_t(INT32_MIN),
|
||||
_val.get() >> 1,
|
||||
int64_t(INT32_MAX)
|
||||
) >> 24
|
||||
@ -59,7 +59,7 @@ audio::int8_8_t::int8_8_t(const audio::int64_64_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::float_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0f,
|
||||
m_data = int16_t(etk::avg(-1.0f,
|
||||
_val.get(),
|
||||
1.0f
|
||||
) * (float(INT8_MAX) + 1.0f)
|
||||
@ -67,7 +67,7 @@ audio::int8_8_t::int8_8_t(const audio::float_t& _val) {
|
||||
}
|
||||
|
||||
audio::int8_8_t::int8_8_t(const audio::double_t& _val) {
|
||||
m_data = int16_t(std::avg(-1.0,
|
||||
m_data = int16_t(etk::avg(-1.0,
|
||||
_val.get(),
|
||||
1.0
|
||||
) * (double(INT8_MAX) + 1.0)
|
||||
@ -80,7 +80,7 @@ audio::int8_8_t::int8_8_t(int64_t _value, int32_t _flotingPointPosition) {
|
||||
|
||||
void audio::int8_8_t::set(int64_t _value, int32_t _flotingPointPosition) {
|
||||
int64_t val = _value << (7-_flotingPointPosition);
|
||||
m_data = std::avg(int64_t(INT8_MIN), val, int64_t(INT8_MAX));
|
||||
m_data = etk::avg(int64_t(INT8_MIN), val, int64_t(INT8_MAX));
|
||||
}
|
||||
|
||||
void audio::int8_8_t::set(int8_t _value) {
|
||||
@ -197,9 +197,9 @@ audio::int8_8_t audio::int8_8_t::operator--(int _unused) {
|
||||
}
|
||||
|
||||
|
||||
std::ostream& audio::operator <<(std::ostream& _os, const audio::int8_8_t& _obj) {
|
||||
_os << "[" << etk::to_string(_obj.get()) << ":0.7=";
|
||||
_os << etk::to_string(double(_obj.get())/double(INT8_MAX));
|
||||
etk::Stream& audio::operator <<(etk::Stream& _os, const audio::int8_8_t& _obj) {
|
||||
_os << "[" << etk::toString(_obj.get()) << ":0.7=";
|
||||
_os << etk::toString(double(_obj.get())/double(INT8_MAX));
|
||||
_os << "]";
|
||||
return _os;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
#include <audio/types.hpp>
|
||||
@ -111,6 +111,6 @@ namespace audio {
|
||||
int8_8_t& operator--();
|
||||
int8_8_t operator--(int _unused);
|
||||
};
|
||||
std::ostream& operator <<(std::ostream& _os, const audio::int8_8_t& _obj);
|
||||
etk::Stream& operator <<(etk::Stream& _os, const audio::int8_8_t& _obj);
|
||||
}
|
||||
|
||||
|
15
audio/types.cpp
Normal file
15
audio/types.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#include <audio/types.hpp>
|
||||
|
||||
const int64_t INT24_MIN = 0XFFFFFFFFFF800000;
|
||||
const int64_t INT24_MAX = 0X00000000007FFFFF;
|
||||
|
||||
const int64_t INT40_MIN = 0XFFFFFF8000000000;
|
||||
const int64_t INT40_MAX = 0X0000007FFFFFFFFF;
|
||||
|
||||
const int64_t INT56_MIN = 0XFF80000000000000;
|
||||
const int64_t INT56_MAX = 0X007FFFFFFFFFFFFF;
|
@ -1,11 +1,12 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <etk/types.hpp>
|
||||
#include <etk/Stream.hpp>
|
||||
|
||||
/**
|
||||
* @brief Audio library namespace
|
||||
@ -24,14 +25,14 @@ namespace audio {
|
||||
class double_t;
|
||||
}
|
||||
|
||||
#define INT24_MIN 0xFFFFFFFFFF800000LL
|
||||
#define INT24_MAX 0x00000000007FFFFFLL
|
||||
extern const int64_t INT24_MIN;
|
||||
extern const int64_t INT24_MAX;
|
||||
|
||||
#define INT40_MIN 0xFFFFFF8000000000LL
|
||||
#define INT40_MAX 0x0000007FFFFFFFFFLL
|
||||
extern const int64_t INT40_MIN;
|
||||
extern const int64_t INT40_MAX;
|
||||
|
||||
#define INT56_MIN 0xFFFF800000000000LL
|
||||
#define INT56_MAX 0x00007FFFFFFFFFFFLL
|
||||
extern const int64_t INT56_MIN;
|
||||
extern const int64_t INT56_MAX;
|
||||
|
||||
#include <audio/int8_8_t.hpp>
|
||||
#include <audio/int8_16_t.hpp>
|
||||
|
@ -28,16 +28,16 @@ Are there any licensing restrictions? {#audio_mainpage_license_restri
|
||||
AUDIO is **FREE software** and _all sub-library are FREE and staticly linkable !!!_
|
||||
|
||||
|
||||
License (APACHE-2.0) {#audio_mainpage_license}
|
||||
====================
|
||||
License (MPL v2.0) {#audio_mainpage_license}
|
||||
==================
|
||||
|
||||
Copyright AUDIO Edouard DUPIN
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
Licensed under the Mozilla Public License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
<http://www.apache.org/licenses/LICENSE-2.0>
|
||||
<https://www.mozilla.org/MPL/2.0>
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
13
license.txt
13
license.txt
@ -1,13 +0,0 @@
|
||||
Copyright audio Edouard DUPIN
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.debug as debug
|
||||
import realog.debug as debug
|
||||
import lutin.tools as tools
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ def get_desc():
|
||||
return "Basic audio types test"
|
||||
|
||||
def get_licence():
|
||||
return "APACHE-2"
|
||||
return "MPL-2"
|
||||
|
||||
def get_compagny_type():
|
||||
return "com"
|
||||
@ -42,7 +42,7 @@ def configure(target, my_module):
|
||||
])
|
||||
my_module.add_depend([
|
||||
'audio',
|
||||
'gtest',
|
||||
'etest',
|
||||
'test-debug'
|
||||
])
|
||||
return True
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.debug as debug
|
||||
import realog.debug as debug
|
||||
import lutin.tools as tools
|
||||
|
||||
def get_type():
|
||||
@ -9,7 +9,7 @@ def get_desc():
|
||||
return "Basic audio types"
|
||||
|
||||
def get_licence():
|
||||
return "APACHE-2"
|
||||
return "MPL-2"
|
||||
|
||||
def get_compagny_type():
|
||||
return "com"
|
||||
@ -26,6 +26,7 @@ def get_version():
|
||||
def configure(target, my_module):
|
||||
my_module.add_src_file([
|
||||
'audio/debug.cpp',
|
||||
'audio/types.cpp',
|
||||
'audio/channel.cpp',
|
||||
'audio/format.cpp',
|
||||
'audio/Time.cpp',
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ TEST(TestBase, type_float_t) {
|
||||
|
||||
TEST(TestBase, type_double_t) {
|
||||
audio::double_t typeBase(16, 0);
|
||||
EXPECT_EQ(int64_t(typeBase.get()), 16LL);
|
||||
EXPECT_EQ(int64_t(typeBase.get()), 16);
|
||||
EXPECT_EQ(typeBase.get(), 16.0); // Note : double point error
|
||||
typeBase.set(-250.0);
|
||||
EXPECT_EQ(typeBase.get(), -250.0);
|
||||
|
@ -1,28 +1,24 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
|
||||
#include <thread>
|
||||
extern "C" {
|
||||
#include <math.h>
|
||||
}
|
||||
#include <ethread/Thread.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
|
||||
int main(int _argc, const char** _argv) {
|
||||
// init Google test :
|
||||
::testing::InitGoogleTest(&_argc, const_cast<char **>(_argv));
|
||||
// the only one init for etk:
|
||||
etk::init(_argc, _argv);
|
||||
etest::init(_argc, _argv);
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
etk::String data = _argv[iii];
|
||||
if ( data == "-h"
|
||||
|| data == "--help") {
|
||||
TEST_INFO("Help : ");
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
TEST(TestFloat, basicConstructorBase) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ TEST(TestInt24_24, basicOperatorMultiplication) {
|
||||
*/
|
||||
|
||||
|
||||
#define RESULT_VALUE (2621440)
|
||||
static const int64_t RESULT_VALUE = 2621440;
|
||||
|
||||
TEST(TestInt24_24, basicConstructorInt8_8) {
|
||||
audio::int24_24_t out(audio::int8_8_t(5,4));
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
@ -16,12 +16,14 @@ TEST(TestInt32_32, basicConstructorBase) {
|
||||
|
||||
TEST(TestInt32_32, basicConstructorSetOne) {
|
||||
audio::int32_32_t typeBase(1, 0);
|
||||
EXPECT_EQ(typeBase.get(), ((1LL<<31)-1));
|
||||
int64_t ret = ((1LL<<31)-1);
|
||||
EXPECT_EQ(typeBase.get(), ret);
|
||||
}
|
||||
|
||||
TEST(TestInt32_32, basicConstructorSetLessOne) {
|
||||
audio::int32_32_t typeBase(-1, 0);
|
||||
EXPECT_EQ(typeBase.get(), (-(1LL<<31)));
|
||||
int64_t ret = (-(1LL<<31));
|
||||
EXPECT_EQ(typeBase.get(), ret);
|
||||
}
|
||||
|
||||
TEST(TestInt32_32, basicOperatorEqual) {
|
||||
@ -184,7 +186,7 @@ TEST(TestInt32_32, basicOperatorDecrementPre) {
|
||||
*/
|
||||
|
||||
|
||||
#define RESULT_VALUE (671088640)
|
||||
static const int64_t RESULT_VALUE = (671088640);
|
||||
|
||||
TEST(TestInt32_32, basicConstructorInt8_8) {
|
||||
audio::int32_32_t out(audio::int8_8_t(5,4));
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
@ -16,12 +16,14 @@ TEST(TestInt32_64, basicConstructorBase) {
|
||||
|
||||
TEST(TestInt32_64, basicConstructorSetOne) {
|
||||
audio::int32_64_t typeBase(1, 0);
|
||||
EXPECT_EQ(typeBase.get(), ((1LL<<32)));
|
||||
int64_t ret = ((1LL<<32));
|
||||
EXPECT_EQ(typeBase.get(), ret);
|
||||
}
|
||||
|
||||
TEST(TestInt32_64, basicConstructorSetLessOne) {
|
||||
audio::int32_64_t typeBase(-1, 0);
|
||||
EXPECT_EQ(typeBase.get(), (-(1LL<<32)));
|
||||
int64_t ret = (-(1LL<<32));
|
||||
EXPECT_EQ(typeBase.get(), ret);
|
||||
}
|
||||
|
||||
TEST(TestInt32_64, basicOperatorEqual) {
|
||||
@ -50,7 +52,8 @@ TEST(TestInt32_64, basicOperatorMultiplication) {
|
||||
EXPECT_EQ(typeBase.get(), -35);
|
||||
typeBase = audio::double_t(0.6);
|
||||
typeBase *= audio::double_t(0.3);
|
||||
EXPECT_EQ(typeBase.get(), 773094112LL);
|
||||
int64_t ret = 773094112LL;
|
||||
EXPECT_EQ(typeBase.get(), ret);
|
||||
}
|
||||
|
||||
|
||||
@ -182,7 +185,7 @@ TEST(TestInt32_64, basicOperatorDecrementPre) {
|
||||
EXPECT_EQ(out.get(), audio::int32_64_t(9, 0).get());
|
||||
}
|
||||
|
||||
#define RESULT_VALUE (1342177280LL)
|
||||
static const int64_t RESULT_VALUE = (1342177280LL);
|
||||
|
||||
TEST(TestInt32_64, basicConstructorInt8_8) {
|
||||
audio::int32_64_t out(audio::int8_8_t(5,4));
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
TEST(TestInt64_64, basicConstructorBase) {
|
||||
@ -15,13 +15,15 @@ TEST(TestInt64_64, basicConstructorBase) {
|
||||
|
||||
TEST(TestInt64_64, basicConstructorSetOne) {
|
||||
// only one way to set the maximum value
|
||||
int64_t ret = 0x7FFFFFFFFFFFFFFFLL;
|
||||
audio::int64_64_t typeBase(0x7FFFFFFFFFFFFFFFLL, 63);
|
||||
EXPECT_EQ(typeBase.get(), 0x7FFFFFFFFFFFFFFFLL);
|
||||
EXPECT_EQ(typeBase.get(), ret);
|
||||
}
|
||||
|
||||
TEST(TestInt64_64, basicConstructorSetLessOne) {
|
||||
audio::int64_64_t typeBase(-1, 0);
|
||||
EXPECT_EQ(typeBase.get(), (-(1LL<<63)));
|
||||
int64_t ret = (-(1LL<<63));
|
||||
EXPECT_EQ(typeBase.get(),ret);
|
||||
}
|
||||
|
||||
TEST(TestInt64_64, basicOperatorEqual) {
|
||||
@ -50,7 +52,8 @@ TEST(TestInt64_64, basicOperatorMultiplication) {
|
||||
EXPECT_EQ(typeBase.get(), -35);
|
||||
typeBase = audio::double_t(0.6);
|
||||
typeBase *= audio::double_t(0.3);
|
||||
EXPECT_EQ(typeBase.get(), 1660206965216520438LL);
|
||||
uint64_t ret = 1660206965216520438LL;
|
||||
EXPECT_EQ(typeBase.get(), ret);
|
||||
}
|
||||
|
||||
TEST(TestInt64_64, basicOperatorCompareEquality) {
|
||||
@ -184,8 +187,7 @@ TEST(TestInt64_64, basicOperatorDecrementPre) {
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#define RESULT_VALUE (2882303761517117440LL)
|
||||
static const uint64_t RESULT_VALUE = (2882303761517117440LL);
|
||||
|
||||
TEST(TestInt64_64, basicConstructorInt8_8) {
|
||||
audio::int64_64_t out(audio::int8_8_t(5,4));
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
TEST(TestInt8_16, basicConstructorBase) {
|
||||
@ -15,12 +15,12 @@ TEST(TestInt8_16, basicConstructorBase) {
|
||||
|
||||
TEST(TestInt8_16, basicConstructorSetOne) {
|
||||
audio::int8_16_t typeBase(1, 0);
|
||||
EXPECT_EQ(typeBase.get(), ((1LL<<8)));
|
||||
EXPECT_EQ(typeBase.get(), ((1<<8)));
|
||||
}
|
||||
|
||||
TEST(TestInt8_16, basicConstructorSetLessOne) {
|
||||
audio::int8_16_t typeBase(-1, 0);
|
||||
EXPECT_EQ(typeBase.get(), (-(1LL<<8)));
|
||||
EXPECT_EQ(typeBase.get(), (-(1<<8)));
|
||||
}
|
||||
|
||||
TEST(TestInt8_16, basicOperatorEqual) {
|
||||
|
@ -1,11 +1,11 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2015, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
|
||||
#include <test-debug/debug.hpp>
|
||||
#include <gtest/gtest.h>
|
||||
#include <etest/etest.hpp>
|
||||
#include <audio/types.hpp>
|
||||
|
||||
|
||||
@ -16,12 +16,12 @@ TEST(TestInt8_8, basicConstructorBase) {
|
||||
|
||||
TEST(TestInt8_8, basicConstructorSetOne) {
|
||||
audio::int8_8_t typeBase(1, 0);
|
||||
EXPECT_EQ(typeBase.get(), ((1LL<<7)-1));
|
||||
EXPECT_EQ(typeBase.get(), ((1<<7)-1));
|
||||
}
|
||||
|
||||
TEST(TestInt8_8, basicConstructorSetLessOne) {
|
||||
audio::int8_8_t typeBase(-1, 0);
|
||||
EXPECT_EQ(typeBase.get(), (-(1LL<<7)));
|
||||
EXPECT_EQ(typeBase.get(), (-(1<<7)));
|
||||
}
|
||||
|
||||
TEST(TestInt8_8, basicOperatorEqual) {
|
||||
|
@ -1 +1 @@
|
||||
0.4.0
|
||||
1.0.0
|
Loading…
x
Reference in New Issue
Block a user