GLBasic V12 (was formerly V11 beta)

Previous topic - Next topic

MrTAToad

Don't think there is an option for that...

fivesprites

Is anybody else experiencing issues with sound on V11.322 on Android?  In other words - NO sound at all! :(

Same program works fine on Android using V10.  All sound plays on Windows, OSX, iPhone etc.

Just seems to be an issue with V11 and Android - has the move to SDL2 broken something?

Note: the output from "adb logcat shell" indicates the audio initialised ok.  However, the output from PLAYSOUND is always -1 (doesn't matter if I'm using .wav of .ogg - same result)

Code (glbasic) Select
V/SDL     (  829): SDL audio: opening device
V/SDL     (  829): SDL audio: wanted stereo 16-bit 44.1kHz, 1024 frames buffer
V/AudioPolicyManager(   83): getDeviceForStrategy() from cache strategy 0, device 2
V/AudioPolicyManager(   83): getOutput() stream 3, samplingRate 0, format 0, channels c, flags 0
V/SDL     (  829): SDL audio: got stereo 16-bit 44.1kHz, 4096 frames buffer
I/glbasic (  829): Init Finalized
V/AudioPolicyManager(   83): startOutput() output 1, stream 3, session 4
V/AudioPolicyManager(   83): getDeviceForStrategy() from cache strategy 0, device 2
V/AudioPolicyManager(   83): getDeviceForStrategy() from cache strategy 0, device 2
V/AudioPolicyManager(   83): getNewDevice() selected device 2
V/AudioPolicyManager(   83): setOutputDevice() output 1 device 2 delayMs 0 force 0
V/AudioPolicyManager(   83): setOutputDevice() setting same device 2 or null device for output 1
D/AudioHardwareALSA(   83): Calling setDevice from write @..1875.
I/AudioHardwareALSA(   83): Initialized ALSA PLAYBACK device AndroidPlayback_Speaker_normal
V/AudioHardwareALSA(   83): Set PLAYBACK PCM format to S16_LE (Signed 16 bit Little Endian)
D/AudioHardwareALSA(   83): Using 2 channels for PLAYBACK.
I/AudioHardwareALSA(   83): DEFAULT_SAMPLE_RATE is 44100, mDefaults->sampleRate is 44100
D/AudioHardwareALSA(   83): Set PLAYBACK sample rate to 44100 HZ
D/AudioHardwareALSA(   83): Buffer size: 4096
D/AudioHardwareALSA(   83): Latency: 92879
W/AudioFlinger(   83): write blocked for 83 msecs, 2 delayed writes, thread 0x2fee8

...

I/glbasic (  829): PLAYSOUND: -1
I/glbasic (  829): LASTERR: 0000 success


I've tried a complete uninstall/reinstall of GLB and have ensured the app is completely uninstalled from the Android device.

I've tested the same on 5 different Android devices with the same result - no sound.


MrTAToad

Gernot has found that sound isn't currently working in Android for some reason.

BdR

Quote from: fivesprites on 2013-Mar-05
Is anybody else experiencing issues with sound on V11.322 on Android?  In other words - NO sound at all! :(
No problems here, I'm using 16bit mono 44kHz .wav files and sound playback seems to works fine on (HTC Desire X, GLB v11.322)

spacefractal

Thinking should test with 11.322 for android sound as well iOS iCade issue (which went back in 11.2xx, but works nice in v11.1xx). Something testing tomorrow.

Yes ts seen sound does init sound for sure, but us sld2 been more restrictive for wav used? Personally I'm allways uses 22khz 16bit mono for sound.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

DaCarSoft

Quote from: spacefractal on 2013-Mar-11
Thinking should test with 11.322 for android sound as well iOS iCade issue (which went back in 11.2xx, but works nice in v11.1xx).

Spacefractal: Do you have iCade issues with Apple devices (iOS) under beta 2.xx????   (I have not tested it) Can you test that under 11.322 please????     Which kind of problems???   Same as before??? (Screen with a line across the screen and borders in two corners)
"Si quieres resultados distintos... no hagas siempre lo mismo" - Albert Einstein.

spacefractal

#246
extractly the same as before, I have not tested with 11.322 yet, because its was needed to been fixed fast, so im just went back to 11.171. SInce 11.171 was nice and stable for iOS, im just used that rather than testing the newer version (but I will do that soon when possible of course, its might have refixed).

Also in 11.261 (all Android talk), I have found some wierd fix for some thing:

1. if im creating a bat file doing this:
Code (glbasic) Select

c:
cd "C:\Program Files (x86)\Android\android-sdk\platform-tools"
adb.exe install -r "D:\Dokumenter\Programmer\Glbasic\GLBasic\Greedy_Mouse\distribute\Android\bin\glbasic-debug.apk"


Then its seen ABD being much more stable than rather to trying to install with the glbasic default ant. Its still fail, but easier to see when its fail. So Im think a seperate bat file for installing ABD is a better what rater than trying to install directly?

2. if I override the BACK key, then multitasking doing much better and dosent crash on back as well home button:

Code (glbasic) Select

    public boolean onKey(View  v, int keyCode, KeyEvent event) {
if(keyCode==KeyEvent.KEYCODE_BACK)
{ Log.v("SDL", "keycode_back");
if(!event.isAltPressed()) // some handle alt+back as "circle"
{ Log.v("SDL", "keycode_back w/o alt-key -> finish?");
backpressed=1;
}
return true;
}

        if (event.getAction() == KeyEvent.ACTION_DOWN) {
            Log.v("SDL", "key down: " + keyCode);
            SDLActivity.onNativeKeyDown(keyCode);
return super.onKeyDown(keyCode, event);
        }
        else if (event.getAction() == KeyEvent.ACTION_UP) {
            SDLActivity.onNativeKeyUp(keyCode);
super.onKeyUp(keyCode, event);
        }
        return false;
    }


howover not sure im did modificed onPause() too?

Code (glbasic) Select

    protected void onPause() {
        Log.i("SDL", "onPause()");
        Log.i("SDL", "glbasicOnPause(1=pause)");
SDLActivity.glbasicOnPause(1); // 1=pause
wl.release(); // Krakatomato
        Log.i("SDL", "super.onPause");
        super.onPause();
        Log.i("SDL", "   onPause done");
    }


This prevent Android to uses the Back button, which normally will crash when press on that. Howover sometimes its might call GLB_ON_PAUSE sub after pressed the BACK button, which means you need to do a JAVACALL to checkout if the backbutton have been pressed there (something like this):
Code (glbasic) Select

SUB GLB_ON_PAUSE:
DEPRINT("GLB_ON_PAUSE() start")
LOCAL result$=""
IF device$="a" OR device$="ak"
result$=CallJava$("back")
IF result$="0"
suspend=1
ENDIF
ELSE
suspend=1
ENDIF
ENDSUB


The above was with 11.220 in mind, and im waiting checking the 11.322 later, until im got this bugfix release out for Greedy Mouse.

3. Sound in Android with 11.220 works pretty nice as well, both sound and music (im using either two or three buffers), but if Im use wav and playing them with MUSIC commands as they was sound, then the sound can been gone. That alternative sound fix was to fix eventuelly DELAY issue on some devices (where MUSIC mixer was more "stable" than SOUND mixer). But if you use SOUND commands in normaly way, its do works pretty nice in 11.220

With above in mind, then its take sometime to integrate the modifications to 11.322 im did, which is also why im not upgrade sson as possible, except if a important fix have been made.

4. Landscape orintation can go in wrong orientation, so as Im wrote before you need that java call and use that returned value to fix the orientation. Its was happens on my new Tab2 and its did fixed using that javacall (here im talk in fixed orientation modes, not the "sensor" mode, which works awesome).

POST EDITED TO BEEN MORE CLEAN AND MY GAME.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

Jonás Perusquía

hey Kitty Hello, i think the translation of the "Setup: Pack&Go" feature is incomplete, since the language shown is German
<HTML><BASIC><EC>
Be free and do good things

nicoatek

Hi!
There are few problems for 3D in android with the last beta.

Without a call to X_AUTONORMALS, Android and windows won't produce the same effect.
It Seems the depth buffer is wrong in Android.

erico

Quote from: BdR on 2013-Mar-10
Quote from: fivesprites on 2013-Mar-05
Is anybody else experiencing issues with sound on V11.322 on Android?  In other words - NO sound at all! :(
No problems here, I'm using 16bit mono 44kHz .wav files and sound playback seems to works fine on (HTC Desire X, GLB v11.322)

Sound not working on my end either with the newer beta(It works with v10), I will take a look on the specs of the sound files like you said.
Thanks.

erico

Ops double post...

About the G-sensor, it was discussed on another thread that the latest version should work on android.
It does work, but not equal to v10, I have to run some tests to check what is different.

fivesprites

Quote1. if im creating a bat file doing this:
Code: [Select]
c:
cd "C:\Program Files (x86)\Android\android-sdk\platform-tools"
adb.exe install -r "D:\Dokumenter\Programmer\Glbasic\GLBasic\Greedy_Mouse\distribute\Android\bin\glbasic-debug.apk"

Then its seen ABD being much more stable than rather to trying to install with the glbasic default ant. Its still fail, but easier to see when its fail. So Im think a seperate bat file for installing ABD is a better what rater than trying to install directly?

I've found that it's better to uninstall the application before installing it.  This ensures the media folder is cleared out too (which has caused me a few headaches in the past!).  To do this automatically, modify the glb_build.bat file and add the following before ::install (debug?)

Code (glbasic) Select
echo "Uninstalling"
:: uninstall (debug)
call "%ANDROIDSDK%\tools\ant\bin\ant.bat" debug uninstall


You should also refrain from doing anything in onPause() as that is no longer used by SDL (uses a native callback instead and onPause is commented out in newer versions of the beta).

I couldn't get sound/music to work at all in 11.322.  However, it's a moot point as GLB sound wasn't flexible enough (I needed to adjust the volume of sounds already playing).  Instead, I updated the SDLActivity to use SoundPool's and also a Mediaplayer instance for music.

I can now control the volume/rate of sounds already playing and the music plays great - no performance issues and it loops correctly.

Pause/resume seems to work ok on some devices (nexus 7 for example), but will crash the app on others (galaxy s1). 

Andoid is a NIGHTMARE! :)

spacefractal

I'm pretty sure you should give gernot use those sound update :-), eventuelly in the code snippet in my thread :-). It's sound cool, even sound did work here, but in 11.2 which I'm use.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation - The beagle Jam - Cave Heroes 2023 - https://spacefractal.itch.io/

fivesprites

I'd happily share the code with Gernot, but I think his plan to use SDL for sound across all platforms is better than splicing in platform specific fixes.  I'm sure he's on the case :)

bigsofty

Gernot is overhauling the sound part of the GLB runtime, which is probably why its not working at the moment but if he succeeds, the new sound system will be much more powerful and flexible.
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)