Search Results

Search found 13 results on 1 pages for 'pion'.

Page 1/1 | 1 

  • iPhone Audio Queue Service sample units

    - by pion
    I am looking at Audio Queue Services document specifically on the following code: // Writing an audio queue buffer to disk AudioFileWritePackets ( // 1 pAqData->mAudioFile, // 2 false, // 3 inBuffer->mAudioDataByteSize, // 4 inPacketDesc, // 5 pAqData->mCurrentPacket, // 6 &inNumPackets, // 7 inBuffer->mAudioData // 8 ); inBuffer-mAudioDataByteSize is the number of bytes of audio data being written. inBuffer-mAudioData is the new audio data to write to the audio file. Assuming the sample rate is 44100. AudioStreamBasicDescription mDataFormat; mDataFormat.mSampleRate = 44100.0f; mDataFormat.mBitsPerChannel = 16; ... NSInteger numberSamples = inBuffer->mAudioDataByteSize / 2; SInt16 *audioSample = (SInt16 *)inBuffer->mAudioData; I use core-plot to plot the above where x axis is number of sample [1 .. numberSamples] and the y axis is audioSample[0] .. audioSample[numberSamples]. I can see the chart in "real-time" where the y axis goes up and down depending the loudness of my voice. Beginner questions: What does the audioSample represent? What am I looking at here? What is the unit of audioSample? What do I need to do if I just want to plot the range between 50 - 100 Hz? Thanks in advance for your help.

    Read the article

  • iPhone: UIImagePickerController Randomly Fails to Take Picture

    - by pion
    I use a UIPickerViewController to take picture. It works 80% but seemingly at random it fails to take a picture. In tracing the code I found out that it occasionally goes to -PinRecordNewTableViewController:viewDidUnload. That is where it fails because it set nil to all ivars. @interface PinRecordNewTableViewController : UITableViewController { } ... @implementation PinRecordNewTableViewController ... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ... PinRecordNewPicture *pinRecordNewPicture = [[PinRecordNewPicture alloc] initWithNibName:@"PinRecordNewPicture" bundle:nil]; pinRecordNewPicture.delegate = self; [self.navigationController pushViewController:pinRecordNewPicture animated:YES]; [pinRecordNewPicture release]; ... } @interface PinRecordNewPicture : UIViewController ... @implementation PinRecordNewPicture ... - (void)picturePicker:(UIImagePickerControllerSourceType)theSource { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = theSource; picker.allowsEditing = YES; [self presentModalViewController:picker animated:YES]; [picker release]; } - (IBAction) takePicture:(id)sender { UIImagePickerControllerSourceType source = UIImagePickerControllerSourceTypeCamera; if ([UIImagePickerController isSourceTypeAvailable:source]) { [self picturePicker:source]; } What did I do wrong? Did I miss something that causes it to behave "randomly"? Thanks in advance for your help.

    Read the article

  • iPhone: Sharing protocol/delegate code

    - by pion
    I have the following code protocol snippets: @protocol FooDelegate; @interface Foo : UIViewController { id delegate; } ... @protocol FooDelegate ... // method 1 ... // method 2 ... @end Also, the following code which implements FooDelegate: @interface Bar1 : UIViewController { ... } @interface Bar2 : UITableViewController { ... } It turns out the implementation of FooDelegate is the same on both Bar1 and Bar2 classes. I currently just copy FooDelegate implementation code from Bar1 to Bar2. How do I structure/implement in such a way that Bar1 and Bar2 share the same code in a single code base (not as currently with 2 copies) since they are the same? Thanks in advance for your help.

    Read the article

  • Miss a single tap randomly

    - by pion
    I have the following code snippets - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; NSUInteger numberTaps = [touch tapCount]; // Tapping if (numberTaps > 0) { // do something } ... The above code basically detects a single tap on a small image (width = 18 and height = 36). It works 90% of the time detecting a single tap. But it sometime misses it (randomly). I have to tap several times before it picks up the single tap. What did I do wrong or miss so I could consistently detect the single tap 100%? Thanks in advance for your help.

    Read the article

  • iPHone: Unit/Logic Tests initWithNibName

    - by pion
    I have setup my Logic Tests following the instructions on http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html. I could test a couple classes successfully. But I got error when testing the following: - (id)init { if (self = [super initWithNibName:@"Foo" bundle:nil]) { ... } return self; } The error message is -[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named "Foo" My question: Did I do something wrong? Missed something? or I cannot test -initWithNibName using Logic Tests technique. Thanks in advance for your help.

    Read the article

  • iphone: Adding UIRequiredDeviceCapabilitie

    - by pion
    I am reading the "Device Support - Setting Required Hardware Capabilities" on http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedFeatures/AdvancedFeatures.html I want to add still-camera capability by doing the following: Open my Info.plist Click + Add UIRequiredDeviceCapabilities on the Key column Add still-camera on the Value column Save the updated Info.plist Is this the correct way? Thanks in advance for your help.

    Read the article

  • UIImagePickerController random behavior

    - by pion
    I have the following code snippets: @interface PinRecordNewTableViewController : UITableViewController { } ... @implementation PinRecordNewTableViewController ... - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ... PinRecordNewPicture *pinRecordNewPicture = [[PinRecordNewPicture alloc] initWithNibName:@"PinRecordNewPicture" bundle:nil]; pinRecordNewPicture.delegate = self; [self.navigationController pushViewController:pinRecordNewPicture animated:YES]; [pinRecordNewPicture release]; ... } @interface PinRecordNewPicture : UIViewController ... @implementation PinRecordNewPicture ... - (void)picturePicker:(UIImagePickerControllerSourceType)theSource { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = theSource; picker.allowsEditing = YES; [self presentModalViewController:picker animated:YES]; [picker release]; } - (IBAction) takePicture:(id)sender { UIImagePickerControllerSourceType source = UIImagePickerControllerSourceTypeCamera; if ([UIImagePickerController isSourceTypeAvailable:source]) { [self picturePicker:source]; } It works 80% of the time -- I could get the picture correctly. The problem is that it occasionally failed to take a picture. When tracing the code, I found out that it occasionally goes to -PinRecordNewTableViewController:viewDidUnload. This is where it fails because it set nil to all ivars. What did I do wrong? Did I miss something so it behaves "randomly"? Thanks in advance for your help.

    Read the article

  • Creating Application URL for iPhone

    - by pion
    I am preparing to submit my iPhone app for approval. This is my first time. One of the requirements is "Application URL". I have done the following to create Application URL: Click Foo-Info.plist Right Click Information Property List" Click "Add Row" Select URL types Expand "URL Types" Expand Item 0 Type in "com.mycompany.Foo" in the Value field with "URL Identifier" key I am wondering if I do this correctly. Thanks in advance for your help.

    Read the article

  • iPhone SpeakHere example produces different number of samples

    - by pion
    I am looking at the SpeakHere example and added the following: // Overriding the output audio route UInt32 audioRouteOverride = kAudioSessionOverrideAudioRoute_Speaker; AudioSessionSetProperty(kAudioSessionProperty_OverrideAudioRoute, sizeof (audioRouteOverride), &audioRouteOverride); assert(status == noErr); // Changing the default output route. The new output route remains in effect unless you change the audio session category. This option is available starting in iPhone OS 3.1. UInt32 doChangeDefaultRoute = 1; status = AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryDefaultToSpeaker, sizeof(doChangeDefaultRoute), &doChangeDefaultRoute); assert(status == noErr); // Enable Bluetooth. See audioRouteOverride & doChangeDefaultRoute above // http://developer.apple.com/iphone/library/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/Cookbook/Cookbook.html#//apple_ref/doc/uid/TP40007875-CH6-SW2 UInt32 allowBluetoothInput = 1; status = AudioSessionSetProperty(kAudioSessionProperty_OverrideCategoryEnableBluetoothInput, sizeof(allowBluetoothInput), &allowBluetoothInput); assert(status == noErr); Also, void AQRecorder::handleInputBufferCallback(void *aqData, ... ... if (inNumPackets > 0) { NSLog(@"Number of samples = %d", inBuffer->mAudioDataByteSize/2); // print out the number of sample status = AudioFileWritePackets(aqr->mAudioFile, FALSE, inBuffer->mAudioDataByteSize, inPacketDesc, aqr->mCurrentPacket, &inNumPackets, inBuffer->mAudioData); assert(status == noErr); aqr->mCurrentPacket += inNumPackets; } ... Notice the "NSLog(@"Number of samples = %d", inBuffer-mAudioDataByteSize/2); // print out the number of sample" statement above. I am using iPhone SDK 3.1.3. I got the following results The number of samples is around 44,100 on Simulator The number of samples is around 22,000 on iPhone The number of samples is around 4,000 on iPhone using Jawbone Bluetooth I am new on this. Why did itproduce different number of samples? Thanks in advance for your help.

    Read the article

  • Freeing JavaScript object

    - by pion
    I am looking at the example from http://www.javascriptkit.com/javatutors/oopjs.shtml var person = new Object() person.name = "Tim Scarfe" person.height = "6Ft" But there is no mention how to "free" it in order to avoid memory leak. Will the following code free it? person = null; How do you free a JavaScript Object using "new Object()? How do you free a JavaScript Array allocated using "new Array(10)"? How do you free a JavaScript JSON allocated using "var json = {"width": 480, "height": 640}"? Thanks in advance for your help.

    Read the article

  • Manipulating gl_LightSource[gl_MaxLights]

    - by pion
    The The OpenGL ® Shading Language Spec version 1.20 http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.20.8.pdf shows the following: struct gl_LightSourceParameters { vec4 ambient; // Acli vec4 diffuse; // Dcli vec4 specular; // Scli vec4 position; // Ppli vec4 halfVector; // Derived: Hi vec3 spotDirection; // Sdli float spotExponent; // Srli float spotCutoff; // Crli // (range: [0.0,90.0], 180.0) float spotCosCutoff; // Derived: cos(Crli) // (range: [1.0,0.0],-1.0) float constantAttenuation; // K0 float linearAttenuation; // K1 float quadraticAttenuation;// K2 }; uniform gl_LightSourceParameters gl_LightSource[gl_MaxLights]; Also, http://www.lighthouse3d.com/opengl/glsl/index.php?ogldir1 shows the following code snippets: lightDir = normalize(vec3(gl_LightSource[0].position)); https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/WebGL-spec.html#5.10 shows many uniform* functions but nothing seems to deal with an array of uniform variable like gl_LightSource[0]. How do we set the gl_LightSource[0] fields in WebGL using JavaScript? For example, gl_LightSource[0].position Thanks in advance for your help. Note: Cross post on http://www.khronos.org/message_boards/viewtopic.php?f=43&t=3373

    Read the article

  • Un écran LCD 3D Ready pour 1499 euros en avril, Samsung investit le marché

    Mise à jour du 09.03.2010 par Katleen Un écran LCD 3D Ready pour 1499 euros en avril, Samsung investit le marché Panasonic s'est fait damer le pion par Samsung, qui vient d'annoncer une sortie de ses premiers téléviseurs 3D Ready en France pour avril 2010, soit un mois en avance sur son concurrent. Une douzaine de modèles sortiront dans cette gamme, toutes technologies confondues (LCD, LED, plasma...). L'appareil le moins cher sera un LCD 3D Ready de 40 pouces à 1499 euros. Les lunettes actives permettant denner des images en trois dimensions seront a acheter en sus, pour 200 euros les 4 paires (offre de lancement). Selon le constructeur coréen, une cinquantaine d...

    Read the article

1