Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1d7dec7
Switch all Jamulus audio sample processing to use floats instead of
hselasky Aug 20, 2020
d5ea08e
Merge pull request #535 from hselasky/floating_point
corrados Sep 26, 2020
7e3fb6a
variable renaming, fixes
corrados Sep 26, 2020
e0540e0
fix compilation error on Linux
corrados Sep 26, 2020
4c77ceb
bug fix
corrados Sep 26, 2020
17ef7cb
update
corrados Sep 26, 2020
3f1640d
fixes
corrados Sep 26, 2020
31650af
code style changes
corrados Sep 26, 2020
94ca039
fix clipping indicator for the client (does not yet work for the serv…
corrados Sep 26, 2020
349db41
clipping in the server seems to work (I tested again)
corrados Sep 26, 2020
a858fa1
a lot of code was from HPS, add him to the header
corrados Sep 26, 2020
be56f6c
Merge branch 'master' into integrate_float
corrados Sep 26, 2020
6c0796c
Merge branch 'master' into integrate_float
corrados Sep 26, 2020
d98f172
Merge branch 'master' into integrate_float
corrados Sep 27, 2020
47b0ae9
merge fix
corrados Sep 27, 2020
e9a1b9f
fixed compilation error
corrados Sep 27, 2020
d106c4d
Merge branch 'master' into integrate_float
corrados Sep 27, 2020
bb5cc54
bug fix: the meter fly back did not work correctly with the float type
corrados Sep 27, 2020
8a45af3
Minor scaling factor fixes
bflamig Sep 29, 2020
32026bd
Merge pull request #645 from bflamig/integrate_float
corrados Sep 30, 2020
615c52a
Merge branch 'master' into integrate_float
corrados Oct 1, 2020
3f64a91
Merge branch 'master' into integrate_float
corrados Oct 4, 2020
67aba98
merge fix: fix the changelog
corrados Oct 4, 2020
815e6c1
Merge branch 'master' into integrate_float
corrados Oct 4, 2020
6a2605c
small fixes
corrados Oct 4, 2020
287ca7d
the type for the CConvBuf is not always float but a template -> renam…
corrados Oct 4, 2020
98eaed7
Merge branch 'integrate_float' into master
corrados Oct 4, 2020
83f4c61
prepare for using multithreading also for the OPUS decoding in the se…
corrados Oct 4, 2020
a4df539
bug fix
corrados Oct 4, 2020
185f3c5
update
corrados Oct 4, 2020
265aaed
Merge branch 'master' into integrate_float2
corrados Oct 5, 2020
ff48de2
Merge branch 'master' into integrate_float2
corrados Oct 8, 2020
8284a71
Merge branch 'master' into integrate_float2
corrados Oct 9, 2020
6b38e4d
Merge branch 'master' into integrate_float2
corrados Oct 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
- bug fix: reduced server list is displayed instead of the normal list (#657)


TODO BUG FIX: the new Windows audio interface gives ugly clipping (which the old one does not)!!!

TODO switched all remaining audio sample processing to use floats, coded by hselasky (#544)



Expand Down
2 changes: 1 addition & 1 deletion android/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/* Implementation *************************************************************/

CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<float>& pfData, void* arg ),
void* arg,
const int iCtrlMIDIChannel,
const bool ,
Expand Down
2 changes: 1 addition & 1 deletion android/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
class CSound : public CSoundBase, public oboe::AudioStreamCallback
{
public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
CSound ( void (*fpNewProcessCallback) ( CVector<float>& pfData, void* arg ),
void* arg,
const int iCtrlMIDIChannel,
const bool ,
Expand Down
2 changes: 1 addition & 1 deletion libs/oboe
Submodule oboe updated 168 files
15 changes: 6 additions & 9 deletions linux/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ int CSound::Init ( const int /* iNewPrefMonoBufferSize */ )
iJACKBufferSizeStero = 2 * iJACKBufferSizeMono;

// create memory for intermediate audio buffer
vecsTmpAudioSndCrdStereo.Init ( iJACKBufferSizeStero );
vecfTmpAudioSndCrdStereo.Init ( iJACKBufferSizeStero );

return iJACKBufferSizeMono;
}
Expand Down Expand Up @@ -259,16 +259,13 @@ int CSound::process ( jack_nframes_t nframes, void* arg )
{
for ( i = 0; i < pSound->iJACKBufferSizeMono; i++ )
{
pSound->vecsTmpAudioSndCrdStereo[2 * i] =
(short) ( in_left[i] * _MAXSHORT );

pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] =
(short) ( in_right[i] * _MAXSHORT );
pSound->vecfTmpAudioSndCrdStereo[2 * i] = in_left[i];
pSound->vecfTmpAudioSndCrdStereo[2 * i + 1] = in_right[i];
}
}

// call processing callback function
pSound->ProcessCallback ( pSound->vecsTmpAudioSndCrdStereo );
pSound->ProcessCallback ( pSound->vecfTmpAudioSndCrdStereo );

// get output data pointer
jack_default_audio_sample_t* out_left =
Expand All @@ -285,10 +282,10 @@ int CSound::process ( jack_nframes_t nframes, void* arg )
for ( i = 0; i < pSound->iJACKBufferSizeMono; i++ )
{
out_left[i] = (jack_default_audio_sample_t)
pSound->vecsTmpAudioSndCrdStereo[2 * i] / _MAXSHORT;
pSound->vecfTmpAudioSndCrdStereo[2 * i];

out_right[i] = (jack_default_audio_sample_t)
pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] / _MAXSHORT;
pSound->vecfTmpAudioSndCrdStereo[2 * i + 1];
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions linux/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
class CSound : public CSoundBase
{
public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
CSound ( void (*fpNewProcessCallback) ( CVector<float>& pfData, void* arg ),
void* arg,
const int iCtrlMIDIChannel,
const bool bNoAutoJackConnect,
Expand All @@ -78,7 +78,7 @@ class CSound : public CSoundBase

// these variables should be protected but cannot since we want
// to access them from the callback function
CVector<short> vecsTmpAudioSndCrdStereo;
CVector<float> vecfTmpAudioSndCrdStereo;
int iJACKBufferSizeMono;
int iJACKBufferSizeStero;
bool bJackWasShutDown;
Expand Down Expand Up @@ -111,7 +111,7 @@ class CSound : public CSoundBase
Q_OBJECT

public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ),
CSound ( void (*fpNewProcessCallback) ( CVector<float>& pfData, void* pParg ),
void* pParg,
const int iCtrlMIDIChannel,
const bool ,
Expand All @@ -122,12 +122,12 @@ class CSound : public CSoundBase
this, &CSound::OnTimer ); }
virtual ~CSound() {}
virtual int Init ( const int iNewPrefMonoBufferSize ) { CSoundBase::Init ( iNewPrefMonoBufferSize );
vecsTemp.Init ( 2 * iNewPrefMonoBufferSize );
vecfTemp.Init ( 2 * iNewPrefMonoBufferSize );
return iNewPrefMonoBufferSize; }
CHighPrecisionTimer HighPrecisionTimer;
CVector<short> vecsTemp;
CVector<float> vecfTemp;

public slots:
void OnTimer() { vecsTemp.Reset ( 0 ); if ( IsRunning() ) { ProcessCallback ( vecsTemp ); } }
void OnTimer() { vecfTemp.Reset ( 0 ); if ( IsRunning() ) { ProcessCallback ( vecfTemp ); } }
};
#endif // WITH_SOUND
24 changes: 12 additions & 12 deletions mac/sound.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


/* Implementation *************************************************************/
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<float>& pfData, void* arg ),
void* arg,
const int iCtrlMIDIChannel,
const bool ,
Expand Down Expand Up @@ -848,7 +848,7 @@ int CSound::Init ( const int iNewPrefMonoBufferSize )
iCoreAudioBufferSizeStereo = 2 * iCoreAudioBufferSizeMono;

