View Ticket
Not logged in
Ticket Hash: 3614f028850dd259ade71e79a01328331d369a63
Title: Snack package seems broken
Status: Closed Type: Code_Defect
Severity: Minor Priority: Low
Subsystem: Resolution: Open
Last Modified: 2023-06-18 09:39:53
Version Found In: 2.2
User Comments:
anonymous added on 2019-02-23 19:52:23:
To replicate one problem (with vanillawish), on an AMD64 Linux, or the Raspberry Pi 3 with a USB sound card:

$ vanillawish
% package require snack
2.2
% sound s
s
% s record ; # record a few seconds of sound
% s stop
% s length
88530
% s play -blocking 1
(hangs)

Not using '-blocking 1' allows playing the sound, ... some times. To make it play it almost every time one has to re-issue stop and play commands:

% s play ; # wait for the sound to play
% s play ; # ... ? no more ?
% s play ; # ... nothing
% s stop
% s stop
% s play ; # (most times) plays the sound

Another problem with vanillatclsh on the AMD:

$ vanillatclsh
% package require sound
2.2
% sound s
s
% s record ; # record some seconds of sound
% s stop
% s length
0            ;# <--- no sound recorded.
% s play ; # nothing

Turning on the event loop with:

% after 100 {vwait ::forever}

doesn't seem to make a difference.

There are other problems with the sound not fully playing _all the times_, although it exists in full in the buffer.

I've downloaded ActiveState's complete TCL release, where they include a binary (no source code) of snack, and I have not been able to replicate the above problems so far. It seems difficult to be sure, because the problems do not occur all the time. I have not found what source code ActiveState has used to compile snack, to make a comparison.

dzach

chw added on 2019-10-11 18:53:49:
I'm closing this ticket for now. Should you have new info, let's re-open it again then.

dzach added on 2023-06-17 18:35:31:

Hi Chris
After about 4 years, I found a version of snack 2.2.11 that appears to run without problems or need for a hack.
It needs a patched jkAudIO_alsa.c that comes in a zip file submitted by PaulObermeier to scottypitcher's repository, here: jkAudIO_alsa.c
Together with sudo apt install alsa-utils libasound2-dev which may be necessary, and ./configure --enable-alsa,
I now have a snack that works on Kubuntu 22.04 and the Raspbery Pi.


chw added on 2023-06-17 19:15:44:
Comparing the patched file from your comment against
the one contained in this repo does not show any
technical difference. Chances are that I've added
it already many months ago.

dzach added on 2023-06-18 08:43:47:

Well, either using CONST84 char * instead of const char * makes a difference with pre 8.6 code [*],
or there is something else that fixes things when I compile a patched Snack independently,
outside the undroidwish tree on my machines. Could it be SDL related?

[*] I found this comment by AK buried deep in the TCL wiki:
adapting C source code to deal with the CONST-ified interfaces of Tcl/Tk 8.4


chw added on 2023-06-18 09:39:53:
The const'ness is related to traces for e.g. volume control
and not related to the signal path. Thus, I bet it's something
else.