Create a rudimentary C# example using DX11 for rendering and XAudio2
for sound (through SlimDX). The player is hacky due to what seems to
be issues with either the implementation or documentation of XAudio2
and/or SlimDX' intergration of it.
While we're at it, make sure we always delete all the data before
trying to re-request. This we won't get out of sync on socket-error
at that particular location.
Previously some functions returned 1 and some returned -1 on
error. There were also two internal functions that returned 0
on error and 1 on 0 on success. Fix this, and make sure we
always return -1 on error and 0 on success.
There were a couple of places where malloc-failures (out-of-memory,
really) weren't caught. This isn't a big deal on modern operating
systems, but is worth dealing with on low-end platforms.
Failures to add/delete keys should count as socket-errors, because
they cause the editor and client to become out of sync.
When seeking in MP3s, BASS needs the BASS_STREAM_PRESCAN-flag to enable
accurate seeking.
While our example uses OGG Vorbis instead of MP3, it doesn't hurt to set
the flag, and leaves one less bug-source for people who base their code
of the example.
Previously, sync_track_path could either overflow it's 'temp'
buffer by one byte, or (even worse) end up not zero-terminating
it.
Correct the code by explicitly zero-terminating the result of
strncpy, and reducing the lenght-parameter to strncat.
Unify the interface for load_track_data() and request_track_data(),
as they essentially perform the same task, but for different
compile-time configurations.
sync_update is the only code-path that can end up calling any of the
callbacks, so there's no need to store it in the device.
This is a breaking change, so all users needs to update their code
accordingly.
BASS and SDL both add a set of headers and libs that needs
to be included into the project. Allow the user to put these
headers in a subfolder called "include" and the libs in a
subfolder called "lib".
Since BASS is available for MacOS X and Linux as well as Windows,
it makes sense to port the example to OpenGL rather than Direct3D9.
Use SDL to get an OpenGL context in a portable fashion.
Remove newlines to reduce noise from visual studio when updating
the resources.
Fix _APS_NEXT_RESOURCE_VALUE so 104 won't be generated, it already
exist.
afxres.h is MFC-ism, and is not included in Visual Studio Express 2008.
To avoid confusing the resource editor in other visual studio versions,
let's implement a minimal version ourselves.
With some really bad luck, it was possible to crash inside
std::string::resize() if the connection was disconnected
right after sending the GET_TRACK command.
C89 does not define strdup(), so provide an implementation for
the systems that doesn't implement it. Enable it by adding
"CPPFLAG += -DNEED_STRDUP" to config.mak.
The network code assumes that the client and server have the
same endianess. This isn't always the case, so let's change
it all to network byte-order.
This change is not backwards compatible, so old clients and
new editors (or vica verca) will not work together any more.