TIP: Click on subject to list as thread! ANSI
echo: rberrypi
to: R.WIESER
from: JIM JACKSON
date: 2020-01-22 22:51:00
subject: Re: Rephrasing my ALSA qu

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)

SOURCE: echomail via QWK@docsplace.org

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.