Fix compile errors related to audio on OSX
This commit is contained in:
parent
2a0ddc1e89
commit
cef0ae5d5d
|
@ -198,20 +198,20 @@ void CameraMatrix::get_viewport_size(float& r_width, float& r_height) const {
|
||||||
Plane near_plane=Plane(matrix[ 3] + matrix[ 2],
|
Plane near_plane=Plane(matrix[ 3] + matrix[ 2],
|
||||||
matrix[ 7] + matrix[ 6],
|
matrix[ 7] + matrix[ 6],
|
||||||
matrix[11] + matrix[10],
|
matrix[11] + matrix[10],
|
||||||
-matrix[15] - matrix[14])
|
-matrix[15] - matrix[14]);
|
||||||
near_plane.normalize();
|
near_plane.normalize();
|
||||||
|
|
||||||
///////--- Right Plane ---///////
|
///////--- Right Plane ---///////
|
||||||
Plane right_plane=Plane(matrix[ 3] - matrix[ 0],
|
Plane right_plane=Plane(matrix[ 3] - matrix[ 0],
|
||||||
matrix[ 7] - matrix[ 4],
|
matrix[ 7] - matrix[ 4],
|
||||||
matrix[11] - matrix[ 8],
|
matrix[11] - matrix[ 8],
|
||||||
- matrix[15] + matrix[12])
|
- matrix[15] + matrix[12]);
|
||||||
right_plane.normalize();
|
right_plane.normalize();
|
||||||
|
|
||||||
Plane top_plane=Plane(matrix[ 3] - matrix[ 1],
|
Plane top_plane=Plane(matrix[ 3] - matrix[ 1],
|
||||||
matrix[ 7] - matrix[ 5],
|
matrix[ 7] - matrix[ 5],
|
||||||
matrix[11] - matrix[ 9],
|
matrix[11] - matrix[ 9],
|
||||||
-matrix[15] + matrix[13])
|
-matrix[15] + matrix[13]);
|
||||||
top_plane.normalize();
|
top_plane.normalize();
|
||||||
|
|
||||||
Vector3 res;
|
Vector3 res;
|
||||||
|
@ -229,28 +229,28 @@ bool CameraMatrix::get_endpoints(const Transform& p_transform, Vector3 *p_8point
|
||||||
Plane near_plane=Plane(matrix[ 3] + matrix[ 2],
|
Plane near_plane=Plane(matrix[ 3] + matrix[ 2],
|
||||||
matrix[ 7] + matrix[ 6],
|
matrix[ 7] + matrix[ 6],
|
||||||
matrix[11] + matrix[10],
|
matrix[11] + matrix[10],
|
||||||
-matrix[15] - matrix[14])
|
-matrix[15] - matrix[14]);
|
||||||
near_plane.normalize();
|
near_plane.normalize();
|
||||||
|
|
||||||
///////--- Far Plane ---///////
|
///////--- Far Plane ---///////
|
||||||
Plane far_plane=Plane(matrix[ 2] - matrix[ 3],
|
Plane far_plane=Plane(matrix[ 2] - matrix[ 3],
|
||||||
matrix[ 6] - matrix[ 7],
|
matrix[ 6] - matrix[ 7],
|
||||||
matrix[10] - matrix[11],
|
matrix[10] - matrix[11],
|
||||||
matrix[15] - matrix[14])
|
matrix[15] - matrix[14]);
|
||||||
far_plane.normalize();
|
far_plane.normalize();
|
||||||
|
|
||||||
///////--- Right Plane ---///////
|
///////--- Right Plane ---///////
|
||||||
Plane right_plane=Plane(matrix[ 0] - matrix[ 3],
|
Plane right_plane=Plane(matrix[ 0] - matrix[ 3],
|
||||||
matrix[ 4] - matrix[ 7],
|
matrix[ 4] - matrix[ 7],
|
||||||
matrix[8] - matrix[ 11],
|
matrix[8] - matrix[ 11],
|
||||||
- matrix[15] + matrix[12])
|
- matrix[15] + matrix[12]);
|
||||||
right_plane.normalize();
|
right_plane.normalize();
|
||||||
|
|
||||||
///////--- Top Plane ---///////
|
///////--- Top Plane ---///////
|
||||||
Plane top_plane=Plane(matrix[ 1] - matrix[ 3],
|
Plane top_plane=Plane(matrix[ 1] - matrix[ 3],
|
||||||
matrix[ 5] - matrix[ 7],
|
matrix[ 5] - matrix[ 7],
|
||||||
matrix[9] - matrix[ 11],
|
matrix[9] - matrix[ 11],
|
||||||
-matrix[15] + matrix[13])
|
-matrix[15] + matrix[13]);
|
||||||
top_plane.normalize();
|
top_plane.normalize();
|
||||||
|
|
||||||
Vector3 near_endpoint;
|
Vector3 near_endpoint;
|
||||||
|
@ -567,7 +567,7 @@ float CameraMatrix::get_fov() const {
|
||||||
Plane right_plane=Plane(matrix[ 3] - matrix[ 0],
|
Plane right_plane=Plane(matrix[ 3] - matrix[ 0],
|
||||||
matrix[ 7] - matrix[ 4],
|
matrix[ 7] - matrix[ 4],
|
||||||
matrix[11] - matrix[ 8],
|
matrix[11] - matrix[ 8],
|
||||||
- matrix[15] + matrix[12])
|
- matrix[15] + matrix[12]);
|
||||||
right_plane.normalize();
|
right_plane.normalize();
|
||||||
|
|
||||||
return Math::rad2deg(Math::acos(Math::abs(right_plane.normal.x)))*2.0;
|
return Math::rad2deg(Math::acos(Math::abs(right_plane.normal.x)))*2.0;
|
||||||
|
|
|
@ -157,8 +157,8 @@ int AudioDriverOSX::get_mix_rate() const {
|
||||||
return 44100;
|
return 44100;
|
||||||
};
|
};
|
||||||
|
|
||||||
AudioDriverSW::OutputFormat AudioDriverOSX::get_output_format() const {
|
AudioDriver::SpeakerMode AudioDriverOSX::get_speaker_mode() const {
|
||||||
return OUTPUT_STEREO;
|
return SPEAKER_MODE_STEREO;
|
||||||
};
|
};
|
||||||
|
|
||||||
void AudioDriverOSX::lock() {
|
void AudioDriverOSX::lock() {
|
||||||
|
|
|
@ -31,11 +31,11 @@
|
||||||
#ifndef AUDIO_DRIVER_OSX_H
|
#ifndef AUDIO_DRIVER_OSX_H
|
||||||
#define AUDIO_DRIVER_OSX_H
|
#define AUDIO_DRIVER_OSX_H
|
||||||
|
|
||||||
#include "servers/audio/audio_server_sw.h"
|
#include "servers/audio_server.h"
|
||||||
|
|
||||||
#include <AudioUnit/AudioUnit.h>
|
#include <AudioUnit/AudioUnit.h>
|
||||||
|
|
||||||
class AudioDriverOSX : public AudioDriverSW {
|
class AudioDriverOSX : public AudioDriver {
|
||||||
|
|
||||||
AudioComponentInstance audio_unit;
|
AudioComponentInstance audio_unit;
|
||||||
bool active;
|
bool active;
|
||||||
|
@ -61,7 +61,7 @@ public:
|
||||||
virtual Error init();
|
virtual Error init();
|
||||||
virtual void start();
|
virtual void start();
|
||||||
virtual int get_mix_rate() const;
|
virtual int get_mix_rate() const;
|
||||||
virtual OutputFormat get_output_format() const;
|
virtual SpeakerMode get_speaker_mode() const;
|
||||||
virtual void lock();
|
virtual void lock();
|
||||||
virtual void unlock();
|
virtual void unlock();
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
|
@ -38,10 +38,7 @@
|
||||||
// #include "servers/visual/visual_server_wrap_mt.h"
|
// #include "servers/visual/visual_server_wrap_mt.h"
|
||||||
#include "servers/visual/rasterizer.h"
|
#include "servers/visual/rasterizer.h"
|
||||||
#include "servers/physics_server.h"
|
#include "servers/physics_server.h"
|
||||||
#include "servers/audio/audio_server_sw.h"
|
#include "servers/audio_server.h"
|
||||||
#include "servers/audio/sample_manager_sw.h"
|
|
||||||
#include "servers/spatial_sound/spatial_sound_server_sw.h"
|
|
||||||
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
|
|
||||||
#include "drivers/rtaudio/audio_driver_rtaudio.h"
|
#include "drivers/rtaudio/audio_driver_rtaudio.h"
|
||||||
#include "drivers/alsa/audio_driver_alsa.h"
|
#include "drivers/alsa/audio_driver_alsa.h"
|
||||||
#include "servers/physics_2d/physics_2d_server_sw.h"
|
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||||
|
@ -72,10 +69,6 @@ public:
|
||||||
IP_Unix *ip_unix;
|
IP_Unix *ip_unix;
|
||||||
|
|
||||||
AudioDriverOSX audio_driver_osx;
|
AudioDriverOSX audio_driver_osx;
|
||||||
AudioServerSW *audio_server;
|
|
||||||
SampleManagerMallocSW *sample_manager;
|
|
||||||
SpatialSoundServerSW *spatial_sound_server;
|
|
||||||
SpatialSound2DServerSW *spatial_sound_2d_server;
|
|
||||||
|
|
||||||
InputDefault *input;
|
InputDefault *input;
|
||||||
JoypadOSX *joypad_osx;
|
JoypadOSX *joypad_osx;
|
||||||
|
|
|
@ -1109,18 +1109,6 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
||||||
ERR_PRINT("Initializing audio failed.");
|
ERR_PRINT("Initializing audio failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
sample_manager = memnew( SampleManagerMallocSW );
|
|
||||||
audio_server = memnew( AudioServerSW(sample_manager) );
|
|
||||||
|
|
||||||
audio_server->set_mixer_params(AudioMixerSW::INTERPOLATION_LINEAR,false);
|
|
||||||
audio_server->init();
|
|
||||||
|
|
||||||
spatial_sound_server = memnew( SpatialSoundServerSW );
|
|
||||||
spatial_sound_server->init();
|
|
||||||
|
|
||||||
spatial_sound_2d_server = memnew( SpatialSound2DServerSW );
|
|
||||||
spatial_sound_2d_server->init();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
physics_server = memnew( PhysicsServerSW );
|
physics_server = memnew( PhysicsServerSW );
|
||||||
physics_server->init();
|
physics_server->init();
|
||||||
|
@ -1167,19 +1155,9 @@ void OS_OSX::finalize() {
|
||||||
CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL);
|
CFNotificationCenterRemoveObserver(CFNotificationCenterGetDistributedCenter(), NULL, kTISNotifySelectedKeyboardInputSourceChanged, NULL);
|
||||||
delete_main_loop();
|
delete_main_loop();
|
||||||
|
|
||||||
spatial_sound_server->finish();
|
|
||||||
memdelete(spatial_sound_server);
|
|
||||||
spatial_sound_2d_server->finish();
|
|
||||||
memdelete(spatial_sound_2d_server);
|
|
||||||
|
|
||||||
memdelete(joypad_osx);
|
memdelete(joypad_osx);
|
||||||
memdelete(input);
|
memdelete(input);
|
||||||
|
|
||||||
memdelete(sample_manager);
|
|
||||||
|
|
||||||
audio_server->finish();
|
|
||||||
memdelete(audio_server);
|
|
||||||
|
|
||||||
visual_server->finish();
|
visual_server->finish();
|
||||||
memdelete(visual_server);
|
memdelete(visual_server);
|
||||||
//memdelete(rasterizer);
|
//memdelete(rasterizer);
|
||||||
|
|
Loading…
Reference in New Issue