Sound playback driving me crazy...

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Sound playback driving me crazy...

Post by Jellicle » Wed Apr 13, 2011 6:42 am

bn wrote:Hi Jellicle,
I do not want the sound to stop playing when the hardware sleep button is pressed. I want it to keep playing. You seem to think I want something different
Sorry, I finally got it. Well, I think that is something for a bug report. I don't know if you have access to the Quality Control Center. If yes that would be the place, if no just report to support at runrev.com
How do I get access to Quality Contro Centre?
14" MacBook Pro
Former LiveCode developer.
Now recovering.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4166
Joined: Sun Jan 07, 2007 9:12 pm

Re: Sound playback driving me crazy...

Post by bn » Wed Apr 13, 2011 8:57 am

Hi Jellicle,

if you have access to the developer list you should have access to the Quality Control Center. The Livecode Developer Program is a paid option.

Else you just report to support.

Kind regards

Bernd

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Sound playback driving me crazy...

Post by Jellicle » Wed Apr 13, 2011 11:08 am

Is the developer list useful? Much traffic?
14" MacBook Pro
Former LiveCode developer.
Now recovering.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4166
Joined: Sun Jan 07, 2007 9:12 pm

Re: Sound playback driving me crazy...

Post by bn » Wed Apr 13, 2011 11:59 am

Hi Jellicle,
description of the Livecode Developer Program from Runrev ($199/year)
Get LiveCode pre-releases, support and direct interaction with our development team. Includes membership of the LiveCode Developer mailing list, access to the Quality Control Center and 6 Quick Support incidents per year. Annual subscription.
Since it is a paid addition the developer list is very useful, especially if you develop for mobile since that is where the features and improvements are most prominent at present.
The response of Runrev is very fast, the option to report quirks/bugs or to suggest features as well as to test prereleases is very valuable if you are serious with mobile development.
It is about 20 messages a day. You can opt for a digest mode that gives you the the last messages once or twice a day or get the messages directly by email.

Kind regards

Bernd

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Sound playback driving me crazy...

Post by Jellicle » Thu Apr 14, 2011 12:35 pm

I've signed up but confirmation of my membership of the actual list seems to be delayed. Runrev can be very slow with sales related stuff, in my experience.
14" MacBook Pro
Former LiveCode developer.
Now recovering.

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Sound playback driving me crazy...

Post by Jellicle » Sat Apr 16, 2011 6:07 am

Based on some advice from someone on the dev list I've started using the MPMoviePlayerController iOS control instead of the other methods. It keeps playing even when the display is put to sleep. As a bonus the user can scroll through the mp3 and manually stop and restart play. This replaces most of my sound play code, and is a much better solution.Awesome!
14" MacBook Pro
Former LiveCode developer.
Now recovering.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4166
Joined: Sun Jan 07, 2007 9:12 pm

Re: Sound playback driving me crazy...

Post by bn » Sat Apr 16, 2011 9:08 am

Hi Jellicle,
Based on some advice from someone on the dev list I've started using the MPMoviePlayerController iOS control instead of the other methods. It keeps playing even when the display is put to sleep.
Thanks for sharing that, good to know. I did not try that for your "continue to play when put to sleep" problem, but using the MPMoviePlayerController iOS control gives you the additional bonus that you can query the currentTime of the sound and base some action on it.

Kind regards

Bernd

Brittgriscom
Posts: 95
Joined: Wed Mar 30, 2011 10:15 am

Re: Sound playback driving me crazy...

Post by Brittgriscom » Mon Apr 18, 2011 2:06 pm

I'm trying to set my stop/restart code in a handler, so all my Narration fields are set to the same mouseUp code:

Code: Select all

on shapeNarrationField
   set the width of fld "Narration" to 1024
   set the height of fld "Narration" to 188
   set the rectangle of fld "Narration" to 0, 580, 1024, 768
   set the visible of fld "Narration" to true
   set the textSize of fld "Narration" to 45
   set the textAlign of fld "Narration" to center
   set the textHeight of fld "Narration" to 110
   set the textColor of fld "Narration" to "blue"
   set the borderWidth of fld "Narration" to 0
   
   set the script of fld "Narration" to \
         "on mouseUp" & cr & \
         "if the environment is "mobile" then" & cr & \
         "if iPhoneSoundChannelStatus(Transient) is playing then" & cr & \
         "stopChannel(Transient)" & cr & \
         "else send "openCard" to me in 1 millisecond" & cr & \
         "" & cr & \
         "else" & cr & \
          " if the sound is "done" then" & cr & \
            " openCard" & cr & \
         "else stopChannel(Transient)" & cr & \
         "end if" & cr & \
         "end mouseUp"
   
