On 2020-01-22, R.Wieser wrote:
> Jim,
>
>> Whether you compile using geany or whatever or from the command line
>> (as I did) doesn't make any difference.
>
>:-) I gave that reference so you would know what I'm using, and maybe know
> thats something works different.
>
> In your case your compiler must have automatically zeroed that "dir" var
> out, or you where incredibly lucky, and that multiple times. Guess what I
> think.
No. The value of dir is set by the function - that's why you pass it the
address of dir. It's returned value for the function
"snd_pcm_hw_params_set_rate_near" is
int dir; /* exact_rate == rate --> dir = 0 */
/* exact_rate dir = -1 */
/* exact_rate > rate --> dir = 1 */
according to some code I found on git hub.
> In other words: your setup is different than mine.
>
>>I copied the example program you referenced. Compiled it and ran
>
> Are those numbers for both the origional as well as the 8000 bitrate ?
I haven't edited the sample code you referenced - so 44100
>
>> But the program compiled just fine.
>
> It compiled just fine here too. The problems only became appearant when
> running it, with the above mentioned uninitialized "dir" variable being the
> first one.
How did that show itself?
>> Whether you compile using geany or whatever or from the command
>> line (as I did) doesn't make any difference.
>
> Nope. As long as the same arguments are used ofcourse. But I wondered if
> my, or rather Geany's calling of gcc missed a "clear declared variables"
> flag (which is why I specifically mentioned what I was using, and how).
gcc -c simple_alsa_play.c
gcc -o simple_alsa_play simple_alsa_play.o -lasound
gcc 4.6.3 - yeah it's an old version.
Jim
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|