mirror of
https://github.com/RetroDECK/Supermodel.git
synced 2025-02-16 17:35:39 +00:00
- Changes submitted by krom: cleaned up spacing in Games.cpp, optimized byte swapping functions in Supermodel.h, minor changes to fix compiler errors in gcc.
This commit is contained in:
parent
4c02a8af05
commit
2ca7898f1a
1074
Src/Games.cpp
1074
Src/Games.cpp
File diff suppressed because it is too large
Load diff
|
@ -422,7 +422,7 @@ void CDSB1::Reset(void)
|
|||
#define DSB1_OFFSET_RAM 0 // 32KB Z80 RAM
|
||||
#define DSB1_OFFSET_MPEG_LEFT 0x8000 // 1604 bytes (48 KHz max., 1/60th second, 2 extra = 2*(48000/60+2)) left MPEG buffer
|
||||
#define DSB1_OFFSET_MPEG_RIGHT 0x8644 // 1604 bytes right MPEG buffer
|
||||
#define DSB1_MEMORY_POOL_SIZE (0x8000+0x644+0x644)
|
||||
#define DSB1_MEMORY_POOL_SIZE (0x8000 + 0x644 + 0x644)
|
||||
|
||||
BOOL CDSB1::Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr)
|
||||
{
|
||||
|
@ -809,7 +809,7 @@ void CDSB2::Reset(void)
|
|||
#define DSB2_OFFSET_RAM 0 // 128KB 68K RAM
|
||||
#define DSB2_OFFSET_MPEG_LEFT 0x20000 // 1604 bytes (48 KHz max., 1/60th second, 2 extra = 2*(48000/60+2)) left MPEG buffer
|
||||
#define DSB2_OFFSET_MPEG_RIGHT 0x20644 // 1604 bytes right MPEG buffer
|
||||
#define DSB2_MEMORY_POOL_SIZE (0x20000+0x644+0x644)
|
||||
#define DSB2_MEMORY_POOL_SIZE (0x20000 + 0x644 + 0x644)
|
||||
|
||||
BOOL CDSB2::Init(const UINT8 *progROMPtr, const UINT8 *mpegROMPtr)
|
||||
{
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
#include "Supermodel.h"
|
||||
|
||||
#ifdef SUPERMODEL_OSX
|
||||
#include "Supermodel.h"
|
||||
|
||||
#ifdef SUPERMODEL_OSX
|
||||
#include <SDL/SDL.h>
|
||||
#include <SDL/SDL_audio.h>
|
||||
#else
|
||||
#include <SDL/SDL_audio.h>
|
||||
#else
|
||||
#include <SDL.h>
|
||||
#include <SDL_audio.h>
|
||||
#include <SDL_audio.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
// Model3 audio output is 44.1KHz 2-channel sound and frame rate is 60fps
|
||||
#define SAMPLE_RATE 44100
|
||||
#define NUM_CHANNELS 2
|
||||
#define SUPERMODEL_FPS 60
|
||||
|
||||
#define BYTES_PER_SAMPLE (NUM_CHANNELS * sizeof(INT16))
|
||||
#define SAMPLES_PER_FRAME (SAMPLE_RATE / SUPERMODEL_FPS)
|
||||
#include <math.h>
|
||||
|
||||
// Model3 audio output is 44.1KHz 2-channel sound and frame rate is 60fps
|
||||
#define SAMPLE_RATE 44100
|
||||
#define NUM_CHANNELS 2
|
||||
#define SUPERMODEL_FPS 60
|
||||
|
||||
#define BYTES_PER_SAMPLE (NUM_CHANNELS * sizeof(INT16))
|
||||
#define SAMPLES_PER_FRAME (SAMPLE_RATE / SUPERMODEL_FPS)
|
||||
#define BYTES_PER_FRAME (SAMPLES_PER_FRAME * BYTES_PER_SAMPLE)
|
||||
|
||||
#define MAX_LATENCY 100
|
||||
#define MAX_LATENCY 100
|
||||
|
||||
static bool enabled = true; // True if sound output is enabled
|
||||
static unsigned latency = 20; // Audio latency to use (ie size of audio buffer) as percentage of max buffer size
|
||||
|
@ -178,6 +178,10 @@ void OutputAudio(unsigned numSamples, INT16 *leftBuffer, INT16 *rightBuffer)
|
|||
{
|
||||
//printf("OutputAudio(%u)\n", numSamples);
|
||||
|
||||
UINT32 bytesRemaining;
|
||||
UINT32 bytesToCopy;
|
||||
INT16 *src;
|
||||
|
||||
// Number of samples should never be more than max number of samples per frame
|
||||
if (numSamples > SAMPLES_PER_FRAME)
|
||||
numSamples = SAMPLES_PER_FRAME;
|
||||
|
@ -224,7 +228,7 @@ void OutputAudio(unsigned numSamples, INT16 *leftBuffer, INT16 *rightBuffer)
|
|||
writeWrapped = true;
|
||||
}
|
||||
|
||||
INT16 *src = mixBuffer;
|
||||
src = mixBuffer;
|
||||
INT8 *dst1;
|
||||
INT8 *dst2;
|
||||
UINT32 len1;
|
||||
|
@ -249,8 +253,8 @@ void OutputAudio(unsigned numSamples, INT16 *leftBuffer, INT16 *rightBuffer)
|
|||
}
|
||||
|
||||
// Copy chunk to write position in buffer
|
||||
UINT32 bytesRemaining = numBytes;
|
||||
UINT32 bytesToCopy = (bytesRemaining > len1 ? len1 : bytesRemaining);
|
||||
bytesRemaining = numBytes;
|
||||
bytesToCopy = (bytesRemaining > len1 ? len1 : bytesRemaining);
|
||||
memcpy(dst1, src, bytesToCopy);
|
||||
|
||||
// Adjust for number of bytes copied
|
||||
|
|
|
@ -169,6 +169,7 @@ extern void InfoLog(const char *fmt, ...);
|
|||
#include "Model3/DSB.h"
|
||||
#include "Model3/Model3.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
Helpful Macros and Inlines
|
||||
******************************************************************************/
|
||||
|
@ -187,16 +188,12 @@ extern void InfoLog(const char *fmt, ...);
|
|||
*/
|
||||
static inline UINT16 FLIPENDIAN16(UINT16 d)
|
||||
{
|
||||
return(((d >> 8) & 0x00FF) |
|
||||
((d << 8) & 0xFF00));
|
||||
return ((d>>8) | (d<<8));
|
||||
}
|
||||
|
||||
static inline UINT32 FLIPENDIAN32(UINT32 d)
|
||||
{
|
||||
return(((d >> 24) & 0x000000FF) |
|
||||
((d >> 8) & 0x0000FF00) |
|
||||
((d << 8) & 0x00FF0000) |
|
||||
((d << 24) & 0xFF000000));
|
||||
return ((d>>24) | ((d<<8)&0x00FF0000) | ((d>>8)&0x0000FF00) | (d<<24));
|
||||
}
|
||||
|
||||
#endif // INCLUDED_SUPERMODEL_H
|
||||
|
|
Loading…
Reference in a new issue