This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
au: add util function calc_nsamp() (#42)
- Loading branch information
Showing
4 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
# Copyright (C) 2010 Creytiv.com | ||
# | ||
|
||
SRCS += au/fmt.c | ||
SRCS += au/fmt.c au/util.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/** | ||
* @file util.c Audio utility functions | ||
* | ||
* Copyright (C) 2022 Commend.com - [email protected] | ||
*/ | ||
|
||
#include <re.h> | ||
#include <rem_au.h> | ||
|
||
|
||
/** | ||
* Calculate number of samples from sample rate, channels and packet time | ||
* | ||
* @param srate Sample rate in [Hz] | ||
* @param channels Number of channels | ||
* @param ptime Packet time in [ms] | ||
* | ||
* @return Number of samples | ||
*/ | ||
uint32_t calc_nsamp(uint32_t srate, uint8_t channels, uint16_t ptime) | ||
{ | ||
return srate * channels * ptime / 1000; | ||
} |