Commit Graph

940 Commits

Author SHA1 Message Date
Andreas Kling
6ecf90c6f8 SystemMonitor: Tweak bottom margin of the process table 2020-02-11 11:53:38 +01:00
Andreas Kling
14f9a29502 Terminal: Set up a nice $PROMPT for the shell :^) 2020-02-10 21:53:04 +01:00
ignas-sa
b67035c3ac
Calculator: Accept more keyboard input (#1207)
Allow user to clear/remove last numeral from input (Esc/Backspace
respectively) and type the decimal point.
2020-02-10 19:48:52 +01:00
William McPherson
aa149b9330 LibAudio/Piano: Replace floats with doubles
We should default to double-precision so that clients can make the
choice to use float or double.
2020-02-10 14:04:27 +01:00
William McPherson
4ad96df0d4 Piano: Draw stereo waves
Draw two waves in different colors.
2020-02-10 14:04:27 +01:00
William McPherson
93903c8064 Piano: Try to be more stereo-oriented 2020-02-10 14:04:27 +01:00
William McPherson
255edcb525 Piano: Add nice scale factor to WaveWidget 2020-02-10 14:04:27 +01:00
William McPherson
2a66878148 Piano: Ensure WaveWidget paints in-bounds
Letting GUI::Frame::paint_event() cover up your mistakes is tacky :P
2020-02-10 14:04:27 +01:00
William McPherson
60fdc6c9ab Piano: Put reset() with other setters 2020-02-10 14:04:27 +01:00
William McPherson
9997b0dbf5 Piano: Add sampler
This commit adds basic support for importing, viewing and playing WAV
samples at different pitches.

Naming issues:
- We are using the Sample struct from Music.h, but also the Sample
  struct from LibAudio (Audio::Sample). This is a little confusing.

set_recorded_sample() finds the peak sample and then divides all the
samples by that peak to get a guaranteed min/max of -1/1. This is nice
because our other waves are also bound between these values and we can
just do the same stuff. This is why we're using Audio::Sample, because
it uses floats, whereas Music.h's Sample uses i16s. It's a little
annoying that we have to use a mixture of floats and doubles though.

For playback at lower frequencies, we're calculating in-between samples,
rather than just playing samples multiple times. Basically, you get the
current sample and add the difference between the current sample and the
next sample multiplied by the distance from the current sample. This is
like drawing the hypotenuse of a right-angled triangle.
2020-02-10 14:04:27 +01:00
Andreas Kling
6cbd72f54f AK: Remove bitrotted Traits::dump() mechanism
This was only used by HashTable::dump() which I used when doing the
first HashTable implementation. Removing this allows us to also remove
most includes of <AK/kstdio.h>.
2020-02-10 11:55:34 +01:00
Andreas Kling
3d62cab90f TextEditor: Enable C++ syntax highlighting for .cpp and .h files :^) 2020-02-07 20:12:25 +01:00
Andreas Kling
6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00
Andreas Kling
2e219255a2 IPCCompiler: Put message classes in the Messages namespace 2020-02-06 20:21:49 +01:00
Andreas Kling
73110e25a9 WindowServer: Move classes into WindowServer namespace
Also remove the leading WS from names and filenames.
2020-02-06 20:03:37 +01:00
William McPherson
b7d190bd10 Piano: Add export action
This is a pretty rudimentary WAV export function for Piano.
2020-02-06 19:13:53 +01:00
William McPherson
5dc014b261 Piano: Fix roll playback at startup
This is not a bug currently, since the first column immediately starts
playing at startup and leaves no time for the user to put notes in it.
However, this is needed for exporting.
2020-02-06 19:13:53 +01:00
William McPherson
9a05bbaace Piano: Move piano roll internals to AudioEngine
The piano roll data definitely belongs in AudioEngine along with the
note and time data. Now RollWidget only has GUI information, much like
the other widgets.

