@@ -844,8 +844,13 @@ bool CRawFileIO::writeSample(const int16_t data, const unsigned int chl)
844
844
{
845
845
if (chl >= m_numChannels || m_eMode == eFileIoMode_input || m_pFramebuffer == nullptr || m_nBitsPerSample != 16 )
846
846
{
847
- LogDebug (" bad params chl={}, m_numChannels={}, m_eMode={}, eFileIoMode_input={}" , chl, m_numChannels,
848
- m_eMode, eFileIoMode_input);
847
+ LogDebug
848
+ (
849
+ " bad param - chl={}, numChannels={}, eMode={}" ,
850
+ chl,
851
+ m_numChannels,
852
+ (int ) m_eMode
853
+ );
849
854
return false ;
850
855
}
851
856
@@ -884,8 +889,13 @@ bool CRawFileIO::writeSample(const int32_t data, const unsigned int chl)
884
889
{
885
890
if (chl >= m_numChannels || m_eMode == eFileIoMode_input || m_pFramebuffer == nullptr || m_nBitsPerSample != 32 )
886
891
{
887
- LogDebug (" bad params chl={}, m_numChannels={}, m_eMode={}, eFileIoMode_input={}" , chl, m_numChannels,
888
- m_eMode, eFileIoMode_input);
892
+ LogDebug
893
+ (
894
+ " bad param - chl={}, numChannels={}, eMode={}" ,
895
+ chl,
896
+ m_numChannels,
897
+ (int ) m_eMode
898
+ );
889
899
return false ;
890
900
}
891
901
@@ -923,8 +933,12 @@ bool CRawFileIO::writeBlock(const void *pData, const unsigned int numFrames)
923
933
{
924
934
if (pData == nullptr || numFrames < 1 || m_eMode == eFileIoMode_input || m_pFramebuffer == nullptr )
925
935
{
926
- LogDebug (" bad params m_bFileOpened={}, m_eMode={}, eFileIoMode_input={}" , m_bFileOpened, m_eMode,
927
- eFileIoMode_input);
936
+ LogDebug
937
+ (
938
+ " bad param - bFileOpened={}, eMode={}" ,
939
+ m_bFileOpened,
940
+ (int ) m_eMode
941
+ );
928
942
return false ;
929
943
}
930
944
@@ -1582,7 +1596,11 @@ bool CWavFileIO::readBlock(void *pData, const unsigned int numFrames)
1582
1596
1583
1597
if (pData == nullptr || m_eMode == eFileIoMode_output)
1584
1598
{
1585
- LogDebug (" bad params, m_eMode={}, eFileIoMode_input={}" , m_eMode, eFileIoMode_input);
1599
+ LogDebug
1600
+ (
1601
+ " bad param - eMode={}" ,
1602
+ (int ) m_eMode
1603
+ );
1586
1604
return false ;
1587
1605
}
1588
1606
@@ -1652,11 +1670,10 @@ bool CWavFileIO::writeSample(const int16_t data, const unsigned int chl)
1652
1670
{
1653
1671
LogDebug
1654
1672
(
1655
- " bad params chl={}, m_numChannels ={}, m_eMode={}, eFileIoMode_input ={}" ,
1673
+ " bad param - chl={}, numChannels ={}, eMode ={}" ,
1656
1674
chl,
1657
1675
m_numChannels,
1658
- m_eMode,
1659
- eFileIoMode_input
1676
+ (int ) m_eMode
1660
1677
);
1661
1678
1662
1679
return false ;
@@ -1709,8 +1726,13 @@ bool CWavFileIO::writeSample(const int32_t data, const unsigned int chl)
1709
1726
{
1710
1727
if (chl >= m_numChannels || m_eMode == eFileIoMode_input || m_nBitsPerSample != 32 )
1711
1728
{
1712
- LogDebug (" bad params chl={}, m_numChannels={}, m_eMode={}, eFileIoMode_input={}" , chl, m_numChannels,
1713
- m_eMode, eFileIoMode_input);
1729
+ LogDebug
1730
+ (
1731
+ " bad param - chl={}, numChannels={}, eMode={}" ,
1732
+ chl,
1733
+ m_numChannels,
1734
+ (int ) m_eMode
1735
+ );
1714
1736
return false ;
1715
1737
}
1716
1738
@@ -1973,25 +1995,64 @@ bool CWavFileIO::setCurrentFrame(unsigned int frameNum)
1973
1995
1974
1996
std::string removeLeadingSpaces (std::string& sStr )
1975
1997
{
1998
+ std::string sOut = " " ;
1999
+
2000
+ bool bFirstCharFound = false ;
2001
+
2002
+ // skip leading spaces
2003
+ for (auto x = sStr .begin (); x != sStr .end (); x++)
2004
+ {
2005
+ if (bFirstCharFound == false && (*x) == ' ' )
2006
+ {
2007
+ continue ;
2008
+ }
2009
+
2010
+ bFirstCharFound = true ;
1976
2011
2012
+ sOut .push_back ((*x));
2013
+ }
2014
+
2015
+ return sOut ;
1977
2016
}
1978
2017
1979
2018
1980
2019
std::string removeTrailingSpaces (std::string& sStr )
1981
2020
{
2021
+ std::string sOut = " " ;
2022
+
2023
+ int nLen = (int ) sStr .size ();
2024
+
2025
+ // find string len - num trailing spaces
2026
+ for (auto x = (sStr .end () - 1 ); x != sStr .begin (); x--)
2027
+ {
2028
+ if ((*x) != ' ' )
2029
+ {
2030
+ break ;
2031
+ }
2032
+
2033
+ nLen--;
2034
+ }
2035
+
2036
+ sOut .append (sStr .substr (0 , nLen));
2037
+
2038
+ return sOut ;
1982
2039
1983
2040
}
1984
2041
1985
2042
1986
2043
std::string getFileExt (std::string& sPath )
1987
2044
{
2045
+ std::filesystem::path filePath (sPath );
1988
2046
2047
+ return (filePath.extension ().string ());
1989
2048
}
1990
2049
1991
2050
1992
2051
std::string getFileName (std::string& sPath )
1993
2052
{
2053
+ std::filesystem::path filePath (sPath );
1994
2054
2055
+ return (filePath.filename ().string ());
1995
2056
}
1996
2057
1997
2058
0 commit comments