@@ -439,7 +439,7 @@ class OpenALAudioOutputDevice : public AudioOutputDevice {
439439
440440 // Upload audio data to OpenAL buffer
441441 alBufferData (buffer, format, pcmBuffer.data (),
442- samplesProcessed * sizeof (int16_t ), sampleRate);
442+ static_cast <ALsizei>( samplesProcessed * sizeof (int16_t )), static_cast <ALsizei>( sampleRate) );
443443 CheckOpenALError (" alBufferData" );
444444
445445 // Queue the buffer
@@ -793,18 +793,17 @@ AudioSource* AudioSystem::CreateAudioSource(const std::string& name) {
793793 }
794794
795795 // Store the source
796- AudioSource* sourcePtr = source.get ();
797796 sources.push_back (std::move (source));
798797
799- return sourcePtr ;
798+ return sources. back (). get () ;
800799}
801800
802801AudioSource* AudioSystem::CreateDebugPingSource (const std::string& name) {
803802 // Create a new audio source for debugging
804803 auto source = std::make_unique<ConcreteAudioSource>(name);
805804
806805 // Set up debug ping parameters
807- // The ping will cycle every 1.5 seconds (0.5s ping + 1.0s silence)
806+ // The ping will cycle every 1.5 seconds (0.5 s ping + 1.0 s silence)
808807 constexpr float sampleRate = 44100 .0f ;
809808 constexpr float pingDuration = 0 .5f ;
810809 constexpr float silenceDuration = 1 .0f ;
@@ -814,20 +813,19 @@ AudioSource* AudioSystem::CreateDebugPingSource(const std::string& name) {
814813 source->SetAudioLength (totalCycleSamples);
815814
816815 // Store the source
817- AudioSource* sourcePtr = source.get ();
818816 sources.push_back (std::move (source));
819817
820- return sourcePtr ;
818+ return sources. back (). get () ;
821819}
822820
823- void AudioSystem::SetListenerPosition (float x, float y, float z) {
821+ void AudioSystem::SetListenerPosition (const float x, const float y, const float z) {
824822 listenerPosition[0 ] = x;
825823 listenerPosition[1 ] = y;
826824 listenerPosition[2 ] = z;
827825}
828826
829- void AudioSystem::SetListenerOrientation (float forwardX, float forwardY, float forwardZ,
830- float upX, float upY, float upZ) {
827+ void AudioSystem::SetListenerOrientation (const float forwardX, const float forwardY, const float forwardZ,
828+ const float upX, const float upY, const float upZ) {
831829 listenerOrientation[0 ] = forwardX;
832830 listenerOrientation[1 ] = forwardY;
833831 listenerOrientation[2 ] = forwardZ;
@@ -836,25 +834,25 @@ void AudioSystem::SetListenerOrientation(float forwardX, float forwardY, float f
836834 listenerOrientation[5 ] = upZ;
837835}
838836
839- void AudioSystem::SetListenerVelocity (float x, float y, float z) {
837+ void AudioSystem::SetListenerVelocity (const float x, const float y, const float z) {
840838 listenerVelocity[0 ] = x;
841839 listenerVelocity[1 ] = y;
842840 listenerVelocity[2 ] = z;
843841}
844842
845- void AudioSystem::SetMasterVolume (float volume) {
843+ void AudioSystem::SetMasterVolume (const float volume) {
846844 masterVolume = volume;
847845}
848846
849- void AudioSystem::EnableHRTF (bool enable) {
847+ void AudioSystem::EnableHRTF (const bool enable) {
850848 hrtfEnabled = enable;
851849}
852850
853851bool AudioSystem::IsHRTFEnabled () const {
854852 return hrtfEnabled;
855853}
856854
857- void AudioSystem::SetHRTFCPUOnly (bool cpuOnly) {
855+ void AudioSystem::SetHRTFCPUOnly (const bool cpuOnly) {
858856 hrtfCPUOnly = cpuOnly;
859857}
860858
@@ -868,15 +866,12 @@ bool AudioSystem::LoadHRTFData(const std::string& filename) {
868866 constexpr uint32_t hrtfSampleCount = 256 ; // Number of samples per impulse response
869867 constexpr uint32_t positionCount = 36 * 13 ; // 36 azimuths (10-degree steps) * 13 elevations (15-degree steps)
870868 constexpr uint32_t channelCount = 2 ; // Stereo (left and right ears)
871- const float sampleRate = 44100 .0f ; // Sample rate for HRTF data
872- const float speedOfSound = 343 .0f ; // Speed of sound in m/s
873- const float headRadius = 0 .0875f ; // Average head radius in meters
869+ // const float headRadius = 0.0875f; // Average head radius in meters
874870
875- // Try to load from file first (only if filename is provided)
871+ // Try to load from a file first (only if the filename is provided)
876872 if (!filename.empty ()) {
877- std::ifstream file (filename, std::ios::binary);
878- if (file.is_open ()) {
879- // Read file header to determine format
873+ if (std::ifstream file (filename, std::ios::binary); file.is_open ()) {
874+ // Read the file header to determine a format
880875 char header[4 ];
881876 file.read (header, 4 );
882877
@@ -889,7 +884,7 @@ bool AudioSystem::LoadHRTFData(const std::string& filename) {
889884
890885 if (fileChannelCount == channelCount) {
891886 hrtfData.resize (fileHrtfSize * filePositionCount * fileChannelCount);
892- file.read (reinterpret_cast <char *>(hrtfData.data ()), hrtfData.size () * sizeof (float ));
887+ file.read (reinterpret_cast <char *>(hrtfData.data ()), static_cast <std::streamsize>( hrtfData.size () * sizeof (float ) ));
893888
894889 hrtfSize = fileHrtfSize;
895890 numHrtfPositions = filePositionCount;
@@ -921,6 +916,8 @@ bool AudioSystem::LoadHRTFData(const std::string& filename) {
921916 float z = std::cos (elevation) * std::cos (azimuth);
922917
923918 for (uint32_t channel = 0 ; channel < channelCount; channel++) {
919+ constexpr float speedOfSound = 343 .0f ;
920+ constexpr float sampleRate = 44100 .0f ;
924921 // Calculate ear position (left ear: -0.1m, right ear: +0.1m on x-axis)
925922 float earX = (channel == 0 ) ? -0 .1f : 0 .1f ;
926923
@@ -944,7 +941,6 @@ bool AudioSystem::LoadHRTFData(const std::string& filename) {
944941
945942
946943 // Generate impulse response
947- uint32_t samplesGenerated = 0 ;
948944 for (uint32_t i = 0 ; i < hrtfSampleCount; i++) {
949945 float value = 0 .0f ;
950946
0 commit comments