How do I implement the @property (nonatomic, readwrite, assign) float volume; in the .m file?

yeah.. how do I do that?
Here is my code.(The 3 dots represent code that I'm leaving out so your eyes don't glaze over) :

// ViewController8YellowBall.h

#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h> /* to import the sound class System Sound ID */

. . .

@interface ViewController8YellowBall : UIViewController <NSObject, AVAudioPlayerDelegate>

. . .
@property (nonatomic, readwrite, assign) float volume;
. . .

@end

//  ViewController8YellowBall.m

#import "ViewController8YellowBall.h"

@interface ViewController8YellowBall ()

@end

@implementation ViewController8YellowBall

- (void)viewDidLoad /* Do any additional setup after loading the view. */
  {
    [super viewDidLoad];
    [self playPageTurnSound];
    . . . 
  }

- (void)playPageTurnSound /* this method brings in the pageTurn sound */
  {
    NSURL *musicFile = [NSURL fileURLWithPath:[[NSBundle mainBundle]
                              pathForResource:@"pageTurn" /* this is the actual sound file */
                                       ofType:@"wav"]];

    AudioServicesCreateSystemSoundID((__bridge CFURLRef)musicFile, &PageTurnSoundID); /* it will use the Sound ID object we have created in the .h file (line 19) to play the sound */
    AudioServicesPlaySystemSound(PageTurnSoundID);
  }

. . .

@end

I am new to coding so keep that in mind. My question here is how can I in the code above lower the volume of the PageTurnSound by way of code? I am sure that the " @property (nonatomic, readwrite, assign) float volume; " in the .h file is the start but I don't know how to implement it in the .m file.

Any suggestions?

JR

Sign In or Register to comment.