// create memory for intermediate audio buffer
vecsTmpAudioSndCrdStereo.Init ( iCoreAudioBufferSizeStereo );
vecfTmpAudioSndCrdStereo.Init ( iCoreAudioBufferSizeStereo );

return iCoreAudioBufferSizeMono;
}
Expand Down Expand Up @@ -970,8 +970,8 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,
for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
{
// copy left and right channels separately
pSound->vecsTmpAudioSndCrdStereo[2 * i] = (short) ( pLeftData[iNumChanPerFrameLeft * i + iSelInInterlChLeft] * _MAXSHORT );
pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] = (short) ( pRightData[iNumChanPerFrameRight * i + iSelInInterlChRight] * _MAXSHORT );
pSound->vecfTmpAudioSndCrdStereo[2 * i] = pLeftData[iNumChanPerFrameLeft * i + iSelInInterlChLeft];
pSound->vecfTmpAudioSndCrdStereo[2 * i + 1] = pRightData[iNumChanPerFrameRight * i + iSelInInterlChRight];
}

// add an additional optional channel
Expand All @@ -982,8 +982,8 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,

for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
{
pSound->vecsTmpAudioSndCrdStereo[2 * i] = Float2Short (
pSound->vecsTmpAudioSndCrdStereo[2 * i] + pLeftData[iNumChanPerFrameLeft * i + iSelAddInInterlChLeft] * _MAXSHORT );
pSound->vecfTmpAudioSndCrdStereo[2 * i] = ClipFloat (
pSound->vecfTmpAudioSndCrdStereo[2 * i] + pLeftData[iNumChanPerFrameLeft * i + iSelAddInInterlChLeft] );
}
}

