From nobody Mon May 05 18:55:15 2025 X-Original-To: freebsd-multimedia@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4ZrrLv6w8Zz5tg18 for ; Mon, 05 May 2025 18:55:19 +0000 (UTC) (envelope-from christos@freebsd.org) Received: from margiolis.net (mail.margiolis.net [95.179.159.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ZrrLt5zhxz46DN for ; Mon, 05 May 2025 18:55:18 +0000 (UTC) (envelope-from christos@freebsd.org) Authentication-Results: mx1.freebsd.org; dkim=pass header.d=margiolis.net header.s=default header.b=hFqv6boq; spf=softfail (mx1.freebsd.org: 95.179.159.8 is neither permitted nor denied by domain of christos@freebsd.org) smtp.mailfrom=christos@freebsd.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=freebsd.org (policy=none) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=default; bh=XqBFpKGXRu9Z H4ihbUilFIxbV1UEquXFJk1jBXddIM8=; h=in-reply-to:references:subject:cc: to:from:date; d=margiolis.net; b=hFqv6boqBklPgw/rJXCK1BgEuFGrSTkFMFvpd SMJPKAdC9zk4xR+X0yk3lozQAq2GZePWhwdY4QASe2vO+x6dSYDQQiggqvggSe20jPdHBV Rv5FUEVSWxUFjAFtqCOHcZcURt1qia1mekxvxQ8DWiKayk3Qd/vGuCNufishC8M4= Received: from pleb (public-gprs243542.centertel.pl [31.60.98.151]) by margiolis.net (OpenSMTPD) with ESMTPSA id a6b445ef (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 5 May 2025 12:55:16 -0600 (MDT) Date: Mon, 5 May 2025 20:55:15 +0200 From: Christos Margiolis To: Goran =?utf-8?B?TWVracSH?= Cc: freebsd-multimedia@freebsd.org Subject: Re: Memory mapped OSS device Message-ID: References: List-Id: Multimedia discussions List-Archive: https://lists.freebsd.org/archives/freebsd-multimedia List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-multimedia@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 4ZrrLt5zhxz46DN X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.67 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.99)[-0.994]; NEURAL_HAM_MEDIUM(-0.97)[-0.972]; MID_RHS_NOT_FQDN(0.50)[]; R_DKIM_ALLOW(-0.20)[margiolis.net:s=default]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : No valid SPF, DKIM not aligned (relaxed),none]; TO_DN_SOME(0.00)[]; MISSING_XM_UA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:20473, ipnet:95.179.144.0/20, country:US]; RCVD_COUNT_ONE(0.00)[1]; FREEFALL_USER(0.00)[christos]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; MLMMJ_DEST(0.00)[freebsd-multimedia@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[margiolis.net:+] Hello again Meka, Goran Mekić wrote: > Hello, > > I am trying to learn about mmap mode of OSS and so far I have this: https://github.com/mekanix/freebsd-src/blob/audio-mmap/share/examples/sound/oss/audio.c. > So the device is initialized properly and my code doesn't break trying to > write something past the length of the buffer, but I do get strange sound. I > am using http://manuals.opensound.com/developer/mmap_test.c.html as > reference and the difference that I implemented is that I'm trying to > "guess" how long I have to sleep so that when I wake up (and maybe wait a > little bit more), I can write the whole buffer. If anybody knows what I'm > doing wrong here, please help me. Pulseaudio seems to be doing mmap, so you could get some inspiration from there as well: https://github.com/pulseaudio/pulseaudio/tree/master/src/modules/oss Christos