end shapeNarrationField
The problem is, LC tells me I need to put a comma near the "openCard" in this line:

Code: Select all

       "else send "openCard" to me in 1 millisecond" & cr & \
Any ideas how to fix/work around this?

Edit: Never mind. I put it in parentheses. That seems to have fixed it.

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound playback driving me crazy...

Post by Klaus » Mon Apr 18, 2011 2:53 pm

Hi Britt,

when creating scripts via scripts you can also use the semicolon ; instead of CR, which will make it a bit more readable.
This is valid sytax:
on mouseup;beep;end mouseup
:)

Another problem in your script is QUOTES insides of QUOTES:
...
"if the environment is "mobile" then"...
...
That will also not work!

To avoid having to write:
... & QUOTE & "mobile & QUOTE ...
I usually have function q in my mainstacks script:

Code: Select all

function q tString
  return QUOTE & tString & QUOTE
end q
Will save LOT of typing:
.. & q("mobile")...

You get the picture :)


Best

Klaus

Brittgriscom
Posts: 95
Joined: Wed Mar 30, 2011 10:15 am

Re: Sound playback driving me crazy...

Post by Brittgriscom » Mon Apr 18, 2011 3:20 pm

I put "mobile" in parentheses, and that seems to work.

How would you call your function q?

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound playback driving me crazy...

Post by Klaus » Mon Apr 18, 2011 3:25 pm

Hi Britt,
Brittgriscom wrote:I put "mobile" in parentheses, and that seems to work.
It definitively shouldn't!
So don't rely on this!
Brittgriscom wrote:How would you call your function q?
Just like the example in my last posting! 8)
...
put q("mobile")
...
Will give: "mobile"


Best

Klaus

Brittgriscom
Posts: 95
Joined: Wed Mar 30, 2011 10:15 am

Re: Sound playback driving me crazy...

Post by Brittgriscom » Mon Apr 18, 2011 5:25 pm

Now I'm getting an error in my actual Narration Field script:

Code: Select all

      if iPhoneSoundChannelStatus doubleQuote ("Transient") is playing then
My function is "doubleQuote".
The error is "(if: missing 'then')"

Edit: I fixed it with this:

Code: Select all

     if iPhoneSoundChannelStatus(Transient) is playing then

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound playback driving me crazy...

Post by Klaus » Mon Apr 18, 2011 6:03 pm

Brittgriscom wrote:Now I'm getting an error in my actual Narration Field script:

Code: Select all

      if iPhoneSoundChannelStatus doubleQuote ("Transient") is playing then
My function is "doubleQuote".
The error is "(if: missing 'then')"
Edit: I fixed it with this:

Code: Select all

     if iPhoneSoundChannelStatus(Transient) is playing then
As I said, don't rely on this, remember Murphys law! :)

AND, what is most important, I found that the engine is getting less and less "forgiving"
over the years (I use MetaCard/Rev/Livecode since 1999), which is not a bad thing!
So it will HIT you, when you least exspect it :)

BTW, the correct syntax for your script is:
...
if iPhoneSoundChannelStatus(doubleQuote("Transient")) is playing then
...
since "iPhoneSoundChannelStatus" is a function, also if you supply another function as a parameter!


Best

Klaus

Brittgriscom
Posts: 95
Joined: Wed Mar 30, 2011 10:15 am

Re: Sound playback driving me crazy...

Post by Brittgriscom » Mon Apr 18, 2011 8:24 pm

bn wrote:Hi Britt,
After days of struggle and suffering, I have realized that the Standalone Applications Settings > Copy Files only works properly if you copy the files individually. If you just copy the folder that contains the files, you're likely to have the same frustration I've been going through.
That is not my experience. I successfully copied a couple of files in a folder by just indicating the folder in "Copy Files"

Kind regards

Bernd
I cannot get the folder to work, unless I have previously installed the file and then deleted it. Installing the files individually works fine, though.

Klaus
Posts: 14182
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Sound playback driving me crazy...

Post by Klaus » Mon Apr 18, 2011 8:27 pm

Hi Britt,

there must be something wrong with your LiveCode, I can copy complete folders, too!


Best

Klaus

Post Reply