Expand All @@ -994,19 +994,19 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,

for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
{
pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] = Float2Short (
pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] + pRightData[iNumChanPerFrameRight * i + iSelAddInInterlChRight] * _MAXSHORT );
pSound->vecfTmpAudioSndCrdStereo[2 * i + 1] = ClipFloat (
pSound->vecfTmpAudioSndCrdStereo[2 * i + 1] + pRightData[iNumChanPerFrameRight * i + iSelAddInInterlChRight] );
}
}
}
else
{
// incompatible sizes, clear work buffer
pSound->vecsTmpAudioSndCrdStereo.Reset ( 0 );
pSound->vecfTmpAudioSndCrdStereo.Reset ( 0 );
}

// call processing callback function
pSound->ProcessCallback ( pSound->vecsTmpAudioSndCrdStereo );
pSound->ProcessCallback ( pSound->vecfTmpAudioSndCrdStereo );
}

if ( ( inDevice == pSound->CurrentAudioOutputDeviceID ) && outOutputData )
Expand All @@ -1028,8 +1028,8 @@ OSStatus CSound::callbackIO ( AudioDeviceID inDevice,
for ( int i = 0; i < iCoreAudioBufferSizeMono; i++ )
{
// copy left and right channels separately
pLeftData[iNumChanPerFrameLeft * i + iSelOutInterlChLeft] = (Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i] / _MAXSHORT;
pRightData[iNumChanPerFrameRight * i + iSelOutInterlChRight] = (Float32) pSound->vecsTmpAudioSndCrdStereo[2 * i + 1] / _MAXSHORT;
pLeftData[iNumChanPerFrameLeft * i + iSelOutInterlChLeft] = (Float32) pSound->vecfTmpAudioSndCrdStereo[2 * i];
pRightData[iNumChanPerFrameRight * i + iSelOutInterlChRight] = (Float32) pSound->vecfTmpAudioSndCrdStereo[2 * i + 1];
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions mac/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
class CSound : public CSoundBase
{
public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
CSound ( void (*fpNewProcessCallback) ( CVector<float>& pfData, void* arg ),
void* arg,
const int iCtrlMIDIChannel,
const bool ,
Expand All @@ -63,7 +63,7 @@ class CSound : public CSoundBase

// these variables should be protected but cannot since we want
// to access them from the callback function
CVector<short> vecsTmpAudioSndCrdStereo;
CVector<float> vecfTmpAudioSndCrdStereo;
int iCoreAudioBufferSizeMono;
int iCoreAudioBufferSizeStereo;
AudioDeviceID CurrentAudioInputDeviceID;
Expand Down
20 changes: 10 additions & 10 deletions src/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,16 +500,16 @@ template<class TData> class CConvBuf
}
}

void PutAll ( const CVector<TData>& vecsData )
void PutAll ( const CVector<TData>& vecData )
{
iGetPos = 0;

std::copy ( vecsData.begin(),
vecsData.begin() + iBufferSize, // note that input vector might be larger then memory size
std::copy ( vecData.begin(),
vecData.begin() + iBufferSize, // note that input vector might be larger then memory size
vecMemory.begin() );
}

bool Put ( const CVector<TData>& vecsData,
bool Put ( const CVector<TData>& vecData,
const int iVecSize )
{
// calculate the input size and the end position after copying
Expand All @@ -519,8 +519,8 @@ template<class TData> class CConvBuf
if ( iEnd <= iBufferSize )
{
// copy new data in internal buffer
std::copy ( vecsData.begin(),
vecsData.begin() + iVecSize,
std::copy ( vecData.begin(),
vecData.begin() + iVecSize,
vecMemory.begin() + iPutPos );

// set buffer pointer one block further
Expand All @@ -540,18 +540,18 @@ template<class TData> class CConvBuf
return vecMemory;
}

void GetAll ( CVector<TData>& vecsData,
void GetAll ( CVector<TData>& vecData,
const int iVecSize )
{
iPutPos = 0;

// copy data from internal buffer in given buffer
std::copy ( vecMemory.begin(),
vecMemory.begin() + iVecSize,
vecsData.begin() );
vecData.begin() );
}

bool Get ( CVector<TData>& vecsData,
bool Get ( CVector<TData>& vecData,
const int iVecSize )
{
// calculate the input size and the end position after copying
Expand All @@ -563,7 +563,7 @@ template<class TData> class CConvBuf
// copy new data from internal buffer
std::copy ( vecMemory.begin() + iGetPos,
vecMemory.begin() + iGetPos + iVecSize,
vecsData.begin() );
vecData.begin() );

// set buffer pointer one block further
iGetPos = iEnd;
Expand Down
10 changes: 5 additions & 5 deletions src/channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CChannel::CChannel ( const bool bNIsServer ) :
bIsEnabled ( false ),
bIsServer ( bNIsServer ),
iAudioFrameSizeSamples ( DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ),
SignalLevelMeter ( false, 0.5 ) // server mode with mono out and faster smoothing
SignalLevelMeter ( false, 0.5f ) // server mode with mono out and faster smoothing
{
// reset network transport properties
ResetNetworkTransportProperties();
Expand Down Expand Up @@ -675,12 +675,12 @@ void CChannel::PrepAndSendPacket ( CHighPrioSocket* pSocket,
}
}

double CChannel::UpdateAndGetLevelForMeterdB ( const CVector<short>& vecsAudio,
const int iInSize,
const bool bIsStereoIn )
float CChannel::UpdateAndGetLevelForMeterdB ( const CVector<float>& vecfAudio,
const int iInSize,
const bool bIsStereoIn )
{
// update the signal level meter and immediately return the current value
SignalLevelMeter.Update ( vecsAudio,
SignalLevelMeter.Update ( vecfAudio,
iInSize,
bIsStereoIn );

Expand Down
6 changes: 3 additions & 3 deletions src/channel.h
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ void CreateReqChannelLevelListMes() { Protocol.CreateReqChannelLevelListMes(); }

CNetworkTransportProps GetNetworkTransportPropsFromCurrentSettings();

double UpdateAndGetLevelForMeterdB ( const CVector<short>& vecsAudio,
const int iInSize,
const bool bIsStereoIn );
float UpdateAndGetLevelForMeterdB ( const CVector<float>& vecfAudio,
const int iInSize,
const bool bIsStereoIn );

protected:
bool ProtocolIsEnabled();
Expand Down
Loading