Changeset 4364:7c2f27407e46 in roaraudio


Ignore:
Timestamp:
09/14/10 17:52:15 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

wrote dstr mixer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/hwmixer_dstr.c

    r4362 r4364  
    2626#include "roard.h" 
    2727 
    28 int hwmixer_dstr_open(struct hwmixer_stream * stream, char * drv, char * dev, int fh, char * basename, struct roar_keyval * subnames, size_t subnamelen); 
    29 int hwmixer_dstr_close(struct hwmixer_stream * stream); 
    30 int hwmixer_dstr_set_vol(struct hwmixer_stream * stream, int channels, int mode, struct roar_mixer_settings * settings); 
     28int hwmixer_dstr_open(struct hwmixer_stream * stream, char * drv, char * dev, int fh, char * basename, struct roar_keyval * subnames, size_t subnamelen) { 
     29 struct roar_vio_calls * vio = roar_mm_malloc(sizeof(struct roar_vio_calls)); 
     30 struct roar_vio_defaults def; 
     31 struct roar_stream_server * ss; 
     32 
     33 if ( vio == NULL ) 
     34  return -1; 
     35 
     36 if ( fh == -1 ) { 
     37  if ( dev == NULL ) { 
     38   roar_mm_free(vio); 
     39   return -1; 
     40  } 
     41 
     42  if ( roar_vio_dstr_init_defaults(&def, ROAR_VIO_DEF_TYPE_NONE, O_WRONLY|O_CREAT|O_TRUNC, 0644) == -1 ) { 
     43   roar_mm_free(vio); 
     44   return -1; 
     45  } 
     46 
     47  if ( roar_vio_open_dstr(vio, dev, &def, 1) == -1 ) { 
     48   roar_mm_free(vio); 
     49   return -1; 
     50  } 
     51 } else { 
     52  if ( roar_vio_open_fh(vio, fh) == -1 ) { 
     53   roar_mm_free(vio); 
     54   return -1; 
     55  } 
     56 } 
     57 
     58 stream->baseud = vio; 
     59 
     60 roar_vio_printf(vio, "No data yet.\n"); 
     61 roar_vio_lseek(vio, 0, SEEK_SET); 
     62 roar_vio_sync(vio); 
     63 
     64 if (streams_get(stream->basestream, &ss) != -1) { 
     65  ROAR_STREAM(ss)->info.channels = 2; 
     66 } else { 
     67  ROAR_WARN("hwmixer_dstr_open(*): can not get object for basestream %i", stream->basestream); 
     68 } 
     69 
     70 return 0; 
     71} 
     72 
     73int hwmixer_dstr_close(struct hwmixer_stream * stream) { 
     74 roar_vio_close(stream->baseud); 
     75 roar_mm_free(stream->baseud); 
     76 return 0; 
     77} 
     78 
     79int hwmixer_dstr_set_vol(struct hwmixer_stream * stream, int channels, int mode, struct roar_mixer_settings * settings) { 
     80 struct roar_vio_calls * vio = stream->baseud; 
     81 int i; 
     82 
     83 roar_vio_printf(vio, "[Stream %i of basestream %i]\n", stream->stream, stream->basestream); 
     84 roar_vio_printf(vio, "Channels: %i\n", channels); 
     85 roar_vio_printf(vio, "Mode: %i\n", mode); 
     86 roar_vio_printf(vio, "Scale: %i\n", (int)settings->scale); 
     87 roar_vio_printf(vio, "RPG: %i/%i\n", (int)settings->rpg_mul, (int)settings->rpg_div); 
     88 
     89 for (i = 0; i < channels; i++) { 
     90  roar_vio_printf(vio, "Channel[%i]: %i\n", i, (int)settings->mixer[i]); 
     91 } 
     92 
     93 roar_vio_lseek(vio, 0, SEEK_SET); 
     94 roar_vio_sync(vio); 
     95 return 0; 
     96} 
    3197 
    3298//ll 
Note: See TracChangeset for help on using the changeset viewer.