changeset 787:e8153e8a948e

Merged.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 04 Aug 2013 11:44:23 +0300
parents bc95f8a6d89c
children 999c7ad69051
files dmengine.c dmsimple.c
diffstat 2 files changed, 27 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/dmengine.c	Sun Aug 04 11:31:53 2013 +0300
+++ b/dmengine.c	Sun Aug 04 11:44:23 2013 +0300
@@ -341,11 +341,11 @@
 {
     JSS_LOCK(eng->jssPlr);
 
-    *playing = eng->jssPlr->isPlaying;
-    *row = eng->jssPlr->row;
-    *pat = eng->jssPlr->pattern;
+    *playing  = eng->jssPlr->isPlaying;
+    *row      = eng->jssPlr->row;
+    *pat      = eng->jssPlr->pattern;
     *npattern = eng->jssPlr->npattern;
-    *order = eng->jssPlr->order;
+    *order    = eng->jssPlr->order;
 
     JSS_UNLOCK(eng->jssPlr);
 }
@@ -354,11 +354,13 @@
 void engineGetJSSChannelInfo(DMEngineData *eng, const int channel, int *ninst, int *nextInst, int *freq, int *note)
 {
     JSS_LOCK(eng->jssPlr);
+
     JSSPlayerChannel *chn = &(eng->jssPlr->channels[channel]);
-    *ninst = chn->ninstrument;
+    *ninst    = chn->ninstrument;
     *nextInst = chn->nextInstrument;
-    *freq = chn->freq;
-    *note = chn->note;
+    *freq     = chn->freq;
+    *note     = chn->note;
+
     JSS_UNLOCK(eng->jssPlr);
 }
 #endif
--- a/dmsimple.c	Sun Aug 04 11:31:53 2013 +0300
+++ b/dmsimple.c	Sun Aug 04 11:44:23 2013 +0300
@@ -79,7 +79,14 @@
 #ifdef DM_USE_JSS
         case DM_ASETUP_JSS:
             if (engine.jssDev != NULL)
+            {
                 jvmRenderAudio(engine.jssDev, stream, len / jvmGetSampleSize(engine.jssDev));
+            }
+
+            JSS_LOCK(engine.jssPlr);
+            if (engine.jssPlr != NULL && !engine.jssPlr->isPlaying)
+                engine.exitFlag = TRUE;
+            JSS_UNLOCK(engine.jssPlr);
             break;
 #endif
 #ifdef DM_USE_TREMOR
@@ -221,9 +228,9 @@
 int engineAddModeToList(int w, int h)
 {
     DMModeEntry *mode;
-    int i;
-    int aspect = engineGetVideoAspect(w, h);
+    int i, aspect = engineGetVideoAspect(w, h);
     
+    dmPrint(2, " - Proposed %d x %d\n", w, h);
     if (aspect <= 0)
         return DMERR_INVALID_ARGS;
     
@@ -261,6 +268,7 @@
     mode->w = w;
     mode->h = h;
     mode->aspect = engineGetVideoAspect(w, h);
+    dmPrint(2, " - %d x %d, %d\n", w, h, mode->aspect);
     
     nengineModeList++;
     
@@ -351,6 +359,7 @@
     if (modes != (SDL_Rect**) -1)
     {
         int i;
+        dmPrint(1, "Enumerating modes.\n");
         for (i = 0; modes[i] != NULL; i++)
             engineAddModeToList(modes[i]->w, modes[i]->h);
     }
@@ -673,7 +682,7 @@
     }
     
     if (engine.optAfmt.samples == 0)
-        engine.optAfmt.samples = engine.optAfmt.freq / 16;
+        engine.optAfmt.samples = engine.optAfmt.freq / 50;
 
     switch (engine.optAudioSetup)
     {
@@ -716,8 +725,9 @@
     }
 
     // Initialize SDL audio
-    dmPrint(1, "Trying to init SDL audio with: fmt=%d, chn=%d, freq=%d\n",
-        engine.optAfmt.format, engine.optAfmt.channels, engine.optAfmt.freq);
+    dmPrint(1, "Trying to init SDL audio with: fmt=%d, chn=%d, freq=%d, samples=%d\n",
+        engine.optAfmt.format, engine.optAfmt.channels,
+        engine.optAfmt.freq, engine.optAfmt.samples);
 
     engine.audioStatus      = SDL_AUDIO_STOPPED;
     engine.optAfmt.callback = engineAudioCallback;
@@ -738,11 +748,14 @@
         // Set up simulated audio thread
         engine.audioSimDelay   = 1000 / 45;
         engine.audioSimBufSize = (engine.optAfmt.freq / 45) * engine.audioSampleSize;
+        engine.audioSimBufSize = engine.optAfmt.samples * sampleSize;
         engine.audioSimBuf     = dmMalloc(engine.audioSimBufSize);
         engine.audioSimDone    = FALSE;
         engine.audioSimThread  = SDL_CreateThread(engineAudioThreadFunc, NULL);
     }
 
+    dmPrint(0, "%d smp, %d b\n", engine.optAfmt.samples, engine.optAfmt.size);
+
     // Initialize SDL video
     if (engine.demoInitPreVideo != NULL &&
        (err = engine.demoInitPreVideo(&engine)) != DMERR_OK)