Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dos
flow3r firmware
Commits
51de2395
Commit
51de2395
authored
1 year ago
by
pippin
Browse files
Options
Downloads
Patches
Plain Diff
st3m_media: dynamically allocate pcm out buf
parent
120c21d6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/st3m/st3m_media.c
+9
-1
9 additions, 1 deletion
components/st3m/st3m_media.c
with
9 additions
and
1 deletion
components/st3m/st3m_media.c
+
9
−
1
View file @
51de2395
...
...
@@ -14,7 +14,7 @@ static st3m_media *audio_media = NULL;
// XXX should be refactored to either be temporary SPIRAM allocation
// or a static shared global pcm queuing API
//
static
int16_t
audio_buffer
[
AUDIO_BUF_SIZE
]
;
static
int16_t
*
audio_buffer
=
NULL
;
void
st3m_media_audio_out
(
int16_t
*
rx
,
int16_t
*
tx
,
uint16_t
len
)
{
if
(
!
audio_media
)
return
;
...
...
@@ -40,6 +40,11 @@ void st3m_media_stop(void) {
if
(
audio_media
&&
audio_media
->
destroy
)
audio_media
->
destroy
(
audio_media
);
audio_media
=
0
;
st3m_audio_set_player_function
(
st3m_audio_player_function_dummy
);
if
(
audio_buffer
)
{
free
(
audio_buffer
);
audio_buffer
=
NULL
;
}
}
void
st3m_media_pause
(
void
)
{
...
...
@@ -111,6 +116,7 @@ st3m_media *st3m_media_load_mod(const char *path);
st3m_media
*
st3m_media_load_mp3
(
const
char
*
path
);
int
st3m_media_load
(
const
char
*
path
)
{
if
(
strstr
(
path
,
".mpg"
))
{
st3m_media_stop
();
audio_media
=
st3m_media_load_mpg1
(
path
);
...
...
@@ -124,6 +130,8 @@ int st3m_media_load(const char *path) {
if
(
!
audio_media
)
return
0
;
if
(
!
audio_buffer
)
audio_buffer
=
heap_caps_malloc
(
AUDIO_BUF_SIZE
*
2
,
MALLOC_CAP_DMA
);
st3m_audio_set_player_function
(
st3m_media_audio_out
);
audio_media
->
audio_buffer
=
audio_buffer
;
audio_media
->
audio_r
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment