568 Commits

Author SHA1 Message Date
Erik Faye-Lund
dbe3cc7dcf player: reorganize compatibility checks
The current layout of the compatibility checks makes is a bit
tricky to reuse parts of a platforms quirk-arounds when adding
compiler-support.

Reorganize into three sections:
- inline support
- CRT features
- socket-stack
2011-03-17 00:54:32 +01:00
Erik Faye-Lund
4c8769c630 player: close socket on socket-error
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.
2011-01-26 22:23:45 +01:00
Erik Faye-Lund
94a88abab0 player: merge sync_connect and purge_and_rerequest
This function has only one call-site, and is trivial. Inline it
into it's caller instead.
2011-01-26 22:23:32 +01:00
Erik Faye-Lund
0c8cc404ff player: be consistent, return -1 on error
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.
2011-01-26 22:22:04 +01:00
Erik Faye-Lund
55f2508283 player: add some comments
The code is horribly undocumented as is. Try to improve this by
adding some comments in the most important parts.
2011-01-26 21:41:28 +01:00
Erik Faye-Lund
bc5fcca75f editor: propagate allocation-errors
This isn't really a big deal, but let's just propagate allocation
errors as std::bad_alloc exceptions.
2011-01-26 21:21:30 +01:00
Erik Faye-Lund
5efe69d845 player: catch malloc-failures
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.
2011-01-26 21:20:38 +01:00
Erik Faye-Lund
e3ee8c2432 Merge branch 'work/for-master' into work/example-fixes
Conflicts:
	example_bass/example_bass.cpp
2011-01-26 00:16:27 +01:00
Erik Faye-Lund
98a6974cc9 example_bass: use BASS_STREAM_PRESCAN
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.
2011-01-26 00:13:54 +01:00
Erik Faye-Lund
0cf8728242 makefile: support building example_bass
Add the juice needed to make example_bass buildable from the Makefile.

This should be compatible with MinGW and Linux.
2011-01-26 00:13:53 +01:00
Erik Faye-Lund
0b1ca80464 example_bass: fix compilation on 64bit linux
HSTREAM is a DWORD on 64-bit linux, so let's just pass the address
of the stack-allocated object instead.
2011-01-26 00:13:47 +01:00
Erik Faye-Lund
8a49fd3c05 player: fix potential buffer overflow
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.
2011-01-25 23:39:06 +01:00
Erik Faye-Lund
1044584639 player: fixup some constness 2011-01-25 23:39:06 +01:00
Erik Faye-Lund
c570d58962 player: remove useless include 2011-01-25 23:39:05 +01:00
Erik Faye-Lund
9324a1180b player: unify loader-code a bit
Unify the interface for load_track_data() and request_track_data(),
as they essentially perform the same task, but for different
compile-time configurations.
2011-01-25 23:39:05 +01:00
Erik Faye-Lund
687df0876b protocol: make client-index implicit
This will enable us to unify the code in a later commit.

