libpd / pd-for-ios

Pure Data for iOS
Other
265 stars 72 forks source link

no sound on simulator #17

Closed michelson closed 7 years ago

michelson commented 7 years ago

Hello, I think that I've pd ios configured correctly , but I can't get sound on my tests , on simulator. right now I don't have an ios device to test in with a real device. So I'm stuck on simulator.

This is the console output maybe it could help


2017-05-16 01:08:00.264 LibPdTest[77365:1832271] -[PdAudioController print][279] ----- AVAudioSession properties -----
2017-05-16 01:08:00.264 LibPdTest[77365:1832271] -[PdAudioController print][280] category: AVAudioSessionCategoryPlayAndRecord
2017-05-16 01:08:00.264 LibPdTest[77365:1832271] -[PdAudioController print][290] currentHardwareSampleRate: 44100
2017-05-16 01:08:00.264 LibPdTest[77365:1832271] -[PdAudioController print][291] preferredHardwareSampleRate: 44100
2017-05-16 01:08:00.265 LibPdTest[77365:1832271] -[PdAudioController print][292] preferredIOBufferDuration: 0.000000
2017-05-16 01:08:00.265 LibPdTest[77365:1832271] -[PdAudioController print][294] inputIsAvailable: YES
2017-05-16 01:08:00.265 LibPdTest[77365:1832271] -[PdAudioController print][295] currentHardwareInputNumberOfChannels: 2
2017-05-16 01:08:00.266 LibPdTest[77365:1832271] -[PdAudioController print][296] currentHardwareOutputNumberOfChannels: 2
2017-05-16 01:08:00.266 LibPdTest[77365:1832271] -[PdAudioUnit print][99] input ASBD:
2017-05-16 01:08:00.266 LibPdTest[77365:1832271] -[PdAudioUnit print][100]   mSampleRate: 44100Hz
2017-05-16 01:08:00.266 LibPdTest[77365:1832271] -[PdAudioUnit print][101]   mChannelsPerFrame: 2
2017-05-16 01:08:00.267 LibPdTest[77365:1832271] -[PdAudioUnit print][120] output ASBD:
2017-05-16 01:08:00.267 LibPdTest[77365:1832271] -[PdAudioUnit print][121]   mSampleRate: 44100Hz
2017-05-16 01:08:00.267 LibPdTest[77365:1832271] -[PdAudioUnit print][122]   mChannelsPerFrame: 2

any ideas why it does not work ?

my implementation is as follows:


#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#import "PdAudioController.h"
#import "PdBase.h"

@interface AppDelegate()
@property (nonatomic, retain) PdAudioController *audioController;
@end

@implementation AppDelegate

@synthesize window;
@synthesize audioController = audioController_;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;

  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"LibPdTest"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];

  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  // PD STUFF
  self.audioController = [[PdAudioController alloc] init ];
  [self.audioController configurePlaybackWithSampleRate:44100 numberChannels:2 inputEnabled:YES mixingEnabled:YES];
  [PdBase openFile:@"test.pd" path:[[NSBundle mainBundle] resourcePath]];

  [self.audioController setActive:YES];
  [self.audioController print];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];

  return YES;
}

@end
michelson commented 7 years ago

seems to be a problem with OS simulator. http://stackoverflow.com/questions/302399/sound-not-working-in-iphone-simulator

closing

aclaussen1 commented 5 years ago

I also am unable to hear anything with mac simulator but on device works fine. which is strange because in this video series: https://www.youtube.com/watch?v=R_-vTybbTn4 the simulator audio works fine.

justkd commented 5 years ago

@aclaussen1 Not sure what your setup looks like, but I have to set the pd sampling rate to 44100 for simulator and 48000 for device.