src/sound.c File Reference

#include "sound.h"

Go to the source code of this file.

Enumerations

enum  { NOTHING_PLAYING_AT_ALL = 3, FADING_IN = 4, FADING_OUT = 5 }

Functions

void InitAudio (void)
void SetBGMusicVolume (float NewVolume)
void SetSoundFXVolume (float NewVolume)
void channelDone (int channel)
void OldMusicHasFinishedFadingOut (void)
void LoadAndFadeInBackgroundMusic (void)
void SwitchBackgroundMusicTo (char *filename_raw_parameter)
void PlayOnceNeededSoundSample (const char *SoundSampleFileName, const int With_Waiting, const int no_double_catching)
void play_sample_using_WAV_cache (char *SoundSampleFileName, int With_Waiting, int no_double_catching)
void play_sample_using_WAV_cache_v (char *SoundSampleFileName, int With_Waiting, int no_double_catching, double volume)
void remove_all_samples_from_WAV_cache (void)

Variables

Mix_Chunk * dynamic_WAV_cache [MAX_SOUNDS_IN_DYNAMIC_WAV_CACHE]
char * sound_names_in_dynamic_wav_chache [MAX_SOUNDS_IN_DYNAMIC_WAV_CACHE]
char * MOD_Music_SampleFilenames [ALL_MOD_MUSICS]
char SoundChannelList [MAX_SOUND_CHANNELS]
Mix_Chunk * List_Of_Sustained_Release_WAV_Files [MAX_SOUND_CHANNELS]
Mix_Music * Loaded_MOD_Files [ALL_MOD_MUSICS]
int BackgroundMusicStateMachineState = NOTHING_PLAYING_AT_ALL
char NewMusicTargetFileName [5000]
static int next_free_position_in_cache = 0
int i
unsigned char * ptr
unsigned char v = 128
int SampleLaenge


Enumeration Type Documentation

anonymous enum

Enumerator:
NOTHING_PLAYING_AT_ALL 
FADING_IN 
FADING_OUT 

Definition at line 86 of file sound.c.


Function Documentation

void channelDone ( int  channel  ) 

================================= FUNCTIONS FOR THREADING ========================================

Definition at line 230 of file sound.c.

References DebugPrintf(), List_Of_Sustained_Release_WAV_Files, and SoundChannelList.

Referenced by PlayOnceNeededSoundSample().

void InitAudio ( void   ) 

============================================ SYSTEM ============================================

Definition at line 117 of file sound.c.

References DebugPrintf(), ErrorMessage(), FALSE, IS_WARNING_ONLY, NO_NEED_TO_INFORM, and sound_on.

Referenced by InitFreedroid().

void LoadAndFadeInBackgroundMusic ( void   ) 

============================================ MUSIC ============================================ This function is intended to provide a convenient way of switching between different backround sounds in freedroid. If no background sound was yet running, the function should start playing the given background music. If some background sound was already playing, the function should shut down the old background music and start playing the new one.

Definition at line 283 of file sound.c.

References configuration_for_freedroid_s::Current_BG_Music_Volume, DebugPrintf(), find_file(), GameConfig, Loaded_MOD_Files, NewMusicTargetFileName, NULL, SILENCE, SOUND_DIR, and sound_on.

Referenced by OldMusicHasFinishedFadingOut(), and SwitchBackgroundMusicTo().

void OldMusicHasFinishedFadingOut ( void   ) 

This function will be invoked by the callback of the SDL mixer when the fading out effect with the background music is completed.

Definition at line 257 of file sound.c.

References DebugPrintf(), and LoadAndFadeInBackgroundMusic().

Referenced by SwitchBackgroundMusicTo().

void play_sample_using_WAV_cache ( char *  SoundSampleFileName,
int  With_Waiting,
int  no_double_catching 
)

void play_sample_using_WAV_cache_v ( char *  SoundSampleFileName,
int  With_Waiting,
int  no_double_catching,
double  volume 
)

void PlayOnceNeededSoundSample ( const char *  SoundSampleFileName,
const int  With_Waiting,
const int  no_double_catching 
)

void remove_all_samples_from_WAV_cache ( void   ) 

