Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
killerham
Posts: 27
Registered: ‎03-31-2011
My Device: Developer
My Carrier: Developer
Accepted Solution

Audio Recording

Hiyo,

 

I need to record from a microphone and save that sound similar to this:

 

http://cookbooks.adobe.com/post_SimpleAudioRecorder___Microphone_Access_API_AIR_2_-16746.html

 

But the playbook/air api doesn't specify how this is possible since there is no Wavwriter.

 

So what I need to do is record, then be able to save this recording as wav, mp3, or something useable. 

 

Thanks

 

Check out Go Studio on Blackberry App World!

http://appworld.blackberry.com/webstore/content/38912
Please use plain text.
Developer
erasmus
Posts: 30
Registered: ‎03-31-2011
My Device: Curve
My Carrier: Rogers

Re: Audio Recording

The Wavwriter class is actually included in the course code posted on that page - what it does is format the bytearray for you and create a wav header. With that imported to your project you shouldn't have any trouble getting it working - though do take note of the fact that when recording in mono and playing back in stereo you may have to write twice to your output.

 

Good luck!

Please use plain text.
Contributor
killerham
Posts: 27
Registered: ‎03-31-2011
My Device: Developer
My Carrier: Developer

Re: Audio Recording

Oh man,

 

I didn't even see that! Thanks, I'll give that a try

Check out Go Studio on Blackberry App World!

http://appworld.blackberry.com/webstore/content/38912
Please use plain text.
Developer
erasmus
Posts: 30
Registered: ‎03-31-2011
My Device: Curve
My Carrier: Rogers

Re: Audio Recording

Shoot me a message if you have troubles - I've gotten pretty familiar with the sound stuff and wav audio processing over the past few days (and a few late, late nights) :smileyhappy:

Please use plain text.
Contributor
killerham
Posts: 27
Registered: ‎03-31-2011
My Device: Developer
My Carrier: Developer

Re: Audio Recording

Awesome it works! Now I have a separate question... The visualizer uses UIComponent. Is there a way to add UIComponents to a sprite separate from the main sprite?

 

for example, I have  popup which is just a sprite added ontop of the sprite from the stage.

 

Thanks

Check out Go Studio on Blackberry App World!

http://appworld.blackberry.com/webstore/content/38912
Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Audio Recording

Just call .addChild( component ).

Make ceretain it has be allocated first.

Please use plain text.
Contributor
killerham
Posts: 27
Registered: ‎03-31-2011
My Device: Developer
My Carrier: Developer

Re: Audio Recording

that works for buttons and such but it doesnt work for UIComponents such as containers and this audioVisual component

Check out Go Studio on Blackberry App World!

http://appworld.blackberry.com/webstore/content/38912
Please use plain text.
Developer
erasmus
Posts: 30
Registered: ‎03-31-2011
My Device: Curve
My Carrier: Rogers

Re: Audio Recording

What does it tell you? I don't have a problem adding Containers - it's how my whole UI is laid out :smileyhappy:

Please use plain text.
Developer
jtegen
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Audio Recording

I add QNX UIComponent to the root sprite all the time.  Do you get an error?

Please use plain text.
Contributor
killerham
Posts: 27
Registered: ‎03-31-2011
My Device: Developer
My Carrier: Developer

Re: Audio Recording

I dont get any errors, it just doesnt add it...For example

 

The main Sprite

 

package
{
	import flash.display.Sprite;
	import qnx.ui.core.*;

	[SWF(height="600", width="1024", frameRate="30", backgroundColor="#FFFFFF")]
	public class Example extends Sprite
	{
		public function Example()
		{
			
			super();
			//put in a popup
			this.addChild(new popup());
			
		}
	}
}

 

package
{
	import flash.display.Shape;
	import flash.display.Sprite;
	
	import qnx.ui.core.*;
	
	public class popup extends Sprite {
		public function popup(){
			
			super();
			
			// make a background for the popup
			var shape:Shape;
			shape = new Shape();
			shape.graphics.beginFill(0x000000,0.9);
			shape.graphics.drawRect(0,0,600,300);
			shape.graphics.endFill();
			this.addChild(shape);
			
			//add a container to the popup
			var myMain:Container = new Container();
			myMain.margins = Vector.<Number>([50,60,50,60]);
			myMain.flow = ContainerFlow.HORIZONTAL;
			myMain.debugColor = 0xFFCC00;
			
			this.addChild(myMain);
		}
	}
	
}

 

The container doesnt get added to the second sprite.

 

Check out Go Studio on Blackberry App World!

http://appworld.blackberry.com/webstore/content/38912
Please use plain text.