|
30 | 30 | //(such as NTFS mounted from linux)
|
31 | 31 | #endif
|
32 | 32 |
|
33 |
| -#include "../timer/timer.h" |
| 33 | +#include "ldp-vldp.h" |
34 | 34 | #include "../io/conout.h"
|
35 | 35 | #include "../io/mpo_fileio.h"
|
36 | 36 | #include "../sound/sound.h"
|
37 |
| -#include "ldp-vldp.h" |
| 37 | +#include "../timer/timer.h" |
38 | 38 |
|
39 | 39 | #ifdef DEBUG
|
40 | 40 | #include <assert.h> // this may include an extra .DLL in windows that I don't want to rely on
|
41 | 41 | #endif
|
42 | 42 |
|
43 | 43 | #include <stdlib.h>
|
44 | 44 | #include <string.h>
|
45 |
| -#include <sys/types.h> |
46 | 45 | #include <sys/stat.h>
|
| 46 | +#include <sys/types.h> |
47 | 47 |
|
48 | 48 | #include <vorbis/codec.h> // OGG VORBIS specific headers
|
49 | 49 | #include <vorbis/vorbisfile.h>
|
@@ -100,8 +100,8 @@ void mmreset()
|
100 | 100 | size_t mmread(void *ptr, size_t size, size_t nmemb, void *datasource)
|
101 | 101 | {
|
102 | 102 | size_t bytes_to_read = size * nmemb; // how many bytes to be read
|
103 |
| - Uint8 *src = ((Uint8 *)datasource) + g_audio_filepos; // where to get the |
104 |
| - // data from |
| 103 | + // where to get the data from |
| 104 | + Uint8 *src = ((Uint8 *)datasource) + g_audio_filepos; |
105 | 105 |
|
106 | 106 | // printf("mmread being called.. size is %d, nmemb is %d, bytes_to_read is
|
107 | 107 | //%d\n", size, nmemb, bytes_to_read);
|
@@ -195,7 +195,7 @@ int mmclose(void *datasource)
|
195 | 195 | long mmtell(void *datasource)
|
196 | 196 | {
|
197 | 197 | // printf("mmtell being called, filepos is %x\n", (Uint32)
|
198 |
| - //g_audio_filepos); |
| 198 | + // g_audio_filepos); |
199 | 199 |
|
200 | 200 | if (datasource) {
|
201 | 201 | }
|
@@ -522,7 +522,7 @@ void ldp_vldp_audio_callback(Uint8 *stream, int len, int unused)
|
522 | 522 | unsigned int uFloodTimer = (GET_TICKS() - g_uCallbackDbgTimer) / 1000;
|
523 | 523 | if (uFloodTimer != g_uCallbackFloodTimer) {
|
524 | 524 | g_uCallbackFloodTimer = uFloodTimer;
|
525 |
| - string s = "audio callback frequency is: " + |
| 525 | + string s = "audio callback frequency is: " + |
526 | 526 | numstr::ToStr((g_u64CallbackByteCount / uFloodTimer) >> 2);
|
527 | 527 | printline(s.c_str());
|
528 | 528 | }
|
@@ -618,22 +618,17 @@ void ldp_vldp_audio_callback(Uint8 *stream, int len, int unused)
|
618 | 618 | unsigned int cur_time = g_ldp->get_elapsed_ms_since_play();
|
619 | 619 | // if our timer is set to the current time or some previous time
|
620 | 620 | if (g_playing_timer < cur_time) {
|
621 |
| - static const Uint64 uBYTES_PER_S = |
622 |
| - sound::FREQ * sound::BYTES_PER_SAMPLE; // needs to be uint64 |
623 |
| - // to prevent overflow |
624 |
| - // from subsequent math |
| 621 | + // needs to be uint64 to prevent overflow from subsequent math |
| 622 | + static const Uint64 uBYTES_PER_S = sound::FREQ * sound::BYTES_PER_SAMPLE; |
| 623 | + // how many samples should have played 176.4 = 44.1 samples per |
| 624 | + // millisecond * 2 for stereo * 2 for 16-bit |
625 | 625 | correct_samples =
|
626 | 626 | (unsigned int)((uBYTES_PER_S * (cur_time - g_playing_timer)) / 1000);
|
627 |
| - // how many samples should have played |
628 |
| - // 176.4 = 44.1 samples per millisecond * 2 for stereo * 2 for |
629 |
| - // 16-bit |
630 | 627 | }
|
631 | 628 | // our timer is set to some time in the future (used with skipping)
|
632 |
| - // so we actually |
633 |
| - // should not have played any samples at this point |
| 629 | + // so we actually should not have played any samples at this point |
634 | 630 | else {
|
635 |
| - // fprintf(stderr, "LDP-VLDP-AUDIO : Timer is in the |
636 |
| - //future\n"); |
| 631 | + // fprintf(stderr, "LDP-VLDP-AUDIO : Timer is in the future\n"); |
637 | 632 | correct_samples = 0;
|
638 | 633 | }
|
639 | 634 |
|
|
0 commit comments