When the sound sample volume is changed via the in-game controls, we need to re-sample everything, which is done only upon loading of the sound samples. Instead of RE-MIXING SOUND SAMPLES AGAIN AND AGAIN to adapt the sound sample volume to the users needs, we will just clear out the current wav file cache, so that when needed again, the sound files will be loaded again and then automatically re-sampled to proper volume from the play/load function itself. Perfect solution.

Definition at line 872 of file sound.c.

References DebugPrintf(), dynamic_WAV_cache, i, next_free_position_in_cache, and sound_names_in_dynamic_wav_chache.

Referenced by SetSoundFXVolume().

void SetBGMusicVolume ( float  NewVolume  ) 

Definition at line 197 of file sound.c.

References sound_on.

Referenced by Sound_handle().

void SetSoundFXVolume ( float  NewVolume  ) 

Definition at line 204 of file sound.c.

References remove_all_samples_from_WAV_cache(), and sound_on.

Referenced by InitFreedroid(), and Sound_handle().

void SwitchBackgroundMusicTo ( char *  filename_raw_parameter  ) 


Variable Documentation

int BackgroundMusicStateMachineState = NOTHING_PLAYING_AT_ALL

Definition at line 93 of file sound.c.

Referenced by SwitchBackgroundMusicTo().

Mix_Chunk* dynamic_WAV_cache[MAX_SOUNDS_IN_DYNAMIC_WAV_CACHE]

This file contains sound related functions ============================================ DUMMYS ============================================ ============================================ GLOBALS ============================================

Definition at line 72 of file sound.c.

Referenced by play_sample_using_WAV_cache_v(), and remove_all_samples_from_WAV_cache().

int i

Definition at line 102 of file sound.c.

