/[svn]/linuxsampler/trunk/src/drivers/audio/AudioOutputDeviceAlsa.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/audio/AudioOutputDeviceAlsa.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1598 by schoenebeck, Tue Sep 4 00:02:06 2007 UTC revision 1599 by schoenebeck, Fri Dec 28 15:47:33 2007 UTC
# Line 250  namespace LinuxSampler { Line 250  namespace LinuxSampler {
250    
251      optional<int> AudioOutputDeviceAlsa::ParameterChannels::RangeMaxAsInt(std::map<String,String> Parameters) {      optional<int> AudioOutputDeviceAlsa::ParameterChannels::RangeMaxAsInt(std::map<String,String> Parameters) {
252          uint channels = 100;          uint channels = 100;
253          if (!Parameters.count("CARD")) return channels;          if (!Parameters.count("CARD")) return optional<int>::nothing;
254    
255          // obtain information from given sound card          // obtain information from given sound card
256          String pcm_name       = "hw:" + Parameters["CARD"];          String pcm_name       = "hw:" + Parameters["CARD"];
257          snd_pcm_t* pcm_handle = NULL;          snd_pcm_t* pcm_handle = NULL;
258          if (snd_pcm_open(&pcm_handle, pcm_name.c_str(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK) < 0) return channels;          if (snd_pcm_open(&pcm_handle, pcm_name.c_str(), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK) < 0)
259                return optional<int>::nothing;
260          snd_pcm_hw_params_t* hwparams;          snd_pcm_hw_params_t* hwparams;
261          snd_pcm_hw_params_alloca(&hwparams);          snd_pcm_hw_params_alloca(&hwparams);
262          if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0) {          if (snd_pcm_hw_params_any(pcm_handle, hwparams) < 0) {
263              snd_pcm_close(pcm_handle);              snd_pcm_close(pcm_handle);
264              return channels;              return optional<int>::nothing;
265          }          }
266    
267          if (snd_pcm_hw_params_get_channels_max(hwparams, &channels) < 0) {          if (snd_pcm_hw_params_get_channels_max(hwparams, &channels) < 0) {
268              snd_pcm_close(pcm_handle);              snd_pcm_close(pcm_handle);
269              return channels;              return optional<int>::nothing;
270          }          }
271          snd_pcm_close(pcm_handle);          snd_pcm_close(pcm_handle);
272          return channels;          return channels;
# Line 735  namespace LinuxSampler { Line 736  namespace LinuxSampler {
736      }      }
737    
738      String AudioOutputDeviceAlsa::Version() {      String AudioOutputDeviceAlsa::Version() {
739         String s = "$Revision: 1.24 $";         String s = "$Revision: 1.25 $";
740         return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword         return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword
741      }      }
742    

Legend:
Removed from v.1598  
changed lines
  Added in v.1599

  ViewVC Help
Powered by ViewVC