00001 /* 00002 $Id: sound.h,v 1.1 2001/03/06 15:09:12 mbn Exp $ 00003 00004 ------------------------------------------------------------------------ 00005 ClanLib, the platform independent game SDK. 00006 00007 This library is distributed under the GNU LIBRARY GENERAL PUBLIC LICENSE 00008 version 2. See COPYING for details. 00009 00010 For a total list of contributers see CREDITS. 00011 00012 ------------------------------------------------------------------------ 00013 */ 00014 00016 00017 #ifndef header_sound 00018 #define header_sound 00019 00020 #include <vector> 00021 #include <stdlib.h> 00022 #include "soundbuffer.h" 00023 00024 class CL_SoundCard 00025 //: Soundcard interface in ClanLib. 00026 // CL_SoundCard is the interface to a soundcard. It is used to control the 00027 // main mixer volume and other global settings. It also provides access to 00028 // the microphone and line in as streamed soundproviders. 00029 { 00030 public: 00031 std::string name; 00032 //: Name of the soundcard. 00033 00034 int card_no; 00035 //: Card number. 00036 00037 virtual ~CL_SoundCard() { ; } 00038 00039 virtual CL_StreamSoundProvider *get_microphone()=0; 00040 //: Returns the streamed soundprovider representing the microphone. 00041 00042 virtual CL_StreamSoundProvider *get_line_in()=0; 00043 //: Returns the streamed soundprovider representing the line in. 00044 00045 virtual void stop_all()=0; 00046 //: Stops all sample playbacks on the soundcard. 00047 00048 virtual void set_global_volume(int volume)=0; 00049 //: Sets the main/mixer volume on the soundcard. 00050 00051 virtual void set_global_pan(int pan)=0; 00052 //: Sets the main panning position on the soundcard. 00053 }; 00054 00055 class CL_Sound 00056 //: Sound interface in ClanLib. 00057 // This class provides a list of all soundcards available on the system. It 00058 // is also a wrapper class for the CL_SoundCard class, providing an easier 00059 // access to a single selected soundcard. 00060 // <br> 00061 // All the functions that share name with those in CL_SoundCard have the 00062 // same functionality. The only difference is, that the ones CL_Sound 00063 // operate on a selected soundcard. This saves the trouble of passing around 00064 // a pointer to the soundcard, when only a single one is used anyway. 00067 { 00068 public: 00069 virtual ~CL_Sound() { ; } 00070 00071 static std::vector<CL_SoundCard*> cards; 00072 //: The list of soundcards available on this system. 00073 00074 static std::list<CL_SoundCard*> preload_cards; 00075 //: List of all cards where soundbuffers are automatically preloaded. 00076 00077 static CL_StreamSoundProvider *get_microphone(); 00078 //: Returns the streamed soundprovider representing the microphone. 00080 00081 static CL_StreamSoundProvider *get_line_in(); 00082 //: Returns the streamed soundprovider representing the line in. 00084 00085 static void clear_card_preload(); 00086 //: Clears the list of preloaded soundcards. 00087 00088 static void add_card_preload(CL_SoundCard *card); 00089 //: Adds 'card' to the preloaded soundcards list. This means all soundbuffers 00090 //: will be automatically preloaded onto the card. By default the first card 00091 //: is always on the preload list. 00092 //: <br> 00093 //: If a card isn't on the list, the soundbuffer's data will first be loaded when 00094 //: the sample is actually played for the first time. 00096 00097 static void remove_card_preload(CL_SoundCard *card); 00098 //: Removes the specified card from the preload list. 00100 00101 static void select_card(CL_SoundCard *card); 00102 //: Change the current selected soundcard to 'card'. 00104 00105 static void select_card(int card_no); 00106 //: Change the current selected soundcard to soundcard number 'card_no'. 00108 00109 static CL_SoundCard *get_current_card(); 00110 //: Returns the current selected soundcard. 00112 }; 00113 00114 #endif
1.2.6 written by Dimitri van Heesch,
© 1997-2001