Note that this commit exacerbates issue #1158 which is caused by
RollWidget::paint_event().
2020-02-06 19:13:53 +01:00
Andreas Kling
97edc82a26 LibAudio: Remove leading A from filenames 2020-02-06 15:18:03 +01:00
Andreas Kling
d17e23bd27 LibCore: Remove leading C from filenames 2020-02-06 15:04:03 +01:00
Andreas Kling
799b0a4fa8 LibGUI: Rename {H,V}BoxLayout => {Horizontal,Vertical}BoxLayout 2020-02-06 14:44:13 +01:00
Andreas Kling
dccf335d5b LibGUI: Add HorizontalSlider and VerticalSlider convenience classes 2020-02-06 14:43:16 +01:00
Andreas Kling
6a71ba1deb LibGUI: Add HorizontalSplitter and VerticalSplitter convenience classes 2020-02-06 14:40:59 +01:00
Andreas Kling
5c06c32df4 LibGfx: Prefer using Gfx::Bitmap::load_from_file instead of load_png()
Code that just wants to open a Gfx::Bitmap from a file should not be
calling the PNG codec directly.
2020-02-06 13:39:17 +01:00
Andreas Kling
f8b00aa290 LibGfx: Unpublish Gfx::Size from the global namespace 2020-02-06 13:32:14 +01:00
Andreas Kling
9b87843af1 LibGfx: Unpublish Gfx::Point from global namespace 2020-02-06 13:08:32 +01:00
Andreas Kling
20cfd2a6bf LibGfx: Unpublish Gfx::Rect from global namespace 2020-02-06 13:02:38 +01:00
Andreas Kling
c39d44fc2e LibGfx: Rename GraphicsBitmap.{cpp,h} => Bitmap.{cpp,h} 2020-02-06 12:07:05 +01:00
Andreas Kling
9ac94d393e LibGfx: Rename from LibDraw :^) 2020-02-06 12:04:00 +01:00
Andreas Kling
11580babbf LibDraw: Put all classes in the Gfx namespace
I started adding things to a Draw namespace, but it somehow felt really
wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename
the library to LibGfx. :^)
2020-02-06 11:56:38 +01:00
Andreas Kling
92f77864de LibAudio: Put all classes in the Audio namespace and remove leading A 2020-02-06 10:40:02 +01:00
Andreas Kling
f2a087126c LibC: Add posix_openpt(), grantpt() and unlockpt()
This makes getting a pseudoterminal pair a little bit more portable.
Note that grantpt() and unlockpt() are currently no-ops, since we've
already granted the pseudoterminal slave to the calling user.

We also accept O_CLOEXEC to posix_openpt(), unlike some systems. :^)
2020-02-05 21:17:41 +01:00
joshua stein
c3a32108b2 Piano: Fix building with clang 2020-02-05 18:39:45 +01:00
joshua stein
b4568b1422 Welcome: Pass -m to ld to fix building with clang/lld 2020-02-05 18:39:45 +01:00
joshua stein
8919b61784 SystemMonitor: Fix building with clang 2020-02-05 18:39:45 +01:00
joshua stein
385ba187bd FileManager: Include limits.h for PATH_MAX 2020-02-05 18:39:45 +01:00
joshua stein
a3c79fcdff FileManager: Fix building with clang
FileUtils.cpp:131:34: error: cannot pass object of non-trivial type 'const AK::String' through variadic method; call will abort at runtime [-Wnon-pod-varargs]
2020-02-05 18:39:45 +01:00
joshua stein
384d640293 FileManager: Include sys/stat.h for struct stat 2020-02-05 18:39:45 +01:00
joshua stein
46601690d9 HexEditor: Remove unused m_hover_pos 2020-02-05 18:39:45 +01:00
joshua stein
640cb920e8 FileManager: Remove unused m_row variable 2020-02-05 18:39:45 +01:00
William McPherson
1e0d57a13f Piano: Set some nice defaults 2020-02-05 17:52:10 +01:00
William McPherson
59bde64ba6 Piano: Add release
Notice that we are calculating release time according to the level when
the note is turned off rather than the sustain level. Naively using the
sustain level gives very long release times if you turn the note off
during attack, whereas this deterministically gives the same release
time.
2020-02-05 17:52:10 +01:00
William McPherson
ab9475a3f3 Piano: Add attack 2020-02-05 17:52:10 +01:00
William McPherson
5990b3b2e6 Piano: Add sustain 2020-02-05 17:52:10 +01:00
William McPherson
421a340572 Piano: Make decay more accurate
1. Make decay sample-granular rather than buffer-granular
You only have ~43 buffers per second which can make a jagged signal.

2. Calculate decay in milliseconds
Decay is supposed to be a time value.
2020-02-05 17:52:10 +01:00
William McPherson
44c81ee9db Piano: Remove phony multiple same note playback
I say "phony" because it's not actually playing the same frequency
twice, it's just playing the same frequency at a higher volume. We can
properly implement this later but at the moment it'll get in the way of
our ADSR implementation.
2020-02-05 17:52:10 +01:00
William McPherson
f909095981 Piano: Fix default knob values
Now you can change the defaults in AudioEngine and not be totally
confused.

1. The default for m_octave_knob was actually upside-down.
2. The default for m_decay_knob wasn't respecting AudioEngine.
3. The default for m_delay_knob wasn't respecting AudioEngine.
2020-02-05 17:52:10 +01:00
Sergey Bugaev
a6e7797a31 LibC: Move waitpid() to sys/wait.h
That's where POSIX says it should be.
2020-02-03 19:50:45 +01:00
Andreas Kling
c5bd9d4ed1 LibGUI: Put all classes in the GUI namespace and remove the leading G
This took me a moment. Welcome to the new world of GUI::Widget! :^)
2020-02-02 15:15:33 +01:00
Andreas Kling
2d39da5405 LibCore: Put all classes in the Core namespace and remove the leading C
I've been wanting to do this for a long time. It's time we start being
consistent about how this stuff works.

The new convention is:

- "LibFoo" is a userspace library that provides the "Foo" namespace.

That's it :^) This was pretty tedious to convert and I didn't even
start on LibGUI yet. But it's coming up next.
2020-02-02 15:15:30 +01:00