Referenced by action_change_map_label_user(), action_change_obstacle_label(), action_change_obstacle_label_user(), action_create_obstacle(), action_redo(), action_remove_obstacle(), action_toggle_waypoint(), action_toggle_waypoint_connection(), action_toggle_waypoint_connection_user(), action_undo(), activate_nth_aquired_skill(), adapt_button_positions_to_screen_resolution(), animate_blasts(), AnimateRefresh(), AnimateTeleports(), AssembleCombatPicture(), AssembleItemListForTradeCharacter(), AssemblePointerListForChestShow(), AssemblePointerListForItemShow(), automap_update_texture_for_square(), blit_all_item_slots(), blit_classic_SDL_light_radius(), blit_mouse_cursor_corona(), blit_nonpreput_objects_according_to_blitting_list(), blit_our_own_mouse_cursor(), blit_preput_objects_according_to_blitting_list(), calculate_light_strength(), ChatDoMenuSelection(), ChatDoMenuSelectionFlagged(), ChatWithFriendlyDroid(), Cheatmenu(), check_bullet_bullet_collisions(), check_for_barrels_to_smash(), check_for_cheat_keys(), CheckBlastCollisions(), CheckForTriggeredEventsAndStatements(), CheckWaypointIntegrity(), clear_active_spells(), clear_all_loaded_tux_images(), clear_out_all_events_and_actions(), clear_out_arrays_for_fresh_game(), clear_out_intermediate_points(), clear_player_inventory_and_stats(), ClearEnemys(), ClickedMenuItemPosition(), close_all_chests_on_level(), closed_chest_below_mouse_cursor(), CollectAutomapData(), count(), CountItemtypeInInventory(), create_new_obstacle_on_level(), CreateNewMapLevel(), CursorIsOnWhichSpellPageButton(), CutDownStringToMaximalSize(), decode_obstacle_descriptions_of_this_level(), decode_obstacle_names_of_this_level(), decode_obstacles_of_this_level(), DecodeChestItemSectionOfThisLevel(), DecodeItemSectionOfThisLevel(), DecodeLoadedLeveldata(), DecodeMapLabelsOfThisLevel(), DecodeStatementsOfThisLevel(), delete_all_obstacles_in_area(), DeleteCookie(), DeleteInventoryItemsOfType(), DeleteOneInventoryItemsOfType(), DeleteWaypoint(), DirectLineLightable(), DirectLineWalkable(), DisplayBigScreenMessage(), DoChatFromChatRosterData(), DoEquippmentListSelection(), DoLevelEditorMainMenu(), DoMeleeDamage(), DoMenuSelection(), DoSkill(), draw_connection_between_tiles(), DropHeldItemToInventory(), DropItemAt(), DropItemToTheFloor(), duplicate_all_obstacles_in_area(), eliminate_dead_obstacle_descriptions(), encode_obstacle_descriptions_of_this_level(), encode_obstacle_names_of_this_level(), encode_obstacles_of_this_level(), EncodeChestItemSectionOfThisLevel(), EncodeItemSectionOfThisLevel(), EncodeLevelForSaving(), EncodeMapLabelsOfThisLevel(), EncodeStatementsOfThisLevel(), endian_swap(), enemy_get_current_walk_target(), enemy_resolve_address(), establish_skill_subset_map(), exchange(), ExecuteChatExtra(), ExecuteEvent(), fade_in_using_gamma_ramp(), fade_out_using_gamma_ramp(), find_file(), find_free_floor_items_index(), find_suitable_bonus_for_item(), FindFirstInventoryIndexWithItemType(), FireTuxRangedWeaponRaw(), floor_copy(), flush_background_image_cache(), FreeOurBFonts(), Get_Bullet_Data(), get_floor_item_index_under_mouse_cursor(), Get_New_Character_Name(), Get_Prefixes_Data(), get_program_index_with_name(), get_random_item_type(), Get_Robot_Data(), GetAllAnimatedMapTiles(), GetEditableStringInPopupWindow(), GetHeldItemPointer(), GetInventoryItemAt(), GetObstacleBelowMouseCursor(), GetTakeoverGraphics(), give_level_of_obstacle_with_label(), give_new_description_to_obstacle(), give_pointer_to_obstacle_with_label(), GiveNumberToThisActionLabel(), GreatShopInterface(), HandleBannerMouseClick(), HandleInventoryScreen(), init_character_descriptions(), init_obstacle_data(), init_system_cursor(), InitChatRosterForNewDialogue(), InitFont(), InitHarmlessTuxStatusVariables(), InitInfluencerChatFlags(), InitInfluencerStartupSkills(), InitOurBFonts(), InitTradeWithCharacter(), insert_blasts_into_blitting_list(), insert_bullets_into_blitting_list(), insert_enemies_into_blitting_list(), insert_new_element_into_blitting_list(), insert_obstacles_into_blitting_list(), insert_thrown_items_into_blitting_list(), InsertColumnEasternInterface(), InsertColumnVeryEast(), InsertLineSouthernInterface(), InsertLineVerySouth(), Inv_Pos_Is_Free(), iso_load_bullet_surfaces(), iso_put_tux_part(), item_slot_position_blocked(), ItemDropFromLevelEditor(), Language_fill(), LevelEditor(), load_all_obstacles(), Load_Enemy_Surfaces(), load_floor_tiles(), Load_Skill_Level_Button_Surfaces(), LoadAndPrepareBlueEnemyRotationModelNr(), LoadAndPrepareEnemyRotationModelNr(), LoadAndPrepareGreenEnemyRotationModelNr(), LoadAndPrepareRedEnemyRotationModelNr(), LoadChatRosterWithChatSequence(), LoadGame(), LoadShip(), make_sure_chat_portraits_loaded_for_this_droid(), MakeHeldFloorItemOutOf(), move_all_items_in_area(), move_obstacles_and_items_south_of(), move_obstacles_east_of(), move_this_bullet_and_check_its_collisions(), move_tux(), move_tux_out_of_obstacles_on_square(), move_tux_thowards_intermediate_point(), MoveActiveSpells(), MoveAwayFromMeleeCombat(), MoveBullets(), MoveEnemys(), MoveLevelDoors(), MoveMapLabelsEastOf(), MoveMapLabelsSouthOf(), MoveThisRobotThowardsHisCurrentTarget(), MoveWaypointsEastOf(), MoveWaypointsSouthOf(), mystrnlen(), PlantCookie(), play_sample_using_WAV_cache_v(), PlayOnceNeededSoundSample(), PrepareStartOfNewCharacter(), printf_SDL(), ProcessThisChatOption(), PurifyWaypointList(), push_or_pop_chat_roster(), PutMiscellaneousSpellEffects(), PutRadialBlueSparks(), PutRadialBlueSparksBestQuality(), PutStringFont(), quickbar_additem(), quickbar_getentry(), read_automap_data_t_array(), read_bigscrmsg_t_array(), read_chatflags_t_array(), read_cookielist_t_array(), recursive_find_walkable_point(), remove_all_samples_from_WAV_cache(), remove_blood_obstacles_for_respawning(), RemoveColumnEasternInterface(), RemoveLineSouthernInterface(), Repair_Items(), ResetGameConfigToDefaultValues(), ResolveMapLabelOnLevel(), ResolveMapLabelOnShip(), ReviveAllDroidsOnShip(), rotozoomSurface(), RunSubMenu(), save_automap_data(), save_bigscrmsg_t_array(), save_chatflags_t_array(), save_cookielist_t_array(), SaveGame(), SaveShip(), set_new_waypointless_walk_target(), set_up_intermediate_course_between_positions(), SetNewBigScreenMessage(), SetNewRandomWaypoint(), Show_Mission_Log_Menu(), show_obstacle_labels(), ShowCombatScreenTexts(), ShowCurrentTextWindow(), ShowDroidPicture(), ShowInventoryScreen(), ShowItemPicture(), ShowLevelEditorTopMenu(), ShowPlayground(), ShowQuickInventory(), ShowSkillsScreen(), ShowWaypoints(), ShuffleEnemys(), silently_unhold_all_items(), smash_obstacles_only_on_tile(), smashable_barrel_below_mouse_cursor(), start_tux_death_explosions(), StartBlast(), Teleport(), teleporter_square_below_mouse_cursor(), TeleportToClosestWaypoint(), TextConditionIsTrue(), TextWidthFont(), throw_out_all_chest_content(), tile_is_free(), TryToIntegrateItemIntoInventory(), TryToPutItem(), TuxReloadWeapon(), update_all_primary_stats(), update_item_text_slot_positions(), update_light_list(), UpdateCountersForThisFrame(), WorkLevelGuns(), and zoomSurface().

