Implement frames/MSF conversion as functions
Macros FRAMES_TO_MSF and MSF_TO_FRAMES come from SDL_cdrom library. SDL_cdrom was removed from SDL2 and these macros are used also in code not directly related to SDL_cdrom library, so a replacement is needed. Turns out output pointer type is different on Windows (int*) than it is on Linux (unsigned char*); given choice between using void* for parameters and a template function, I prefer template.
This commit is contained in:
parent
f39b51fa78
commit
fce61e33bb
1 changed files with 19 additions and 0 deletions
|
@ -54,6 +54,25 @@ typedef struct SCtrl {
|
|||
Bit8u vol[4]; // channel volume
|
||||
} TCtrl;
|
||||
|
||||
// Conversion function from frames to Minutes/Second/Frames
|
||||
//
|
||||
template<typename T>
|
||||
inline void frames_to_msf(int frames, T *m, T *s, T *f) {
|
||||
const int cd_fps = 75;
|
||||
*f = frames % cd_fps;
|
||||
frames /= cd_fps;
|
||||
*s = frames % 60;
|
||||
frames /= 60;
|
||||
*m = frames;
|
||||
}
|
||||
|
||||
// Conversion function from Minutes/Second/Frames to frames
|
||||
//
|
||||
inline int msf_to_frames(int m, int s, int f) {
|
||||
const int cd_fps = 75;
|
||||
return m * 60 * cd_fps + s * cd_fps + f;
|
||||
}
|
||||
|
||||
extern int CDROM_GetMountType(char* path, int force);
|
||||
|
||||
class CDROM_Interface
|
||||
|
|
Loading…
Add table
Reference in a new issue