Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Patch for ARM jackd2 on Ubuntu 14.04
Fixing jack audio on ARM Ubuntu 14.04
Install prerequisite packages:
$ sudo apt-get build-dep jackd2
Install the source package:
$ apt-get source jackd2
Downloads the source into the current directory and applies the Ubuntu
patches on top of the upstream version.
Build the vanilla package without any changes.
(-us -uc just means you won't be signing the packages)
$ cd jackd2-1.9.9.5+20130622git7de15e7a
$ dpkg-buildpackage -us -uc
Created a patch based on this change: https://github.com/jackaudio/jack2/commit/d425d8035b761b4a362c538c41eca874ff4995f0?diff=unified
Get jackd2.patch here: https://gist.github.com/rogerallen/0346a1812deda2a380da
$ patch -p1 < jackd2.patch
Rebuild after patching
$ ./waf-light build
$ sudo ./waf-light install
$ sudo ldconfig
Add yourself to the audio group for realtime scheduling
$ sudo adduser <yourUserid> audio
Allow audio group realtime priority
$ sudo vi /etc/security/limits.conf
@audio - rtprio 99
@audio - memlock 250000
@audio - nice -10
[Reboot]
Start jackd
$ jackd -dalsa -dhw:1,0 -p256 -n3 -s &
Try out jack. You should hear 2 different sine wave tones. A higher
pitch on the right side.
$ jack_simple_client
--- linux/JackLinuxTime.c 2014-10-11 08:11:45.296952544 -0700
+++ linux/JackLinuxTime.c 2014-10-11 08:15:24.636952491 -0700
@@ -38,7 +38,6 @@
#include <stdlib.h>
#include <inttypes.h>
-static jack_time_t __jack_cpu_mhz = 0;
jack_time_t (*_jack_get_microseconds)(void) = 0;
#if defined(__gnu_linux__) && (defined(__i386__) || defined(__x86_64__))
@@ -124,61 +123,6 @@
#endif /* HPET_SUPPORT */
-static jack_time_t jack_get_microseconds_from_cycles (void) {
- return get_cycles() / __jack_cpu_mhz;
-}
-
-/*
- * This is another kludge. It looks CPU-dependent, but actually it
- * reflects the lack of standards for the Linux kernel formatting of
- * /proc/cpuinfo.
- */
-
-static jack_time_t jack_get_mhz (void)
-{
- FILE *f = fopen("/proc/cpuinfo", "r");
- if (f == 0)
- {
- perror("can't open /proc/cpuinfo\n");
- exit(1); // TODO : should be remplaced by an exception
- }
-
- for (;;)
- {
- jack_time_t mhz;
- int ret;
- char buf[1000];
-
- if (fgets(buf, sizeof(buf), f) == NULL) {
- jack_error ("FATAL: cannot locate cpu MHz in /proc/cpuinfo\n");
- exit(1); // TODO : should be remplaced by an exception
- }
-
-#if defined(__powerpc__)
- ret = sscanf(buf, "clock\t: %" SCNu64 "MHz", &mhz);
-#elif defined( __i386__ ) || defined (__hppa__) || defined (__ia64__) || \
- defined(__x86_64__)
- ret = sscanf(buf, "cpu MHz : %" SCNu64, &mhz);
-#elif defined( __sparc__ )
- ret = sscanf(buf, "Cpu0Bogo : %" SCNu64, &mhz);
-#elif defined( __mc68000__ )
- ret = sscanf(buf, "Clocking: %" SCNu64, &mhz);
-#elif defined( __s390__ )
- ret = sscanf(buf, "bogomips per cpu: %" SCNu64, &mhz);
-#elif defined( __sh__ )
- ret = sscanf(buf, "bogomips : %" SCNu64, &mhz);
-#else /* MIPS, ARM, alpha */
- ret = sscanf(buf, "BogoMIPS : %" SCNu64, &mhz);
-#endif
-
- if (ret == 1)
- {
- fclose(f);
- return (jack_time_t)mhz;
- }
- }
-}
-
#define HAVE_CLOCK_GETTIME 1
#ifndef HAVE_CLOCK_GETTIME
@@ -216,7 +160,7 @@
SERVER_EXPORT void InitTime()
{
- __jack_cpu_mhz = jack_get_mhz ();
+ /* nothing to do on a generic system - we use the system clock */
}
SERVER_EXPORT void EndTime()
@@ -228,10 +172,6 @@
switch (source)
{
- case JACK_TIMER_CYCLE_COUNTER:
- _jack_get_microseconds = jack_get_microseconds_from_cycles;
- break;
-
case JACK_TIMER_HPET:
if (jack_hpet_init () == 0) {
_jack_get_microseconds = jack_get_microseconds_from_hpet;
@@ -250,8 +190,6 @@
const char* ClockSourceName(jack_timer_type_t source)
{
switch (source) {
- case JACK_TIMER_CYCLE_COUNTER:
- return "cycle counter";
case JACK_TIMER_HPET:
return "hpet";
case JACK_TIMER_SYSTEM_CLOCK:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment