Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug in _SNDOPEN (fixed in v3.14.1)
#1
Is it possible that there is a limit on the $EMBED or _EMBEDDED$?
When I have loaded some sounds, I get a repeat of the first or second sound. I can never play them all.

Example below where 5 different MP3 files are read. But the same sounds are played.
Can you test it? I am using the latest version, so the 3.14 of QB-PE.
In the example you choose 5 MP3 files yourself.


Code: (Select All)
$EMBED:'D:\Sound\Sound-1.MP3','SOUND1'
$EMBED:'D:\Sound\Sound-2.MP3','SOUND2'
$EMBED:'D:\Sound\Sound-3.MP3','SOUND3'
$EMBED:'D:\Sound\Sound-4.MP3','SOUND4'
$EMBED:'D:\Sound\Sound-5.MP3','SOUND5'

'DIM handles
DIM SHARED SND1&, SND2&, SND3&, SND4&, SND5&

DIM Gedaan AS INTEGER
Gedaan = 0

'LOAD the music files
SND1& = _SNDOPEN(_EMBEDDED$("SOUND1"), "MEMORY")
SND2& = _SNDOPEN(_EMBEDDED$("SOUND2"), "MEMORY")
SND3& = _SNDOPEN(_EMBEDDED$("SOUND3"), "MEMORY")
SND4& = _SNDOPEN(_EMBEDDED$("SOUND4"), "MEMORY")
SND5& = _SNDOPEN(_EMBEDDED$("SOUND5"), "MEMORY")

'Simple menu
DO
    PRINT "1 = sound 1"
    PRINT "2 = sound 2"
    PRINT "3 = sound 3"
    PRINT "4 = sound 4"
    PRINT "5 = sound 5"
    PRINT
    PRINT "ESC = END"
    a$ = INPUT$(1)

    IF a$ = CHR$(27) THEN Gedaan = 1

    IF a$ = "1" THEN
        IF SND1& THEN _SNDPLAY SND1&
    END IF

    IF a$ = "2" THEN
        IF SND2& THEN _SNDPLAY SND2&
    END IF

    IF a$ = "3" THEN
        IF SND3& THEN _SNDPLAY SND3&
    END IF

    IF a$ = "4" THEN
        IF SND4& THEN _SNDPLAY SND4&
    END IF

    IF a$ = "5" THEN
        IF SND5& THEN _SNDPLAY SND5&
    END IF

LOOP UNTIL Gedaan = 1

'END program
_SNDCLOSE SND1&
_SNDCLOSE SND2&
_SNDCLOSE SND3&
_SNDCLOSE SND4&
_SNDCLOSE SND5&
SYSTEM
Reply
#2
Thank you for reporting. Have been able to recreate the issue. Investigating further.
Reply
#3
Definitly not the fault of $EMBED/_EMBEDDED$, using the code below to write the embedded files back and then using "WinMerge" to compare with the originals shows, every file is correctly handled by itself, no repeats or overlaps, so it must be an issue with the sound handles/buffers.

Code: (Select All)
$EMBED:'Sound-1.MP3','SOUND1'
$EMBED:'Sound-2.MP3','SOUND2'
$EMBED:'Sound-3.MP3','SOUND3'
$EMBED:'Sound-4.MP3','SOUND4'
$EMBED:'Sound-5.MP3','SOUND5'

_WRITEFILE "Sound-11.mp3", _EMBEDDED$("SOUND1")
_WRITEFILE "Sound-22.mp3", _EMBEDDED$("SOUND2")
_WRITEFILE "Sound-33.mp3", _EMBEDDED$("SOUND3")
_WRITEFILE "Sound-44.mp3", _EMBEDDED$("SOUND4")
_WRITEFILE "Sound-55.mp3", _EMBEDDED$("SOUND5")

END

However, as it works when loading the sounds directly (see below), I suspect that especially the "MEMORY" parameter in _SNDOPEN has a glich in it.

Code: (Select All)
'DIM handles
DIM SHARED SND1&, SND2&, SND3&, SND4&, SND5&

DIM Gedaan AS INTEGER
Gedaan = 0

'LOAD the music files
SND1& = _SNDOPEN("Sound-1.MP3")
SND2& = _SNDOPEN("Sound-2.MP3")
SND3& = _SNDOPEN("Sound-3.MP3")
SND4& = _SNDOPEN("Sound-4.MP3")
SND5& = _SNDOPEN("Sound-5.MP3")

'Simple menu
DO
PRINT "1 = sound 1"
PRINT "2 = sound 2"
PRINT "3 = sound 3"
PRINT "4 = sound 4"
PRINT "5 = sound 5"
PRINT
PRINT "ESC = END"
a$ = INPUT$(1)

IF a$ = CHR$(27) THEN Gedaan = 1

IF a$ = "1" THEN
IF SND1& THEN _SNDPLAY SND1&
END IF

IF a$ = "2" THEN
IF SND2& THEN _SNDPLAY SND2&
END IF

IF a$ = "3" THEN
IF SND3& THEN _SNDPLAY SND3&
END IF

IF a$ = "4" THEN
IF SND4& THEN _SNDPLAY SND4&
END IF

IF a$ = "5" THEN
IF SND5& THEN _SNDPLAY SND5&
END IF

LOOP UNTIL Gedaan = 1

'END program
_SNDCLOSE SND1&
_SNDCLOSE SND2&
_SNDCLOSE SND3&
_SNDCLOSE SND4&
_SNDCLOSE SND5&
SYSTEM
Reply




Users browsing this thread: 1 Guest(s)