Skip to content

Commit 87085e4

Browse files
committed
Fixed #8803 (Remove BASS Error message for players) Patch from ruun
1 parent ea8151a commit 87085e4

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

MTA10/mods/deathmatch/logic/CClientGame.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2861,13 +2861,13 @@ void CClientGame::AddBuiltInEvents ( void )
28612861
m_Events.AddEvent ( "onClientExplosion", "x, y, z, type", NULL, false );
28622862

28632863
// Projectile events
2864-
m_Events.AddEvent ( "onClientProjectileCreation", "creator", NULL, false );
2865-
2866-
// Sound events
2867-
m_Events.AddEvent ( "onClientSoundStream", "success, length, streamName", NULL, false );
2868-
m_Events.AddEvent ( "onClientSoundFinishedDownload", "length", NULL, false );
2869-
m_Events.AddEvent ( "onClientSoundChangedMeta", "streamTitle", NULL, false );
2870-
m_Events.AddEvent ( "onClientSoundStarted", "reason", NULL, false );
2864+
m_Events.AddEvent ( "onClientProjectileCreation", "creator", NULL, false );
2865+
2866+
// Sound events
2867+
m_Events.AddEvent ( "onClientSoundStream", "success, length, streamName, error", NULL, false );
2868+
m_Events.AddEvent ( "onClientSoundFinishedDownload", "length", NULL, false );
2869+
m_Events.AddEvent ( "onClientSoundChangedMeta", "streamTitle", NULL, false );
2870+
m_Events.AddEvent ( "onClientSoundStarted", "reason", NULL, false );
28712871
m_Events.AddEvent ( "onClientSoundStopped", "reason", NULL, false );
28722872
m_Events.AddEvent ( "onClientSoundBeat", "time", NULL, false );
28732873

MTA10/mods/shared_logic/CBassAudio.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ void CBassAudio::PlayStreamIntern ( void* arguments )
380380
//
381381
void CBassAudio::CompleteStreamConnect ( HSTREAM pSound )
382382
{
383-
if ( pSound )
383+
SString strError;
384+
if (pSound)
384385
{
385386
m_pSound = pSound;
386387

@@ -395,11 +396,11 @@ void CBassAudio::CompleteStreamConnect ( HSTREAM pSound )
395396

396397
if ( BASS_FX_BPM_CallbackSet ( pSound, (BPMPROC*)&BPMCallback, 1, 0, 0, m_uiCallbackId ) == false )
397398
{
398-
g_pCore->GetConsole()->Print ( "BASS ERROR in BASS_FX_BPM_CallbackSet" );
399+
strError = "BASS ERROR in BASS_FX_BPM_CallbackSet";
399400
}
400401
if ( BASS_FX_BPM_BeatCallbackSet ( pSound, (BPMBEATPROC*)&BeatCallback, m_uiCallbackId ) == false )
401402
{
402-
g_pCore->GetConsole()->Print ( "BASS ERROR in BASS_FX_BPM_BeatCallbackSet" );
403+
strError = "BASS ERROR in BASS_FX_BPM_BeatCallbackSet";
403404
}
404405
// get the broadcast name
405406
const char* szIcy;
@@ -439,11 +440,11 @@ void CBassAudio::CompleteStreamConnect ( HSTREAM pSound )
439440
//g_pCore->GetConsole()->Printf ( "BASS ERROR %d in BASS_SYNC_WMA_CHANGE", BASS_ErrorGetCode() );
440441
}
441442
else
442-
g_pCore->GetConsole()->Printf ( "BASS ERROR %d in PlayStream b3D = %s path = %s", BASS_ErrorGetCode(), m_b3D ? "true" : "false", m_strPath.c_str() );
443+
strError = SString( "BASS ERROR %d in PlayStream b3D = %s path = %s", BASS_ErrorGetCode(), m_b3D ? "true" : "false", m_strPath.c_str() );
443444

444445
OutputDebugLine ( "[Bass] stream connect complete" );
445446

446-
AddQueuedEvent ( SOUND_EVENT_STREAM_RESULT, m_strStreamName, GetLength (), pSound ? true : false );
447+
AddQueuedEvent ( SOUND_EVENT_STREAM_RESULT, m_strStreamName, GetLength (), pSound ? true : false, strError );
447448
}
448449

449450

@@ -1025,13 +1026,14 @@ void CBassAudio::ParseShoutcastMeta ( const SString& strMeta )
10251026
//
10261027
// Add queued event from
10271028
//
1028-
void CBassAudio::AddQueuedEvent ( eSoundEventType type, const SString& strString, double dNumber, bool bBool )
1029+
void CBassAudio::AddQueuedEvent ( eSoundEventType type, const SString& strString, double dNumber, bool bBool, const SString& strError )
10291030
{
10301031
SSoundEventInfo info;
10311032
info.type = type;
10321033
info.strString = strString;
10331034
info.dNumber = dNumber;
10341035
info.bBool = bBool;
1036+
info.strError = strError;
10351037
m_EventQueue.push_back ( info );
10361038
}
10371039

MTA10/mods/shared_logic/CBassAudio.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ struct SSoundEventInfo
2626
SString strString;
2727
double dNumber;
2828
bool bBool;
29+
SString strError;
2930
};
3031

3132
struct SSoundThreadVariables
@@ -77,7 +78,7 @@ class CBassAudio
7778
void SetPan ( float fPan );
7879

7980
void DoPulse ( const CVector& vecPlayerPosition, const CVector& vecCameraPosition, const CVector& vecLookAt );
80-
void AddQueuedEvent ( eSoundEventType type, const SString& strString, double dNumber = 0.0, bool bBool = false );
81+
void AddQueuedEvent ( eSoundEventType type, const SString& strString, double dNumber = 0.0, bool bBool = false, const SString& strError = "" );
8182
bool GetQueuedEvent ( SSoundEventInfo& info );
8283
void ParseShoutcastMeta ( const SString& strMeta );
8384
float* GetFFTData ( int iLength );

MTA10/mods/shared_logic/CClientSound.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,10 @@ void CClientSound::Process3D ( const CVector& vecPlayerPosition, const CVector&
682682
CLuaArguments Arguments;
683683
Arguments.PushBoolean ( eventInfo.bBool );
684684
Arguments.PushNumber ( eventInfo.dNumber );
685-
if ( !eventInfo.strString.empty () )
686-
Arguments.PushString ( eventInfo.strString );
685+
Arguments.PushString( eventInfo.strString );
686+
Arguments.PushString( eventInfo.strError );
687687
CallEvent ( "onClientSoundStream", Arguments, true );
688-
OutputDebugLine ( SString ( "[ClientSound] onClientSoundStream %d %f %s", eventInfo.bBool, eventInfo.dNumber, *eventInfo.strString ) );
688+
OutputDebugLine ( SString ( "[ClientSound] onClientSoundStream %d %f %s %s", eventInfo.bBool, eventInfo.dNumber, *eventInfo.strString, *eventInfo.strError ) );
689689
}
690690
else
691691
if ( eventInfo.type == SOUND_EVENT_BEAT )

0 commit comments

Comments
 (0)