Changeset 2375:7f8c3646bbc3 in roaraudio
- Timestamp:
- 08/16/09 01:53:15 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarsndio/stream.c
r2358 r2375 34 34 #include "libroarsndio.h" 35 35 36 // this is void because we do not care about if this failed... 37 static void send_vol_event (struct sio_hdl * hdl) { 38 int channels; 39 struct roar_mixer_settings mixer; 40 int i; 41 unsigned vol; 42 43 // in case of no event handler we do not send the event at all ;) 44 if ( hdl->on_vol == NULL ) 45 return; 46 47 if ( roar_get_vol(&(hdl->con), roar_stream_get_id(&(hdl->stream)), &mixer, &channels) == -1 ) 48 return; 49 50 ROAR_DBG("send_vol_event(*): channels=%i", channels); 51 52 switch (channels) { 53 case 1: 54 ROAR_DBG("send_vol_event(*): mixer.scale=%i, mixer.mixer={%i,...}", mixer.scale, mixer.mixer[0]); 55 vol = mixer.mixer[0] * SIO_MAXVOL; 56 vol /= mixer.scale; 57 ROAR_DBG("send_vol_event(*): vol=%u", vol); 58 break; 59 case 2: 60 vol = (mixer.mixer[0] + mixer.mixer[1]) * SIO_MAXVOL / mixer.scale / 2; 61 break; 62 default: 63 vol = 0; 64 for (i = 0; i < channels; i++) 65 vol += mixer.mixer[i]; 66 67 vol /= channels; 68 vol *= SIO_MAXVOL; 69 vol /= mixer.scale; 70 break; 71 } 72 73 ROAR_DBG("send_vol_event(*): vol=%u", vol); 74 hdl->on_vol(hdl->on_vol_arg, vol); 75 } 76 36 77 #define _i(x) (hdl->info.x) 37 78 int sio_start (struct sio_hdl * hdl) { … … 58 99 return 0; 59 100 } 101 102 send_vol_event(hdl); 60 103 #else 61 104 if ( roar_stream_new_by_id(&(hdl->stream), -1) == -1 ) … … 65 108 return 0; 66 109 } 110 111 // FIXME: this does not work in this case 112 //send_vol_event(hdl); 67 113 #endif 68 114
Note: See TracChangeset
for help on using the changeset viewer.