Mix_Chunk* List_Of_Sustained_Release_WAV_Files[MAX_SOUND_CHANNELS]

Definition at line 79 of file sound.c.

Referenced by channelDone(), and PlayOnceNeededSoundSample().

Mix_Music* Loaded_MOD_Files[ALL_MOD_MUSICS]

Initial value:

    {
        NULL
    }

Definition at line 80 of file sound.c.

Referenced by LoadAndFadeInBackgroundMusic().

char* MOD_Music_SampleFilenames[ALL_MOD_MUSICS]

Initial value:

 {
            "ERRORSOUND_NILL.NOMOD"
        }

Definition at line 74 of file sound.c.

Definition at line 94 of file sound.c.

Referenced by LoadAndFadeInBackgroundMusic(), and SwitchBackgroundMusicTo().

int next_free_position_in_cache = 0 [static]

Definition at line 98 of file sound.c.

Referenced by play_sample_using_WAV_cache_v(), and remove_all_samples_from_WAV_cache().

unsigned char* ptr

Definition at line 103 of file sound.c.

Referenced by grab_enemy_images_from_archive(), and grab_tux_images_from_archive().

Definition at line 105 of file sound.c.

char* sound_names_in_dynamic_wav_chache[MAX_SOUNDS_IN_DYNAMIC_WAV_CACHE]

Definition at line 73 of file sound.c.

Referenced by play_sample_using_WAV_cache_v(), and remove_all_samples_from_WAV_cache().

char SoundChannelList[MAX_SOUND_CHANNELS]

Definition at line 77 of file sound.c.

Referenced by channelDone(), and PlayOnceNeededSoundSample().

unsigned char v = 128

Definition at line 104 of file sound.c.


Generated on Mon Apr 28 21:58:00 2008 for FreedroidRPG by  doxygen 1.5.5