Commit Graph

140 Commits

Author SHA1 Message Date
Rémi Bernon 0ef9ebde9f winmm: Fix int-to-pointer and pointer-to-int casts warnings.
The stream pointer was used as the DWORD id, which is only going to
work on 32bit. It may very well be that winmm is only used in 32bit,
but then we still build a 64bit version of it.

Signed-off-by: Rémi Bernon <rbernon@codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-11-14 21:04:00 +01:00
Michael Stefaniuc 24f4781216 winmm: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-09-20 16:37:19 +02:00
Akihiro Sagawa 95c21f3f94 winmm: Support TIME_MIDI position in MIDI stream.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-12 13:34:23 +02:00
Akihiro Sagawa ced8ce55b4 winmm: Make TIME_TICKS position continuous.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-11 20:43:16 +02:00
Akihiro Sagawa 16808d432c winmm: Use microsecond unit in MIDI stream position variable to simplify the code.
Since 32-bit variable overflows after approximately 70 minutes,
we use 64-bit variable for this purpose. `remainder' member is removed.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-11 20:43:16 +02:00
Akihiro Sagawa 381012f75d winmm: Preserve fractions in microseconds to compensate rounding errors.
Otherwise, a song is played faster than expected in some cases.

For instance, we assume that 40 pan control change (CC#10) messages are
expressed in 12.5ms each,
 * Prior art omits fractions, i.e. 12ms + 12ms + ... = 480ms.
 * Proposal technique saves fractions, i.e. 12ms + 13ms + ... = 500ms.
Ideal duration is 500ms. So, the proposed method is better than prior one.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-10 10:34:20 +02:00
Akihiro Sagawa 2cb326260b winmm: Don't allow to set time division property while playing.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-07-10 10:34:14 +02:00
Akihiro Sagawa 3840443958 winmm: Reset the tick counter after handling messages.
Otherwise, events might be triggered immediately after a resuming.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-29 17:39:22 +02:00
Akihiro Sagawa 2e2ff80567 winmm: Return a continuous stream position in MIDI stream.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-29 17:39:18 +02:00
Akihiro Sagawa 25f610f96a winmm: Synchronize player status and API calls.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-29 17:14:02 +02:00
Akihiro Sagawa b70f0d723a winmm: Add playing status to MIDI stream structure and use it.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-24 23:28:43 +02:00
Akihiro Sagawa 169d657d78 winmm: Protect MIDI stream info with critical section.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-24 23:28:41 +02:00
Akihiro Sagawa 1c38d47e4d winmm: Fix superfluous MOM_DONE callback messages.
This is a regression introduced by 185d98bbfd.
Because midiOutLongMsg's MOM_DONE callback message confuses an application,
we don't rely on midiOut callback routine anymore in MIDI stream processing.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-15 23:12:33 +02:00
Akihiro Sagawa 107dba39a3 winmm: Avoid casting unsigned char to plain char.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-11 20:13:27 +02:00
Akihiro Sagawa 1d49939618 winmm: Fix default time division value in MIDI stream.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-05-11 20:13:25 +02:00
Akihiro Sagawa 185d98bbfd winmm: Fix MEVT_LONGMSG handling in MIDI stream.
Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2018-04-09 09:53:47 +02:00
Carlo Bramini 23439a0ae8 winmm: Fix wrong return type for midiInOpen and midiOutOpen.
Signed-off-by: Carlo Bramini <carlo_bramini@users.sourceforge.net>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2017-02-16 15:27:54 +01:00
Bruno Jesus a6f43ecf9b winmm: Return meaningful value in WINMM_CreateIData.
Signed-off-by: Bruno Jesus <00cpxxx@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2016-12-01 15:27:38 +01:00
Nikolay Sivov a360cc47d5 winmm: For consistency forward wReserved1 values from -W to -A calls too.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-25 13:22:38 +09:00
Nikolay Sivov 349f834976 winmm: Initialize AUXCAPSA.wReserved1 returned from auxGetDevCapsA() (Coverity).
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2015-11-16 17:14:18 +09:00
Francois Gouget c1de3cc5d4 winmm: Remove unneeded NONAMELESSSTRUCT directives. 2015-04-01 14:13:20 +09:00
Jörg Höhle f67bc43e22 winmm: Handle GetTickCount overflow in MIDI player. 2013-02-14 17:37:14 +01:00
Jörg Höhle b95910ccbc winmm: More compatible midiIn/Out[Un]Prepare MHDR_* flag handling. 2013-02-13 17:19:43 +01:00
André Hentschel 126fded4a4 winmm: Mark up fallthrough switch case (coverity). 2012-11-08 15:37:51 +01:00
Francois Gouget fac36c55e9 Assorted typo, spelling, wording and case fixes. 2012-05-15 16:26:43 +02:00
Andrew Eikum 47332210dd winmm: Don't call MMDevAPI during process exit. 2012-05-11 15:39:21 +02:00
Jörg Höhle 21e47e905e winmm: Make midiStream* messages asynchronous to avoid deadlocks. 2012-02-17 18:06:51 +01:00
Jörg Höhle 1b11576005 winmm: Avoid using SuspendThread, it can hang Wine. 2012-02-17 18:06:50 +01:00
Francois Gouget 814c854fd2 winmm: Give a name to the critical sections, make them static and delete them when unloading the dll. 2011-11-15 19:37:36 +01:00
Akihiro Sagawa 203d06d410 winmm: Add support for MEVT_LONGMSG. 2011-09-08 20:08:06 +02:00
Andrew Eikum be158e48ad winmm: Implement waveOut* on top of MMDevAPI. 2011-07-12 11:49:21 +02:00
Andrew Eikum a700f9e0fc winmm: Pull wave and mixer functions into their own source file. 2011-06-29 10:24:04 -05:00
Jörg Höhle c3774b664a winmm: Check callback flags prior to opening a driver. 2011-04-04 14:42:12 +02:00
Jörg Höhle a0dbd846c6 winmm: Get rid of psStopEvent which was never used like an event. 2011-03-30 13:28:04 +02:00
Jörg Höhle c89853ebe5 winmm: More MIDI boundary tests & fixes. 2010-05-19 11:17:27 +02:00
Maarten Lankhorst 4f4dd855c4 winmm: Defer loading drivers until they are requested. 2010-04-01 18:12:40 +02:00
Francois Gouget 3428b94a8d Assorted spelling and case fixes. 2010-03-22 10:49:13 +01:00
Jörg Höhle 64b6287e83 winmm: Accept the ancient, smaller MIDIHDR. 2010-02-22 13:18:26 +01:00
Jörg Höhle a8f1d2eb2f winmm: MIDIHDR.dwOffset is set with MEVT_F_CALLBACK only.
At the same time, the change to the player loop prevents a buffer
overshoot and a (perhaps unlikely) program trace where a sequence
Suspend; Stop; midiStreamOut could send MOM_DONE twice and access
memory possibly released within a MOM_DONE DCB_FUNCTION callback.
2010-02-22 13:17:26 +01:00
Jörg Höhle 63d0aeeafa winmm: Do not access MIDIHDR past MOM_DONE DriverCallback. 2010-02-22 13:17:04 +01:00
Jörg Höhle a956086e18 winmm: dwBytesRecorded controls how much is played, not dwBufferLength. 2010-02-19 15:10:29 +01:00
Jörg Höhle 67124e1c0b winmm: Improve initial MIDI player thread synchronisation. 2010-02-11 14:38:45 +01:00
Jörg Höhle 7bd6be0706 winmm: Fix incorrect memory useage (Valgrind w/ MIDI tests). 2010-02-11 14:38:44 +01:00
Jörg Höhle a758c6a981 winmm: The 64KB buffer limit on MIDIHDR buffers applies to streams only. 2010-02-03 15:49:09 +01:00
Jörg Höhle bc76916b90 winmm: Reset MIDIHDR flags prior to return from midiStreamOut. 2010-02-02 12:00:07 +01:00
Jörg Höhle b0d2f77cc9 winmm: Have xyzGetDevCaps return MMSYSERR_BADDEVICEID, not INVALHANDLE. 2010-02-02 11:47:19 +01:00
Jörg Höhle 06d6dd3e72 winmm: Perform stricter MIDI-related error checking. 2010-02-01 15:39:28 +01:00
Jörg Höhle f1373d57c1 winmm: midiStreamPosition can select an alternative MMTIME format. 2010-02-01 14:11:04 +01:00
Jörg Höhle 9fac9d8ffd winmm: Fix MIDI resource leaks. 2010-01-28 11:10:19 +01:00
Eric Pouech 37afecb883 winmm: A couple of simple fixes for winmm compilation on 64bit platforms. 2010-01-25 12:51:31 +01:00