diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/audio/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/audio/audio.h | 235 | ||||
-rw-r--r-- | src/audio/bind | 123 | ||||
-rw-r--r-- | src/audio/bind.bind | 472 | ||||
-rw-r--r-- | src/audio/engine.c | 11 | ||||
-rw-r--r-- | src/audio/sound_group.c | 522 |
6 files changed, 890 insertions, 474 deletions
diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 8d38f01..c4b333c 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -5,4 +5,5 @@ target_sources(honey PUBLIC ${CMAKE_CURRENT_LIST_DIR}/setup.c ${CMAKE_CURRENT_LIST_DIR}/engine.c ${CMAKE_CURRENT_LIST_DIR}/sound.c + ${CMAKE_CURRENT_LIST_DIR}/sound_group.c ) diff --git a/src/audio/audio.h b/src/audio/audio.h index 984e1ea..0ea02d0 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -12,6 +12,7 @@ void ma_push_node(lua_State *L, ma_node *n); X("ma.engine", ma_engine_tname) \ X("ma.node", ma_node_tname) \ X("ma.sound", ma_sound_tname) \ + X("ma.sound_group", ma_sound_group_tname) \ #define X(name, mt) extern const char *mt; AUDIO_METATABLES @@ -20,98 +21,152 @@ AUDIO_METATABLES #define AUDIO_FUNCTIONS \ /* engine */ \ - X("ma_engine_init", ma_engine_init_bind) \ - X("ma_engine_uninit", ma_engine_uninit_bind) \ - X("ma_engine_get_endpoint", ma_engine_get_endpoint_bind) \ - X("ma_engine_get_time", ma_engine_get_time_bind) \ - X("ma_engine_set_time", ma_engine_set_time_bind) \ - X("ma_engine_get_channels", ma_engine_get_channels_bind) \ - X("ma_engine_get_sample_rate", ma_engine_get_sample_rate_bind) \ - X("ma_engine_start", ma_engine_start_bind) \ - X("ma_engine_stop", ma_engine_stop_bind) \ - X("ma_engine_set_volume", ma_engine_set_volume_bind) \ - X("ma_engine_set_gain_db", ma_engine_set_gain_db_bind) \ - X("ma_engine_get_listener_count", ma_engine_get_listener_count_bind) \ - X("ma_engine_find_closest_listener", ma_engine_find_closest_listener_bind) \ - X("ma_engine_listener_set_position", ma_engine_listener_set_position_bind) \ - X("ma_engine_listener_get_position", ma_engine_listener_get_position_bind) \ - X("ma_engine_listener_set_direction", ma_engine_listener_set_direction_bind) \ - X("ma_engine_listener_get_direction", ma_engine_listener_get_direction_bind) \ - X("ma_engine_listener_set_velocity", ma_engine_listener_set_velocity_bind) \ - X("ma_engine_listener_get_velocity", ma_engine_listener_get_velocity_bind) \ - X("ma_engine_listener_set_cone", ma_engine_listener_set_cone_bind) \ - X("ma_engine_listener_get_cone", ma_engine_listener_get_cone_bind) \ - X("ma_engine_listener_set_world_up", ma_engine_listener_set_world_up_bind) \ - X("ma_engine_listener_get_world_up", ma_engine_listener_get_world_up_bind) \ - X("ma_engine_listener_set_enabled", ma_engine_listener_set_enabled_bind) \ - X("ma_engine_listener_is_enabled", ma_engine_listener_is_enabled_bind) \ - X("ma_engine_play_sound_ex", ma_engine_play_sound_ex_bind) \ - X("ma_engine_play_sound", ma_engine_play_sound_bind) \ + X("engine_init", ma_engine_init_bind) \ + X("engine_uninit", ma_engine_uninit_bind) \ + X("engine_get_time", ma_engine_get_time_bind) \ + X("engine_set_time", ma_engine_set_time_bind) \ + X("engine_get_channels", ma_engine_get_channels_bind) \ + X("engine_get_sample_rate", ma_engine_get_sample_rate_bind) \ + X("engine_start", ma_engine_start_bind) \ + X("engine_stop", ma_engine_stop_bind) \ + X("engine_set_volume", ma_engine_set_volume_bind) \ + X("engine_set_gain_db", ma_engine_set_gain_db_bind) \ + X("engine_get_listener_count", ma_engine_get_listener_count_bind) \ + X("engine_find_closest_listener", ma_engine_find_closest_listener_bind) \ + X("engine_listener_set_position", ma_engine_listener_set_position_bind) \ + X("engine_listener_get_position", ma_engine_listener_get_position_bind) \ + X("engine_listener_set_direction", ma_engine_listener_set_direction_bind) \ + X("engine_listener_get_direction", ma_engine_listener_get_direction_bind) \ + X("engine_listener_set_velocity", ma_engine_listener_set_velocity_bind) \ + X("engine_listener_get_velocity", ma_engine_listener_get_velocity_bind) \ + X("engine_listener_set_cone", ma_engine_listener_set_cone_bind) \ + X("engine_listener_get_cone", ma_engine_listener_get_cone_bind) \ + X("engine_listener_set_world_up", ma_engine_listener_set_world_up_bind) \ + X("engine_listener_get_world_up", ma_engine_listener_get_world_up_bind) \ + X("engine_listener_set_enabled", ma_engine_listener_set_enabled_bind) \ + X("engine_listener_is_enabled", ma_engine_listener_is_enabled_bind) \ + X("engine_play_sound_ex", ma_engine_play_sound_ex_bind) \ + X("engine_play_sound", ma_engine_play_sound_bind) \ \ /* sound */ \ - X("ma_sound_init_from_file", ma_sound_init_from_file_bind) \ - X("ma_sound_init_copy", ma_sound_init_copy_bind) \ - X("ma_sound_uninit", ma_sound_uninit_bind) \ - X("ma_sound_start", ma_sound_start_bind) \ - X("ma_sound_stop", ma_sound_stop_bind) \ - X("ma_sound_set_volume", ma_sound_set_volume_bind) \ - X("ma_sound_get_volume", ma_sound_get_volume_bind) \ - X("ma_sound_set_pan", ma_sound_set_pan_bind) \ - X("ma_sound_get_pan", ma_sound_get_pan_bind) \ - X("ma_sound_set_pan_mode", ma_sound_set_pan_mode_bind) \ - X("ma_sound_get_pan_mode", ma_sound_get_pan_mode_bind) \ - X("ma_sound_set_pitch", ma_sound_set_pitch_bind) \ - X("ma_sound_get_pitch", ma_sound_get_pitch_bind) \ - X("ma_sound_set_spatialization_enabled", ma_sound_set_spatialization_enabled_bind) \ - X("ma_sound_is_spatialization_enabled", ma_sound_is_spatialization_enabled_bind) \ - X("ma_sound_set_pinned_listener_index", ma_sound_set_pinned_listener_index_bind) \ - X("ma_sound_get_pinned_listener_index", ma_sound_get_pinned_listener_index_bind) \ - X("ma_sound_get_listener_index", ma_sound_get_listener_index_bind) \ - X("ma_sound_get_direction_to_listener", ma_sound_get_direction_to_listener_bind) \ - X("ma_sound_set_position", ma_sound_set_position_bind) \ - X("ma_sound_get_position", ma_sound_get_position_bind) \ - X("ma_sound_set_direction", ma_sound_set_direction_bind) \ - X("ma_sound_get_direction", ma_sound_get_direction_bind) \ - X("ma_sound_set_velocity", ma_sound_set_velocity_bind) \ - X("ma_sound_get_velocity", ma_sound_get_velocity_bind) \ - X("ma_sound_set_attenuation_model", ma_sound_set_attenuation_model_bind) \ - X("ma_sound_get_attenuation_model", ma_sound_get_attenuation_model_bind) \ - X("ma_sound_set_positioning", ma_sound_set_positioning_bind) \ - X("ma_sound_get_positioning", ma_sound_get_positioning_bind) \ - X("ma_sound_set_rolloff", ma_sound_set_rolloff_bind) \ - X("ma_sound_get_rolloff", ma_sound_get_rolloff_bind) \ - X("ma_sound_set_min_gain", ma_sound_set_min_gain_bind) \ - X("ma_sound_get_min_gain", ma_sound_get_min_gain_bind) \ - X("ma_sound_set_max_gain", ma_sound_set_max_gain_bind) \ - X("ma_sound_get_max_gain", ma_sound_get_max_gain_bind) \ - X("ma_sound_set_min_distance", ma_sound_set_min_distance_bind) \ - X("ma_sound_get_min_distance", ma_sound_get_min_distance_bind) \ - X("ma_sound_set_max_distance", ma_sound_set_max_distance_bind) \ - X("ma_sound_get_max_distance", ma_sound_get_max_distance_bind) \ - X("ma_sound_set_cone", ma_sound_set_cone_bind) \ - X("ma_sound_get_cone", ma_sound_get_cone_bind) \ - X("ma_sound_set_doppler_factor", ma_sound_set_doppler_factor_bind) \ - X("ma_sound_get_doppler_factor", ma_sound_get_doppler_factor_bind) \ - X("ma_sound_set_directional_attenuation_factor", ma_sound_set_directional_attenuation_factor_bind) \ - X("ma_sound_get_directional_attenuation_factor", ma_sound_get_directional_attenuation_factor_bind) \ - X("ma_sound_set_fade_in_pcm_frames", ma_sound_set_fade_in_pcm_frames_bind) \ - X("ma_sound_set_fade_in_milliseconds", ma_sound_set_fade_in_milliseconds_bind) \ - X("ma_sound_get_current_fade_volume", ma_sound_get_current_fade_volume_bind) \ - X("ma_sound_set_start_time_in_pcm_frames", ma_sound_set_start_time_in_pcm_frames_bind) \ - X("ma_sound_set_start_time_in_milliseconds", ma_sound_set_start_time_in_milliseconds_bind) \ - X("ma_sound_set_stop_time_in_pcm_frames", ma_sound_set_stop_time_in_pcm_frames_bind) \ - X("ma_sound_set_stop_time_in_milliseconds", ma_sound_set_stop_time_in_milliseconds_bind) \ - X("ma_sound_is_playing", ma_sound_is_playing_bind) \ - X("ma_sound_get_time_in_pcm_frames", ma_sound_get_time_in_pcm_frames_bind) \ - X("ma_sound_set_looping", ma_sound_set_looping_bind) \ - X("ma_sound_is_looping", ma_sound_is_looping_bind) \ - X("ma_sound_at_end", ma_sound_at_end_bind) \ - X("ma_sound_seek_to_pcm_frame", ma_sound_seek_to_pcm_frame_bind) \ - X("ma_sound_get_data_format", ma_sound_get_data_format_bind) \ - X("ma_sound_get_cursor_in_pcm_frames", ma_sound_get_cursor_in_pcm_frames_bind) \ - X("ma_sound_get_length_in_pcm_frames", ma_sound_get_length_in_pcm_frames_bind) \ - X("ma_sound_get_cursor_in_seconds", ma_sound_get_cursor_in_seconds_bind) \ - X("ma_sound_get_length_in_seconds", ma_sound_get_length_in_seconds_bind) \ + X("sound_init_from_file", ma_sound_init_from_file_bind) \ + X("sound_init_copy", ma_sound_init_copy_bind) \ + X("sound_uninit", ma_sound_uninit_bind) \ + X("sound_start", ma_sound_start_bind) \ + X("sound_stop", ma_sound_stop_bind) \ + X("sound_set_volume", ma_sound_set_volume_bind) \ + X("sound_get_volume", ma_sound_get_volume_bind) \ + X("sound_set_pan", ma_sound_set_pan_bind) \ + X("sound_get_pan", ma_sound_get_pan_bind) \ + X("sound_set_pan_mode", ma_sound_set_pan_mode_bind) \ + X("sound_get_pan_mode", ma_sound_get_pan_mode_bind) \ + X("sound_set_pitch", ma_sound_set_pitch_bind) \ + X("sound_get_pitch", ma_sound_get_pitch_bind) \ + X("sound_set_spatialization_enabled", ma_sound_set_spatialization_enabled_bind) \ + X("sound_is_spatialization_enabled", ma_sound_is_spatialization_enabled_bind) \ + X("sound_set_pinned_listener_index", ma_sound_set_pinned_listener_index_bind) \ + X("sound_get_pinned_listener_index", ma_sound_get_pinned_listener_index_bind) \ + X("sound_get_listener_index", ma_sound_get_listener_index_bind) \ + X("sound_get_direction_to_listener", ma_sound_get_direction_to_listener_bind) \ + X("sound_set_position", ma_sound_set_position_bind) \ + X("sound_get_position", ma_sound_get_position_bind) \ + X("sound_set_direction", ma_sound_set_direction_bind) \ + X("sound_get_direction", ma_sound_get_direction_bind) \ + X("sound_set_velocity", ma_sound_set_velocity_bind) \ + X("sound_get_velocity", ma_sound_get_velocity_bind) \ + X("sound_set_attenuation_model", ma_sound_set_attenuation_model_bind) \ + X("sound_get_attenuation_model", ma_sound_get_attenuation_model_bind) \ + X("sound_set_positioning", ma_sound_set_positioning_bind) \ + X("sound_get_positioning", ma_sound_get_positioning_bind) \ + X("sound_set_rolloff", ma_sound_set_rolloff_bind) \ + X("sound_get_rolloff", ma_sound_get_rolloff_bind) \ + X("sound_set_min_gain", ma_sound_set_min_gain_bind) \ + X("sound_get_min_gain", ma_sound_get_min_gain_bind) \ + X("sound_set_max_gain", ma_sound_set_max_gain_bind) \ + X("sound_get_max_gain", ma_sound_get_max_gain_bind) \ + X("sound_set_min_distance", ma_sound_set_min_distance_bind) \ + X("sound_get_min_distance", ma_sound_get_min_distance_bind) \ + X("sound_set_max_distance", ma_sound_set_max_distance_bind) \ + X("sound_get_max_distance", ma_sound_get_max_distance_bind) \ + X("sound_set_cone", ma_sound_set_cone_bind) \ + X("sound_get_cone", ma_sound_get_cone_bind) \ + X("sound_set_doppler_factor", ma_sound_set_doppler_factor_bind) \ + X("sound_get_doppler_factor", ma_sound_get_doppler_factor_bind) \ + X("sound_set_directional_attenuation_factor", ma_sound_set_directional_attenuation_factor_bind) \ + X("sound_get_directional_attenuation_factor", ma_sound_get_directional_attenuation_factor_bind) \ + X("sound_set_fade_in_pcm_frames", ma_sound_set_fade_in_pcm_frames_bind) \ + X("sound_set_fade_in_milliseconds", ma_sound_set_fade_in_milliseconds_bind) \ + X("sound_get_current_fade_volume", ma_sound_get_current_fade_volume_bind) \ + X("sound_set_start_time_in_pcm_frames", ma_sound_set_start_time_in_pcm_frames_bind) \ + X("sound_set_start_time_in_milliseconds", ma_sound_set_start_time_in_milliseconds_bind) \ + X("sound_set_stop_time_in_pcm_frames", ma_sound_set_stop_time_in_pcm_frames_bind) \ + X("sound_set_stop_time_in_milliseconds", ma_sound_set_stop_time_in_milliseconds_bind) \ + X("sound_is_playing", ma_sound_is_playing_bind) \ + X("sound_get_time_in_pcm_frames", ma_sound_get_time_in_pcm_frames_bind) \ + X("sound_set_looping", ma_sound_set_looping_bind) \ + X("sound_is_looping", ma_sound_is_looping_bind) \ + X("sound_at_end", ma_sound_at_end_bind) \ + X("sound_seek_to_pcm_frame", ma_sound_seek_to_pcm_frame_bind) \ + X("sound_get_data_format", ma_sound_get_data_format_bind) \ + X("sound_get_cursor_in_pcm_frames", ma_sound_get_cursor_in_pcm_frames_bind) \ + X("sound_get_length_in_pcm_frames", ma_sound_get_length_in_pcm_frames_bind) \ + X("sound_get_cursor_in_seconds", ma_sound_get_cursor_in_seconds_bind) \ + X("sound_get_length_in_seconds", ma_sound_get_length_in_seconds_bind) \ +\ + /* sound group */ \ + X("sound_group_init", ma_sound_group_init_bind) \ + X("sound_group_uninit", ma_sound_group_uninit_bind) \ + X("sound_group_start", ma_sound_group_start_bind) \ + X("sound_group_stop", ma_sound_group_stop_bind) \ + X("sound_group_set_volume", ma_sound_group_set_volume_bind) \ + X("sound_group_get_volume", ma_sound_group_get_volume_bind) \ + X("sound_group_set_pan", ma_sound_group_set_pan_bind) \ + X("sound_group_get_pan", ma_sound_group_get_pan_bind) \ + X("sound_group_set_pan_mode", ma_sound_group_set_pan_mode_bind) \ + X("sound_group_get_pan_mode", ma_sound_group_get_pan_mode_bind) \ + X("sound_group_set_pitch", ma_sound_group_set_pitch_bind) \ + X("sound_group_get_pitch", ma_sound_group_get_pitch_bind) \ + X("sound_group_set_spatialization_enabled", ma_sound_group_set_spatialization_enabled_bind) \ + X("sound_group_is_spatialization_enabled", ma_sound_group_is_spatialization_enabled_bind) \ + X("sound_group_set_pinned_listener_index", ma_sound_group_set_pinned_listener_index_bind) \ + X("sound_group_get_pinned_listener_index", ma_sound_group_get_pinned_listener_index_bind) \ + X("sound_group_get_listener_index", ma_sound_group_get_listener_index_bind) \ + X("sound_group_get_direction_to_listener", ma_sound_group_get_direction_to_listener_bind) \ + X("sound_group_set_position", ma_sound_group_set_position_bind) \ + X("sound_group_get_position", ma_sound_group_get_position_bind) \ + X("sound_group_set_direction", ma_sound_group_set_direction_bind) \ + X("sound_group_get_direction", ma_sound_group_get_direction_bind) \ + X("sound_group_set_velocity", ma_sound_group_set_velocity_bind) \ + X("sound_group_get_velocity", ma_sound_group_get_velocity_bind) \ + X("sound_group_set_attenuation_model", ma_sound_group_set_attenuation_model_bind) \ + X("sound_group_get_attenuation_model", ma_sound_group_get_attenuation_model_bind) \ + X("sound_group_set_positioning", ma_sound_group_set_positioning_bind) \ + X("sound_group_get_positioning", ma_sound_group_get_positioning_bind) \ + X("sound_group_set_rolloff", ma_sound_group_set_rolloff_bind) \ + X("sound_group_get_rolloff", ma_sound_group_get_rolloff_bind) \ + X("sound_group_set_min_gain", ma_sound_group_set_min_gain_bind) \ + X("sound_group_get_min_gain", ma_sound_group_get_min_gain_bind) \ + X("sound_group_set_max_gain", ma_sound_group_set_max_gain_bind) \ + X("sound_group_get_max_gain", ma_sound_group_get_max_gain_bind) \ + X("sound_group_set_min_distance", ma_sound_group_set_min_distance_bind) \ + X("sound_group_get_min_distance", ma_sound_group_get_min_distance_bind) \ + X("sound_group_set_max_distance", ma_sound_group_set_max_distance_bind) \ + X("sound_group_get_max_distance", ma_sound_group_get_max_distance_bind) \ + X("sound_group_set_cone", ma_sound_group_set_cone_bind) \ + X("sound_group_get_cone", ma_sound_group_get_cone_bind) \ + X("sound_group_set_doppler_factor", ma_sound_group_set_doppler_factor_bind) \ + X("sound_group_get_doppler_factor", ma_sound_group_get_doppler_factor_bind) \ + X("sound_group_set_directional_attenuation_factor", ma_sound_group_set_directional_attenuation_factor_bind) \ + X("sound_group_get_directional_attenuation_factor", ma_sound_group_get_directional_attenuation_factor_bind) \ + X("sound_group_set_fade_in_pcm_frames", ma_sound_group_set_fade_in_pcm_frames_bind) \ + X("sound_group_set_fade_in_milliseconds", ma_sound_group_set_fade_in_milliseconds_bind) \ + X("sound_group_get_current_fade_volume", ma_sound_group_get_current_fade_volume_bind) \ + X("sound_group_set_start_time_in_pcm_frames", ma_sound_group_set_start_time_in_pcm_frames_bind) \ + X("sound_group_set_start_time_in_milliseconds", ma_sound_group_set_start_time_in_milliseconds_bind) \ + X("sound_group_set_stop_time_in_pcm_frames", ma_sound_group_set_stop_time_in_pcm_frames_bind) \ + X("sound_group_set_stop_time_in_milliseconds", ma_sound_group_set_stop_time_in_milliseconds_bind) \ + X("sound_group_is_playing", ma_sound_group_is_playing_bind) \ + X("sound_group_get_time_in_pcm_frames", ma_sound_group_get_time_in_pcm_frames_bind) \ #define X(name, func) int func(lua_State *L); diff --git a/src/audio/bind b/src/audio/bind index 6f7e41c..3a9befe 100644 --- a/src/audio/bind +++ b/src/audio/bind @@ -1,68 +1,55 @@ -ma_result ma_sound_init_from_file(ma_engine* pEngine, const char* pFilePath, ma_uint32 flags, ma_sound_group* pGroup, ma_fence* pDoneFence, ma_sound* pSound); -ma_result ma_sound_init_from_file_w(ma_engine* pEngine, const wchar_t* pFilePath, ma_uint32 flags, ma_sound_group* pGroup, ma_fence* pDoneFence, ma_sound* pSound); -ma_result ma_sound_init_copy(ma_engine* pEngine, const ma_sound* pExistingSound, ma_uint32 flags, ma_sound_group* pGroup, ma_sound* pSound); -ma_result ma_sound_init_from_data_source(ma_engine* pEngine, ma_data_source* pDataSource, ma_uint32 flags, ma_sound_group* pGroup, ma_sound* pSound); -ma_result ma_sound_init_ex(ma_engine* pEngine, const ma_sound_config* pConfig, ma_sound* pSound); -void ma_sound_uninit(ma_sound* pSound); -ma_engine* ma_sound_get_engine(const ma_sound* pSound); -ma_data_source* ma_sound_get_data_source(const ma_sound* pSound); -ma_result ma_sound_start(ma_sound* pSound); -ma_result ma_sound_stop(ma_sound* pSound); -void ma_sound_set_volume(ma_sound* pSound, float volume); -float ma_sound_get_volume(const ma_sound* pSound); -void ma_sound_set_pan(ma_sound* pSound, float pan); -float ma_sound_get_pan(const ma_sound* pSound); -void ma_sound_set_pan_mode(ma_sound* pSound, ma_pan_mode panMode); -ma_pan_mode ma_sound_get_pan_mode(const ma_sound* pSound); -void ma_sound_set_pitch(ma_sound* pSound, float pitch); -float ma_sound_get_pitch(const ma_sound* pSound); -void ma_sound_set_spatialization_enabled(ma_sound* pSound, ma_bool32 enabled); -ma_bool32 ma_sound_is_spatialization_enabled(const ma_sound* pSound); -void ma_sound_set_pinned_listener_index(ma_sound* pSound, ma_uint32 listenerIndex); -ma_uint32 ma_sound_get_pinned_listener_index(const ma_sound* pSound); -ma_uint32 ma_sound_get_listener_index(const ma_sound* pSound); -ma_vec3f ma_sound_get_direction_to_listener(const ma_sound* pSound); -void ma_sound_set_position(ma_sound* pSound, float x, float y, float z); -ma_vec3f ma_sound_get_position(const ma_sound* pSound); -void ma_sound_set_direction(ma_sound* pSound, float x, float y, float z); -ma_vec3f ma_sound_get_direction(const ma_sound* pSound); -void ma_sound_set_velocity(ma_sound* pSound, float x, float y, float z); -ma_vec3f ma_sound_get_velocity(const ma_sound* pSound); -void ma_sound_set_attenuation_model(ma_sound* pSound, ma_attenuation_model attenuationModel); -ma_attenuation_model ma_sound_get_attenuation_model(const ma_sound* pSound); -void ma_sound_set_positioning(ma_sound* pSound, ma_positioning positioning); -ma_positioning ma_sound_get_positioning(const ma_sound* pSound); -void ma_sound_set_rolloff(ma_sound* pSound, float rolloff); -float ma_sound_get_rolloff(const ma_sound* pSound); -void ma_sound_set_min_gain(ma_sound* pSound, float minGain); -float ma_sound_get_min_gain(const ma_sound* pSound); -void ma_sound_set_max_gain(ma_sound* pSound, float maxGain); -float ma_sound_get_max_gain(const ma_sound* pSound); -void ma_sound_set_min_distance(ma_sound* pSound, float minDistance); -float ma_sound_get_min_distance(const ma_sound* pSound); -void ma_sound_set_max_distance(ma_sound* pSound, float maxDistance); -float ma_sound_get_max_distance(const ma_sound* pSound); -void ma_sound_set_cone(ma_sound* pSound, float innerAngleInRadians, float outerAngleInRadians, float outerGain); -void ma_sound_get_cone(const ma_sound* pSound, float* pInnerAngleInRadians, float* pOuterAngleInRadians, float* pOuterGain); -void ma_sound_set_doppler_factor(ma_sound* pSound, float dopplerFactor); -float ma_sound_get_doppler_factor(const ma_sound* pSound); -void ma_sound_set_directional_attenuation_factor(ma_sound* pSound, float directionalAttenuationFactor); -float ma_sound_get_directional_attenuation_factor(const ma_sound* pSound); -void ma_sound_set_fade_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames); -void ma_sound_set_fade_in_milliseconds(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds); -float ma_sound_get_current_fade_volume(ma_sound* pSound); -void ma_sound_set_start_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames); -void ma_sound_set_start_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds); -void ma_sound_set_stop_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames); -void ma_sound_set_stop_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds); -ma_bool32 ma_sound_is_playing(const ma_sound* pSound); -ma_uint64 ma_sound_get_time_in_pcm_frames(const ma_sound* pSound); -void ma_sound_set_looping(ma_sound* pSound, ma_bool32 isLooping); -ma_bool32 ma_sound_is_looping(const ma_sound* pSound); -ma_bool32 ma_sound_at_end(const ma_sound* pSound); -ma_result ma_sound_seek_to_pcm_frame(ma_sound* pSound, ma_uint64 frameIndex); -ma_result ma_sound_get_data_format(ma_sound* pSound, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate, ma_channel* pChannelMap, size_t channelMapCap); -ma_result ma_sound_get_cursor_in_pcm_frames(ma_sound* pSound, ma_uint64* pCursor); -ma_result ma_sound_get_length_in_pcm_frames(ma_sound* pSound, ma_uint64* pLength); -ma_result ma_sound_get_cursor_in_seconds(ma_sound* pSound, float* pCursor); -ma_result ma_sound_get_length_in_seconds(ma_sound* pSound, float* pLength); +ma_result ma_sound_group_init(ma_engine* pEngine, ma_uint32 flags, ma_sound_group* pParentGroup, ma_sound_group* pGroup); +ma_result ma_sound_group_init_ex(ma_engine* pEngine, const ma_sound_group_config* pConfig, ma_sound_group* pGroup); +void ma_sound_group_uninit(ma_sound_group* pGroup); +ma_engine* ma_sound_group_get_engine(const ma_sound_group* pGroup); +ma_result ma_sound_group_start(ma_sound_group* pGroup); +ma_result ma_sound_group_stop(ma_sound_group* pGroup); +void ma_sound_group_set_volume(ma_sound_group* pGroup, float volume); +float ma_sound_group_get_volume(const ma_sound_group* pGroup); +void ma_sound_group_set_pan(ma_sound_group* pGroup, float pan); +float ma_sound_group_get_pan(const ma_sound_group* pGroup); +void ma_sound_group_set_pan_mode(ma_sound_group* pGroup, ma_pan_mode panMode); +ma_pan_mode ma_sound_group_get_pan_mode(const ma_sound_group* pGroup); +void ma_sound_group_set_pitch(ma_sound_group* pGroup, float pitch); +float ma_sound_group_get_pitch(const ma_sound_group* pGroup); +void ma_sound_group_set_spatialization_enabled(ma_sound_group* pGroup, ma_bool32 enabled); +ma_bool32 ma_sound_group_is_spatialization_enabled(const ma_sound_group* pGroup); +void ma_sound_group_set_pinned_listener_index(ma_sound_group* pGroup, ma_uint32 listenerIndex); +ma_uint32 ma_sound_group_get_pinned_listener_index(const ma_sound_group* pGroup); +ma_uint32 ma_sound_group_get_listener_index(const ma_sound_group* pGroup); +ma_vec3f ma_sound_group_get_direction_to_listener(const ma_sound_group* pGroup); +void ma_sound_group_set_position(ma_sound_group* pGroup, float x, float y, float z); +ma_vec3f ma_sound_group_get_position(const ma_sound_group* pGroup); +void ma_sound_group_set_direction(ma_sound_group* pGroup, float x, float y, float z); +ma_vec3f ma_sound_group_get_direction(const ma_sound_group* pGroup); +void ma_sound_group_set_velocity(ma_sound_group* pGroup, float x, float y, float z); +ma_vec3f ma_sound_group_get_velocity(const ma_sound_group* pGroup); +void ma_sound_group_set_attenuation_model(ma_sound_group* pGroup, ma_attenuation_model attenuationModel); +ma_attenuation_model ma_sound_group_get_attenuation_model(const ma_sound_group* pGroup); +void ma_sound_group_set_positioning(ma_sound_group* pGroup, ma_positioning positioning); +ma_positioning ma_sound_group_get_positioning(const ma_sound_group* pGroup); +void ma_sound_group_set_rolloff(ma_sound_group* pGroup, float rolloff); +float ma_sound_group_get_rolloff(const ma_sound_group* pGroup); +void ma_sound_group_set_min_gain(ma_sound_group* pGroup, float minGain); +float ma_sound_group_get_min_gain(const ma_sound_group* pGroup); +void ma_sound_group_set_max_gain(ma_sound_group* pGroup, float maxGain); +float ma_sound_group_get_max_gain(const ma_sound_group* pGroup); +void ma_sound_group_set_min_distance(ma_sound_group* pGroup, float minDistance); +float ma_sound_group_get_min_distance(const ma_sound_group* pGroup); +void ma_sound_group_set_max_distance(ma_sound_group* pGroup, float maxDistance); +float ma_sound_group_get_max_distance(const ma_sound_group* pGroup); +void ma_sound_group_set_cone(ma_sound_group* pGroup, float innerAngleInRadians, float outerAngleInRadians, float outerGain); +void ma_sound_group_get_cone(const ma_sound_group* pGroup, float* pInnerAngleInRadians, float* pOuterAngleInRadians, float* pOuterGain); +void ma_sound_group_set_doppler_factor(ma_sound_group* pGroup, float dopplerFactor); +float ma_sound_group_get_doppler_factor(const ma_sound_group* pGroup); +void ma_sound_group_set_directional_attenuation_factor(ma_sound_group* pGroup, float directionalAttenuationFactor); +float ma_sound_group_get_directional_attenuation_factor(const ma_sound_group* pGroup); +void ma_sound_group_set_fade_in_pcm_frames(ma_sound_group* pGroup, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames); +void ma_sound_group_set_fade_in_milliseconds(ma_sound_group* pGroup, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds); +float ma_sound_group_get_current_fade_volume(ma_sound_group* pGroup); +void ma_sound_group_set_start_time_in_pcm_frames(ma_sound_group* pGroup, ma_uint64 absoluteGlobalTimeInFrames); +void ma_sound_group_set_start_time_in_milliseconds(ma_sound_group* pGroup, ma_uint64 absoluteGlobalTimeInMilliseconds); +void ma_sound_group_set_stop_time_in_pcm_frames(ma_sound_group* pGroup, ma_uint64 absoluteGlobalTimeInFrames); +void ma_sound_group_set_stop_time_in_milliseconds(ma_sound_group* pGroup, ma_uint64 absoluteGlobalTimeInMilliseconds); +ma_bool32 ma_sound_group_is_playing(const ma_sound_group* pGroup); +ma_uint64 ma_sound_group_get_time_in_pcm_frames(const ma_sound_group* pGroup); diff --git a/src/audio/bind.bind b/src/audio/bind.bind index c09a1ca..41fddd6 100644 --- a/src/audio/bind.bind +++ b/src/audio/bind.bind @@ -1,653 +1,511 @@ -int ma_sound_init_from_file_bind(lua_State *L) +int ma_sound_group_init_bind(lua_State *L) { ma_engine * pEngine = get: ma_engine * - const char * pFilePath = luaL_checkstring(L, 2); - ma_uint32 flags = luaL_checkinteger(L, 3); + ma_uint32 flags = luaL_checkinteger(L, 2); + ma_sound_group * pParentGroup = get: ma_sound_group * ma_sound_group * pGroup = get: ma_sound_group * - ma_fence * pDoneFence = get: ma_fence * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_from_file(pEngine, pFilePath, flags, pGroup, pDoneFence, pSound); + ma_result bind_result = ma_sound_group_init(pEngine, flags, pParentGroup, pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_init_from_file_w_bind(lua_State *L) +int ma_sound_group_init_ex_bind(lua_State *L) { ma_engine * pEngine = get: ma_engine * - const wchar_t * pFilePath = luaL_checkstring(L, 2); - ma_uint32 flags = luaL_checkinteger(L, 3); + const ma_sound_group_config * pConfig = get: const ma_sound_group_config * ma_sound_group * pGroup = get: ma_sound_group * - ma_fence * pDoneFence = get: ma_fence * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_from_file_w(pEngine, pFilePath, flags, pGroup, pDoneFence, pSound); + ma_result bind_result = ma_sound_group_init_ex(pEngine, pConfig, pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_init_copy_bind(lua_State *L) +int ma_sound_group_uninit_bind(lua_State *L) { - ma_engine * pEngine = get: ma_engine * - const ma_sound * pExistingSound = get: const ma_sound * - ma_uint32 flags = luaL_checkinteger(L, 3); - ma_sound_group * pGroup = get: ma_sound_group * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_copy(pEngine, pExistingSound, flags, pGroup, pSound); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_init_from_data_source_bind(lua_State *L) -{ - ma_engine * pEngine = get: ma_engine * - ma_data_source * pDataSource = get: ma_data_source * - ma_uint32 flags = luaL_checkinteger(L, 3); ma_sound_group * pGroup = get: ma_sound_group * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_from_data_source(pEngine, pDataSource, flags, pGroup, pSound); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_init_ex_bind(lua_State *L) -{ - ma_engine * pEngine = get: ma_engine * - const ma_sound_config * pConfig = get: const ma_sound_config * - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_init_ex(pEngine, pConfig, pSound); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_uninit_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_sound_uninit(pSound); + ma_sound_group_uninit(pGroup); return 0; } -int ma_sound_get_engine_bind(lua_State *L) -{ - const ma_sound * pSound = get: const ma_sound * - ma_engine* bind_result = ma_sound_get_engine(pSound); - /* push result */ - return /* count */; -} - - -int ma_sound_get_data_source_bind(lua_State *L) +int ma_sound_group_get_engine_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_data_source* bind_result = ma_sound_get_data_source(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_engine* bind_result = ma_sound_group_get_engine(pGroup); /* push result */ return /* count */; } -int ma_sound_start_bind(lua_State *L) +int ma_sound_group_start_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_start(pSound); + ma_sound_group * pGroup = get: ma_sound_group * + ma_result bind_result = ma_sound_group_start(pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_stop_bind(lua_State *L) +int ma_sound_group_stop_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * - ma_result bind_result = ma_sound_stop(pSound); + ma_sound_group * pGroup = get: ma_sound_group * + ma_result bind_result = ma_sound_group_stop(pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_set_volume_bind(lua_State *L) +int ma_sound_group_set_volume_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float volume = luaL_checknumber(L, 2); - ma_sound_set_volume(pSound, volume); + ma_sound_group_set_volume(pGroup, volume); return 0; } -int ma_sound_get_volume_bind(lua_State *L) +int ma_sound_group_get_volume_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_volume(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_volume(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_pan_bind(lua_State *L) +int ma_sound_group_set_pan_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float pan = luaL_checknumber(L, 2); - ma_sound_set_pan(pSound, pan); + ma_sound_group_set_pan(pGroup, pan); return 0; } -int ma_sound_get_pan_bind(lua_State *L) +int ma_sound_group_get_pan_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_pan(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_pan(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_pan_mode_bind(lua_State *L) +int ma_sound_group_set_pan_mode_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_pan_mode panMode = get: ma_pan_mode - ma_sound_set_pan_mode(pSound, panMode); + ma_sound_group_set_pan_mode(pGroup, panMode); return 0; } -int ma_sound_get_pan_mode_bind(lua_State *L) +int ma_sound_group_get_pan_mode_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_pan_mode bind_result = ma_sound_get_pan_mode(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_pan_mode bind_result = ma_sound_group_get_pan_mode(pGroup); /* push result */ return /* count */; } -int ma_sound_set_pitch_bind(lua_State *L) +int ma_sound_group_set_pitch_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float pitch = luaL_checknumber(L, 2); - ma_sound_set_pitch(pSound, pitch); + ma_sound_group_set_pitch(pGroup, pitch); return 0; } -int ma_sound_get_pitch_bind(lua_State *L) +int ma_sound_group_get_pitch_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_pitch(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_pitch(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_spatialization_enabled_bind(lua_State *L) +int ma_sound_group_set_spatialization_enabled_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_bool32 enabled = get: ma_bool32 - ma_sound_set_spatialization_enabled(pSound, enabled); + ma_sound_group_set_spatialization_enabled(pGroup, enabled); return 0; } -int ma_sound_is_spatialization_enabled_bind(lua_State *L) +int ma_sound_group_is_spatialization_enabled_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_bool32 bind_result = ma_sound_is_spatialization_enabled(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_bool32 bind_result = ma_sound_group_is_spatialization_enabled(pGroup); /* push result */ return /* count */; } -int ma_sound_set_pinned_listener_index_bind(lua_State *L) +int ma_sound_group_set_pinned_listener_index_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint32 listenerIndex = luaL_checkinteger(L, 2); - ma_sound_set_pinned_listener_index(pSound, listenerIndex); + ma_sound_group_set_pinned_listener_index(pGroup, listenerIndex); return 0; } -int ma_sound_get_pinned_listener_index_bind(lua_State *L) +int ma_sound_group_get_pinned_listener_index_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_uint32 bind_result = ma_sound_get_pinned_listener_index(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_uint32 bind_result = ma_sound_group_get_pinned_listener_index(pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_get_listener_index_bind(lua_State *L) +int ma_sound_group_get_listener_index_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_uint32 bind_result = ma_sound_get_listener_index(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_uint32 bind_result = ma_sound_group_get_listener_index(pGroup); lua_pushinteger(L, bind_result); return 1; } -int ma_sound_get_direction_to_listener_bind(lua_State *L) +int ma_sound_group_get_direction_to_listener_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_vec3f bind_result = ma_sound_get_direction_to_listener(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_vec3f bind_result = ma_sound_group_get_direction_to_listener(pGroup); /* push result */ return /* count */; } -int ma_sound_set_position_bind(lua_State *L) +int ma_sound_group_set_position_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float x = luaL_checknumber(L, 2); float y = luaL_checknumber(L, 3); float z = luaL_checknumber(L, 4); - ma_sound_set_position(pSound, x, y, z); + ma_sound_group_set_position(pGroup, x, y, z); return 0; } -int ma_sound_get_position_bind(lua_State *L) +int ma_sound_group_get_position_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_vec3f bind_result = ma_sound_get_position(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_vec3f bind_result = ma_sound_group_get_position(pGroup); /* push result */ return /* count */; } -int ma_sound_set_direction_bind(lua_State *L) +int ma_sound_group_set_direction_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float x = luaL_checknumber(L, 2); float y = luaL_checknumber(L, 3); float z = luaL_checknumber(L, 4); - ma_sound_set_direction(pSound, x, y, z); + ma_sound_group_set_direction(pGroup, x, y, z); return 0; } -int ma_sound_get_direction_bind(lua_State *L) +int ma_sound_group_get_direction_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_vec3f bind_result = ma_sound_get_direction(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_vec3f bind_result = ma_sound_group_get_direction(pGroup); /* push result */ return /* count */; } -int ma_sound_set_velocity_bind(lua_State *L) +int ma_sound_group_set_velocity_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float x = luaL_checknumber(L, 2); float y = luaL_checknumber(L, 3); float z = luaL_checknumber(L, 4); - ma_sound_set_velocity(pSound, x, y, z); + ma_sound_group_set_velocity(pGroup, x, y, z); return 0; } -int ma_sound_get_velocity_bind(lua_State *L) +int ma_sound_group_get_velocity_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_vec3f bind_result = ma_sound_get_velocity(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_vec3f bind_result = ma_sound_group_get_velocity(pGroup); /* push result */ return /* count */; } -int ma_sound_set_attenuation_model_bind(lua_State *L) +int ma_sound_group_set_attenuation_model_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_attenuation_model attenuationModel = get: ma_attenuation_model - ma_sound_set_attenuation_model(pSound, attenuationModel); + ma_sound_group_set_attenuation_model(pGroup, attenuationModel); return 0; } -int ma_sound_get_attenuation_model_bind(lua_State *L) +int ma_sound_group_get_attenuation_model_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_attenuation_model bind_result = ma_sound_get_attenuation_model(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_attenuation_model bind_result = ma_sound_group_get_attenuation_model(pGroup); /* push result */ return /* count */; } -int ma_sound_set_positioning_bind(lua_State *L) +int ma_sound_group_set_positioning_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_positioning positioning = get: ma_positioning - ma_sound_set_positioning(pSound, positioning); + ma_sound_group_set_positioning(pGroup, positioning); return 0; } -int ma_sound_get_positioning_bind(lua_State *L) +int ma_sound_group_get_positioning_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_positioning bind_result = ma_sound_get_positioning(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_positioning bind_result = ma_sound_group_get_positioning(pGroup); /* push result */ return /* count */; } -int ma_sound_set_rolloff_bind(lua_State *L) +int ma_sound_group_set_rolloff_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float rolloff = luaL_checknumber(L, 2); - ma_sound_set_rolloff(pSound, rolloff); + ma_sound_group_set_rolloff(pGroup, rolloff); return 0; } -int ma_sound_get_rolloff_bind(lua_State *L) +int ma_sound_group_get_rolloff_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_rolloff(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_rolloff(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_min_gain_bind(lua_State *L) +int ma_sound_group_set_min_gain_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float minGain = luaL_checknumber(L, 2); - ma_sound_set_min_gain(pSound, minGain); + ma_sound_group_set_min_gain(pGroup, minGain); return 0; } -int ma_sound_get_min_gain_bind(lua_State *L) +int ma_sound_group_get_min_gain_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_min_gain(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_min_gain(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_max_gain_bind(lua_State *L) +int ma_sound_group_set_max_gain_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float maxGain = luaL_checknumber(L, 2); - ma_sound_set_max_gain(pSound, maxGain); + ma_sound_group_set_max_gain(pGroup, maxGain); return 0; } -int ma_sound_get_max_gain_bind(lua_State *L) +int ma_sound_group_get_max_gain_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_max_gain(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_max_gain(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_min_distance_bind(lua_State *L) +int ma_sound_group_set_min_distance_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float minDistance = luaL_checknumber(L, 2); - ma_sound_set_min_distance(pSound, minDistance); + ma_sound_group_set_min_distance(pGroup, minDistance); return 0; } -int ma_sound_get_min_distance_bind(lua_State *L) +int ma_sound_group_get_min_distance_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_min_distance(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_min_distance(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_max_distance_bind(lua_State *L) +int ma_sound_group_set_max_distance_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float maxDistance = luaL_checknumber(L, 2); - ma_sound_set_max_distance(pSound, maxDistance); + ma_sound_group_set_max_distance(pGroup, maxDistance); return 0; } -int ma_sound_get_max_distance_bind(lua_State *L) +int ma_sound_group_get_max_distance_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_max_distance(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_max_distance(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_cone_bind(lua_State *L) +int ma_sound_group_set_cone_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float innerAngleInRadians = luaL_checknumber(L, 2); float outerAngleInRadians = luaL_checknumber(L, 3); float outerGain = luaL_checknumber(L, 4); - ma_sound_set_cone(pSound, innerAngleInRadians, outerAngleInRadians, outerGain); + ma_sound_group_set_cone(pGroup, innerAngleInRadians, outerAngleInRadians, outerGain); return 0; } -int ma_sound_get_cone_bind(lua_State *L) +int ma_sound_group_get_cone_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * + const ma_sound_group * pGroup = get: const ma_sound_group * float * pInnerAngleInRadians = get: float * float * pOuterAngleInRadians = get: float * float * pOuterGain = get: float * - ma_sound_get_cone(pSound, pInnerAngleInRadians, pOuterAngleInRadians, pOuterGain); + ma_sound_group_get_cone(pGroup, pInnerAngleInRadians, pOuterAngleInRadians, pOuterGain); return 0; } -int ma_sound_set_doppler_factor_bind(lua_State *L) +int ma_sound_group_set_doppler_factor_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float dopplerFactor = luaL_checknumber(L, 2); - ma_sound_set_doppler_factor(pSound, dopplerFactor); + ma_sound_group_set_doppler_factor(pGroup, dopplerFactor); return 0; } -int ma_sound_get_doppler_factor_bind(lua_State *L) +int ma_sound_group_get_doppler_factor_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_doppler_factor(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_doppler_factor(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_directional_attenuation_factor_bind(lua_State *L) +int ma_sound_group_set_directional_attenuation_factor_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float directionalAttenuationFactor = luaL_checknumber(L, 2); - ma_sound_set_directional_attenuation_factor(pSound, directionalAttenuationFactor); + ma_sound_group_set_directional_attenuation_factor(pGroup, directionalAttenuationFactor); return 0; } -int ma_sound_get_directional_attenuation_factor_bind(lua_State *L) +int ma_sound_group_get_directional_attenuation_factor_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - float bind_result = ma_sound_get_directional_attenuation_factor(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + float bind_result = ma_sound_group_get_directional_attenuation_factor(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_fade_in_pcm_frames_bind(lua_State *L) +int ma_sound_group_set_fade_in_pcm_frames_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float volumeBeg = luaL_checknumber(L, 2); float volumeEnd = luaL_checknumber(L, 3); ma_uint64 fadeLengthInFrames = luaL_checkinteger(L, 4); - ma_sound_set_fade_in_pcm_frames(pSound, volumeBeg, volumeEnd, fadeLengthInFrames); + ma_sound_group_set_fade_in_pcm_frames(pGroup, volumeBeg, volumeEnd, fadeLengthInFrames); return 0; } -int ma_sound_set_fade_in_milliseconds_bind(lua_State *L) +int ma_sound_group_set_fade_in_milliseconds_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * float volumeBeg = luaL_checknumber(L, 2); float volumeEnd = luaL_checknumber(L, 3); ma_uint64 fadeLengthInMilliseconds = luaL_checkinteger(L, 4); - ma_sound_set_fade_in_milliseconds(pSound, volumeBeg, volumeEnd, fadeLengthInMilliseconds); + ma_sound_group_set_fade_in_milliseconds(pGroup, volumeBeg, volumeEnd, fadeLengthInMilliseconds); return 0; } -int ma_sound_get_current_fade_volume_bind(lua_State *L) +int ma_sound_group_get_current_fade_volume_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * - float bind_result = ma_sound_get_current_fade_volume(pSound); + ma_sound_group * pGroup = get: ma_sound_group * + float bind_result = ma_sound_group_get_current_fade_volume(pGroup); lua_pushnumber(L, bind_result); return 1; } -int ma_sound_set_start_time_in_pcm_frames_bind(lua_State *L) +int ma_sound_group_set_start_time_in_pcm_frames_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint64 absoluteGlobalTimeInFrames = luaL_checkinteger(L, 2); - ma_sound_set_start_time_in_pcm_frames(pSound, absoluteGlobalTimeInFrames); + ma_sound_group_set_start_time_in_pcm_frames(pGroup, absoluteGlobalTimeInFrames); return 0; } -int ma_sound_set_start_time_in_milliseconds_bind(lua_State *L) +int ma_sound_group_set_start_time_in_milliseconds_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint64 absoluteGlobalTimeInMilliseconds = luaL_checkinteger(L, 2); - ma_sound_set_start_time_in_milliseconds(pSound, absoluteGlobalTimeInMilliseconds); + ma_sound_group_set_start_time_in_milliseconds(pGroup, absoluteGlobalTimeInMilliseconds); return 0; } -int ma_sound_set_stop_time_in_pcm_frames_bind(lua_State *L) +int ma_sound_group_set_stop_time_in_pcm_frames_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint64 absoluteGlobalTimeInFrames = luaL_checkinteger(L, 2); - ma_sound_set_stop_time_in_pcm_frames(pSound, absoluteGlobalTimeInFrames); + ma_sound_group_set_stop_time_in_pcm_frames(pGroup, absoluteGlobalTimeInFrames); return 0; } -int ma_sound_set_stop_time_in_milliseconds_bind(lua_State *L) +int ma_sound_group_set_stop_time_in_milliseconds_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * + ma_sound_group * pGroup = get: ma_sound_group * ma_uint64 absoluteGlobalTimeInMilliseconds = luaL_checkinteger(L, 2); - ma_sound_set_stop_time_in_milliseconds(pSound, absoluteGlobalTimeInMilliseconds); + ma_sound_group_set_stop_time_in_milliseconds(pGroup, absoluteGlobalTimeInMilliseconds); return 0; } -int ma_sound_is_playing_bind(lua_State *L) +int ma_sound_group_is_playing_bind(lua_State *L) { - const ma_sound * pSound = get: const ma_sound * - ma_bool32 bind_result = ma_sound_is_playing(pSound); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_bool32 bind_result = ma_sound_group_is_playing(pGroup); /* push result */ return /* count */; } -int ma_sound_get_time_in_pcm_frames_bind(lua_State *L) -{ - const ma_sound * pSound = get: const ma_sound * - ma_uint64 bind_result = ma_sound_get_time_in_pcm_frames(pSound); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_set_looping_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_bool32 isLooping = get: ma_bool32 - ma_sound_set_looping(pSound, isLooping); - return 0; -} - - -int ma_sound_is_looping_bind(lua_State *L) -{ - const ma_sound * pSound = get: const ma_sound * - ma_bool32 bind_result = ma_sound_is_looping(pSound); - /* push result */ - return /* count */; -} - - -int ma_sound_at_end_bind(lua_State *L) -{ - const ma_sound * pSound = get: const ma_sound * - ma_bool32 bind_result = ma_sound_at_end(pSound); - /* push result */ - return /* count */; -} - - -int ma_sound_seek_to_pcm_frame_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_uint64 frameIndex = luaL_checkinteger(L, 2); - ma_result bind_result = ma_sound_seek_to_pcm_frame(pSound, frameIndex); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_data_format_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_format * pFormat = get: ma_format * - ma_uint32 * pChannels = get: ma_uint32 * - ma_uint32 * pSampleRate = get: ma_uint32 * - ma_channel * pChannelMap = get: ma_channel * - size_t channelMapCap = get: size_t - ma_result bind_result = ma_sound_get_data_format(pSound, pFormat, pChannels, pSampleRate, pChannelMap, channelMapCap); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_cursor_in_pcm_frames_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_uint64 * pCursor = get: ma_uint64 * - ma_result bind_result = ma_sound_get_cursor_in_pcm_frames(pSound, pCursor); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_length_in_pcm_frames_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - ma_uint64 * pLength = get: ma_uint64 * - ma_result bind_result = ma_sound_get_length_in_pcm_frames(pSound, pLength); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_cursor_in_seconds_bind(lua_State *L) -{ - ma_sound * pSound = get: ma_sound * - float * pCursor = get: float * - ma_result bind_result = ma_sound_get_cursor_in_seconds(pSound, pCursor); - lua_pushinteger(L, bind_result); - return 1; -} - - -int ma_sound_get_length_in_seconds_bind(lua_State *L) +int ma_sound_group_get_time_in_pcm_frames_bind(lua_State *L) { - ma_sound * pSound = get: ma_sound * - float * pLength = get: float * - ma_result bind_result = ma_sound_get_length_in_seconds(pSound, pLength); + const ma_sound_group * pGroup = get: const ma_sound_group * + ma_uint64 bind_result = ma_sound_group_get_time_in_pcm_frames(pGroup); lua_pushinteger(L, bind_result); return 1; } diff --git a/src/audio/engine.c b/src/audio/engine.c index 4d2caba..ec43728 100644 --- a/src/audio/engine.c +++ b/src/audio/engine.c @@ -29,6 +29,8 @@ int ma_engine_init_bind(lua_State *L) lua_pushinteger(L, result); lua_pushvalue(L, engine_index); lua_remove(L, engine_index); + luaL_getmetatable(L, ma_engine_tname); + lua_setmetatable(L, -2); return 2; } @@ -41,15 +43,6 @@ int ma_engine_uninit_bind(lua_State *L) } -int ma_engine_get_endpoint_bind(lua_State *L) -{ - ma_engine * pEngine = luaL_checkudata(L, 1, ma_engine_tname); - ma_node* bind_result = ma_engine_get_endpoint(pEngine); - ma_push_node(L, bind_result); - return 1; -} - - int ma_engine_get_time_bind(lua_State *L) { ma_engine * pEngine = luaL_checkudata(L, 1, ma_engine_tname); diff --git a/src/audio/sound_group.c b/src/audio/sound_group.c new file mode 100644 index 0000000..c52b3be --- /dev/null +++ b/src/audio/sound_group.c @@ -0,0 +1,522 @@ +#include <lua.h> +#include <lauxlib.h> +#include <miniaudio.h> +#include "audio.h" + + +ma_sound_group * to_sound_group(lua_State *L, int index) +{ + if (lua_isnil(L, index)) { + return NULL; + } + return luaL_checkudata(L, index, ma_sound_group_tname); +} + + +int ma_sound_group_init_bind(lua_State *L) +{ + ma_engine * pEngine = luaL_checkudata(L, 1, ma_engine_tname); + ma_uint32 flags = luaL_checkinteger(L, 2); + ma_sound_group * pParentGroup = to_sound_group(L, 3); + ma_sound_group * pGroup = lua_newuserdata(L, sizeof(ma_sound_group)); + int gindex = lua_gettop(L); + ma_result bind_result = ma_sound_group_init(pEngine, flags, pParentGroup, pGroup); + lua_pushinteger(L, bind_result); + lua_pushvalue(L, gindex); + lua_remove(L, gindex); + luaL_getmetatable(L, ma_sound_group_tname); + lua_setmetatable(L, -2); + return 2; +} + + +int ma_sound_group_uninit_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_sound_group_uninit(pGroup); + return 0; +} + + +int ma_sound_group_start_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_result bind_result = ma_sound_group_start(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_stop_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_result bind_result = ma_sound_group_stop(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_volume_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float volume = luaL_checknumber(L, 2); + ma_sound_group_set_volume(pGroup, volume); + return 0; +} + + +int ma_sound_group_get_volume_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_volume(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_pan_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float pan = luaL_checknumber(L, 2); + ma_sound_group_set_pan(pGroup, pan); + return 0; +} + + +int ma_sound_group_get_pan_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_pan(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_pan_mode_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_pan_mode panMode = luaL_checkinteger(L, 2); + ma_sound_group_set_pan_mode(pGroup, panMode); + return 0; +} + + +int ma_sound_group_get_pan_mode_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_pan_mode bind_result = ma_sound_group_get_pan_mode(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_pitch_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float pitch = luaL_checknumber(L, 2); + ma_sound_group_set_pitch(pGroup, pitch); + return 0; +} + + +int ma_sound_group_get_pitch_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_pitch(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_spatialization_enabled_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_bool32 enabled = lua_toboolean(L, 2); + ma_sound_group_set_spatialization_enabled(pGroup, enabled); + return 0; +} + + +int ma_sound_group_is_spatialization_enabled_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_bool32 bind_result = ma_sound_group_is_spatialization_enabled(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_pinned_listener_index_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint32 listenerIndex = luaL_checkinteger(L, 2); + ma_sound_group_set_pinned_listener_index(pGroup, listenerIndex); + return 0; +} + + +int ma_sound_group_get_pinned_listener_index_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint32 bind_result = ma_sound_group_get_pinned_listener_index(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_get_listener_index_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint32 bind_result = ma_sound_group_get_listener_index(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_get_direction_to_listener_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_vec3f bind_result = ma_sound_group_get_direction_to_listener(pGroup); + lua_pushnumber(L, bind_result.x); + lua_pushnumber(L, bind_result.y); + lua_pushnumber(L, bind_result.z); + return 3; +} + + +int ma_sound_group_set_position_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float x = luaL_checknumber(L, 2); + float y = luaL_checknumber(L, 3); + float z = luaL_checknumber(L, 4); + ma_sound_group_set_position(pGroup, x, y, z); + return 0; +} + + +int ma_sound_group_get_position_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_vec3f bind_result = ma_sound_group_get_position(pGroup); + lua_pushnumber(L, bind_result.x); + lua_pushnumber(L, bind_result.y); + lua_pushnumber(L, bind_result.z); + return 3; +} + + +int ma_sound_group_set_direction_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float x = luaL_checknumber(L, 2); + float y = luaL_checknumber(L, 3); + float z = luaL_checknumber(L, 4); + ma_sound_group_set_direction(pGroup, x, y, z); + return 0; +} + + +int ma_sound_group_get_direction_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_vec3f bind_result = ma_sound_group_get_direction(pGroup); + lua_pushnumber(L, bind_result.x); + lua_pushnumber(L, bind_result.y); + lua_pushnumber(L, bind_result.z); + return 3; +} + + +int ma_sound_group_set_velocity_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float x = luaL_checknumber(L, 2); + float y = luaL_checknumber(L, 3); + float z = luaL_checknumber(L, 4); + ma_sound_group_set_velocity(pGroup, x, y, z); + return 0; +} + + +int ma_sound_group_get_velocity_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_vec3f bind_result = ma_sound_group_get_velocity(pGroup); + lua_pushnumber(L, bind_result.x); + lua_pushnumber(L, bind_result.y); + lua_pushnumber(L, bind_result.z); + return 3; +} + + +int ma_sound_group_set_attenuation_model_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_attenuation_model attenuationModel = luaL_checkinteger(L, 2); + ma_sound_group_set_attenuation_model(pGroup, attenuationModel); + return 0; +} + + +int ma_sound_group_get_attenuation_model_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_attenuation_model bind_result = ma_sound_group_get_attenuation_model(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_positioning_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_positioning positioning = luaL_checkinteger(L, 2); + ma_sound_group_set_positioning(pGroup, positioning); + return 0; +} + + +int ma_sound_group_get_positioning_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_positioning bind_result = ma_sound_group_get_positioning(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_set_rolloff_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float rolloff = luaL_checknumber(L, 2); + ma_sound_group_set_rolloff(pGroup, rolloff); + return 0; +} + + +int ma_sound_group_get_rolloff_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_rolloff(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_min_gain_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float minGain = luaL_checknumber(L, 2); + ma_sound_group_set_min_gain(pGroup, minGain); + return 0; +} + + +int ma_sound_group_get_min_gain_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_min_gain(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_max_gain_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float maxGain = luaL_checknumber(L, 2); + ma_sound_group_set_max_gain(pGroup, maxGain); + return 0; +} + + +int ma_sound_group_get_max_gain_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_max_gain(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_min_distance_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float minDistance = luaL_checknumber(L, 2); + ma_sound_group_set_min_distance(pGroup, minDistance); + return 0; +} + + +int ma_sound_group_get_min_distance_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_min_distance(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_max_distance_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float maxDistance = luaL_checknumber(L, 2); + ma_sound_group_set_max_distance(pGroup, maxDistance); + return 0; +} + + +int ma_sound_group_get_max_distance_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_max_distance(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_cone_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float innerAngleInRadians = luaL_checknumber(L, 2); + float outerAngleInRadians = luaL_checknumber(L, 3); + float outerGain = luaL_checknumber(L, 4); + ma_sound_group_set_cone(pGroup, innerAngleInRadians, outerAngleInRadians, outerGain); + return 0; +} + + +int ma_sound_group_get_cone_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float InnerAngleInRadians, OuterAngleInRadians, OuterGain; + ma_sound_group_get_cone(pGroup, &InnerAngleInRadians, &OuterAngleInRadians, &OuterGain); + lua_pushnumber(L, InnerAngleInRadians); + lua_pushnumber(L, OuterAngleInRadians); + lua_pushnumber(L, OuterGain); + return 3; +} + + +int ma_sound_group_set_doppler_factor_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float dopplerFactor = luaL_checknumber(L, 2); + ma_sound_group_set_doppler_factor(pGroup, dopplerFactor); + return 0; +} + + +int ma_sound_group_get_doppler_factor_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_doppler_factor(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_directional_attenuation_factor_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float directionalAttenuationFactor = luaL_checknumber(L, 2); + ma_sound_group_set_directional_attenuation_factor(pGroup, directionalAttenuationFactor); + return 0; +} + + +int ma_sound_group_get_directional_attenuation_factor_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_directional_attenuation_factor(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_fade_in_pcm_frames_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float volumeBeg = luaL_checknumber(L, 2); + float volumeEnd = luaL_checknumber(L, 3); + ma_uint64 fadeLengthInFrames = luaL_checkinteger(L, 4); + ma_sound_group_set_fade_in_pcm_frames(pGroup, volumeBeg, volumeEnd, fadeLengthInFrames); + return 0; +} + + +int ma_sound_group_set_fade_in_milliseconds_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float volumeBeg = luaL_checknumber(L, 2); + float volumeEnd = luaL_checknumber(L, 3); + ma_uint64 fadeLengthInMilliseconds = luaL_checkinteger(L, 4); + ma_sound_group_set_fade_in_milliseconds(pGroup, volumeBeg, volumeEnd, fadeLengthInMilliseconds); + return 0; +} + + +int ma_sound_group_get_current_fade_volume_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + float bind_result = ma_sound_group_get_current_fade_volume(pGroup); + lua_pushnumber(L, bind_result); + return 1; +} + + +int ma_sound_group_set_start_time_in_pcm_frames_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 absoluteGlobalTimeInFrames = luaL_checkinteger(L, 2); + ma_sound_group_set_start_time_in_pcm_frames(pGroup, absoluteGlobalTimeInFrames); + return 0; +} + + +int ma_sound_group_set_start_time_in_milliseconds_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 absoluteGlobalTimeInMilliseconds = luaL_checkinteger(L, 2); + ma_sound_group_set_start_time_in_milliseconds(pGroup, absoluteGlobalTimeInMilliseconds); + return 0; +} + + +int ma_sound_group_set_stop_time_in_pcm_frames_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 absoluteGlobalTimeInFrames = luaL_checkinteger(L, 2); + ma_sound_group_set_stop_time_in_pcm_frames(pGroup, absoluteGlobalTimeInFrames); + return 0; +} + + +int ma_sound_group_set_stop_time_in_milliseconds_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 absoluteGlobalTimeInMilliseconds = luaL_checkinteger(L, 2); + ma_sound_group_set_stop_time_in_milliseconds(pGroup, absoluteGlobalTimeInMilliseconds); + return 0; +} + + +int ma_sound_group_is_playing_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_bool32 bind_result = ma_sound_group_is_playing(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + +int ma_sound_group_get_time_in_pcm_frames_bind(lua_State *L) +{ + ma_sound_group * pGroup = luaL_checkudata(L, 1, ma_sound_group_tname); + ma_uint64 bind_result = ma_sound_group_get_time_in_pcm_frames(pGroup); + lua_pushinteger(L, bind_result); + return 1; +} + + |