Commit graph

29 commits

Author SHA1 Message Date
Wim Taymans
19f4fac1e1 pw-cat: add support for streaming
sndfile actually supports reading and writing from/to stdin/out with the -
filename, so allow that.

Add support for streaming in dsf, dff and midifile as well.

Add a -a option to pw-cat use a pipe with raw bytes, otherwise try to
use the parsers and sndfile to read/write from/to stdin/stdout.

You can then do things like:

 sox 2L-053_04_stereo-DSD64.dff -t dsf -  | pw-cat -pdv -

 pw-cat 07.Joe.Satriani.Clouds.race.across.the.sky.wav | pw-cat -pv -

 pw-cat -rmv --target=0 - | pw-mididump -

Fixes: #4204
2024-08-23 15:44:31 +02:00
Wim Taymans
d9bd2628d9 midifile: remove MIDI1 message requirement
We can transparently convert to MIDI1 so there is not need for the
assert.
2024-08-23 15:35:16 +02:00
Wim Taymans
63afe65e3f midifile: use the meta.offset to get to the metadata 2024-08-23 15:34:36 +02:00
Wim Taymans
d057c95b2b midifile: add support for UMP
Add a type to the events, which can be MIDI1 or UMP.

Add debug functions for UMP messages.

midifile only supports saving MIDI1 format files for now. It will convert
to MIDI1 when asked to write an UMP message.

In pw-cat, convert the MIDI1 messages to UMP before sending into the
graph.
2024-07-30 09:38:40 +02:00
Wim Taymans
1ae4374ccf Fix compilation with -Werror=float-conversion
Better make the conversions explicit so that we don't get any surprises.

Fixes #4065
2024-06-18 12:17:56 +02:00
Barnabás Pőcze
934ab3036e treewide: use SPDX tags to specify copyright information
SPDX tags make the licensing information easy to understand and clear,
and they are machine parseable.

See https://spdx.dev for more information.
2023-02-16 10:54:48 +00:00
Wim Taymans
0ddf80d470 midifile: error won invalid track size
When the track data would exceed the file size, return an error.
2023-01-09 11:49:10 +01:00
Wim Taymans
43b27002eb tools: add beginnings of DSD player 2021-09-21 10:50:44 +02:00
Wim Taymans
bf29130f84 midifile: debug some more message types 2021-09-14 15:39:35 +02:00
Barnabás Pőcze
f5d51162c4 treewide: mark things static and const
Mark some structures, arrays static/const at various places.
In some cases this prevents unnecessary initialization
when a function is entered.

All in all, the text segments across all shared
libraries are reduced by about 2 KiB. However,
the total size increases by about 2 KiB as well.
2021-06-30 14:44:08 +02:00
Peter Hutterer
7697ed0757 treewide: replace strcmp() == 0 with spa_streq()
This change is only done in source files for now, header files will be done
separately.
2021-05-18 22:10:27 +10:00
Emmanuel Gil Peyrot
14fdf07e8f Run codespell on the entire codebase
This tool detects and fixes common English spelling mistakes, with
generally very few mistakes.

Here is the command I used to generate this commit.  There were a few
changes that had to be done manually, and of course adding the ignore
file:
```shell
codespell -I .codespell-ignore -x .codespell-ignore -w
```

I didn’t add it to the CI, but this would be a good place for it.
2020-08-17 17:16:31 +00:00
Wim Taymans
cb1a2ed769 midifile: check return of write and fail on error 2020-06-23 15:26:23 +02:00
Wim Taymans
08ffc507c0 midifile: fix CLAMP range of minor/mayor keys 2020-05-20 15:24:25 +02:00
Wim Taymans
ff4a314022 use fstat when we can
This avoids having things change between the stat and open.
2020-05-20 15:24:25 +02:00
Wim Taymans
b09caaadc0 midifile: make it possible to specify output file 2020-04-14 20:12:23 +02:00
Wim Taymans
84b048507b midifile: remove impossible case. 2020-04-14 20:11:51 +02:00
Wim Taymans
3d9f54d8a4 midifile: count channels from 1 to 16 2020-03-03 10:25:03 +01:00
Wim Taymans
70fc09b891 midifile: add support for event dump
Make a method to dump event info to stdout.
2020-03-01 20:39:07 +01:00
Wim Taymans
3b1fc4acce midifile: put some parsed data in the event
Put some of the data we parsed into the event.
2020-03-01 20:37:50 +01:00
Wim Taymans
2982b9511e pw-cat: simplify midi reading and writing 2020-02-28 20:35:28 +01:00
Wim Taymans
a3582f0e0f pw-cat: add midi recording 2020-02-27 15:37:12 +01:00
Wim Taymans
b7dbf4bbc1 pw-cat: rework midifile a little
Move the code to read and write midi into the midifile helper
and simplify things a bit.
2020-02-27 12:42:21 +01:00
Wim Taymans
9bec2e5d8a pw-cat: improve midi errors
EINVAL for invalid events and file
ENOENT for unknown event
2020-02-24 10:20:33 +01:00
Wim Taymans
8b874a9514 pw-cat: handle midi EOF better
Return 0 when there are no more events, 1 when we have an event and
< 0 for errors. Use this to correctly push the last set of events on
EOS and then return 0 and stop without an error.
2020-02-21 11:19:35 +01:00
Wim Taymans
cc1ed84f9f midi: simplify some things 2020-02-19 10:48:16 +01:00
Wim Taymans
ddcb08a98a pw-cat: read midi file from memory
mmap the midi file and read from memory. Simplifies some things and
allows us to potentially parse from the RT thread later.
2020-02-19 09:58:47 +01:00
Wim Taymans
b6a6d1f0bb pw-cat: fix tempo changes
Use time in seconds as event timestamp.
Apply tempo from the new events, keep track of elapsed time and
time since tempo change to get the right time.
Skip metadata midi in pw-cat.
2020-02-18 16:13:35 +01:00
Wim Taymans
fe616e38d8 pw-cat: add midi support 2020-02-18 13:38:26 +01:00