]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Added frequency parameter.
authorToni Wilen <twilen@winuae.net>
Thu, 1 Jan 2015 11:21:22 +0000 (13:21 +0200)
committerToni Wilen <twilen@winuae.net>
Thu, 1 Jan 2015 11:21:22 +0000 (13:21 +0200)
blkdev_cdimage.cpp
cd32_fmv.cpp
od-win32/blkdev_win32_ioctl.cpp
od-win32/cda_play.cpp
od-win32/cda_play.h

index 6ca7e2dcf4ba6fb890e1db0edb12f1d43b133076..b4f062bb4ea30196f7eb71a304e5f2bec2870913 100644 (file)
@@ -26,6 +26,7 @@
 #include "mp3decoder.h"
 #include "cda_play.h"
 #include "memory.h"
+#include "audio.h"
 #ifdef RETROPLATFORM
 #include "rp.h"
 #endif
@@ -424,6 +425,11 @@ static void audio_unpack (struct cdunit *cdu, struct cdtoc *t)
                Sleep (10);
 }
 
+void audio_state_cda(int ch)
+{
+       audio_state_cda_state(ch, 0, 0);
+}
+
 static void *cdda_play_func (void *v)
 {
        int cdda_pos;
@@ -446,7 +452,7 @@ static void *cdda_play_func (void *v)
        bufon[0] = bufon[1] = 0;
        bufnum = 0;
 
-       cda_audio *cda = new cda_audio (num_sectors, 2352);
+       cda_audio *cda = new cda_audio (num_sectors, 2352, 44100);
 
        while (cdu->cdda_play > 0) {
 
index 1aa2bba2a37728b97a1ea81749045afca5bedba2..8afa6dffd15cd891019a83da7f1383725ca8c375 100644 (file)
@@ -1538,7 +1538,7 @@ addrbank *cd32_fmv_init (uaecptr start)
 
        kjmp2_init(&mp2);
        if (!cda) {
-               cda = new cda_audio(PCM_SECTORS, KJMP2_SAMPLES_PER_FRAME * 4);
+               cda = new cda_audio(PCM_SECTORS, KJMP2_SAMPLES_PER_FRAME * 4, 44100);
                l64111_setvolume();
        }
        if (!mpeg_decoder) {
index f1f741bb5cbb94ae2270dcc65ca885136013e832..393c8764c2a519f956e2a3cc97f79216ae25ab58 100644 (file)
@@ -502,7 +502,7 @@ static void *cdda_play (void *v)
        bufnum = 0;
        buffered = 0;
 
-       cda_audio *cda = new cda_audio (num_sectors, 2352);
+       cda_audio *cda = new cda_audio (num_sectors, 2352, 44100);
 
        while (ciw->cdda_play > 0) {
 
index c2fe1d8208b6ad512f1fe1ab7301715603d950ce..7ff511ba809bb3d7d8fe44f420592f60d04acc43 100644 (file)
@@ -52,7 +52,7 @@ cda_audio::~cda_audio()
        }
 }
 
-cda_audio::cda_audio(int num_sectors, int sectorsize)
+cda_audio::cda_audio(int num_sectors, int sectorsize, int samplerate)
 {
        active = false;
        playing = false;
@@ -69,7 +69,7 @@ cda_audio::cda_audio(int num_sectors, int sectorsize)
 
        wav.cbSize = 0;
        wav.nChannels = 2;
-       wav.nSamplesPerSec = 44100;
+       wav.nSamplesPerSec = samplerate;
        wav.wBitsPerSample = 16;
        wav.nBlockAlign = wav.wBitsPerSample / 8 * wav.nChannels;
        wav.nAvgBytesPerSec = wav.nBlockAlign * wav.nSamplesPerSec;
@@ -216,9 +216,11 @@ bool cda_audio::play(int bufnum)
        return true;
 #else
        uae_s16 *p = (uae_s16*)(buffers[bufnum]);
-       for (int i = 0; i < num_sectors * sectorsize / 4; i++) {
-               p[i * 2 + 0] = p[i * 2 + 0] * volume[0] / 32768;
-               p[i * 2 + 1] = p[i * 2 + 1] * volume[1] / 32768;
+       if (volume[0] != 32768 || volume[1] != 32768) {
+               for (int i = 0; i < num_sectors * sectorsize / 4; i++) {
+                       p[i * 2 + 0] = p[i * 2 + 0] * volume[0] / 32768;
+                       p[i * 2 + 1] = p[i * 2 + 1] * volume[1] / 32768;
+               }
        }
        MMRESULT mmr = waveOutWrite (wavehandle, &whdr[bufnum], sizeof (WAVEHDR));
        if (mmr != MMSYSERR_NOERROR) {
index 320394144969055aedf2b4b4aeef392e29603010..384243ce1af94dfee03aebda8b0740a8a06c8e3d 100644 (file)
@@ -24,7 +24,7 @@ private:
 public:
        uae_u8 *buffers[2];
 
-       cda_audio(int num_sectors, int sectorsize);
+       cda_audio(int num_sectors, int sectorsize, int samplerate);
        ~cda_audio();
        void setvolume(int master, int left, int right);
        bool play(int bufnum);