This is a protocol-breaking change, and means that matching editor
and player must be used.
2011-01-25 23:36:15 +01:00
Erik Faye-Lund
5bfd04f55b player: pass callback directly to sync_update
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.
2011-01-25 04:10:39 +01:00
Erik Faye-Lund
a3da5fe361 Merge branch 'rk/example-opengl' 2011-01-15 16:29:43 +01:00
Erik Faye-Lund
2b86c31b5a makefile: add all object files to archive
For some reason I haven't noticed until now that the Makefile
only added the first object-file to the library. Fix that.
2011-01-14 00:40:13 +01:00
Erik Faye-Lund
81e4455f16 contrib: remove broken c++-wrapper 2011-01-14 00:38:43 +01:00
Erik Faye-Lund
1096fb3119 example_bass: use folders for external deps
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".
2011-01-14 00:38:42 +01:00
Rasmus Kaae
8fb9aa6257 example_bass: port graphics code from D3D to OGL
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.
2011-01-14 00:38:30 +01:00
Erik Faye-Lund
b45b7af70f example_bass: remove superfluous includes
While we're at it, switch all standard library includes to C-style
rather than C++-style.
2011-01-13 16:39:34 +01:00
Erik Faye-Lund
7bb3ee3ab1 example_bass: mark file-local symbols as static 2011-01-13 16:36:34 +01:00
Erik Faye-Lund
e43c33a1ab player: add API to save tracks
This is a bit more convenient than having to remember to do
"remote export" from the editor all the time.
2010-12-27 20:32:55 +01:00
Erik Faye-Lund
569f9d082b example: make sure SYNC_PLAYER is set in release builds 2010-12-14 19:37:03 +01:00
Erik Faye-Lund
7590f5c6c6 Merge branch 'work/icon' 2010-11-23 22:00:33 +01:00
Erik Faye-Lund
8c842edff3 editor: add an application icon
The ICO was created from contrib/logo.svg by exporting a PNG from
Inkscape, and converting the PNG online at with iconverticons.com
2010-11-17 23:18:42 +01:00
Erik Faye-Lund
70bd0d006d contrib: add a logo
The logo is in SVG format, drawn in Inkscape and hand-optimized
to reduce bloat and increase maintainability.
2010-11-17 23:14:30 +01:00
Erik Faye-Lund
5318b90d7a editor: delete remote keys when creating new document 2010-11-13 14:06:26 +01:00
Erik Faye-Lund
2827d4b4dc editor: reorder file-list
Update the file-list in the order Visual Studio prefers it to be. This
reduces update-noise when adding files to the project.
2010-11-02 18:58:14 +01:00
Erik Faye-Lund
5bd6a515cf editor: clean up resource-header
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.
2010-11-02 18:58:13 +01:00
Erik Faye-Lund
7edb2082be documentation: document interpolation modes 2010-10-30 19:47:08 +02:00
Erik Faye-Lund
466a47f9db documentation: improve language 2010-10-30 19:39:31 +02:00
Erik Faye-Lund
b6b6d72332 Makefile: do not fail if lib exists 2010-10-26 21:20:16 +02:00
Erik Faye-Lund
7ea7cabd96 posix: include unistd.h for close
The close prototype is defined in unistd.h, according to
POSIX. Include it.
2010-09-13 00:03:11 +02:00
Erik Faye-Lund
f2c12d1351 editor: do not use MFC header
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.
2010-09-05 15:37:54 +02:00
Erik Faye-Lund
126fbe1c33 editor: prevent crash on early disconnection
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.
2010-09-05 00:07:25 +02:00
Erik Faye-Lund
9da5e1b3d4 gcc: add a basic makefile 2010-09-04 14:36:41 +02:00
Erik Faye-Lund
ca123707b3 add NEED_STRDUP for C89 support
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.
2010-09-04 14:32:26 +02:00
Erik Faye-Lund
ab243a6c1a add basic gcc support 2010-09-04 14:32:26 +02:00
Erik Faye-Lund
6aafb683cc select: send in socket + 1 2010-09-04 14:32:25 +02:00
Erik Faye-Lund
1d4e1bb795 gcc: fix compilation warnings 2010-09-04 14:32:24 +02:00
Erik Faye-Lund
d3dd8a78f0 player: fix typo hanle->handle 2010-08-31 19:33:52 +02:00
Erik Faye-Lund
68ae5f69a6 editor: style-nit 2010-08-29 23:43:10 +02:00
Erik Faye-Lund
6693c3f8f4 protocol: use network byte-order
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.
2010-08-29 23:43:10 +02:00
Erik Faye-Lund
9d4aea28fb player: do not assume 32-bit ints
The player can be compiled for other architectures than Windows,
where ints aren't 32-bit. 64-bit Mac/Linux are not-that-unlikely
examples.
2010-08-29 23:43:09 +02:00
Erik Faye-Lund
163194e338 editor: increase warning level and fix warnings
While we're at it, let's fix-up some code-style errors.
2010-08-29 23:43:08 +02:00
Erik Faye-Lund
878d1534f1 player: increase warning level and fix a warning 2010-08-29 23:40:47 +02:00
Erik Faye-Lund
fbc958adeb player: make port unsigned short
TCP ports are unsigned 16 bit integer, so let's use a more natural
type for it.
2010-08-27 21:20:10 +02:00