|
Lines 441-446
Link Here
|
| 441 |
|
441 |
|
| 442 |
#include <sound/pcm_params.h> |
442 |
#include <sound/pcm_params.h> |
| 443 |
|
443 |
|
|
|
444 |
#ifndef FOUND_SND_PCM_HW_PARAM_SET |
| 445 |
static int snd_interval_refine_set(struct snd_interval *i, unsigned int val) |
| 446 |
{ |
| 447 |
struct snd_interval t; |
| 448 |
t.empty = 0; |
| 449 |
t.min = t.max = val; |
| 450 |
t.openmin = t.openmax = 0; |
| 451 |
t.integer = 1; |
| 452 |
return snd_interval_refine(i, &t); |
| 453 |
} |
| 454 |
|
| 455 |
static int _snd_pcm_hw_param_set(struct snd_pcm_hw_params *params, |
| 456 |
snd_pcm_hw_param_t var, unsigned int val, |
| 457 |
int dir) |
| 458 |
{ |
| 459 |
int changed; |
| 460 |
if (hw_is_mask(var)) { |
| 461 |
struct snd_mask *m = hw_param_mask(params, var); |
| 462 |
if (val == 0 && dir < 0) { |
| 463 |
changed = -EINVAL; |
| 464 |
snd_mask_none(m); |
| 465 |
} else { |
| 466 |
if (dir > 0) |
| 467 |
val++; |
| 468 |
else if (dir < 0) |
| 469 |
val--; |
| 470 |
changed = snd_mask_refine_set(hw_param_mask(params, var), val); |
| 471 |
} |
| 472 |
} else if (hw_is_interval(var)) { |
| 473 |
struct snd_interval *i = hw_param_interval(params, var); |
| 474 |
if (val == 0 && dir < 0) { |
| 475 |
changed = -EINVAL; |
| 476 |
snd_interval_none(i); |
| 477 |
} else if (dir == 0) |
| 478 |
changed = snd_interval_refine_set(i, val); |
| 479 |
else { |
| 480 |
struct snd_interval t; |
| 481 |
t.openmin = 1; |
| 482 |
t.openmax = 1; |
| 483 |
t.empty = 0; |
| 484 |
t.integer = 0; |
| 485 |
if (dir < 0) { |
| 486 |
t.min = val - 1; |
| 487 |
t.max = val; |
| 488 |
} else { |
| 489 |
t.min = val; |
| 490 |
t.max = val+1; |
| 491 |
} |
| 492 |
changed = snd_interval_refine(i, &t); |
| 493 |
} |
| 494 |
} else |
| 495 |
return -EINVAL; |
| 496 |
if (changed) { |
| 497 |
params->cmask |= 1 << var; |
| 498 |
params->rmask |= 1 << var; |
| 499 |
} |
| 500 |
return changed; |
| 501 |
} |
| 502 |
#endif /* !FOUND_SND_PCM_HW_PARAM_SET */ |
| 503 |
|
| 444 |
static int cnxthsf_snd_pcm_change_params(struct snd_pcm_substream *substream, int hw_param_buffer_bytes) |
504 |
static int cnxthsf_snd_pcm_change_params(struct snd_pcm_substream *substream, int hw_param_buffer_bytes) |
| 445 |
{ |
505 |
{ |
| 446 |
//snd_pcm_runtime_t *runtime = substream->runtime; |
506 |
//snd_pcm_runtime_t *runtime = substream->runtime; |